jam-cloud/web/app/assets/javascripts/react-components/stores/SessionNotificationStore.js...

40 lines
792 B
CoffeeScript

$ = jQuery
context = window
logger = context.JK.logger
rest = context.JK.Rest()
@SessionNotificationStore = Reflux.createStore(
{
listenables: @NotificationActions
notifications: []
count: 0
issueChange: () ->
@trigger(@notifications)
onClear: () ->
@notifications = []
@issueChange()
onSessionEnded: () ->
notifications: []
@issueChange()
processNotification: (notification) ->
notification.id = ++@count
@notifications.unshift(notification)
if @notifications.length > 100
@notifications.pop();
@issueChange()
onBackendNotification: (notification) ->
@processNotification(notification)
onFrontendNotification: (notification) ->
@processNotification(notification)
}
)