codess
Version:
vscode代码片段管理器,通过 本地包(本地某个文件夹) 或官网的 远程包(代码片段集合) 生成本地项目的 vscode 代码片段配置。
30 lines (29 loc) • 707 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lazy = void 0;
class Lazy {
constructor(executor) {
this.executor = executor;
this._didRun = false;
}
get hasValue() { return this._didRun; }
get value() {
if (!this._didRun) {
try {
this._value = this.executor();
}
catch (err) {
this._error = err;
}
finally {
this._didRun = true;
}
}
if (this._error) {
throw this._error;
}
return this._value;
}
get rawValue() { return this._value; }
}
exports.Lazy = Lazy;