js.extras.JsEnum Maven / Gradle / Ivy
package js.extras;
import js.lang.Unknown;
import js.util.JS;
import org.teavm.jso.JSBody;
public abstract class JsEnum implements Unknown {
@JSBody(params = "value", script = "return value")
public static native T of(String value);
@JSBody(params = "value", script = "return value")
public static native T of(int value);
@JSBody(params = "value", script = "return value")
public static native T of(double value);
@JSBody(params = "value", script = "return value")
public static native T of(boolean value);
public static T from(String jsEval) {
return JS.eval(jsEval).cast();
}
}