UNPKG

@ryo-98/react-api-bridge

Version:
47 lines (46 loc) 1.59 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var genOutput_exports = {}; __export(genOutput_exports, { genOutput: () => genOutput }); module.exports = __toCommonJS(genOutput_exports); var import_react = require("react"); function genOutput(payload, bridgeOptions) { const globalContextValue = { bridge: {}, parent: void 0, payload }; const BridgeContext = (0, import_react.createContext)(globalContextValue); const cacheInitCbMap = /* @__PURE__ */ new WeakMap(); const initializedOnInitMap = /* @__PURE__ */ new Map(); const pendingResolverMap = /* @__PURE__ */ new Map(); const output = { initializedOnInitMap, cacheInitCbMap, bridgeOptions, BridgeContext, globalContextValue, pendingResolverMap }; Object.setPrototypeOf(output, null); Object.freeze(output); return output; }