Improve context lost handling

This commit is contained in:
schmelczerandras 2020-11-09 11:53:43 +01:00
parent 9d5c11543c
commit 77ade80753
4 changed files with 26 additions and 21 deletions

View file

@ -0,0 +1,4 @@
/**
* @internal
*/
export class ContextLostException {}

View file

@ -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);