Permalink
Browse files

events, refactor: save the wrapper function into data object to avoid…

… using Callee.
  • Loading branch information...
xicilion committed Nov 2, 2017
1 parent d860ada commit f551793d42ff90f26e25f5dc252da271e98cced9
Showing with 4 additions and 1 deletion.
  1. +4 −1 fibjs/include/Trigger.h
View
@@ -228,6 +228,7 @@ class JSTrigger {
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(_data->Get(isolate->NewString("_func")));
v8::Local<v8::Value> v = _data->Get(isolate->NewString("_ev"));
v8::Local<v8::Function> _wrap = v8::Local<v8::Function>::Cast(_data->Get(isolate->NewString("_wrap")));
exlib::string ev;
GetArgumentValue(v, ev, true);
@@ -241,7 +242,7 @@ class JSTrigger {
v8::Local<v8::Object> vr;
JSTrigger t(args);
t.off(ev, args.Callee(), vr);
t.off(ev, _wrap, vr);
func->Call(args.This(), (int32_t)_args.size(), _args.data());
}
@@ -255,6 +256,8 @@ class JSTrigger {
v8::Local<v8::Function> wrap = _isolate->NewFunction("_onceWrap", _onceWrap, _data);
wrap->Set(NewString("_func"), func);
_data->Set(NewString("_wrap"), wrap);
putFunction(GetHiddenList(ev, true), wrap, ev);
retVal = o;

0 comments on commit f551793

Please sign in to comment.