2017 © Pedro Peláez
 

library await

Provides await functionality for RxPHP

image

rx/await

Provides await functionality for RxPHP

  • Wednesday, April 18, 2018
  • by davidwdan
  • Repository
  • 2 Watchers
  • 4 Stars
  • 2,019 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Await for RxPHP

This library will allow observables to block until complete. For use when combining observables with imperative code., (*1)

It uses the Voryx event-loop which behaves like the Javascript event-loop. ie. You don't need to start it., (*2)

Basic Example


require __DIR__ . '/../vendor/autoload.php'; //Do some aysnc craziness with observables $observable = \Rx\Observable::interval(1000); //Returns a `Generator` with the results of the observable $generator = \Rx\await($observable); //You can now use the results like a regular `Iterator` foreach ($generator as $item) { //Will block here until the observable completes echo $item, PHP_EOL; }

Timeout Example

Since observables can return 1 to an infinite number of results, you'll need to make sure that you either limit the number of items you take or use a timeout or it could block forever., (*3)

require __DIR__ . '/../vendor/autoload.php';

$source = \Rx\Observable::interval(1000)
    ->takeUntil(\Rx\Observable::timer(10000)); //timeout after 10 seconds

$generator = \Rx\await($source);

foreach ($generator as $item) {
    echo $item, PHP_EOL;
}

echo "DONE";


$source = \Rx\Observable::interval(1000) ->take(5); //Limit items to 5 $generator = \Rx\await($source); foreach ($generator as $item) { echo $item, PHP_EOL; } echo "DONE";

The Versions

18/04 2018

dev-master

9999999-dev

Provides await functionality for RxPHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

reactphp rxphp reactivex rx.php await

18/04 2018

2.1.0

2.1.0.0

Provides await functionality for RxPHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

reactphp rxphp reactivex rx.php await

18/04 2018

2.0.0

2.0.0.0

Provides await functionality for RxPHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

reactphp rxphp reactivex rx.php await

07/02 2016

0.1.0

0.1.0.0

Provides await functionality for RxPHP

  Sources   Download

MIT

The Requires

 

by Matt Bonneau
by David Dan

reactphp rxphp reactivex rx.php await