Adding ability for stateful views to 'emit' events to their update functions. enhancing state tree viewer
This commit is contained in:
parent
69407cd25b
commit
6f217a0923
6 changed files with 111 additions and 77 deletions
|
|
@ -92,7 +92,9 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
|
|||
setFocus(fullKey);
|
||||
}
|
||||
|
||||
const viewResult = instance.view(instance.state);
|
||||
const emit = (event: any) => ({ _tag: 'ComponentEvent', _0: fullKey, _1: event });
|
||||
const viewResult = instance.view(instance.state)(emit);
|
||||
|
||||
const viewUI = {
|
||||
kind: 'clickable',
|
||||
child: viewResult,
|
||||
|
|
@ -206,6 +208,11 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (event._tag === 'ComponentEvent') {
|
||||
handleComponentEvent(event._0, event._1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event._tag === 'NoOp')
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue