@@ -1017,14 +1017,11 @@ const runTests = async (van, msgDom, { debug }) => {
1017
1017
const counter = van . state ( init ) ;
1018
1018
return div ( Object . assign ( Object . assign ( { } , ( id ? { id } : { } ) ) , { "data-counter" : counter } ) , "❤️ " , counter , " " , button ( { onclick : ( ) => ++ counter . val } , up ) , button ( { onclick : ( ) => -- counter . val } , down ) ) ;
1019
1019
} ;
1020
- const OptimizedCounter = ( { van : { state, derive, val, tags : { button, div } } , id, init = 0 , buttonStyle = "👍👎" , } ) => div ( ( dom ) => {
1021
- if ( dom )
1022
- return dom ;
1023
- const counter = state ( init ) ;
1024
- const up = state ( undefined ) , down = state ( undefined ) ;
1025
- derive ( ( ) => [ up . val , down . val ] = [ ...val ( buttonStyle ) ] ) ;
1026
- return div ( Object . assign ( Object . assign ( { } , ( id ? { id } : { } ) ) , { "data-counter" : counter } ) , "❤️ " , counter , " " , button ( { onclick : ( ) => ++ counter . val } , up ) , button ( { onclick : ( ) => -- counter . val } , down ) ) ;
1027
- } ) . firstChild ;
1020
+ const OptimizedCounter = ( { van, id, init = 0 , buttonStyle = "👍👎" , } ) => {
1021
+ const { button, div } = van . tags ;
1022
+ const counter = van . state ( init ) ;
1023
+ return div ( Object . assign ( Object . assign ( { } , ( id ? { id } : { } ) ) , { "data-counter" : counter } ) , "❤️ " , counter , " " , button ( { onclick : ( ) => ++ counter . val } , ( ) => [ ...van . val ( buttonStyle ) ] [ 0 ] ) , button ( { onclick : ( ) => -- counter . val } , ( ) => [ ...van . val ( buttonStyle ) ] [ 1 ] ) ) ;
1024
+ } ;
1028
1025
const hydrateExample = ( Counter ) => withHiddenDom ( async ( hiddenDom ) => {
1029
1026
const counterInit = 5 ;
1030
1027
const selectDom = select ( { value : "👆👇" } , option ( "👆👇" ) , option ( "👍👎" ) , option ( "🔼🔽" ) , option ( "⏫⏬" ) , option ( "📈📉" ) ) ;
0 commit comments