decord/source/modules/emoji_terms/LazyPromiseInitializer.tsx

51 lines
1.3 KiB
TypeScript
Raw Normal View History

// Module ID: 5518
// Function ID: 5519
// Name: LazyPromiseInitializer
2026-07-29 08:29:29 +00:00
// Dependencies: [2]
2026-07-20 16:05:17 +00:00
// Module 5518 (LazyPromiseInitializer)
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
const result = size.fileFinishedImporting("modules/emoji_terms/LazyPromiseInitializer.tsx");
2026-07-29 08:29:29 +00:00
class LazyPromiseInitializer {
constructor(arg0) {
merged = Object.assign({ loading: false, loaded: false });
merged.loader = global;
return merged;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
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;
2026-07-29 08:29:29 +00:00
if (!this.loaded) {
if (!self.loading) {
if (undefined !== self.param) {
const param = self.param;
self.loading = true;
self.loader(param).then((result) => {
2026-07-29 08:29:29 +00:00
if (param === self.param) {
tmp.val = result;
2026-07-29 08:29:29 +00:00
tmp.loading = false;
tmp.loaded = true;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
});
const loaderResult = self.loader(param);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
}
};
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
export default LazyPromiseInitializer;