UNPKG

837 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.DocsContext = void 0;
7
8var _react = require("react");
9
10var _global = require("global");
11
12// We add DocsContext to window. The reason is that in case DocsContext.ts is
13// imported multiple times (maybe once directly, and another time from a minified bundle)
14// we will have multiple DocsContext definitions - leading to lost context in
15// the React component tree.
16// This was specifically a problem with the Vite builder.
17
18/* eslint-disable no-underscore-dangle */
19if (_global.window.__DOCS_CONTEXT__ === undefined) {
20 _global.window.__DOCS_CONTEXT__ = /*#__PURE__*/(0, _react.createContext)({});
21 _global.window.__DOCS_CONTEXT__.displayName = 'DocsContext';
22}
23
24var DocsContext = _global.window.__DOCS_CONTEXT__;
25exports.DocsContext = DocsContext;
\No newline at end of file