Changing the shape of apps. adding better error boundries at stateful components. start fontViewer
This commit is contained in:
parent
d58c39a1ac
commit
cc33b9a015
5 changed files with 197 additions and 117 deletions
|
|
@ -97,7 +97,17 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
|
|||
}
|
||||
|
||||
const emit = (event: any) => ({ _tag: 'ComponentEvent', _0: fullKey, _1: event });
|
||||
const viewResult = instance.view(instance.state)(emit);
|
||||
let viewResult;
|
||||
try {
|
||||
viewResult = instance.view(instance.state)(emit);
|
||||
} catch (e: any) {
|
||||
viewResult = {
|
||||
kind: 'stack', children: [
|
||||
{ kind: 'rect', w: 9999, h: 60, color: '#400' },
|
||||
{ kind: 'text', content: `Error: ${e.message}`, x: 10, y: 30, color: '#f88' }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
const viewUI = {
|
||||
kind: 'clickable',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue