diff options
Diffstat (limited to 'src/example.ts')
-rw-r--r-- | src/example.ts | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/example.ts b/src/example.ts index 1362fbd..5ff3fba 100644 --- a/src/example.ts +++ b/src/example.ts @@ -1,7 +1,7 @@ -import { h, withVar, mount, RxAble } from 'rx' +import { h, withState, mount, sequence2, RxAble } from 'rx' const imbricatedMaps = - withVar(1, counter => [ + withState(1, counter => [ counterComponent({ value: counter, onSub: () => counter.update(n => n - 1), @@ -20,7 +20,7 @@ const imbricatedMaps = ]) const flatMap = - withVar(1, counter => [ + withState(1, counter => [ counterComponent({ value: counter, onSub: () => counter.update(n => n - 1), @@ -36,7 +36,7 @@ const flatMap = ]) const checkbox = - withVar(false, checked => [ + withState(false, checked => [ checkboxComponent({ label: 'Checkbox', isChecked: checked, @@ -46,7 +46,7 @@ const checkbox = ]) const rxChildren = - withVar(3, count => [ + withState(3, count => [ h('input', { type: 'number', value: count, @@ -60,7 +60,7 @@ const rxChildren = ]) const nodesCancel = - withVar(false, checked => [ + withState(false, checked => [ checkboxComponent({ label: 'Checkbox', isChecked: checked, @@ -70,7 +70,7 @@ const nodesCancel = ]) const counters = - withVar<Array<number>>([], counters => { + withState<Array<number>>([], counters => { return [ counterComponent({ value: counters.map(cs => cs.length), @@ -97,7 +97,7 @@ const counters = }) const rows = - withVar(1, count => [ + withState(1, count => [ h('input', { type: 'number', value: count, @@ -107,13 +107,13 @@ const rows = ]) const chrono = - withVar(false, isChecked => [ + withState(false, isChecked => [ checkboxComponent({ label: 'Show counter', isChecked, onCheck: b => isChecked.update(_ => b) }), - isChecked.map(b => b && withVar(0, elapsed => { + isChecked.map(b => b && withState(0, elapsed => { const interval = window.setInterval( () => elapsed.update(n => n + 1), 1000 @@ -127,8 +127,8 @@ const chrono = ]) const doubleMapChild = - withVar(true, isEven => - withVar('', search => { + withState(true, isEven => + withState('', search => { const books = [...Array(50).keys()] const filteredBooks = isEven.flatMap(f => search.map(s => |