diff --git a/.ci/doc/config.yml b/.ci/doc/config.yml index 6ee9fee2b..9dcbd9e18 100644 --- a/.ci/doc/config.yml +++ b/.ci/doc/config.yml @@ -13,10 +13,10 @@ runners: lint: global: true cmd: npx eslint@8.38.0 -c /mnt/.ci/doc/eslint.json {{ snippet.dir }} - before: timeout 600 ash -c 'until stat /home/node/runner_ready_to_lint; do sleep 1; done' + before: timeout 600 ash -c 'until stat /tmp/runner_ready_to_lint; do sleep 1; done' run: cmd: node {{ snippet.source }} - before: timeout 600 ash -c 'until stat /home/node/runner_is_ready && curl -f -s -o /dev/null http://kuzzle:7512/_now; do sleep 1; done' + before: timeout 600 ash -c 'until stat /tmp/runner_is_ready && curl -f -s -o /dev/null http://kuzzle:7512/_now; do sleep 1; done' web: service: doc-runner-web diff --git a/src/utils/browser.js b/src/utils/browser.js new file mode 100644 index 000000000..3d81f11b6 --- /dev/null +++ b/src/utils/browser.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isBrowser = exports.getBrowserWindow = void 0; +function getBrowserWindow() { + let windowObject; + try { + windowObject || (windowObject = globalThis.window); + if (windowObject) { + return windowObject; + } + } + catch { + // Check next variable + } + try { + windowObject || (windowObject = global.window); + if (windowObject) { + return windowObject; + } + } + catch { + // Check next variable + } + try { + windowObject || (windowObject = window); + if (windowObject) { + return windowObject; + } + } + catch { + // return undefined + } +} +exports.getBrowserWindow = getBrowserWindow; +function isBrowser() { + const window = getBrowserWindow(); + return window !== undefined && window !== null && typeof window === "object"; +} +exports.isBrowser = isBrowser; +//# sourceMappingURL=browser.js.map \ No newline at end of file