Skip to content

Commit

Permalink
feat(event-manager): add LAYER_ADDED event
Browse files Browse the repository at this point in the history
It's fired every time a layer is added (either way) to the layer selector.
  • Loading branch information
AleksueiR committed Apr 21, 2015
1 parent f621da4 commit b4977c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/js/RAMP/Modules/eventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,17 @@ define([],
*/
LAYER_LOADED: "layerLoader/layer-loaded",

/**
* Indicates that a map layer has been added to the layer selector
*
* @event LayerLoader.LAYER_ADDED
* @for LayerLoader
* @param event {Object}
* @param event.layer {Object} layer object that has been added
*
*/
LAYER_ADDED: "layerLoader/layer-added",

/**
* Indicates that a map layer has updated. This means the data it is showing is visible and up-to-date
*
Expand Down
3 changes: 3 additions & 0 deletions src/js/RAMP/Modules/layerLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ define([
//object to make state decisions
map.addLayer(layer, insertIdx);

// publish LAYER_ADDED event for every user-added layer
topic.publish(EventManager.LayerLoader.LAYER_ADDED, { layer: layer });

//derive initial state
switch (layer.ramp.load.state) {
case "loaded":
Expand Down

0 comments on commit b4977c1

Please sign in to comment.