Dispose of webgl resources properly

Fixes #3889
This commit is contained in:
Daniel Imms
2022-07-06 07:32:42 -07:00
parent 915fa49ce3
commit 54cbbf600d
6 changed files with 29 additions and 7 deletions
+7
View File
@@ -50,6 +50,13 @@ export abstract class Disposable implements IDisposable {
}
}
/**
* Wrap a function in a disposable.
*/
export function toDisposable(f: () => void): IDisposable {
return { dispose: f };
}
/**
* Dispose of all disposables in an array and set its length to 0.
*/