rxjs-queue
[![Build Status](https://travis-ci.org/NathanGrimaud/rxjs-asqueue.svg?branch=master)](https://travis-ci.org/NathanGrimaud/rxjs-asqueue) [![Coverage Status](https://coveralls.io/repos/github/NathanGrimaud/rxjs-asqueue/badge.svg?branch=master)](https://cove
Last updated 2 years ago by grimu .
MIT · Original npm · Tarball · package.json
$ cnpm install rxjs-queue 
SYNC missed versions from official npm registry.

Build Status Coverage Status

Rx asQueue

signature: asQueue(input: Observable[]): Observable

Turn multiple observables into a single observable, values will be emitted in the order of the input observables.

Examples

with the merge operator, once a value is emitted, it will be sent to our pipeline

const results = [{ wait: 0 }, { wait: 2000 }, { wait: 100 }, { wait: 1000 }, { wait: 3000 }];
const example = of(null);
const messages = results.map(result => example.pipe(mapTo(result.wait), delay(result.wait)));
merge(...messages)
  .pipe(
    map(value => {
      console.log(`${value}ms!`);
    })
  )
  .subscribe();

// 0ms ! ... 100ms! ... 1000ms! ... 2000ms! ... 3000ms

with the asQueue operator, we will receive the values in the order of the input observables

const results = [{ wait: 0 }, { wait: 2000 }, { wait: 100 }, { wait: 1000 }, { wait: 3000 }];
const example = of(null);
const messages = results.map(result => example.pipe(mapTo(result.wait), delay(result.wait)));
asQueue(messages)
  .pipe(
    map(value => {
      console.log(`${value}ms!`);
    })
  )
  .subscribe();

// 0ms ! ... 2000ms! ... 100ms! ... 1000ms! ... 3000ms

Current Tags

  • 1.0.1                                ...           latest (2 years ago)

1 Versions

  • 1.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (7)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |