diff options
Diffstat (limited to 'javascript/duktape/Window.bnd')
-rw-r--r-- | javascript/duktape/Window.bnd | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/javascript/duktape/Window.bnd b/javascript/duktape/Window.bnd index 81f605931..af62eb711 100644 --- a/javascript/duktape/Window.bnd +++ b/javascript/duktape/Window.bnd @@ -95,3 +95,24 @@ getter Window::location() } return 1; %} + +getter Window::navigator() +%{ + duk_push_this(ctx); + duk_get_prop_string(ctx, -1, MAGIC(Navigator)); + if (duk_is_undefined(ctx, -1)) { + duk_pop(ctx); + + if (dukky_create_object(ctx, + PROTO_NAME(NAVIGATOR), + 0) != DUK_EXEC_SUCCESS) { + duk_error(ctx, + DUK_ERR_ERROR, + "Unable to create navigator object"); + return 0; + } + duk_dup(ctx, -1); + duk_put_prop_string(ctx, -3, MAGIC(Navigator)); + } + return 1; +%} |