From fbc3f36fb5a72c2cc399d5e83291ffabc299017e Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 5 Oct 2015 15:46:22 +0100 Subject: initial js navigator binding --- javascript/duktape/Window.bnd | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'javascript/duktape/Window.bnd') 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; +%} -- cgit v1.2.3