Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
// Module ID: 4513
|
|
// Function ID: 4514
|
|
// Dependencies: [19, 4514, 4515]
|
|
// Exports: usePortal
|
|
|
|
// Module 4513
|
|
import ACTIONS from "ACTIONS" /* 4515 */;
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
({ useCallback: c2, useContext: c3 } = noop);
|
|
|
|
export const usePortal = () => {
|
|
let str = arg0;
|
|
if (arg0 === undefined) {
|
|
str = "root";
|
|
}
|
|
const tmp = closure_3(str(4514).PortalDispatchContext);
|
|
dependencyMap = tmp;
|
|
if (null === tmp) {
|
|
const _Error = Error;
|
|
const error = new Error("'PortalDispatchContext' cannot be null, please add 'PortalProvider' to the root component.");
|
|
throw error;
|
|
} else {
|
|
const tmp3 = closure_2(() => {
|
|
closure_1({ type: ACTIONS.ACTIONS.REGISTER_HOST, hostName: str });
|
|
}, []);
|
|
const tmp5 = closure_2((portalName, node) => {
|
|
closure_1({ type: ACTIONS.ACTIONS.ADD_UPDATE_PORTAL, hostName: str, portalName, node });
|
|
}, []);
|
|
const obj = {
|
|
registerHost: tmp3,
|
|
deregisterHost: closure_2(() => {
|
|
closure_1({ type: ACTIONS.ACTIONS.DEREGISTER_HOST, hostName: str });
|
|
}, []),
|
|
addPortal: tmp5,
|
|
updatePortal: tmp5,
|
|
removePortal: closure_2((portalName) => {
|
|
closure_1({ type: ACTIONS.ACTIONS.REMOVE_PORTAL, hostName: str, portalName });
|
|
}, [])
|
|
};
|
|
return obj;
|
|
}
|
|
};
|