All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.plugin.js.external.ExternalFunction Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.plugin.js.external;

import cn.nukkit.plugin.js.JSExternal;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
import org.graalvm.polyglot.proxy.ProxyExecutable;

public final class ExternalFunction extends JSExternal implements ProxyExecutable {
    public ExternalFunction(Context sourceContext, Value value) {
        super(sourceContext, value);
    }

    @Override
    public Object execute(Value... arguments) {
        synchronized (sourceContext) {
            checkAlive();
            if(value.canExecute())
                return value.execute((Object[]) arguments);
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy