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:
authorRyan <ry@tinyclouds.org>2009-04-21 17:55:11 +0400
committerRyan <ry@tinyclouds.org>2009-04-21 17:55:11 +0400
commit47fad676b44976b2e8fc23450eaed4a538cc5c7a (patch)
treedb816db799042aea75bb91c6b289f9577720af98 /src/timers.cc
parenta0f2b8a0c5da9de9d7f52ea0312b1a6ffc53277c (diff)
Rename JS_ to NODE_ for method macros. add marcos to timers.cc
Diffstat (limited to 'src/timers.cc')
-rw-r--r--src/timers.cc34
1 files changed, 9 insertions, 25 deletions
diff --git a/src/timers.cc b/src/timers.cc
index 90b0cdcf396..88154ed81dc 100644
--- a/src/timers.cc
+++ b/src/timers.cc
@@ -99,8 +99,7 @@ UnwrapTimeoutID (Handle<External> timeoutID)
//
// * delay is the number of milliseconds (thousandths of a second) that the
// function call should be delayed by.
-static Handle<Value>
-setTimeout(const Arguments& args)
+NODE_METHOD(setTimeout)
{
if (args.Length() < 2)
return Undefined();
@@ -108,7 +107,7 @@ setTimeout(const Arguments& args)
HandleScope scope;
Local<Function> callback = Local<Function>::Cast(args[0]);
- uint32_t delay = args[1]->Uint32Value();
+ int delay = args[1]->IntegerValue();
ev_tstamp after = (double)delay / 1000.0;
@@ -132,9 +131,7 @@ setTimeout(const Arguments& args)
}
// clearTimeout(timeoutID)
-static Handle<Value> clearTimeout
- ( const Arguments& args
- )
+NODE_METHOD(clearTimeout)
{
if (args.Length() < 1)
return Undefined();
@@ -161,9 +158,7 @@ static Handle<Value> clearTimeout
//
// * delay is the number of milliseconds (thousandths of a second) that the
// setInterval() function should wait before each call to func.
-static Handle<Value> setInterval
- ( const Arguments& args
- )
+NODE_METHOD(setInterval)
{
if (args.Length() < 2)
return Undefined();
@@ -171,7 +166,7 @@ static Handle<Value> setInterval
HandleScope scope;
Local<Function> callback = Local<Function>::Cast(args[0]);
- uint32_t delay = args[1]->Uint32Value();
+ int delay = args[1]->IntegerValue();
ev_tstamp after = (double)delay / 1000.0;
@@ -192,19 +187,8 @@ NodeInit_timers (Handle<Object> target)
{
HandleScope scope;
- target->Set ( String::New("setTimeout")
- , FunctionTemplate::New(setTimeout)->GetFunction()
- );
-
- target->Set ( String::New("clearTimeout")
- , FunctionTemplate::New(clearTimeout)->GetFunction()
- );
-
- target->Set ( String::New("setInterval")
- , FunctionTemplate::New(setInterval)->GetFunction()
- );
-
- target->Set ( String::New("clearInterval")
- , FunctionTemplate::New(clearTimeout)->GetFunction()
- );
+ NODE_SET_METHOD(target, "setTimeout", setTimeout);
+ NODE_SET_METHOD(target, "clearTimeout", clearTimeout);
+ NODE_SET_METHOD(target, "setInterval", setInterval);
+ NODE_SET_METHOD(target, "clearInterval", clearTimeout);
}