@typeheim/fluent-ng
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

FluentNG

Collection of Angular extensions

NPM Version Build Status Package License Discord

Getting Started

Install package

yarn add @typeheim/fluent-ng
//or
npm -i @typeheim/fluent-ng

StreamPipe

StreamPipe is an alternative to Angular core AsyncPipe. StreamPipe is tuned to work only with observables and support setting default values instead of null. Unlike AsyncPipe, StreamPipe call detectChanges of ChangeDetectorRef instead of markForCheck that marks the component tree dirty up to the root component, and then re-renders the full path until the component that caused the change, and all its child components related to the change. In the end, StreamPipe, triggers change detection and rendering only in the very component where the change got introduced, and the child components effected by the change giving better performance and smooth UI chnages.

@Component({
  template: `
    {{observableSource | stream}}
    {{observableSource | stream: {default: 'default text'} }}
  `
})
class StreamSampleComponent {
  observableSource = new Subject()
}

AwaitPipe

AwaitPipe works the same way as StreamPipe but instead of observables it expects promise.

@Component({
  template: `
    {{promiseSource | await}}
    {{promiseSource | await: {default: 'default text'} }}
  `
})
class PromiseSampleComponent {
  promiseSource = new Promise((resolve) => resolve('it works!'))
}

Readme

Keywords

none

Package Sidebar

Install

npm i @typeheim/fluent-ng

Weekly Downloads

1

Version

0.2.0

License

none

Unpacked Size

82.8 kB

Total Files

18

Last publish

Collaborators

  • prowwid