summaryrefslogtreecommitdiff
path: root/src/node_stat_watcher.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-07-19 01:23:50 -0700
committerRyan Dahl <ry@tinyclouds.org>2011-07-19 01:23:50 -0700
commit0a3fc1d9c8becc32c63ae736ca2b3719a3d03c5b (patch)
tree113826e9922f8097f2ef03450bde0a53d2b3fe60 /src/node_stat_watcher.cc
parent2e16ae703ee5d14cf7199218b3112407a188af42 (diff)
downloadandroid-node-v8-0a3fc1d9c8becc32c63ae736ca2b3719a3d03c5b.tar.gz
android-node-v8-0a3fc1d9c8becc32c63ae736ca2b3719a3d03c5b.tar.bz2
android-node-v8-0a3fc1d9c8becc32c63ae736ca2b3719a3d03c5b.zip
Remove StatWatcher's dep on C++ EventEmitter
Diffstat (limited to 'src/node_stat_watcher.cc')
-rw-r--r--src/node_stat_watcher.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc
index 340f387354..fd4d68a5cc 100644
--- a/src/node_stat_watcher.cc
+++ b/src/node_stat_watcher.cc
@@ -31,21 +31,14 @@ using namespace v8;
Persistent<FunctionTemplate> StatWatcher::constructor_template;
-static Persistent<String> change_symbol;
-static Persistent<String> stop_symbol;
-
void StatWatcher::Initialize(Handle<Object> target) {
HandleScope scope;
Local<FunctionTemplate> t = FunctionTemplate::New(StatWatcher::New);
constructor_template = Persistent<FunctionTemplate>::New(t);
- constructor_template->Inherit(EventEmitter::constructor_template);
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
constructor_template->SetClassName(String::NewSymbol("StatWatcher"));
- change_symbol = NODE_PSYMBOL("change");
- stop_symbol = NODE_PSYMBOL("stop");
-
NODE_SET_PROTOTYPE_METHOD(constructor_template, "start", StatWatcher::Start);
NODE_SET_PROTOTYPE_METHOD(constructor_template, "stop", StatWatcher::Stop);
@@ -61,7 +54,7 @@ void StatWatcher::Callback(EV_P_ ev_stat *watcher, int revents) {
Handle<Value> argv[2];
argv[0] = Handle<Value>(BuildStatsObject(&watcher->attr));
argv[1] = Handle<Value>(BuildStatsObject(&watcher->prev));
- handler->Emit(change_symbol, 2, argv);
+ MakeCallback(handler->handle_, "onchange", 2, argv);
}
@@ -113,7 +106,7 @@ Handle<Value> StatWatcher::Start(const Arguments& args) {
Handle<Value> StatWatcher::Stop(const Arguments& args) {
HandleScope scope;
StatWatcher *handler = ObjectWrap::Unwrap<StatWatcher>(args.Holder());
- handler->Emit(stop_symbol, 0, NULL);
+ MakeCallback(handler->handle_, "onstop", 0, NULL);
handler->Stop();
return Undefined();
}