Skip to content

Commit

Permalink
doc: improve process.emitWarning() example
Browse files Browse the repository at this point in the history
PR-URL: #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 authored and addaleax committed Nov 22, 2016
1 parent 3b4ec5f commit 25a6f88
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 25a6f88

Please sign in to comment.