doc: improve process.emitWarning() example

PR-URL: https://github.com/nodejs/node/pull/9590
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Brian White authored and Anna Henningsen committed 2016-11-22 06:35:53 +01:00
1 parent 3b4ec5f6c5
commit 25a6f88d98
1 file changed
+2 -3
+2 -3
View File
@@ -821,11 +821,10 @@ so, it is recommended to place the `emitWarning()` behind a simple boolean
flag as illustrated in the example below:
```js
var warned = false;
function emitMyWarning() {
if (!warned) {
if (!emitMyWarning.warned) {
emitMyWarning.warned = true;
process.emitWarning('Only warn once!');
warned = true;
}
}
emitMyWarning();