UNPKG

@tanstack/query-core

Version:

The framework agnostic core that powers TanStack Query

32 lines 686 B
// src/removable.ts import { isServer, isValidTimeout } from "./utils.js"; var Removable = class { #gcTimeout; destroy() { this.clearGcTimeout(); } scheduleGc() { this.clearGcTimeout(); if (isValidTimeout(this.gcTime)) { this.#gcTimeout = setTimeout(() => { this.optionalRemove(); }, this.gcTime); } } updateGcTime(newGcTime) { this.gcTime = Math.max( this.gcTime || 0, newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3) ); } clearGcTimeout() { if (this.#gcTimeout) { clearTimeout(this.#gcTimeout); this.#gcTimeout = void 0; } } }; export { Removable }; //# sourceMappingURL=removable.js.map