Skip to content
damylen edited this page Dec 2, 2015 · 18 revisions

Messaging

csWeb has a simple publish/subscribe messaging bus, which is available as an Angular service. Besides providing functionality to publish a message to a topic, including optional title and data object, it also offers access to the (pnotify) publication service.

Overview of current messages

  • map: is used to signal map events

this.$messageBusService.publish("map", "setextent", {southWest, northEast}); this.$messageBusService.publish("map", "setbaselayer", 'baselayername');

  • project: is used to indicate when a project is loaded. (TODO implement unloaded event)

$messageBusService.publish('project', 'loaded');

  • layer: is used to indicate when a feature is (de-)activated.

$messageBusService.publish('layer', 'activated|deactivating|deactivate');

  • feature: is used to indicate when a feature is (de-)selected.

$messageBusService.publish('feature', 'onFeatureSelect|onFeatureDeselect');

  • sidebar: is used to indicate whether the right sidebar needs to be shown or not.

$messageBusService.publish('sidebar', 'show|hide|toggle');

  • FeatureTab: is used to indicate which FeatureProps tab is opened, e.g.

$messageBusService.publish('FeatureTab', 'activated', { sectionTitle: sectionTitle, section: section });

  • timeline: is used to signal timeline events (currently only the timeline publishes these events)

this.$messageBusService.publish("timeline", "focusChange", this.focusDate); to listen for changes this.$messageBusService.publish("timeline", "setFocus", this.focusDate); to set the focus (focusDate: Date). this.$messageBusService.publish("timeline","timeSpanUpdated",""); trigger a debounced timespan updated message