Hi, Everyone,
I do a test, a.js call function 'b()' in b.js.
a.js is the main work file,
b.js is the library of functions developed by another develoer.
In Chrome, I can using the following code, the test goes well.
//----------------------------------------------------------
a.js:
new_element=document.createElement("script");
new_element.setAttribute("type", "text/javascript");
new_element.setAttribute("src", "b.js");
document.body.appendChild(new_element);
function a()
{
//...
b();
}
b.js:
function b()
{
//...
}
//----------------------------------------------------------
Now, I need do the test with V8, I can use the following code, but it will be complicated and not elegant
//----------------------------------------------------------
string scriptFileText = getFileContents("a.js") + getFileContents("b.js");
Handle<String> scriptSource = String::New(scriptFileText.c_str());
Handle<Script> script = Script::Compile(scriptSource);
How can I deal with it, Any of your help will be appreciated!