Skip to content

Instantly share code, notes, and snippets.

@SeaniaTwix
Last active June 18, 2020 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SeaniaTwix/ca0fdc751da93c84fd121b5b8e300b27 to your computer and use it in GitHub Desktop.
Save SeaniaTwix/ca0fdc751da93c84fd121b5b8e300b27 to your computer and use it in GitHub Desktop.
fun load(path: string) {
val ctx = Context.newBuilder("js").allowAllAccess(true).build()
val file = File(path)
val source = Source.newBuilder(JavaScriptLanguage.ID, file)
.mimeType("application/javascript+module").build()
val v = ctx.eval(source)
v.execute("outside: hello")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment