webpack-build-notifier
Advanced tools
Comparing version 0.1.25 to 0.1.26
42
index.js
@@ -128,2 +128,10 @@ /** | ||
/** | ||
* @cfg {Function} onTimeout | ||
* A function called when the notification times out (closes). Undefined by default. The function is passed | ||
* two parameters: | ||
* 1) {Object} notifierObject - The notifier object instance. | ||
* 2) {Object} options - The notifier object options. | ||
*/ | ||
this.onTimeout = cfg.onTimeout; | ||
/** | ||
* @cfg {Function} messageFormatter | ||
@@ -146,5 +154,19 @@ * A function which returns a formatted notification message. The function is passed two parameters: | ||
}; | ||
/** | ||
* @cfg {Object} notifyOptions | ||
* Any additional node-notifier options as documented in the node-notifer documentation: | ||
* https://github.com/mikaelbr/node-notifier | ||
* | ||
* Note that options provided here will only be applied to the success/warning/error notifications | ||
* (not the "compilation started" notification). The title, message, sound, contentImage (logo), and icon | ||
* options will be ignored, as they will be set via the corresponding WebpackBuildNotifier config options | ||
* (either user-specified or default). | ||
*/ | ||
this.notifyOptions = cfg.notifyOptions || {}; | ||
// add notification click handler to activate terminal window | ||
notifier.on('click', this.onClick.bind(this)); | ||
if (this.onTimeout) { | ||
notifier.on('timeout', this.onTimeout); | ||
} | ||
}; | ||
@@ -217,11 +239,13 @@ | ||
if (notify) { | ||
notifier.notify({ | ||
appName: appName, | ||
title: title, | ||
message: stripAnsi(msg), | ||
sound: sound, | ||
contentImage: this.logo, | ||
icon: icon, | ||
wait: true | ||
}); | ||
notifier.notify( | ||
Object.assign(this.notifyOptions, { | ||
appName: appName, | ||
title: title, | ||
message: stripAnsi(msg), | ||
sound: sound, | ||
contentImage: this.logo, | ||
icon: icon, | ||
wait: true | ||
}) | ||
); | ||
} | ||
@@ -228,0 +252,0 @@ |
{ | ||
"name": "webpack-build-notifier", | ||
"version": "0.1.25", | ||
"version": "0.1.26", | ||
"description": "A Webpack plugin that generates OS notifications for build steps using node-notifier.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -97,5 +97,12 @@ # webpack-build-notifier | ||
#### notifyOptions | ||
Any additional node-notifier options as documented in the [node-notifer documentation](https://github.com/mikaelbr/node-notifier). | ||
Note that options provided here will only be applied to the success/warning/error notifications (not the "compilation started" notification). The title, message, sound, contentImage (logo), and icon options will be ignored, as they will be set via the corresponding WebpackBuildNotifier config options (either user-specified or default). | ||
#### onClick | ||
A function called when the notification is clicked. By default it activates the Terminal application. | ||
#### onTimeout | ||
A function called when the notification times out and is closed. Undefined by default. | ||
Future Improvements | ||
@@ -115,6 +122,11 @@ ------------------- | ||
--------- | ||
#### 0.1.26 | ||
###### _May 31, 2018_ | ||
- Added two new config options: *notifyOptions* and *onTimeout* per [#26](/../../issues/26). | ||
#### 0.1.25 | ||
###### _April 18, 2018_ | ||
- Updated Webpack 4 watchRun hook to use tapAsync to fix #25. | ||
- Updated Webpack 4 watchRun hook to use tapAsync to fix [#25](/../../issues/25). | ||
@@ -121,0 +133,0 @@ #### 0.1.24 |
100857
257
224