1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 13:21:16 +01:00
amp/lib/Observable.php
2016-05-29 11:46:58 -05:00

21 lines
685 B
PHP

<?php
namespace Amp;
use Interop\Async\Awaitable;
interface Observable extends Awaitable {
/**
* Registers a callback to be invoked each time value is emitted from the observable. If the function returns an
* awaitable, backpressure is applied to the awaitable until the returned awaitable is resolved.
*
* Exceptions thrown from $onNext (or failures of awaitables returned from $onNext) will fail the returned
* Disposable with the thrown exception.
*
* @param callable $onNext Function invoked each time a value is emitted from the observable.
*
* @return \Amp\Disposable
*/
public function subscribe(callable $onNext);
}