signal-chain
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -154,2 +154,4 @@ export * from './signal/types'; | ||
merge: typeof merge; | ||
if: <Range_2>(condition: import("./signal/types").Function1<Range_2, boolean>) => import("./signal/if").IfCall<Range_2>; | ||
ifNot: <V1_1>(condition: import("./signal/types").Function1<V1_1, boolean>) => import("./signal/if").IfCall<V1_1>; | ||
log: <V_1>(message?: string | undefined) => import("./signal/types").Chain<V_1>; | ||
@@ -156,0 +158,0 @@ buffer: <V_2>(size: number) => import("./signal/types").Chain<V_2, V_2[]>; |
export * from './signal/types'; | ||
import { emit, select, stopIf, stop, passIf, passUnique, count } from './signal/tools'; | ||
import { ifFn, ifNot } from './signal/if'; | ||
import { chain, sidechain } from './signal/chain'; | ||
@@ -93,5 +94,5 @@ import { connect as connectPrimitive, create as createPrimitive } from './signal/primitive'; | ||
merge, | ||
if: ifFn, | ||
ifNot, | ||
// missing: | ||
// if | ||
// ifNot | ||
// while | ||
@@ -98,0 +99,0 @@ // cache |
import type { Chain, Function1 } from './types'; | ||
export declare function count<V>(): Chain<V, number>; | ||
export declare function emit<V>(parameter: V): Chain<void, V>; | ||
export declare function emit<V, Input = void>(parameter: V): Chain<Input, V>; | ||
export declare function passIf<V>(condition: Function1<V, boolean>): Chain<V>; | ||
@@ -10,3 +10,3 @@ export declare function stopIf<V>(condition: Function1<V, boolean>): Chain<V>; | ||
export declare function select<V>(): Chain<V>; | ||
export declare function select<From, To>(mapping: Function1<From, To>): Chain<From, To>; | ||
export declare function select<From, To = From>(mapping: Function1<From, To>): Chain<From, To>; | ||
//# sourceMappingURL=tools.d.ts.map |
{ | ||
"name": "signal-chain", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"author": "Christoph Franke", | ||
@@ -15,2 +15,3 @@ "description": "Declarative reactive programming library", | ||
"reactive", | ||
"state", | ||
"chain" | ||
@@ -17,0 +18,0 @@ ], |
@@ -136,3 +136,3 @@ # Signal-Chain: A Declarative Reactive Programming Library | ||
user.meta = { | ||
profile: '/default.png', | ||
profil: '/default.png', | ||
loggedIn: false, | ||
@@ -144,6 +144,6 @@ comments: [] | ||
// here we can select a user from a dropdown | ||
document.getElementById('my-user-select').addEventListener('change', (event) => { | ||
user.user = (event.target as HTMLSelectElement).value | ||
document.getElementById('my-user-select')?.addEventListener('change', (event) => { | ||
user.name = (event.target as HTMLSelectElement).value | ||
user.meta = { | ||
profil: `/profil/${user.user}.png`, | ||
profil: `/profil/${user.name}.png`, | ||
loggedIn: true, | ||
@@ -155,3 +155,3 @@ comments: [] | ||
// here we can add a comment to the user | ||
document.getElementById('add-comment').addEventListener('click', () => { | ||
document.getElementById('add-comment')?.addEventListener('click', () => { | ||
user.meta.comments.push({ ... }) // push the new comment | ||
@@ -190,3 +190,7 @@ }) | ||
$.select(() => undefined) | ||
) | ||
), | ||
// typescript cannot infer that the if/ifNot eliminated the possibility of a boolean type here | ||
// the assert statement will crash if not given a parameter | ||
// it will also remove the type boolean from the type inference | ||
$.assert.not.isBoolean() | ||
) | ||
@@ -208,3 +212,3 @@ | ||
- Options and behaviour of update batching and async updates is not stable yet. There are several options and there will be a way to turn on/off batching and asnyc, the default configuration may change though. | ||
- `$.if`, `$.ifNot` are not implemented yet, but will be soon. | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
298770
63
1672
210