Renderer.ts
26 lines
| 552 B
| video/mp2t
|
TypeScriptLexer
cin
|
r94 | import { Scope } from "./Scope"; | ||
import { destroy, Rendition } from "./traits"; | ||||
let _scope = Scope.dummy; | ||||
const beginRender = async () => { | ||||
} | ||||
const endRender = () => { | ||||
} | ||||
export const getScope = () => _scope; | ||||
export const render = async (rendition: () => Rendition, scope = Scope.dummy) => { | ||||
await beginRender(); | ||||
const prev = _scope; | ||||
_scope = scope; | ||||
try { | ||||
const node = rendition().getDomNode(); | ||||
scope.own(() => destroy(node)); | ||||
return node; | ||||
} finally { | ||||
_scope = prev; | ||||
endRender(); | ||||
} | ||||
} | ||||