Improve context lost handling
This commit is contained in:
parent
9d5c11543c
commit
77ade80753
4 changed files with 26 additions and 21 deletions
4
src/graphics/graphics-library/context-lost-exception.ts
Normal file
4
src/graphics/graphics-library/context-lost-exception.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
export class ContextLostException {}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { RendererInfo } from '../rendering/renderer/renderer-info';
|
||||
import { ContextLostException } from './context-lost-exception';
|
||||
|
||||
/** @internal */
|
||||
export type UniversalRenderingContext = (
|
||||
|
|
@ -70,7 +71,7 @@ export const getUniversalRenderingContext = (
|
|||
if (typeof value === 'function') {
|
||||
if (isDestroyed || target.isContextLost()) {
|
||||
isDestroyed = true;
|
||||
throw new Error('Context lost');
|
||||
throw new ContextLostException();
|
||||
}
|
||||
|
||||
return value.bind(target);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue