signal-chain
Advanced tools
Comparing version 0.11.5 to 0.11.6
@@ -190,4 +190,5 @@ export * from './signal/types'; | ||
function: import("./signal/evaluate").FunctionCall; | ||
computed: import("./signal/evaluate").ComputedCall; | ||
}; | ||
export default _default; | ||
//# sourceMappingURL=signal-ts.d.ts.map |
@@ -15,3 +15,3 @@ export * from './signal/types'; | ||
import { connect } from './signal/connect'; | ||
import { evaluate, toFunction } from './signal/evaluate'; | ||
import { evaluate, toFunction, toComputed } from './signal/evaluate'; | ||
import { listenToEvent } from './signal/event'; | ||
@@ -126,2 +126,3 @@ import { merge } from './signal/merge'; | ||
function: toFunction, | ||
computed: toComputed, | ||
}; |
@@ -16,2 +16,9 @@ import type { SyncChain, AsyncChain, WeakChain, AsyncWeakChain, Function1 } from "./types"; | ||
export declare const toFunction: FunctionCall; | ||
export interface ComputedCall { | ||
<V1, V2 = V1, V3 = V2, V4 = V3, V5 = V4, V6 = V5, V7 = V6, V8 = V7, V9 = V8, V10 = V9, V11 = V10, V12 = V11, V13 = V12, V14 = V13, V15 = V14, V16 = V15, V17 = V16, V18 = V17, V19 = V18, V20 = V19>(element1: SyncChain<V1, V2>, element2?: SyncChain<V2, V3>, element3?: SyncChain<V3, V4>, element4?: SyncChain<V4, V5>, element5?: SyncChain<V5, V6>, element6?: SyncChain<V6, V7>, element7?: SyncChain<V7, V8>, element8?: SyncChain<V8, V9>, element9?: SyncChain<V9, V10>, element10?: SyncChain<V10, V11>, element11?: SyncChain<V11, V12>, element12?: SyncChain<V12, V13>, element13?: SyncChain<V13, V14>, element14?: SyncChain<V14, V15>, element15?: SyncChain<V15, V16>, element16?: SyncChain<V16, V17>, element17?: SyncChain<V17, V18>, element18?: SyncChain<V18, V19>, element19?: SyncChain<V19, V20>): Function1<V1, V20>; | ||
<V1, V2 = V1, V3 = V2, V4 = V3, V5 = V4, V6 = V5, V7 = V6, V8 = V7, V9 = V8, V10 = V9, V11 = V10, V12 = V11, V13 = V12, V14 = V13, V15 = V14, V16 = V15, V17 = V16, V18 = V17, V19 = V18, V20 = V19>(element1: AsyncChain<V1, V2>, element2?: AsyncChain<V2, V3>, element3?: AsyncChain<V3, V4>, element4?: AsyncChain<V4, V5>, element5?: AsyncChain<V5, V6>, element6?: AsyncChain<V6, V7>, element7?: AsyncChain<V7, V8>, element8?: AsyncChain<V8, V9>, element9?: AsyncChain<V9, V10>, element10?: AsyncChain<V10, V11>, element11?: AsyncChain<V11, V12>, element12?: AsyncChain<V12, V13>, element13?: AsyncChain<V13, V14>, element14?: AsyncChain<V14, V15>, element15?: AsyncChain<V15, V16>, element16?: AsyncChain<V16, V17>, element17?: AsyncChain<V17, V18>, element18?: AsyncChain<V18, V19>, element19?: AsyncChain<V19, V20>): Function1<V1, V20 | undefined>; | ||
<V1, V2 = V1, V3 = V2, V4 = V3, V5 = V4, V6 = V5, V7 = V6, V8 = V7, V9 = V8, V10 = V9, V11 = V10, V12 = V11, V13 = V12, V14 = V13, V15 = V14, V16 = V15, V17 = V16, V18 = V17, V19 = V18, V20 = V19>(element1: WeakChain<V1, V2>, element2?: WeakChain<V2, V3>, element3?: WeakChain<V3, V4>, element4?: WeakChain<V4, V5>, element5?: WeakChain<V5, V6>, element6?: WeakChain<V6, V7>, element7?: WeakChain<V7, V8>, element8?: WeakChain<V8, V9>, element9?: WeakChain<V9, V10>, element10?: WeakChain<V10, V11>, element11?: WeakChain<V11, V12>, element12?: WeakChain<V12, V13>, element13?: WeakChain<V13, V14>, element14?: WeakChain<V14, V15>, element15?: WeakChain<V15, V16>, element16?: WeakChain<V16, V17>, element17?: WeakChain<V17, V18>, element18?: WeakChain<V18, V19>, element19?: WeakChain<V19, V20>): Function1<V1, V20 | undefined>; | ||
<V1, V2 = V1, V3 = V2, V4 = V3, V5 = V4, V6 = V5, V7 = V6, V8 = V7, V9 = V8, V10 = V9, V11 = V10, V12 = V11, V13 = V12, V14 = V13, V15 = V14, V16 = V15, V17 = V16, V18 = V17, V19 = V18, V20 = V19>(element1: AsyncWeakChain<V1, V2>, element2?: AsyncWeakChain<V2, V3>, element3?: AsyncWeakChain<V3, V4>, element4?: AsyncWeakChain<V4, V5>, element5?: AsyncWeakChain<V5, V6>, element6?: AsyncWeakChain<V6, V7>, element7?: AsyncWeakChain<V7, V8>, element8?: AsyncWeakChain<V8, V9>, element9?: AsyncWeakChain<V9, V10>, element10?: AsyncWeakChain<V10, V11>, element11?: AsyncWeakChain<V11, V12>, element12?: AsyncWeakChain<V12, V13>, element13?: AsyncWeakChain<V13, V14>, element14?: AsyncWeakChain<V14, V15>, element15?: AsyncWeakChain<V15, V16>, element16?: AsyncWeakChain<V16, V17>, element17?: AsyncWeakChain<V17, V18>, element18?: AsyncWeakChain<V18, V19>, element19?: AsyncWeakChain<V19, V20>): Function1<V1, V20 | undefined>; | ||
} | ||
export declare const toComputed: ComputedCall; | ||
//# sourceMappingURL=evaluate.d.ts.map |
import { chain } from "./chain"; | ||
import { execute } from "./util"; | ||
import { emit } from './tools'; | ||
import { connect } from "./primitive"; | ||
// @ts-expect-error | ||
@@ -32,1 +33,11 @@ export const evaluate = (listen1, ...additionalListeners) => { | ||
}; | ||
// @ts-expect-error | ||
export const toComputed = (listen1, ...additionalListeners) => { | ||
const memo = new Map(); | ||
return (value) => { | ||
if (!memo.has(value)) { | ||
memo.set(value, connect(emit(value), listen1, ...additionalListeners)); | ||
} | ||
return memo.get(value).value; | ||
}; | ||
}; |
{ | ||
"name": "signal-chain", | ||
"version": "0.11.5", | ||
"version": "0.11.6", | ||
"author": "Christoph Franke", | ||
@@ -5,0 +5,0 @@ "description": "Declarative Reactive Programming Library", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
313059
2008