UNPKG

@gongt/ts-stl-client

Version:
23 lines 963 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const global_page_data_1 = require("@gongt/ts-stl-library/pattern/global-page-data"); const react_redux_1 = require("react-redux"); const store_1 = require("../redux/store"); function reactUseRedux(react) { const preventDuplicate = new global_page_data_1.GlobalVariable(react); if (preventDuplicate.has('redux')) { throw new TypeError('reactUseRedux(): duplicate call to one react instance.'); } preventDuplicate.set('redux', true); react.wrapComponent('Provider', react_redux_1.Provider, (global) => { const store = global.get(store_1.REDUX_PRELOAD_NAME); if (!store || typeof store.getState !== 'function') { throw new Error('render react: REDUX is used, but has not been init.'); } return { store: store, }; }); } exports.reactUseRedux = reactUseRedux; //# sourceMappingURL=client.js.map