export class ResourceLifecycle {
    resources = new Set();
    track(resource) {
        this.resources.add(resource);
        return resource;
    }
    dispose() {
        for (const resource of this.resources) {
            if (!resource.disposed)
                resource.dispose();
        }
        this.resources.clear();
    }
    leakCount() {
        return [...this.resources].filter((resource) => !resource.disposed).length;
    }
}
//# sourceMappingURL=ResourceLifecycle.js.map