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

21 lines
685 B
PHP
Raw Normal View History

2016-05-24 11:47:14 -05:00
<?php
namespace Amp;
2016-05-29 11:35:09 -05:00
use Interop\Async\Awaitable;
interface Observable extends Awaitable {
2016-05-24 11:47:14 -05:00
/**
2016-05-27 15:44:01 -05:00
* 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.
2016-05-26 18:20:05 -05:00
*
2016-05-27 15:44:01 -05:00
* 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
2016-05-24 11:47:14 -05:00
*/
2016-05-27 15:44:01 -05:00
public function subscribe(callable $onNext);
2016-05-24 11:47:14 -05:00
}