You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
973 B
25 lines
973 B
import { Trie } from "@wry/trie"; |
|
import { canUseWeakMap } from "../../../utilities/index.js"; |
|
import { InternalQueryReference } from "./QueryReference.js"; |
|
var SuspenseCache = /** @class */ (function () { |
|
function SuspenseCache(options) { |
|
if (options === void 0) { options = Object.create(null); } |
|
this.queryRefs = new Trie(canUseWeakMap); |
|
this.options = options; |
|
} |
|
SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) { |
|
var ref = this.queryRefs.lookupArray(cacheKey); |
|
if (!ref.current) { |
|
ref.current = new InternalQueryReference(createObservable(), { |
|
autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs, |
|
onDispose: function () { |
|
delete ref.current; |
|
}, |
|
}); |
|
} |
|
return ref.current; |
|
}; |
|
return SuspenseCache; |
|
}()); |
|
export { SuspenseCache }; |
|
//# sourceMappingURL=SuspenseCache.js.map
|