* Turn a function that implements dispose into an IDisposable. * * @param fn Clean up function, guaranteed to be called only **once**.
(fn: () => void)
| 69 | * @param fn Clean up function, guaranteed to be called only **once**. |
| 70 | */ |
| 71 | function 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. |
no test coverage detected