diff --git a/src/me/topchetoeu/jscript/lib/DateLib.java b/src/me/topchetoeu/jscript/lib/DateLib.java index c456717..5a3d892 100644 --- a/src/me/topchetoeu/jscript/lib/DateLib.java +++ b/src/me/topchetoeu/jscript/lib/DateLib.java @@ -254,6 +254,12 @@ public class DateLib { else return normal.getTimeInMillis(); } + @Native + public String toString() { + return normal.getTime().toString(); + } + + @Native public DateLib(long timestamp) { normal = Calendar.getInstance(); utc = Calendar.getInstance(); diff --git a/src/me/topchetoeu/jscript/lib/Internals.java b/src/me/topchetoeu/jscript/lib/Internals.java index 432ff2e..893c54c 100644 --- a/src/me/topchetoeu/jscript/lib/Internals.java +++ b/src/me/topchetoeu/jscript/lib/Internals.java @@ -15,9 +15,6 @@ public class Internals { private static final DataKey> THREADS = new DataKey<>(); private static final DataKey I = new DataKey<>(); - @Native public static FunctionValue bind(FunctionValue func, Object thisArg) throws InterruptedException { - return FunctionLib.bind(func, thisArg); - } @Native public static void log(Context ctx, Object ...args) throws InterruptedException { for (var arg : args) { Values.printValue(ctx, arg); @@ -87,6 +84,9 @@ public class Internals { var wp = env.wrappersProvider; var glob = env.global = new GlobalScope(NativeWrapperProvider.makeNamespace(env, Internals.class)); + glob.define(null, "Math", false, NativeWrapperProvider.makeNamespace(env, MathLib.class)); + + glob.define(null, "Date", false, wp.getConstr(DateLib.class)); glob.define(null, "Object", false, wp.getConstr(ObjectLib.class)); glob.define(null, "Function", false, wp.getConstr(FunctionLib.class)); glob.define(null, "Array", false, wp.getConstr(ArrayLib.class));