Skip to content

Commit

Permalink
Merge pull request #30 from WorldMaker/blinkenlights
Browse files Browse the repository at this point in the history
Blinkenlights
  • Loading branch information
WorldMaker authored Mar 23, 2022
2 parents 336ad24 + 38311c1 commit 31d416b
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 20 deletions.
17 changes: 17 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,23 @@ managing the DOM. (If you were to build a "push" alternative to Angular's Reacti
for instance.) In such cases there are "Immediate" variants of bindings. You may not need them,
and the defaults should do what you need in most cases.

### Error Blinkenlights

Pharkas provides a set of blinkenlights (lights intended to blink a status) for very basic error
status indication. These are "last chance error reporting" blinkenlights for generic error
situations when any observable provided to `bind` or `bindEffect` or an "Immediate" variant of
such has thrown an error.

`pharkasTemplateStopped` in particular signals that a component has effectively _stopped_ updating just
about entirely as Pharkas will stop notifying Angular Change Detection when it raises
`pharkasTemplateStopped` during observation of an error from the combined change detection observable
for non-"Immediate" observables.

It is encouraged to move error detection and avoidance strategies such as retries up into your
observable pipelines themselves, but sometimes you need a last chance way to detect that the
worst has happened, the component may be stopped/stuck, and in that case render some sort of
frowny face 😟.

## Callbacks

Callbacks are very useful for everything from consuming output bindings of other Angular controls to
Expand Down
117 changes: 104 additions & 13 deletions docs/classes/PharkasComponent.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ inspirations from ReactiveUI (.NET) and React's Hook components.

- [constructor](PharkasComponent.md#constructor)

### Accessors

- [pharkasEffectError](PharkasComponent.md#pharkaseffecterror)
- [pharkasError](PharkasComponent.md#pharkaserror)
- [pharkasImmediateTemplateError](PharkasComponent.md#pharkasimmediatetemplateerror)
- [pharkasTemplateError](PharkasComponent.md#pharkastemplateerror)
- [pharkasTemplateStopped](PharkasComponent.md#pharkastemplatestopped)

### Methods

- [bind](PharkasComponent.md#bind)
Expand Down Expand Up @@ -60,7 +68,90 @@ inspirations from ReactiveUI (.NET) and React's Hook components.

#### Defined in

[pharkas.component.ts:77](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L77)
[pharkas.component.ts:129](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L129)

## Accessors

### pharkasEffectError

`get` **pharkasEffectError**(): `boolean`

An error has been observed in any observable applied to `bindEffect` or
`bindEffectImmediate`.

#### Returns

`boolean`

#### Defined in

[pharkas.component.ts:104](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L104)

___

### pharkasError

`get` **pharkasError**(): `boolean`

An error has been observed in any observable applied to `bind`, `bindImmediate`,
`bindEffect`, or `bindEffectImmediate`.

#### Returns

`boolean`

#### Defined in

[pharkas.component.ts:93](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L93)

___

### pharkasImmediateTemplateError

`get` **pharkasImmediateTemplateError**(): `boolean`

An error has been observed in any observable applied to `bindImmediate`.

#### Returns

`boolean`

#### Defined in

[pharkas.component.ts:117](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L117)

___

### pharkasTemplateError

`get` **pharkasTemplateError**(): `boolean`

An error has been observed in any observable applied to `bind` or `bindImmediate`.

#### Returns

`boolean`

#### Defined in

[pharkas.component.ts:123](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L123)

___

### pharkasTemplateStopped

`get` **pharkasTemplateStopped**(): `boolean`

An error has been observed in any observable applied to `bind`. Change detection
has *stopped* for all `bind` bound template observables.

#### Returns

`boolean`

#### Defined in

[pharkas.component.ts:111](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L111)

## Methods

Expand Down Expand Up @@ -93,7 +184,7 @@ Default bound observation is combined and throttled to requestAnimationFrame for

#### Defined in

[pharkas.component.ts:191](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L191)
[pharkas.component.ts:243](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L243)

___

Expand Down Expand Up @@ -124,7 +215,7 @@ ___

#### Defined in

[pharkas.component.ts:306](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L306)
[pharkas.component.ts:358](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L358)

___

Expand Down Expand Up @@ -157,7 +248,7 @@ Immediate bindings are neither combined nor throttled.

#### Defined in

[pharkas.component.ts:218](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L218)
[pharkas.component.ts:270](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L270)

___

Expand Down Expand Up @@ -188,7 +279,7 @@ ___

#### Defined in

[pharkas.component.ts:331](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L331)
[pharkas.component.ts:386](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L386)

___

Expand Down Expand Up @@ -217,7 +308,7 @@ Bind an observable to an `@Output()`.

#### Defined in

[pharkas.component.ts:244](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L244)
[pharkas.component.ts:296](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L296)

___

Expand Down Expand Up @@ -247,7 +338,7 @@ value

#### Defined in

[pharkas.component.ts:173](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L173)
[pharkas.component.ts:225](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L225)

___

Expand Down Expand Up @@ -279,7 +370,7 @@ Callback function

#### Defined in

[pharkas.component.ts:258](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L258)
[pharkas.component.ts:310](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L310)

___

Expand All @@ -297,7 +388,7 @@ OnDestroy.ngOnDestroy

#### Defined in

[pharkas.component.ts:389](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L389)
[pharkas.component.ts:464](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L464)

___

Expand All @@ -315,7 +406,7 @@ OnInit.ngOnInit

#### Defined in

[pharkas.component.ts:351](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L351)
[pharkas.component.ts:409](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L409)

___

Expand Down Expand Up @@ -346,7 +437,7 @@ Set an input value

#### Defined in

[pharkas.component.ts:133](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L133)
[pharkas.component.ts:185](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L185)

___

Expand Down Expand Up @@ -378,7 +469,7 @@ Observable

#### Defined in

[pharkas.component.ts:281](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L281)
[pharkas.component.ts:333](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L333)

___

Expand Down Expand Up @@ -412,4 +503,4 @@ Observable

#### Defined in

[pharkas.component.ts:154](/~https://github.com/WorldMaker/angular-pharkas/blob/b6a6991/projects/angular-pharkas/src/pharkas.component.ts#L154)
[pharkas.component.ts:206](/~https://github.com/WorldMaker/angular-pharkas/blob/0eb4ab5/projects/angular-pharkas/src/pharkas.component.ts#L206)
17 changes: 17 additions & 0 deletions projects/angular-pharkas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,23 @@ managing the DOM. (If you were to build a "push" alternative to Angular's Reacti
for instance.) In such cases there are "Immediate" variants of bindings. You may not need them,
and the defaults should do what you need in most cases.

### Error Blinkenlights

Pharkas provides a set of blinkenlights (lights intended to blink a status) for very basic error
status indication. These are "last chance error reporting" blinkenlights for generic error
situations when any observable provided to `bind` or `bindEffect` or an "Immediate" variant of
such has thrown an error.

`pharkasTemplateStopped` in particular signals that a component has effectively _stopped_ updating just
about entirely as Pharkas will stop notifying Angular Change Detection when it raises
`pharkasTemplateStopped` during observation of an error from the combined change detection observable
for non-"Immediate" observables.

It is encouraged to move error detection and avoidance strategies such as retries up into your
observable pipelines themselves, but sometimes you need a last chance way to detect that the
worst has happened, the component may be stopped/stuck, and in that case render some sort of
frowny face 😟.

## Callbacks

Callbacks are very useful for everything from consuming output bindings of other Angular controls to
Expand Down
2 changes: 1 addition & 1 deletion projects/angular-pharkas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-pharkas",
"version": "1.0.0",
"version": "2.0.0",
"peerDependencies": {
"@angular/common": "^11.1.1",
"@angular/core": "^11.1.1"
Expand Down
Loading

0 comments on commit 31d416b

Please sign in to comment.