cycle-gear
Advanced tools
Comparing version 5.2.0 to 6.0.0
@@ -19,7 +19,7 @@ import { Observable } from 'xstream'; | ||
} | ||
export declare type ToothReduce<TActions, TModel, TAccumulator> = (accumulator: TAccumulator, current: [TModel, Gear<TActions, TModel>]) => TAccumulator; | ||
export interface ToothConnector<TActions, TModel, TAccumulator> { | ||
reduce: ToothReduce<TActions, TModel, TAccumulator>; | ||
export declare type ToothReduce<TActions, TModel, TTooth, TAccumulator> = (accumulator: TAccumulator, current: [TTooth, Gear<TActions, TModel>]) => TAccumulator; | ||
export interface ToothConnector<TActions, TModel, TTooth, TAccumulator> { | ||
reduce: ToothReduce<TActions, TModel, TTooth, TAccumulator>; | ||
init: () => TAccumulator; | ||
isolate?: (sink: Observable<any>, gear: Gear<TActions, TModel>) => Observable<any>; | ||
isolate?: (sources: any, sink: Observable<any>, gear: Gear<TActions, TModel>) => Observable<any>; | ||
} | ||
@@ -35,6 +35,6 @@ export declare type Transmission = ((sources: any) => Observable<Gear<any, any>>) | Observable<Gear<any, any>>; | ||
sourcesWrapper?: (sources: any, gear: Gear<any, any>) => any; | ||
defaultConnector?: ToothConnector<any, any, any>; | ||
connectors?: Map<string, ToothReduce<any, any, any>>; | ||
defaultConnector?: ToothConnector<any, any, any, any>; | ||
connectors?: Map<string, ToothReduce<any, any, any, any>>; | ||
} | ||
export declare function pedal(transmission: Transmission, {defaultGear, defaultFilter, sinkMap}?: PedalOptions): (sources: any) => {}; | ||
export declare function motor(gearbox: Gearbox, {defaultGear, defaultFilter, defaultConnector, sourcesWrapper, connectors, sinkMap}?: MotorOptions): (sources: any) => {}; |
@@ -104,3 +104,3 @@ import { adapt } from '@cycle/run/lib/adapt'; | ||
if (isolator) { | ||
view = xs.fromObservable(isolator(view, gear)); | ||
view = xs.fromObservable(isolator(sources, view, gear)); | ||
} | ||
@@ -107,0 +107,0 @@ views[tooth].push(view); |
@@ -19,7 +19,7 @@ import { Observable } from 'xstream'; | ||
} | ||
export declare type ToothReduce<TActions, TModel, TAccumulator> = (accumulator: TAccumulator, current: [TModel, Gear<TActions, TModel>]) => TAccumulator; | ||
export interface ToothConnector<TActions, TModel, TAccumulator> { | ||
reduce: ToothReduce<TActions, TModel, TAccumulator>; | ||
export declare type ToothReduce<TActions, TModel, TTooth, TAccumulator> = (accumulator: TAccumulator, current: [TTooth, Gear<TActions, TModel>]) => TAccumulator; | ||
export interface ToothConnector<TActions, TModel, TTooth, TAccumulator> { | ||
reduce: ToothReduce<TActions, TModel, TTooth, TAccumulator>; | ||
init: () => TAccumulator; | ||
isolate?: (sink: Observable<any>, gear: Gear<TActions, TModel>) => Observable<any>; | ||
isolate?: (sources: any, sink: Observable<any>, gear: Gear<TActions, TModel>) => Observable<any>; | ||
} | ||
@@ -35,6 +35,6 @@ export declare type Transmission = ((sources: any) => Observable<Gear<any, any>>) | Observable<Gear<any, any>>; | ||
sourcesWrapper?: (sources: any, gear: Gear<any, any>) => any; | ||
defaultConnector?: ToothConnector<any, any, any>; | ||
connectors?: Map<string, ToothReduce<any, any, any>>; | ||
defaultConnector?: ToothConnector<any, any, any, any>; | ||
connectors?: Map<string, ToothReduce<any, any, any, any>>; | ||
} | ||
export declare function pedal(transmission: Transmission, {defaultGear, defaultFilter, sinkMap}?: PedalOptions): (sources: any) => {}; | ||
export declare function motor(gearbox: Gearbox, {defaultGear, defaultFilter, defaultConnector, sourcesWrapper, connectors, sinkMap}?: MotorOptions): (sources: any) => {}; |
@@ -169,3 +169,3 @@ "use strict"; | ||
if (isolator) { | ||
view = xstream_1.default.fromObservable(isolator(view, gear)); | ||
view = xstream_1.default.fromObservable(isolator(sources, view, gear)); | ||
} | ||
@@ -172,0 +172,0 @@ views[tooth].push(view); |
22
index.ts
@@ -25,8 +25,8 @@ import { adapt } from '@cycle/run/lib/adapt' | ||
export type ToothReduce<TActions, TModel, TAccumulator> = (accumulator: TAccumulator, current: [TModel, Gear<TActions, TModel>]) => TAccumulator | ||
export type ToothReduce<TActions, TModel, TTooth, TAccumulator> = (accumulator: TAccumulator, current: [TTooth, Gear<TActions, TModel>]) => TAccumulator | ||
export interface ToothConnector<TActions, TModel, TAccumulator> { | ||
reduce: ToothReduce<TActions, TModel, TAccumulator> | ||
export interface ToothConnector<TActions, TModel, TTooth, TAccumulator> { | ||
reduce: ToothReduce<TActions, TModel, TTooth, TAccumulator> | ||
init: () => TAccumulator | ||
isolate?: (sink: Observable<any>, gear: Gear<TActions, TModel>) => Observable<any> | ||
isolate?: (sources: any, sink: Observable<any>, gear: Gear<TActions, TModel>) => Observable<any> | ||
} | ||
@@ -46,4 +46,4 @@ | ||
sourcesWrapper?: (sources: any, gear: Gear<any, any>) => any | ||
defaultConnector?: ToothConnector<any, any, any> | ||
connectors?: Map<string, ToothReduce<any, any, any>> | ||
defaultConnector?: ToothConnector<any, any, any, any> | ||
connectors?: Map<string, ToothReduce<any, any, any, any>> | ||
} | ||
@@ -165,7 +165,7 @@ | ||
sourcesWrapper: (sources: any, gear: Gear<any, any>) => any, | ||
defaultConnector: ToothConnector<any, any, any>, | ||
connectors: Map<string, ToothConnector<any, any, any>>): (t: Iterable<Gear<any, any>>) => {} { | ||
defaultConnector: ToothConnector<any, any, any, any>, | ||
connectors: Map<string, ToothConnector<any, any, any, any>>): (t: Iterable<Gear<any, any>>) => {} { | ||
const modelCache = new WeakMap<Gear<any, any>, xs<any>>() | ||
return gears => { | ||
const views = teeth.reduce((acc, cur) => ({...acc, [cur]: [] as Array<Observable<any>> }), | ||
const views = teeth.reduce((acc, cur) => ({ ...acc, [cur]: [] as Array<Observable<any>> }), | ||
{} as {[tooth: string]: Array<Observable<any>>}) | ||
@@ -190,3 +190,3 @@ for (let gear of gears) { | ||
if (isolator) { | ||
view = xs.fromObservable(isolator(view, gear)) | ||
view = xs.fromObservable(isolator(sources, view, gear)) | ||
} | ||
@@ -207,3 +207,3 @@ views[tooth].push(view) | ||
const defaultDefaultConnector = { | ||
reduce: (acc: any, [cur, gear]: [any, Gear<any, any>]) => ({...acc, [gear.name || '?']: cur}), | ||
reduce: (acc: any, [cur, gear]: [any, Gear<any, any>]) => ({ ...acc, [gear.name || '?']: cur }), | ||
init: () => ({}) | ||
@@ -210,0 +210,0 @@ } |
{ | ||
"name": "cycle-gear", | ||
"version": "5.2.0", | ||
"version": "6.0.0", | ||
"description": "Main function factory for CycleJS", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69026