Skip to content

Commit

Permalink
add VectorTileSource#setData for dynamic vector tiles rendering map…
Browse files Browse the repository at this point in the history
  • Loading branch information
stepankuzmin committed Mar 17, 2019
1 parent c605974 commit eb93b37
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/source/vector_tile_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,23 @@ class VectorTileSource extends Evented implements Source {
this.load();
}

setData(options: VectorSourceSpecification & {collectResourceTiming: boolean}) {
if (this._tileJSONRequest) {
this._tileJSONRequest.cancel();
}

extend(this, pick(options, ['url', 'scheme', 'tileSize']));
this._options = extend({ type: 'vector' }, options);

this._collectResourceTiming = options.collectResourceTiming;

if (this.tileSize !== 512) {
throw new Error('vector tile sources must have a tileSize of 512');
}

this.load();
}

onRemove() {
if (this._tileJSONRequest) {
this._tileJSONRequest.cancel();
Expand Down

0 comments on commit eb93b37

Please sign in to comment.