Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add argument for temp directory at creating nodeJS #346

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/main/java/com/eclipsesource/v8/NodeJS.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,20 @@ public class NodeJS {
* been compiled for your platform.
*/
public static NodeJS createNodeJS() {
return createNodeJS(null);
return createNodeJS(null, null);
}

/**
* Creates a NodeJS runtime and executes a JS Script
*
* @param file The JavaScript to execute or null for no script.
* @return The NodeJS runtime.
*
* May throw an UnsupportedOperationException if node.js integration has not
* been compiled for your platform.
*/
public static NodeJS createNodeJS(final File file){
return createNodeJS(file, null);
}

/**
Expand Down Expand Up @@ -75,13 +88,14 @@ public String getNodeVersion() {
* Creates a NodeJS runtime and executes a JS Script
*
* @param file The JavaScript to execute or null for no script.
* @param tempDirectory The name of the directory to extract the native
* @return The NodeJS runtime.
*
* May throw an UnsupportedOperationException if node.js integration has not
* been compiled for your platform.
*/
public static NodeJS createNodeJS(final File file) {
V8 v8 = V8.createV8Runtime(GLOBAL);
public static NodeJS createNodeJS(final File file, final String tempDirectory) {
V8 v8 = V8.createV8Runtime(GLOBAL, tempDirectory);
final NodeJS node = new NodeJS(v8);
v8.registerJavaMethod(new JavaVoidCallback() {

Expand Down