Add wasDisplayed to Notification

This commit is contained in:
Ben Ogle
2015-01-09 16:24:43 -08:00
parent 6cc1ffa793
commit 48e6cd533d
2 changed files with 17 additions and 1 deletions

View File

@@ -48,3 +48,10 @@ class NotificationManager
###
getNotifications: -> @notifications
###
Section: Managing Notifications
###
clear: ->
@notifications = []

View File

@@ -8,10 +8,14 @@ class Notification
@timestamp = new Date()
@dismissed = true
@dismissed = false if @isDismissable()
@displayed = false
onDidDismiss: (callback) ->
@emitter.on 'did-dismiss', callback
onDidDisplay: (callback) ->
@emitter.on 'did-display', callback
getOptions: -> @options
getType: -> @type
@@ -30,12 +34,17 @@ class Notification
dismiss: ->
return unless @isDismissable() and not @isDismissed()
@dismissed = true
@emitter.emit 'did-dismiss'
@emitter.emit 'did-dismiss', this
isDismissed: -> @dismissed
isDismissable: -> !!@options.dismissable
wasDisplayed: -> @displayed
setDisplayed: (@displayed) ->
@emitter.emit 'did-display', this
getIcon: ->
return @options.icon if @options.icon?
switch @type