UNPKG

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

Version:
39 lines 1.6 kB
import { __decorate } from "tslib"; import { getSim, Sim } from '@dooboostore/simple-boot/decorators/SimDecorator'; let IntentSchemeServerProxy = class IntentSchemeServerProxy { get(target, prop) { const t = target[prop]; if (typeof t === 'function') { return (...args) => { const simstanceManager = target._SimpleBoot_simstanceManager; const simOption = target._SimpleBoot_simOption; const config = getSim(target); const data = t.apply(target, args); if (simstanceManager && simOption && (config === null || config === void 0 ? void 0 : config.scheme) && simOption.window) { if (!simOption.window.server_side_data) { simOption.window.server_side_data = {}; } const key = config.scheme + '_' + prop; if (data instanceof Promise) { data.then((it) => { simOption.window.server_side_data[key] = JSON.stringify(it); return it; }); } else { simOption.window.server_side_data[key] = JSON.stringify(data); } } return data; }; } else { return t; } } }; IntentSchemeServerProxy = __decorate([ Sim ], IntentSchemeServerProxy); export { IntentSchemeServerProxy }; //# sourceMappingURL=IntentSchemeServerProxy.js.map