From 5ac106dc9c6043a99c7c6e8ed8eb38f84842576a Mon Sep 17 00:00:00 2001 From: Ross Allen Date: Wed, 26 Aug 2015 17:54:14 -0700 Subject: [PATCH] Document all options for creating Notifications The defaults for the 'icon' values come from Notification::getIcon[0]. [0]: https://github.com/atom/atom/blob/v1.0.7/src/notification.coffee#L79 --- src/notification-manager.coffee | 45 +++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/src/notification-manager.coffee b/src/notification-manager.coffee index f4ebd97db..46e4c60d4 100644 --- a/src/notification-manager.coffee +++ b/src/notification-manager.coffee @@ -29,40 +29,65 @@ class NotificationManager # Public: Add a success notification. # # * `message` A {String} message - # * `options` An options {Object} with optional keys such as: - # * `detail` A {String} with additional details about the notification + # * `options` (optional) An options {Object} with the following keys: + # * `detail` (optional) A {String} with additional details about the + # notification. + # * `dismissable` (optional) A {Boolean} indicating whether this + # notification can be dismissed by the user. Defaults to `false`. + # * `icon` (optional) A {String} name of an icon from Octicons to display + # in the notification header. Defaults to `'check'`. addSuccess: (message, options) -> @addNotification(new Notification('success', message, options)) # Public: Add an informational notification. # # * `message` A {String} message - # * `options` An options {Object} with optional keys such as: - # * `detail` A {String} with additional details about the notification + # * `options` (optional) An options {Object} with the following keys: + # * `detail` (optional) A {String} with additional details about the + # notification. + # * `dismissable` (optional) A {Boolean} indicating whether this + # notification can be dismissed by the user. Defaults to `false`. + # * `icon` (optional) A {String} name of an icon from Octicons to display + # in the notification header. Defaults to `'info'`. addInfo: (message, options) -> @addNotification(new Notification('info', message, options)) # Public: Add a warning notification. # # * `message` A {String} message - # * `options` An options {Object} with optional keys such as: - # * `detail` A {String} with additional details about the notification + # * `options` (optional) An options {Object} with the following keys: + # * `detail` (optional) A {String} with additional details about the + # notification. + # * `dismissable` (optional) A {Boolean} indicating whether this + # notification can be dismissed by the user. Defaults to `false`. + # * `icon` (optional) A {String} name of an icon from Octicons to display + # in the notification header. Defaults to `'alert'`. addWarning: (message, options) -> @addNotification(new Notification('warning', message, options)) # Public: Add an error notification. # # * `message` A {String} message - # * `options` An options {Object} with optional keys such as: - # * `detail` A {String} with additional details about the notification + # * `options` (optional) An options {Object} with the following keys: + # * `detail` (optional) A {String} with additional details about the + # notification. + # * `dismissable` (optional) A {Boolean} indicating whether this + # notification can be dismissed by the user. Defaults to `false`. + # * `icon` (optional) A {String} name of an icon from Octicons to display + # in the notification header. Defaults to `'flame'`. addError: (message, options) -> @addNotification(new Notification('error', message, options)) # Public: Add a fatal error notification. # # * `message` A {String} message - # * `options` An options {Object} with optional keys such as: - # * `detail` A {String} with additional details about the notification + # * `options` (optional) An options {Object} with the following keys: + # * `detail` (optional) A {String} with additional details about the + # notification. + # * `dismissable` (optional) A {Boolean} indicating whether this + # notification can be dismissed by the user. Defaults to `false`. + # * `icon` (optional) A {String} name of an icon from Octicons to display + # in the notification header. Defaults to `'bug'`. addFatalError: (message, options) -> @addNotification(new Notification('fatal', message, options))