typesafehub / js-engine

A JavaScript Engine Library - provides an abstract of a means to execute JavaScript code where no browser is involved.
Other
72 stars 20 forks source link

String as script source in addition to File #53

Open sorenbs opened 7 years ago

sorenbs commented 7 years ago

Would you accept a pull request that makes it possible to use a string as source instead of a File?

NodeEnvironment already exposes this

public NodeScript createScript(String scriptName, String script, String[] args)

but it is not exposed in Engine:

case class ExecuteJs(
                        source: java.io.File,
                        args: immutable.Seq[String],
                        timeout: FiniteDuration,
                        timeoutExitValue: Int = Int.MinValue,
                        environment: Map[String, String] = Map.empty
                        )
benmccann commented 7 years ago

Yes, pull requests accepted. However see https://github.com/typesafehub/js-engine/issues/43#issuecomment-249386598