You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/pitfall/pdfkit/node_modules/timers-browserify/main.js

24 lines
990 B
JavaScript

// DOM APIs, for completeness
if (typeof setTimeout !== 'undefined') exports.setTimeout = function() { return setTimeout.apply(window, arguments); };
if (typeof clearTimeout !== 'undefined') exports.clearTimeout = function() { clearTimeout.apply(window, arguments); };
if (typeof setInterval !== 'undefined') exports.setInterval = function() { return setInterval.apply(window, arguments); };
if (typeof clearInterval !== 'undefined') exports.clearInterval = function() { clearInterval.apply(window, arguments); };
// TODO: Change to more effiecient list approach used in Node.js
// For now, we just implement the APIs using the primitives above.
exports.enroll = function(item, delay) {
item._timeoutID = setTimeout(item._onTimeout, delay);
};
exports.unenroll = function(item) {
clearTimeout(item._timeoutID);
};
exports.active = function(item) {
// our naive impl doesn't care (correctness is still preserved)
};
exports.setImmediate = require('process/browser.js').nextTick;