diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2015-08-10 20:09:58 +0200 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2015-08-10 20:09:58 +0200 |
commit | d4f487acf157f14d80d19d586bd6f6869c564523 (patch) | |
tree | dea71a5cfadad1b09290ce5710f0f90da2d76b12 /javascript/duktape/Window.bnd | |
parent | 0df3439eb26914466b91ce529e7f3366094030d6 (diff) | |
download | netsurf-d4f487acf157f14d80d19d586bd6f6869c564523.tar.gz netsurf-d4f487acf157f14d80d19d586bd6f6869c564523.tar.bz2 |
Basic Console support
Diffstat (limited to 'javascript/duktape/Window.bnd')
-rw-r--r-- | javascript/duktape/Window.bnd | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/javascript/duktape/Window.bnd b/javascript/duktape/Window.bnd index fee5d2105..09390e631 100644 --- a/javascript/duktape/Window.bnd +++ b/javascript/duktape/Window.bnd @@ -38,6 +38,8 @@ prototype Window() EXPOSE(undefined); EXPOSE(eval); EXPOSE(Object); + EXPOSE(parseInt); + EXPOSE(parseFloat); #undef EXPOSE %} @@ -53,4 +55,20 @@ getter Window::window() %{ duk_push_this(ctx); return 1; -%}
\ No newline at end of file +%} + +getter Window::console() +%{ + duk_push_this(ctx); + duk_get_prop_string(ctx, -1, MAGIC(Console)); + if (duk_is_undefined(ctx, -1)) { + duk_pop(ctx); + if (dukky_create_object(ctx, PROTO_NAME(CONSOLE), 0) != DUK_EXEC_SUCCESS) { + duk_error(ctx, DUK_ERR_ERROR, "Unable to create console object"); + return 0; + } + duk_dup(ctx, -1); + duk_put_prop_string(ctx, -3, MAGIC(Console)); + } + return 1; +%} |