cycle-gear
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -13,3 +13,3 @@ import * as Rx from 'rx'; | ||
export interface Gear<TActions, TModel> { | ||
catch?: (error: any) => Rx.Observable<any>; | ||
catch?: (error: any, actions: TActions) => Rx.Observable<any>; | ||
intent?: (sources: any) => TActions; | ||
@@ -16,0 +16,0 @@ model?: (actions: TActions) => Rx.Observable<TModel>; |
@@ -51,4 +51,4 @@ import * as Rx from 'rx'; | ||
const actions = gear.intent ? gear.intent(sources) : defaultIntent(sources); | ||
const state$ = (gear.model ? gear.model(actions) : defaultModel(sources)) | ||
.catch(gear.catch ? gear.catch : defaultCatch) | ||
const state$ = (gear.model ? gear.model(actions) : defaultModel(actions)) | ||
.catch((err) => gear.catch ? gear.catch(err, actions) : defaultCatch(err, actions)) | ||
.shareReplay(1); | ||
@@ -55,0 +55,0 @@ const views = teeth.reduce((accum, tooth) => Object.assign(accum, { |
@@ -13,3 +13,3 @@ import * as Rx from 'rx'; | ||
export interface Gear<TActions, TModel> { | ||
catch?: (error: any) => Rx.Observable<any>; | ||
catch?: (error: any, actions: TActions) => Rx.Observable<any>; | ||
intent?: (sources: any) => TActions; | ||
@@ -16,0 +16,0 @@ model?: (actions: TActions) => Rx.Observable<TModel>; |
@@ -57,4 +57,4 @@ "use strict"; | ||
var actions = gear.intent ? gear.intent(sources) : defaultIntent(sources); | ||
var state$ = (gear.model ? gear.model(actions) : defaultModel(sources)) | ||
.catch(gear.catch ? gear.catch : defaultCatch) | ||
var state$ = (gear.model ? gear.model(actions) : defaultModel(actions)) | ||
.catch(function (err) { return gear.catch ? gear.catch(err, actions) : defaultCatch(err, actions); }) | ||
.shareReplay(1); | ||
@@ -61,0 +61,0 @@ var views = teeth.reduce(function (accum, tooth) { |
@@ -17,3 +17,3 @@ import * as Rx from 'rx' | ||
export interface Gear<TActions, TModel> { | ||
catch?: (error: any) => Rx.Observable<any> | ||
catch?: (error: any, actions: TActions) => Rx.Observable<any> | ||
intent?: (sources: any) => TActions | ||
@@ -85,4 +85,4 @@ model?: (actions: TActions) => Rx.Observable<TModel> | ||
const actions = gear.intent ? gear.intent(sources) : defaultIntent(sources) | ||
const state$ = (gear.model ? gear.model(actions) : defaultModel(sources)) | ||
.catch(gear.catch ? gear.catch : defaultCatch) | ||
const state$ = (gear.model ? gear.model(actions) : defaultModel(actions)) | ||
.catch((err: any) => gear.catch ? gear.catch(err, actions) : defaultCatch(err, actions)) | ||
.shareReplay(1) | ||
@@ -89,0 +89,0 @@ const views = teeth.reduce((accum, tooth) => Object.assign(accum, { |
{ | ||
"name": "cycle-gear", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Main function factory for CycleJS", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -32,2 +32,8 @@ # cycle-gear | ||
The `catch` will handle the gear's `model` errors. While this could be manually | ||
done for each gear model, as a top level part of a gear it encourages the ability | ||
to handle errors systematically, such as how each `tooth` might deal with it. (It | ||
also allows for a `catch` to be defaulted across a `transmission`, helping avoid | ||
issues with a "stuck" `transmission`.) | ||
## `pedal` | ||
@@ -42,2 +48,2 @@ | ||
router such as [@cycle/history](https://github.com/cyclejs/history), and at lower levels a | ||
`transmission` might be some other sort of user-action dependent state machine. | ||
`transmission` might be some other sort of user-action dependent state machine. |
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
49413
48