cesium/scripts/ContextCache.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
512 B
JavaScript
Raw Permalink Normal View History

2023-09-15 03:56:25 +08:00
class ContextCache {
2025-04-26 02:17:23 +08:00
constructor(context) {
this.context = context;
this.promise = Promise.resolve();
this.result = undefined;
2023-09-15 03:56:25 +08:00
}
2025-04-26 02:17:23 +08:00
clear() {
this.result = undefined;
}
async rebuild() {
const promise = (this.promise = this.context.rebuild());
const result = (this.result = await promise);
return result;
}
isBuilt() {
return (
this.result &&
this.result.outputFiles &&
this.result.outputFiles.length > 0
);
}
}
export default ContextCache;