Hi, there
When I use Global<Function> to save a js closure( a function uses
external function or variable) and call it next time, whether those
external function or variable need to be compiled again. In other word, can
Global<Function> save the function and external functions or variables it
refers without compiling again.
test.js
<https://lh3.googleusercontent.com/-k6YHaBl5b5A/WNTv2wkV-kI/AAAAAAAAAAk/OgDnKsQYe0U4CwOlPmyybJfoP4CYlOJ6gCLcB/s1600/MacHi%2B2017-03-24%2B18-07-02.png>
for example, read the script, compile, run and save the return funtion
object to Global<Function>:
Global<Function> process_;
Handle<v8::Script> compiled_script = v8::Script::Compile(script); // script
is a string read from test.js
Local<Value> result = compiled_script->Run(); //
result = function object "main"
Local<Function> process_fun = Local<Function>::Cast(result);
process_.Reset(GetIsolate(), process_fun);
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.