From 9d0ed6da52ca4c275772ee0b59de8befd91c4586 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Sun, 17 Sep 2017 08:25:05 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Document=20that=20NotficationMan?= =?UTF-8?q?ager=20add*=20methods=20return=20a=20Notification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parts of the Atom ecosystem rely on the fact that these methods return the Notification that was added. For example: https://github.com/atom/exception-reporting/blob/4e6866c3a9/lib/reporter.js#L159 Therefore, we should document that these methods are expected to return the Notification that was added. --- src/notification-manager.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/notification-manager.js b/src/notification-manager.js index b36f13e50..df5e5fb42 100644 --- a/src/notification-manager.js +++ b/src/notification-manager.js @@ -53,6 +53,8 @@ class NotificationManager { // 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'`. + // + // Returns the {Notification} that was added. addSuccess (message, options) { return this.addNotification(new Notification('success', message, options)) } @@ -79,6 +81,8 @@ class NotificationManager { // 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'`. + // + // Returns the {Notification} that was added. addInfo (message, options) { return this.addNotification(new Notification('info', message, options)) } @@ -105,6 +109,8 @@ class NotificationManager { // 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'`. + // + // Returns the {Notification} that was added. addWarning (message, options) { return this.addNotification(new Notification('warning', message, options)) } @@ -133,6 +139,8 @@ class NotificationManager { // in the notification header. Defaults to `'flame'`. // * `stack` (optional) A preformatted {String} with stack trace // information describing the location of the error. + // + // Returns the {Notification} that was added. addError (message, options) { return this.addNotification(new Notification('error', message, options)) } @@ -161,6 +169,8 @@ class NotificationManager { // in the notification header. Defaults to `'bug'`. // * `stack` (optional) A preformatted {String} with stack trace // information describing the location of the error. + // + // Returns the {Notification} that was added. addFatalError (message, options) { return this.addNotification(new Notification('fatal', message, options)) }