Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
// Module ID: 5518
|
|
// Function ID: 5519
|
|
// Name: LazyPromiseInitializer
|
|
// Dependencies: [2]
|
|
|
|
// Module 5518 (LazyPromiseInitializer)
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const result = size.fileFinishedImporting("modules/emoji_terms/LazyPromiseInitializer.tsx");
|
|
class LazyPromiseInitializer {
|
|
constructor(arg0) {
|
|
merged = Object.assign({ loading: false, loaded: false });
|
|
merged.loader = global;
|
|
return merged;
|
|
}
|
|
}
|
|
const prototype = LazyPromiseInitializer.prototype;
|
|
prototype["setParams"] = function setParams(param) {
|
|
const self = this;
|
|
if (this.param !== param) {
|
|
self.param = param;
|
|
self.loading = false;
|
|
self.loaded = false;
|
|
}
|
|
};
|
|
prototype["get"] = function get() {
|
|
this.ensureLoaded();
|
|
return this.val;
|
|
};
|
|
prototype["ensureLoaded"] = function ensureLoaded() {
|
|
const self = this;
|
|
if (!this.loaded) {
|
|
if (!self.loading) {
|
|
if (undefined !== self.param) {
|
|
const param = self.param;
|
|
self.loading = true;
|
|
self.loader(param).then((result) => {
|
|
if (param === self.param) {
|
|
tmp.val = result;
|
|
tmp.loading = false;
|
|
tmp.loaded = true;
|
|
}
|
|
});
|
|
const loaderResult = self.loader(param);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
export default LazyPromiseInitializer;
|