As with many JavaScript environments, you simply load a script that contains other functions that you want to run an example browser . Any functions that are added to the global scope are now available to you:
V8 v8 = V8.createV8Runtime(); v8.executeScript(readFileAsString("script1")); // contains the function foo(); v8.executeScript(readFileAsString("script2")); // contains the function bar(x, y); v8.executeJSFunction("foo"); v8.executeJSFunction("bar", 7, 8);
source share