mirror of
https://github.com/bellard/quickjs.git
synced 2025-05-15 02:36:17 +08:00
qjs: added performance.now()
This commit is contained in:
parent
2b6cf578af
commit
f05760c585
@ -3836,7 +3836,7 @@ static JSValue js_console_log(JSContext *ctx, JSValueConst this_val,
|
|||||||
|
|
||||||
void js_std_add_helpers(JSContext *ctx, int argc, char **argv)
|
void js_std_add_helpers(JSContext *ctx, int argc, char **argv)
|
||||||
{
|
{
|
||||||
JSValue global_obj, console, args;
|
JSValue global_obj, console, args, performance;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* XXX: should these global definitions be enumerable? */
|
/* XXX: should these global definitions be enumerable? */
|
||||||
@ -3847,6 +3847,11 @@ void js_std_add_helpers(JSContext *ctx, int argc, char **argv)
|
|||||||
JS_NewCFunction(ctx, js_console_log, "log", 1));
|
JS_NewCFunction(ctx, js_console_log, "log", 1));
|
||||||
JS_SetPropertyStr(ctx, global_obj, "console", console);
|
JS_SetPropertyStr(ctx, global_obj, "console", console);
|
||||||
|
|
||||||
|
performance = JS_NewObject(ctx);
|
||||||
|
JS_SetPropertyStr(ctx, performance, "now",
|
||||||
|
JS_NewCFunction(ctx, js_os_now, "now", 0));
|
||||||
|
JS_SetPropertyStr(ctx, global_obj, "performance", performance);
|
||||||
|
|
||||||
/* same methods as the mozilla JS shell */
|
/* same methods as the mozilla JS shell */
|
||||||
if (argc >= 0) {
|
if (argc >= 0) {
|
||||||
args = JS_NewArray(ctx);
|
args = JS_NewArray(ctx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user