Allow maps to be configured with a promise for view props
This commit is contained in:
@@ -90,6 +90,28 @@ class Source extends BaseObject {
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {function(import("../View.js").ViewOptions):void}
|
||||
*/
|
||||
this.viewResolver = null;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {function(Error):void}
|
||||
*/
|
||||
this.viewRejector = null;
|
||||
|
||||
const self = this;
|
||||
/**
|
||||
* @private
|
||||
* @type {Promise<import("../View.js").ViewOptions>}
|
||||
*/
|
||||
this.viewPromise_ = new Promise(function (resolve, reject) {
|
||||
self.viewResolver = resolve;
|
||||
self.viewRejector = reject;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,6 +148,13 @@ class Source extends BaseObject {
|
||||
return abstract();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {Promise<import("../View.js").ViewOptions>} A promise for view-related properties.
|
||||
*/
|
||||
getView() {
|
||||
return this.viewPromise_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of the source, see {@link module:ol/source/State~State} for possible states.
|
||||
* @return {import("./State.js").default} State.
|
||||
|
||||
Reference in New Issue
Block a user