GT2/GT2-iOS/node_modules/immediate/lib/messageChannel.js

18 lines
414 B
JavaScript
Raw Normal View History

2018-02-12 17:26:06 +00:00
'use strict';
exports.test = function () {
if (global.setImmediate) {
// we can only get here in IE10
// which doesn't handel postMessage well
return false;
}
return typeof global.MessageChannel !== 'undefined';
};
exports.install = function (func) {
var channel = new global.MessageChannel();
channel.port1.onmessage = func;
return function () {
channel.port2.postMessage(0);
};
};