Skip to content

Instantly share code, notes, and snippets.

/t.cpp Secret

Created December 1, 2016 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3b4707b5611a110a0067f71ebdaff9f2 to your computer and use it in GitHub Desktop.
Save anonymous/3b4707b5611a110a0067f71ebdaff9f2 to your computer and use it in GitHub Desktop.
96 if (!process_emit.IsEmpty())
97 {
98 printf("Getting isolate\n");
99 Isolate *isolate = Isolate::GetCurrent();
100 printf("Creating a local copy of process.emit()\n");
101 Local<Function> lpe = Local<Function>::New(isolate, process_emit);
102 printf("Creating the arguments for process.emit()\n");
103 Local<Value> args[2] = {
104 args[0] = Local<Value>::New(
105 isolate, String::NewFromUtf8(isolate, "test")),
106 args[1] = Local<Value>::New(
107 isolate, Number::New(isolate, 0))
108 };
109 printf("Calling process.emit()\n");
110 lpe->Call(isolate->GetCurrentContext()->Global(), 2, NULL);
111 return 0;
112 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment