UNPKG

@dooboostore/simple-boot-http-server-ssr

Version:
26 lines 1.05 kB
import { getSim } from '@dooboostore/simple-boot/decorators/SimDecorator'; export const SaveAroundAfter = (obj, propertyKey, args, beforeReturn) => { const simstanceManager = obj._SimpleBoot_simstanceManager; const simOption = obj._SimpleBoot_simOption; const config = getSim(obj); if (simstanceManager && simOption && (config === null || config === void 0 ? void 0 : config.scheme)) { if (!simOption.window.server_side_data) { simOption.window.server_side_data = {}; } const key = config.scheme + '_' + propertyKey; if (beforeReturn instanceof Promise) { beforeReturn.then((it) => { simOption.window.server_side_data[key] = JSON.stringify(it); return it; }); } else { simOption.window.server_side_data[key] = JSON.stringify(beforeReturn); } } return beforeReturn; }; export const getStorage = (window) => { return window.aroundStorage; }; //# sourceMappingURL=SaveAroundAfter.js.map