Skip to content

Commit

Permalink
merge all several types into 'source'
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wojciechowski committed Sep 27, 2016
1 parent d56dcaf commit 71378d9
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions js/source/geojson_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function GeoJSONSource(id, options, dispatcher) {
this.fire('error', {error: err});
return;
}
this.fire('data', {dataType: 'geojson'});
this.fire('data', {dataType: 'source'});
this.fire('source.load');
}.bind(this));
}
Expand Down Expand Up @@ -120,7 +120,7 @@ GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototy
if (err) {
return this.fire('error', { error: err });
}
this.fire('data', {dataType: 'geoJSON'});
this.fire('data', {dataType: 'source'});
}.bind(this));

return this;
Expand Down
4 changes: 2 additions & 2 deletions js/source/image_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function ImageSource(id, options, dispatcher) {

this.image = image;
this._loaded = true;
this.fire('data', {type: 'image'});
this.fire('data', {dataType: 'source'});
this.fire('source.load');

if (this.map) {
Expand Down Expand Up @@ -107,7 +107,7 @@ ImageSource.prototype = util.inherit(Evented, /** @lends ImageSource.prototype *
Math.round((zoomedCoord.row - centerCoord.row) * EXTENT));
});

this.fire('data', {dataType: 'image'});
this.fire('data', {dataType: 'source'});
return this;
},

Expand Down
2 changes: 1 addition & 1 deletion js/source/raster_tile_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function RasterTileSource(id, options, dispatcher) {
return this.fire('error', err);
}
util.extend(this, tileJSON);
this.fire('data', {type: 'tileJSON'});
this.fire('data', {dataType: 'source'});
this.fire('source.load');
}.bind(this));
}
Expand Down
2 changes: 1 addition & 1 deletion js/source/source_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function SourceCache(id, options, dispatcher) {
});

this.on('data', function(event) {
if (this._sourceLoaded && ['image', 'video', 'geoJSON'].indexOf(event.dataType) !== -1) {
if (this._sourceLoaded && event.dataType === 'source') {
this.reload();
if (this.transform) {
this.update(this.transform, this.map && this.map.style.rasterFadeDuration);
Expand Down
2 changes: 1 addition & 1 deletion js/source/vector_tile_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function VectorTileSource(id, options, dispatcher) {
return;
}
util.extend(this, tileJSON);
this.fire('data', {dataType: 'tileJSON'});
this.fire('data', {dataType: 'source'});
this.fire('source.load');
}.bind(this));
}
Expand Down
2 changes: 1 addition & 1 deletion js/source/video_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function VideoSource(id, options) {
this.setCoordinates(options.coordinates);
}

this.fire('data', {dataType: 'video'});
this.fire('data', {dataType: 'source'});
this.fire('source.load');
}.bind(this));
}
Expand Down
4 changes: 2 additions & 2 deletions test/js/source/source_cache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ test('SourceCache / Source lifecycle', function (t) {
});
});

t.test('reloads tiles after a geoJSON data event', function (t) {
t.test('reloads tiles after a "source" data event', function (t) {
var transform = new Transform();
transform.resize(511, 511);
transform.zoom = 0;
Expand All @@ -252,7 +252,7 @@ test('SourceCache / Source lifecycle', function (t) {

sourceCache.on('source.load', function () {
sourceCache.update(transform);
sourceCache.getSource().fire('data', {dataType: 'geoJSON'});
sourceCache.getSource().fire('data', {dataType: 'source'});
});
});

Expand Down

0 comments on commit 71378d9

Please sign in to comment.