summaryrefslogtreecommitdiffstats
path: root/src/civetweb/src/third_party/duktape-1.5.2/polyfills/performance-now.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/civetweb/src/third_party/duktape-1.5.2/polyfills/performance-now.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/civetweb/src/third_party/duktape-1.5.2/polyfills/performance-now.js b/src/civetweb/src/third_party/duktape-1.5.2/polyfills/performance-now.js
new file mode 100644
index 000000000..dfb0a1d6e
--- /dev/null
+++ b/src/civetweb/src/third_party/duktape-1.5.2/polyfills/performance-now.js
@@ -0,0 +1,25 @@
+/*
+ * Performance.now() polyfill
+ *
+ * http://www.w3.org/TR/hr-time/#sec-high-resolution-time
+ *
+ * Dummy implementation which uses the Date built-in and has no higher
+ * resolution. If/when Duktape has a built-in high resolution timer
+ * interface, reimplement this.
+ */
+
+var _perfNowZeroTime = Date.now();
+
+if (typeof Performance === 'undefined') {
+ Object.defineProperty(this, 'Performance', {
+ value: {},
+ writable: true, enumerable: false, configurable: true
+ });
+}
+if (typeof Performance.now === 'undefined') {
+ Object.defineProperty(Performance, 'now', {
+ value: function () {
+ return Date.now() - _perfNowZeroTime;
+ }, writable: true, enumerable: false, configurable: true
+ });
+}