diff --git a/website/guide/duktapebuiltins.html b/website/guide/duktapebuiltins.html index 2430a7b7..d3944d3b 100644 --- a/website/guide/duktapebuiltins.html +++ b/website/guide/duktapebuiltins.html @@ -14,7 +14,7 @@ objects, methods, and values.

-global +global References the global object itself. See proposal-global. @@ -32,9 +32,28 @@ objects, methods, and values.

TextDecoder() from WHATWG Encoding API. Converts a buffer into a string using UTF-8 encoding. + +performance +performance.now() from High Resolution Time Level 2. + Bindings like performance.timing from + Navigation Timing + are not supported. + +

global

+ +

References the global object itself, see +proposal-global. +Disabled by default, enable using DUK_USE_GLOBAL_BINDING.

+ +
+This binding might be removed as there is some concern whether the +binding has too many backward compatibility issues for browsers, see +global breaks flickr.com. +
+

The Duktape object

@@ -430,3 +449,31 @@ print(str.length); // length is 2, represented as a surrog print(str.charCodeAt(0)); // 55357, high surrogate print(str.charCodeAt(1)); // 56489, low surrogate + +

performance

+ +

performance.now() provides a monotonic time in milliseconds (including +fractions if available) from an unspecified origin. The return value is +from DUK_USE_GET_MONOTONIC_TIME() with a fallback to DUK_USE_DATE_GET_NOW(). +If an actual monotonic time provider is available, the return value is +guaranteed to advance in real time without "time jumps" caused by date/time +adjustments. This is useful for performance measurement, scheduling events +relative to current time instead of wall clock time, rate limiting, etc. +Example:

+ +
+function testFunction() {
+    for (var i = 0; i < 1e6; i++) {}
+}
+
+var t1 = performance.now();
+testFunction();
+var t2 = performance.now();
+print('test took:', (t2 - t1), 'milliseconds');
+
+ +

performance.timeOrigin is currently (Duktape 2.2.0) absent on purpose, +until its semantics for Duktape are decided.

+ +

Navigation Timing +bindings like performance.timing are not currently supported.