This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
EventEmitter constructor should not be in C++ #1335
Comments
ghost
assigned ry
Jul 15, 2011
was there a purpose of this beyond that if EventEmitter's constructor/emit not existing in C++, that other c-bindings wont have access to EventEmitter? |
complete in 4ef8f06 |
@ry ETA for complete EE2 with tests is ~Friday Jul 22 |
So how are we supposed to be able to emit events from C++ land? Or is that no longer possible at all? |
@mscdex: this is how you would (approximately) go about it. Local<Object> obj = /* ... */;
Local<Value> val = obj->Get(String::NewSymbol("emit"));
if (val->IsFunction()) {
Local<Function> fun = val.As<Function>();
Local<Value> argv[2] = {
String::New("event_name"),
String::New("argument")
};
TryCatch tc;
fun->Call(obj, 2, argv);
if (tc.HasCaught()) {
// handle exception
}
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
cc @hij1nx
The text was updated successfully, but these errors were encountered: