UNPKG

@builder.io/sdk

Version:

This SDK is largely a wrapper over our [Content API](https://www.builder.io/c/docs/content-api)

29 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.nextTick = void 0; var isSafari = typeof window !== 'undefined' && /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent); var isClient = typeof window !== 'undefined'; // TODO: queue all of these in a debounceNextTick function nextTick(fn) { // if (typeof process !== 'undefined' && process.nextTick) { // console.log('process.nextTick?'); // process.nextTick(fn); // return; // } // FIXME: fix the real safari issue of this randomly not working if (!isClient || isSafari || typeof MutationObserver === 'undefined') { setTimeout(fn); return; } var called = 0; var observer = new MutationObserver(function () { return fn(); }); var element = document.createTextNode(''); observer.observe(element, { characterData: true, }); // tslint:disable-next-line element.data = String((called = ++called)); } exports.nextTick = nextTick; //# sourceMappingURL=next-tick.function.js.map