Readonly
dataFrame duration
Number of times the user has left the page
Device pixel ratio
Screen physical size
Window physical size
Root element of the app
Protected
listenersLoad resources to RAM
It will show loading progress for each resource on page
Promise that resolves to array of loaded resources
Create data collector
using dc = await app.collector('data.csv');
dc.add({ name: 'Alice', age: 25 });
dc.add({ name: 'Bob', age: 30 });
using dc = await app
.collector('data.csv')
.on('add', ({ row, chunk }) => {
console.log('add a row', row, 'its chunk is', chunk);
})
.on('save', ({ chunk, preventDefault }) => {
preventDefault(); // Prevent the default save behavior
console.log('save all rows, the final chunk is', chunk);
});
Create a scene
const setup = (props: { text: string }, ctx) => {
const el = h('div'); // create element
effect(() => {
el.textContent = props.text; // update element content when props.text changes
});
return { node: el, data: () => ({ text: el.textContent }) }; // return element and data getter
};
// create scene by setup function
using scene = app.scene(setup, {
defaultProps: { text: 'default text' },
});
// change props.text and show, then get data
const data = await scene.show({ text: 'new text' });
Create a text scene
Optional
content: stringOptional text content to display
Optional
defaultOptions: Partial<SceneOptions<(props: ...) => ...>>Optional default scene options
Root element of the app