Allow maps to be configured with a promise for view props

This commit is contained in:
Tim Schaub
2021-09-21 00:06:26 +00:00
parent 79a54e33bb
commit d5813deb08
9 changed files with 230 additions and 116 deletions
+29
View File
@@ -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.