All Projects → Tibing → Async Pipeline

Tibing / Async Pipeline

Licence: mit
🌈 RxJS operators for Angular component templates 😱

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Async Pipeline

Batcave
Batcave client is chat app built with Electron and Angular2, Socket.io with RxJS.
Stars: ✭ 114 (-15.56%)
Mutual labels:  rxjs
Reactive Patterns Course
Contains the code for the RxJs & Reactive Patterns Angular Architecture Course
Stars: ✭ 127 (-5.93%)
Mutual labels:  rxjs
Fp Ts Rxjs
fp-ts bindings for RxJS
Stars: ✭ 133 (-1.48%)
Mutual labels:  rxjs
Rxjs In Action
Code sample repository
Stars: ✭ 117 (-13.33%)
Mutual labels:  rxjs
Reactivetradercloud
Real-time FX trading showcase by Adaptive.
Stars: ✭ 1,664 (+1132.59%)
Mutual labels:  rxjs
Frontend Hard Mode Interview
《前端内参》,有关于JavaScript、编程范式、设计模式、软件开发的艺术等大前端范畴内的知识分享,旨在帮助前端工程师们夯实技术基础以通过一线互联网企业技术面试。
Stars: ✭ 2,338 (+1631.85%)
Mutual labels:  rxjs
Bloc.js
A predictable state management library that helps implement the BLoC design pattern in JavaScript
Stars: ✭ 111 (-17.78%)
Mutual labels:  rxjs
Page Transitions Travelapp
Travel App, Native-like Page Transitions
Stars: ✭ 134 (-0.74%)
Mutual labels:  rxjs
Rxjs Diagrams
React Components for visualising RxJS observables and operators
Stars: ✭ 126 (-6.67%)
Mutual labels:  rxjs
Rx Book
xgrommx.github.io/rx-book
Stars: ✭ 1,660 (+1129.63%)
Mutual labels:  rxjs
Rxios
A RxJS wrapper for axios
Stars: ✭ 119 (-11.85%)
Mutual labels:  rxjs
React Eva
Effects+View+Actions(React distributed state management solution with rxjs.)
Stars: ✭ 121 (-10.37%)
Mutual labels:  rxjs
Cyclejs.cn
The Cycle.js Chinese documentation website.
Stars: ✭ 132 (-2.22%)
Mutual labels:  rxjs
Cyclejs
A functional and reactive JavaScript framework for predictable code
Stars: ✭ 9,996 (+7304.44%)
Mutual labels:  rxjs
Od Virtualscroll
🚀 Observable-based virtual scroll implementation in Angular
Stars: ✭ 133 (-1.48%)
Mutual labels:  rxjs
Types First Ui
An opinionated framework for building long-lived, maintainable UI codebases
Stars: ✭ 114 (-15.56%)
Mutual labels:  rxjs
Ayanami
🍭 A better way to react with state
Stars: ✭ 129 (-4.44%)
Mutual labels:  rxjs
Rxmq.js
JavaScript pub/sub library based on RxJS
Stars: ✭ 134 (-0.74%)
Mutual labels:  rxjs
Beicon
Reactive Streams for ClojureScript
Stars: ✭ 133 (-1.48%)
Mutual labels:  rxjs
Angular Interview Questions
List of 300 Angular Interview Questions and answers
Stars: ✭ 2,264 (+1577.04%)
Mutual labels:  rxjs

AsyncPipeline

Do you still use streams in an old fashioned way? 🧐

alt text

Async pipeline bring RxJS operators in Angular templates! 🔥 Useful custom operators included!

alt text

Getting started

  • npm i ngx-async-pipeline
  • Import required modules:
import { CommonModule } from '@angular/common';
import { NotModule, LengthModule, SkipModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [
    CommonModule,
    NotModule,
    LengthModule,
    SkipModule,
  ],
})
export class AppModule {}
  • Use pipes
<app-errors *ngIf="errors$ | skip:3 | length | not | async"></app-errors>
  • Be awesome 🌈

Available pipes

Custom pipes

Here's a list of custom pipes introduced to bring simplicity and clarity to Angular templates.

RxJS

Here's a list of RxJS operators provided as pipes. Each RxJS pipe has the same API as appropriate operator.

Custom pipes

LengthPipe

// app.module.ts
import { LengthModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ LengthModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | length | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

length operator has to be used to retrieve the length of the string or array title$ | length.

LogPipe

// app.module.ts
import { LogModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ LogModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | log | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

log operator will console.log each value from the stream title$ | log.

NotPipe

// app.module.ts
import { NotModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ NotModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    <div *ngIf="data$ | length | not | async">
      No Data
    </div>
  `,
})
export class AppComponent {
  data$: Observable<string[]> = of([
    'Hello, Async Pipeline!',
    'Some another string',
    'And one more string',
    'And so on...',
  ]);
}

not operator will negate the value from the stream using ! operator condition$ | not

GetPipe

// app.module.ts
import { GetModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ GetModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ data$ | get:'title' | async }}
  `,
})
export class AppComponent {
  data$: Observable<{ title: string }> = of({ title: 'Here is a title!' });
}

Using get pipe you can get a value from an object by key provided as a param get:'title'. Or, get could be used to retrieve a specific item from an array get:3.

RxJS pipes

DebounceTimePipe

// app.module.ts
import { DebounceTimeModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ DebounceTimeModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | debounceTime:1000 | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for debounceTime operator.

DelayPipe

// app.module.ts
import { DelayModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ DelayModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | delay:1000 | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for delay operator.

DistinctUntilChangedPipe

// app.module.ts
import { DistinctUntilChangedModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ DistinctUntilChangedModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | distinctUntilChanged | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for distinctUntilChanged operator.

FirstPipe

// app.module.ts
import { FirstModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ FirstModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | first:3 | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for first operator.

LastPipe

// app.module.ts
import { LastModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ LastModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | last:3 | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for last operator.

MapToPipe

// app.module.ts
import { MapToModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ MapToModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | mapTo:'some other string' | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for mapTo operator.

PairwisePipe

// app.module.ts
import { PairwiseModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ PairwiseModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | pairwise | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for pairwise operator.

SkipPipe

// app.module.ts
import { SkipModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ SkipModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | skip:3 | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for skip operator.

SkipLastPipe

// app.module.ts
import { SkipLastModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ SkipLastModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | skipLast:3 | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for skipLast operator.

TakePipe

// app.module.ts
import { TakeModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ TakeModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | take:3 | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for take operator.

TakeLastPipe

// app.module.ts
import { TakeLastModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ TakeLastModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | takeLast:3 | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for takeLast operator.

ThrottlePipe

// app.module.ts
import { ThrottleModule } from 'ngx-async-pipeline';

@NgModule({
  imports: [ ThrottleModule ],
})
export class AppModule {}

// app.component.ts
@Component({
  template: `
    {{ title$ | throttle:1000 | async }}
  `,
})
export class AppComponent {
  title$: Observable<string> = of('Hello, Async Pipeline!');
}

Official documentation for throttle operator.

How can I support the developer?

  • Create pull requests, submit bugs, suggest new features or documentation updates 🔧
  • Star my GitHub repos ⭐️
  • Read me on Medium
  • Follow me on Twitter 🐾
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].