Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2018 Red Hat, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.reactiverse.es4x;
import io.reactiverse.es4x.impl.EventEmitterImpl;
import io.reactiverse.es4x.impl.VertxFileSystem;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Source;
import org.graalvm.polyglot.Value;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
public final class Runtime extends EventEmitterImpl {
private final Context context;
private final Value bindings;
Runtime(final Vertx vertx, final Context context, Source... scripts) {
this.context = context;
this.bindings = this.context.getBindings("js");
// remove specific features that we don't want to expose
for (String identifier : Arrays.asList("exit", "quit", "Packages", "java", "javafx", "javax", "com", "org", "edu")) {
if (bindings.hasMember(identifier)) {
bindings.removeMember(identifier);
}
}
// add vertx as a global
bindings.putMember("vertx", vertx);
// clean up the current working dir
final File cwd = new File(VertxFileSystem.getCWD());
// override the default load function to allow proper mapping of file for debugging
bindings.putMember("load", new Function