From 71d4a7474d234bba9461e28c95841bbd090cc642 Mon Sep 17 00:00:00 2001 From: Brian White Date: Sat, 12 Nov 2016 23:34:35 -0500 Subject: [PATCH] doc: improve process.emitWarning() example PR-URL: https://github.com/nodejs/node/pull/9590 Reviewed-By: Roman Reiss Reviewed-By: Prince John Wesley Reviewed-By: Colin Ihrig --- doc/api/process.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index 7b74080352..4ea0fd864e 100644 --- a/doc/api/process.md +++ b/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();