thedesk/app/node_modules/lazy-val/out/main.js.map
2019-09-12 23:38:13 +09:00

2 lines
1.0 KiB
Plaintext

{"version":3,"sources":["../src/main.ts"],"names":[],"mappings":";;;;;;;AAAM,MAAO,IAAP,CAAW;AAIf,EAAA,WAAA,CAAY,OAAZ,EAAqC;AAH7B,SAAA,MAAA,GAA4B,IAA5B;AAIN,SAAK,OAAL,GAAe,OAAf;AACD;;AAED,MAAI,QAAJ,GAAY;AACV,WAAO,KAAK,OAAL,IAAgB,IAAvB;AACD;;AAED,MAAI,KAAJ,GAAS;AACP,QAAI,KAAK,OAAL,IAAgB,IAApB,EAA0B;AACxB,aAAO,KAAK,MAAZ;AACD;;AAED,UAAM,MAAM,GAAG,KAAK,OAAL,EAAf;AACA,SAAK,KAAL,GAAa,MAAb;AACA,WAAO,MAAP;AACD;;AAED,MAAI,KAAJ,CAAU,KAAV,EAA2B;AACzB,SAAK,MAAL,GAAc,KAAd;AACA,SAAK,OAAL,GAAe,IAAf;AACD;;AAzBc,C","sourcesContent":["export class Lazy<T> {\n private _value: Promise<T> | null = null\n private creator: (() => Promise<T>) | null\n\n constructor(creator: () => Promise<T>) {\n this.creator = creator\n }\n\n get hasValue() {\n return this.creator == null\n }\n\n get value(): Promise<T> {\n if (this.creator == null) {\n return this._value!!\n }\n\n const result = this.creator()\n this.value = result\n return result\n }\n\n set value(value: Promise<T>) {\n this._value = value\n this.creator = null\n }\n}"],"sourceRoot":""}