UNPKG

youzanyun-devtool-worker

Version:

40 lines (39 loc) 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const path_1 = tslib_1.__importDefault(require("path")); const spring4js_nodejs_1 = require("spring4js-nodejs"); let H5ExtensionPreviewService = class H5ExtensionPreviewService { constructor() { this.previewCompsMap = {}; this._broadcastPreviewComps = new spring4js_nodejs_1.Emitter(); this.onBroadcastPreviewComps = this._broadcastPreviewComps.registerEvent; } async start() { } async getTouchJsPath() { const touchJsPath = path_1.default.resolve(this.configService.getWorkerDir(), 'assets/utils/touch-emulator.js'); return touchJsPath; } async broadcastPreviewComps(projectId, workbenchId, previewComps) { this._broadcastPreviewComps.fire(previewComps); } async updatePreviewComps(projectId, nodeCode, pageName, previewComps) { const key = `${projectId}_${nodeCode}_${pageName}`; this.previewCompsMap[key] = previewComps; return true; } async getPreviewComps(projectId, nodeCode, pageName) { const key = `${projectId}_${nodeCode}_${pageName}`; const result = this.previewCompsMap[key]; return result; } }; tslib_1.__decorate([ (0, spring4js_nodejs_1.Resource)() ], H5ExtensionPreviewService.prototype, "configService", void 0); H5ExtensionPreviewService = tslib_1.__decorate([ (0, spring4js_nodejs_1.Service)() ], H5ExtensionPreviewService); exports.default = H5ExtensionPreviewService; ;