32 lines
679 B
CoffeeScript
32 lines
679 B
CoffeeScript
$ = jQuery
|
|
context = window
|
|
logger = context.JK.logger
|
|
broadcastActions = context.JK.Actions.broadcast
|
|
|
|
rest = context.JK.Rest()
|
|
|
|
broadcastActions.load.listenAndPromise(rest.getBroadcastNotification);
|
|
|
|
BroadcastStore = Reflux.createStore(
|
|
{
|
|
listenables: broadcastActions
|
|
|
|
onLoad: () ->
|
|
logger.debug("loading broadcast notification...")
|
|
|
|
onLoadCompleted: (response) ->
|
|
logger.debug("broadcast notification sync completed")
|
|
this.trigger(response)
|
|
|
|
onLoadFailed: (jqXHR) ->
|
|
if jqXHR.status != 404
|
|
logger.error("broadcast notification sync failed")
|
|
|
|
onHide: () ->
|
|
this.trigger(null)
|
|
}
|
|
)
|
|
|
|
module.exports = BroadcastStore
|
|
|