Added setTimeout and clearTimeout.
diff --git a/js/ndnProtocol/modules/ndn-js-header.txt b/js/ndnProtocol/modules/ndn-js-header.txt
index e30c261..3f505d2 100644
--- a/js/ndnProtocol/modules/ndn-js-header.txt
+++ b/js/ndnProtocol/modules/ndn-js-header.txt
@@ -24,3 +24,13 @@
}
};
+// The NDN class uses setTimeout and clearTimeout, so define them using XPCOM.
+function setTimeout(callback, delay) {
+ var timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
+ timer.initWithCallback({notify: callback}, delay, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ return timer;
+}
+
+function clearTimeout(timer) {
+ timer.cancel();
+}