Hi all,
I was wondering if it's possible to compile multiple javascript source files into a single context. For example,
// File a.js
function f1(){
console.log(10);
}
// File b.js
function f2(){
console.log(20);
}
In C++, I'm trying to compile them one after another -
//Sources v8 string
v8::String a_js = ...
v8::String b_js = ...
// Compiling them one after another
v8::Script::Compile(context, a_js);
auto script = v8::Script::Compile(context, b_js).ToLocalChecked();
Now, when I try to grab the reference to f1 (function in a.js) in the C++ function, I get an empty handle, I assume that when I compiled b.js, the context got overwritten.
Could anyone please tell me if it's possible to compile multiple sources into the same context?
Thanks,
--Gautham