Permalink
Browse files

Use node::MakeCallback().

  • Loading branch information...
1 parent ed27fd2 commit 2aaf2224244e4663bf0ee1018db65bcb7118f82d @bnoordhuis committed Jan 7, 2012
Showing with 1 addition and 10 deletions.
  1. +1 −10 event-emitter.cc
View
@@ -43,21 +43,12 @@ Handle<Value> Emitter::New(const Arguments& args) {
Handle<Value> Emitter::Ping(const Arguments& args) {
HandleScope scope;
- Local<Value> emit_v = args.This()->Get(String::NewSymbol("emit"));
- assert(emit_v->IsFunction());
- Local<Function> emit_f = emit_v.As<Function>();
-
Handle<Value> argv[2] = {
String::New("ping"), // event name
args[0]->ToString() // argument
};
- TryCatch tc;
-
- emit_f->Call(args.This(), 2, argv);
-
- if (tc.HasCaught())
- FatalException(tc);
+ MakeCallback(args.This(), "emit", 2, argv);
return Undefined();
}

0 comments on commit 2aaf222

Please sign in to comment.