@lcap/asl
Version:
NetEase Application Specific Language
42 lines • 1.27 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadViewCache = exports.saveViewCache = void 0;
const webFile_1 = __importDefault(require("../../service/webFile"));
const hotReload_1 = require("./hotReload");
/**
* 保存子页面缓存
* @param view
*/
function saveViewCache(view) {
const serviceId = view.page.service.id;
const path = `ID_${view.id}.vue.json`;
const promise = webFile_1.default.saveFile({
body: {
serviceId,
path,
type: 'options-vue',
content: JSON.stringify(view.toVueOptions({ finalCode: false })),
},
});
hotReload_1.saveLastModified(serviceId, path);
return promise;
}
exports.saveViewCache = saveViewCache;
/**
* 加载子页面缓存
* @param view
*/
async function loadViewCache(serviceId, viewId) {
const result = await webFile_1.default.loadFile({
query: {
serviceId,
path: `ID_${viewId}.vue.json`,
},
});
return result && JSON.parse(result.content);
}
exports.loadViewCache = loadViewCache;
//# sourceMappingURL=page.js.map