| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ Timer::Initialize (Handle<Object> target) | |||
| 27 | 27 | ||
| 28 | 28 | NODE_SET_PROTOTYPE_METHOD(constructor_template, "start", Timer::Start); | |
| 29 | 29 | NODE_SET_PROTOTYPE_METHOD(constructor_template, "stop", Timer::Stop); | |
| 30 | + NODE_SET_PROTOTYPE_METHOD(constructor_template, "again", Timer::Again); | ||
| 30 | 31 | ||
| 31 | 32 | constructor_template->InstanceTemplate()->SetAccessor(repeat_symbol, | |
| 32 | 33 | RepeatGetter, RepeatSetter); | |
@@ -140,3 +141,15 @@ void Timer::Stop () { | |||
| 140 | 141 | Unref(); | |
| 141 | 142 | } | |
| 142 | 143 | } | |
| 144 | + | ||
| 145 | + | ||
| 146 | + Handle<Value> Timer::Again(const Arguments& args) { | ||
| 147 | + HandleScope scope; | ||
| 148 | + Timer *timer = ObjectWrap::Unwrap<Timer>(args.Holder()); | ||
| 149 | + | ||
| 150 | + ev_tstamp repeat = NODE_V8_UNIXTIME(args[0]); | ||
| 151 | + if (repeat > 0) timer->watcher_.repeat = repeat; | ||
| 152 | + ev_timer_again(EV_DEFAULT_UC_ &timer->watcher_); | ||
| 153 | + | ||
| 154 | + return Undefined(); | ||
| 155 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,7 @@ class Timer : ObjectWrap { | |||
| 21 | 21 | static v8::Handle<v8::Value> New (const v8::Arguments& args); | |
| 22 | 22 | static v8::Handle<v8::Value> Start (const v8::Arguments& args); | |
| 23 | 23 | static v8::Handle<v8::Value> Stop (const v8::Arguments& args); | |
| 24 | + static v8::Handle<v8::Value> Again (const v8::Arguments& args); | ||
| 24 | 25 | static v8::Handle<v8::Value> RepeatGetter (v8::Local<v8::String> property, const v8::AccessorInfo& info); | |
| 25 | 26 | static void RepeatSetter (v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info); | |
| 26 | 27 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments