summaryrefslogtreecommitdiff
path: root/lib/timers.js
diff options
context:
space:
mode:
authorWeijia Wang <381152119@qq.com>2017-10-07 22:50:42 +0800
committerTobias Nießen <tniessen@tnie.de>2017-10-16 23:34:32 +0200
commit212de3c5ec429a580d2e79ce3c2516b93b52b8f5 (patch)
treed74522686a9753df084b42bcaf766a3a8ad97e7d /lib/timers.js
parenta3a106865a95665a3f2d8d7c03a1a12f1680a087 (diff)
downloadandroid-node-v8-212de3c5ec429a580d2e79ce3c2516b93b52b8f5.tar.gz
android-node-v8-212de3c5ec429a580d2e79ce3c2516b93b52b8f5.tar.bz2
android-node-v8-212de3c5ec429a580d2e79ce3c2516b93b52b8f5.zip
lib: use destructuring for some constants
This change is to unify the declaration for constants into using destructuring on the top-level-module scope, reducing some redundant code. PR-URL: https://github.com/nodejs/node/pull/16063 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'lib/timers.js')
-rw-r--r--lib/timers.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/timers.js b/lib/timers.js
index 5727de159a..9d32aed7a5 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -26,17 +26,21 @@ const TimerWrap = process.binding('timer_wrap').Timer;
const L = require('internal/linkedlist');
const internalUtil = require('internal/util');
const { createPromise, promiseResolve } = process.binding('util');
-const async_hooks = require('async_hooks');
const assert = require('assert');
const util = require('util');
const errors = require('internal/errors');
const debug = util.debuglog('timer');
const kOnTimeout = TimerWrap.kOnTimeout | 0;
-const initTriggerId = async_hooks.initTriggerId;
// Two arrays that share state between C++ and JS.
const { async_hook_fields, async_id_fields } = async_wrap;
-// The needed emit*() functions.
-const { emitInit, emitBefore, emitAfter, emitDestroy } = async_hooks;
+const {
+ initTriggerId,
+ // The needed emit*() functions.
+ emitInit,
+ emitBefore,
+ emitAfter,
+ emitDestroy
+} = require('async_hooks');
// Grab the constants necessary for working with internal arrays.
const { kInit, kDestroy, kAsyncIdCounter } = async_wrap.constants;
// Symbols for storing async id state.