Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
feat(events): Emit hubOnline and hubOffline events
Browse files Browse the repository at this point in the history
When harmonyhubjs-discover emits an online or offline event for a hub, orchestra-jsapi do reemit
them now as hubOnline and hubOffline events. The regarding hub object gets sent along with the
event.
  • Loading branch information
swissmanu committed Jan 17, 2016
1 parent 32701e7 commit 188ddc4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ var Universe = function () {
self._discoveredHubs = hubs
self.emit('discoveredHubs', hubs)
})

self._discover.on('online', function (hub) {
self.emit('hubOnline', hub)
})

self._discover.on('offline', function (hub) {
self.emit('hubOffline', hub)
})
self._discover.start()

EventEmitter.call(self)
Expand Down

0 comments on commit 188ddc4

Please sign in to comment.