Default scene options
ReadonlylistenersReadonlyrootRoot element
FunctionshowShow the scene and change props one-time
Basic usage
using scene = new Scene(
(props: { text: string }, ctx) => {
const node = document.createElement('div');
ctx.on('scene:show', (newProps) => {
node.textContent = newProps.text;
});
return node;
},
{
//...
defaultProps: { text: 'default' },
},
);
await scene.show({ text: 'new' }); // show `new`
await scene.show(); // show `default`
Add a microtask to close the scene. It is useful when close in 'scene:show'
Override default options one-time
Emit event listeners
Remove event listener
Add event listener
Add one-time event listener, can not be removed manually
Basic element of a task