MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / toDisposable

Function toDisposable

src/platform/common/utils/lifecycle.ts:71–76  ·  view source on GitHub ↗

* Turn a function that implements dispose into an IDisposable. * * @param fn Clean up function, guaranteed to be called only **once**.

(fn: () => void)

Source from the content-addressed store, hash-verified

69 * @param fn Clean up function, guaranteed to be called only **once**.
70 */
71function toDisposable(fn: () => void): IDisposable {
72 const self = trackDisposable({
73 dispose: once(() => fn())
74 });
75 return self;
76}
77
78/**
79 * Manages a collection of disposable values.

Callers 1

combinedDisposableFunction · 0.85

Calls 2

onceFunction · 0.90
trackDisposableFunction · 0.85

Tested by

no test coverage detected