UNPKG

@gongt/ts-stl-client

Version:
48 lines 2.32 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); const check_environment_1 = require("@gongt/ts-stl-library/check-environment"); const global_page_data_1 = require("@gongt/ts-stl-library/pattern/global-page-data"); const singleton_class_1 = require("@gongt/ts-stl-library/pattern/singleton-class"); const store_1 = require("./store"); let ReduxStoreWindow = class ReduxStoreWindow extends store_1.ReduxStore { constructor(logicRegister) { super(logicRegister); this.emptyPlHandlers = []; if (check_environment_1.IS_CLIENT && '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__' in window) { console.info('using redux dev-tools.'); this.composeEnhancers = __REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ // TODO, Specify here name, actionsBlacklist, actionsCreators and other options }); } } pushEmptyPreloadHandler(fn) { this.emptyPlHandlers.push(fn); } createStore() { const global = new global_page_data_1.GlobalVariable(); if (!global.has(store_1.REDUX_PRELOAD_NAME)) { const pl = {}; this.emptyPlHandlers.forEach((fn) => { fn(pl); }); global.set(store_1.REDUX_PRELOAD_NAME, pl); } return super.createStore(global); } ; }; ReduxStoreWindow = __decorate([ singleton_class_1.Singleton(true), __metadata("design:paramtypes", [Object]) ], ReduxStoreWindow); exports.ReduxStoreWindow = ReduxStoreWindow; //# sourceMappingURL=store-client.js.map