Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-08-19 07:58:25 +0300
committerJames M Snell <jasnell@gmail.com>2017-08-23 20:35:19 +0300
commit771a03dfe3dba6ac3136bd4aa25525220e29b0ff (patch)
tree9276a1e18c07fcead1ce87a384a7a47e42f00d79 /src/timer_wrap.cc
parent0ce54a7ec96431a088a15a5e24614428184497f0 (diff)
src: fixup strings, reduce duplication
PR-URL: https://github.com/nodejs/node/pull/14937 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/timer_wrap.cc')
-rw-r--r--src/timer_wrap.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc
index 609d087e334..03e7ad32626 100644
--- a/src/timer_wrap.cc
+++ b/src/timer_wrap.cc
@@ -39,6 +39,7 @@ using v8::HandleScope;
using v8::Integer;
using v8::Local;
using v8::Object;
+using v8::String;
using v8::Value;
const uint32_t kOnTimeout = 0;
@@ -50,8 +51,9 @@ class TimerWrap : public HandleWrap {
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New);
+ Local<String> timerString = FIXED_ONE_BYTE_STRING(env->isolate(), "Timer");
constructor->InstanceTemplate()->SetInternalFieldCount(1);
- constructor->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Timer"));
+ constructor->SetClassName(timerString);
constructor->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kOnTimeout"),
Integer::New(env->isolate(), kOnTimeout));
@@ -67,8 +69,7 @@ class TimerWrap : public HandleWrap {
env->SetProtoMethod(constructor, "start", Start);
env->SetProtoMethod(constructor, "stop", Stop);
- target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "Timer"),
- constructor->GetFunction());
+ target->Set(timerString, constructor->GetFunction());
}
size_t self_size() const override { return sizeof(*this); }