feat: readd date internals
This commit is contained in:
parent
a17ec737b7
commit
fc705e7383
@ -254,6 +254,12 @@ public class DateLib {
|
|||||||
else return normal.getTimeInMillis();
|
else return normal.getTimeInMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Native
|
||||||
|
public String toString() {
|
||||||
|
return normal.getTime().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Native
|
||||||
public DateLib(long timestamp) {
|
public DateLib(long timestamp) {
|
||||||
normal = Calendar.getInstance();
|
normal = Calendar.getInstance();
|
||||||
utc = Calendar.getInstance();
|
utc = Calendar.getInstance();
|
||||||
|
@ -15,9 +15,6 @@ public class Internals {
|
|||||||
private static final DataKey<HashMap<Integer, Thread>> THREADS = new DataKey<>();
|
private static final DataKey<HashMap<Integer, Thread>> THREADS = new DataKey<>();
|
||||||
private static final DataKey<Integer> I = new DataKey<>();
|
private static final DataKey<Integer> 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 {
|
@Native public static void log(Context ctx, Object ...args) throws InterruptedException {
|
||||||
for (var arg : args) {
|
for (var arg : args) {
|
||||||
Values.printValue(ctx, arg);
|
Values.printValue(ctx, arg);
|
||||||
@ -87,6 +84,9 @@ public class Internals {
|
|||||||
var wp = env.wrappersProvider;
|
var wp = env.wrappersProvider;
|
||||||
var glob = env.global = new GlobalScope(NativeWrapperProvider.makeNamespace(env, Internals.class));
|
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, "Object", false, wp.getConstr(ObjectLib.class));
|
||||||
glob.define(null, "Function", false, wp.getConstr(FunctionLib.class));
|
glob.define(null, "Function", false, wp.getConstr(FunctionLib.class));
|
||||||
glob.define(null, "Array", false, wp.getConstr(ArrayLib.class));
|
glob.define(null, "Array", false, wp.getConstr(ArrayLib.class));
|
||||||
|
Loading…
Reference in New Issue
Block a user