Change signature of ol.layer.Group#getLayers

This commit changes the signature of ol.layer.Group#getLayers from {ol.Collection.<ol.layer.Base>|undefined} to {!ol.Collection.<ol.layer.Base>}. In this way the caller is guaranteed that getLayers returns a dereferencable object.
This commit is contained in:
Éric Lemoine
2014-09-05 12:24:05 +02:00
committed by Frederic Junod
parent bfef6ab075
commit 96f7d6323a
2 changed files with 5 additions and 7 deletions

View File

@@ -495,7 +495,6 @@ ol.Map.prototype.addInteraction = function(interaction) {
*/
ol.Map.prototype.addLayer = function(layer) {
var layers = this.getLayerGroup().getLayers();
goog.asserts.assert(goog.isDef(layers));
layers.push(layer);
};
@@ -703,7 +702,7 @@ goog.exportProperty(
/**
* Get the collection of layers associated with this map.
* @return {ol.Collection.<ol.layer.Base>|undefined} Layers.
* @return {!ol.Collection.<ol.layer.Base>|undefined} Layers.
* @api stable
*/
ol.Map.prototype.getLayers = function() {
@@ -1147,7 +1146,6 @@ ol.Map.prototype.removeInteraction = function(interaction) {
*/
ol.Map.prototype.removeLayer = function(layer) {
var layers = this.getLayerGroup().getLayers();
goog.asserts.assert(goog.isDef(layers));
return layers.remove(layer);
};