Skip to content

Commit

Permalink
doc: improve process.emitWarning() example
Browse files Browse the repository at this point in the history
PR-URL: nodejs#9590
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
mscdex committed Nov 16, 2016
1 parent 89469c8 commit 71d4a74
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 71d4a74

Please sign in to comment.