Browse Source

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>
v7.x
Brian White 8 years ago
committed by Anna Henningsen
parent
commit
25a6f88d98
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 5
      doc/api/process.md

5
doc/api/process.md

@ -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();

Loading…
Cancel
Save