create-expo-cljs-app
Version:
Create a react native application with Expo and Shadow-CLJS!
112 lines (110 loc) • 3.99 kB
JavaScript
goog.provide("goog.async.nextTick");
goog.provide("goog.async.throwException");
goog.require("goog.debug.entryPointRegistry");
goog.require("goog.dom");
goog.require("goog.dom.TagName");
goog.require("goog.dom.safe");
goog.require("goog.functions");
goog.require("goog.html.SafeHtml");
goog.require("goog.html.TrustedResourceUrl");
goog.require("goog.labs.userAgent.browser");
goog.require("goog.labs.userAgent.engine");
goog.require("goog.string.Const");
goog.async.throwException = function(exception) {
goog.global.setTimeout(function() {
throw exception;
}, 0);
};
goog.async.nextTick = function(callback, opt_context, opt_useSetImmediate) {
var cb = callback;
if (opt_context) {
cb = goog.bind(callback, opt_context);
}
cb = goog.async.nextTick.wrapCallback_(cb);
if (goog.isFunction(goog.global.setImmediate) && (opt_useSetImmediate || goog.async.nextTick.useSetImmediate_())) {
goog.global.setImmediate(cb);
return;
}
if (!goog.async.nextTick.setImmediate_) {
goog.async.nextTick.setImmediate_ = goog.async.nextTick.getSetImmediateEmulator_();
}
goog.async.nextTick.setImmediate_(cb);
};
goog.async.nextTick.useSetImmediate_ = function() {
if (!goog.global.Window || !goog.global.Window.prototype) {
return true;
}
if (goog.labs.userAgent.browser.isEdge() || goog.global.Window.prototype.setImmediate != goog.global.setImmediate) {
return true;
}
return false;
};
goog.async.nextTick.setImmediate_;
goog.async.nextTick.getSetImmediateEmulator_ = function() {
var Channel = goog.global["MessageChannel"];
if (typeof Channel === "undefined" && typeof window !== "undefined" && window.postMessage && window.addEventListener && !goog.labs.userAgent.engine.isPresto()) {
Channel = function() {
var iframe = goog.dom.createElement(goog.dom.TagName.IFRAME);
iframe.style.display = "none";
goog.dom.safe.setIframeSrc(iframe, goog.html.TrustedResourceUrl.fromConstant(goog.string.Const.EMPTY));
document.documentElement.appendChild(iframe);
var win = iframe.contentWindow;
var doc = win.document;
doc.open();
goog.dom.safe.documentWrite(doc, goog.html.SafeHtml.EMPTY);
doc.close();
var message = "callImmediate" + Math.random();
var origin = win.location.protocol == "file:" ? "*" : win.location.protocol + "//" + win.location.host;
var onmessage = goog.bind(function(e) {
if (origin != "*" && e.origin != origin || e.data != message) {
return;
}
this["port1"].onmessage();
}, this);
win.addEventListener("message", onmessage, false);
this["port1"] = {};
this["port2"] = {postMessage:function() {
win.postMessage(message, origin);
}};
};
}
if (typeof Channel !== "undefined" && !goog.labs.userAgent.browser.isIE()) {
var channel = new Channel;
var head = {};
var tail = head;
channel["port1"].onmessage = function() {
if (head.next !== undefined) {
head = head.next;
var cb = head.cb;
head.cb = null;
cb();
}
};
return function(cb) {
tail.next = {cb:cb};
tail = tail.next;
channel["port2"].postMessage(0);
};
}
if (typeof document !== "undefined" && "onreadystatechange" in goog.dom.createElement(goog.dom.TagName.SCRIPT)) {
return function(cb) {
var script = goog.dom.createElement(goog.dom.TagName.SCRIPT);
script.onreadystatechange = function() {
script.onreadystatechange = null;
script.parentNode.removeChild(script);
script = null;
cb();
cb = null;
};
document.documentElement.appendChild(script);
};
}
return function(cb) {
goog.global.setTimeout(cb, 0);
};
};
goog.async.nextTick.wrapCallback_ = goog.functions.identity;
goog.debug.entryPointRegistry.register(function(transformer) {
goog.async.nextTick.wrapCallback_ = transformer;
});
//# sourceMappingURL=goog.async.nexttick.js.map