Messages -> notifications

This commit is contained in:
Ben Ogle
2014-11-20 18:53:06 -08:00
parent 25caaa92f1
commit 9c6a5fb4fa
9 changed files with 120 additions and 120 deletions

44
src/notification.coffee Normal file
View File

@@ -0,0 +1,44 @@
# Experimental: This will likely change, do not use.
module.exports =
class Notification
constructor: (@type, @message, @options={}) ->
getOptions: -> @options
getType: -> @type
getMessage: -> @message
getDetail: -> @optons.detail
isClosable: ->
!!@options.closable
getIcon: ->
return @options.icon if @options.icon?
switch @type
when 'fatal' then 'flame'
when 'error' then 'bug'
when 'warning' then 'alert'
when 'info' then 'info'
when 'success' then 'check'
getIssueUrl: ->
"https://github.com/atom/atom/issues/new?title=#{encodeURI(@getIssueTitle())}&body=#{encodeURI(@getIssueBody())}"
getIssueTitle: ->
@message
getIssueBody: ->
# TODO: crib version information from bug-report: https://github.com/lee-dohm/bug-report/blob/master/lib/bug-report.coffee#L69
"""
There was an unhandled error
Stack Trace
```
At #{@options.detail}
#{@options.stack}
```
"""