private function start()
    {
        Loop\queue(function () { // Asynchronously start the observable.
            if (null === $this->emitter) {
                return;
            }

            /**
             * Emits a value from the observable.
             *
             * @coroutine
             *
             * @param mixed $value If $value is an instance of \Icicle\Awaitable\Awaitable, the fulfillment value is
             *     used as the value to emit or the rejection reason is thrown from this coroutine.
             *
             * @return \Generator
             *
             * @resolve mixed The emitted value (the resolution value of $value)
             *
             * @throws \Icicle\Observable\Exception\CompletedError If the observable has been completed.
             */
            $emit = function ($value = null): \Generator {
                return $this->queue->push($value);
            };

            try {
                $generator = ($this->emitter)($emit);

                if (!$generator instanceof Generator) {
                    throw new UnexpectedTypeError('Generator', $generator);
                }

                $this->coroutine = new Coroutine($generator);
                $this->coroutine->done([$this->queue, 'complete'], [$this->queue, 'fail']);
            } catch (Throwable $exception) {
                $this->queue->fail(new InvalidEmitterError($this->emitter, $exception));
            }

            $this->emitter = null;
        });
    }
private function start()
    {
        Loop\queue(function () { // Asynchronously start the observable.
            if (null === $this->emitter) {
                return;
            }

            /**
             * Emits a value from the observable.
             *
             * @coroutine
             *
             * @param mixed $value If $value is an instance of \Icicle\Awaitable\Awaitable, the fulfillment value is
             *     used as the value to emit or the rejection reason is thrown from this coroutine.
             *
             * @return \Generator
             *
             * @resolve mixed The emitted value (the resolution value of $value)
             *
             * @throws \Icicle\Observable\Exception\CompletedError If the observable has been completed.
             */
            $emit = function ($value = null): \Generator {
                return $this->queue->push($value);
            };

            try {
                $generator = ($this->emitter)($emit);

                if (!$generator instanceof Generator) {
                    throw new UnexpectedTypeError('Generator', $generator);
                }

                $this->coroutine = new Coroutine($generator);
                $this->coroutine->done([$this->queue, 'complete'], [$this->queue, 'fail']);
            } catch (Throwable $exception) {
                $this->queue->fail(new InvalidEmitterError($this->emitter, $exception));
            }

            $this->emitter = null;
        });
    }
private function start ( ) { Loop \ queue ( function ( ) { // Asynchronously start the observable. if ( null === $ this -> emitter ) { return ; } /**
             * Emits a value from the observable.
             *
             * @coroutine
             *
             * @param mixed $value If $value is an instance of \Icicle\Awaitable\Awaitable, the fulfillment value is
             *     used as the value to emit or the rejection reason is thrown from this coroutine.
             *
             * @return \Generator
             *
             * @resolve mixed The emitted value (the resolution value of $value)
             *
             * @throws \Icicle\Observable\Exception\CompletedError If the observable has been completed.
             */ $ emit = function ( $ value = null ) : \ Generator { return $ this -> queue -> push ( $ value ) ; } ; try { $ generator = ( $ this -> emitter ) ( $ emit ) ; if ( ! $ generator instanceof Generator ) { throw new UnexpectedTypeError ( 'Generator' , $ generator ) ; } $ this -> coroutine = new Coroutine ( $ generator ) ; $ this -> coroutine -> done ( [ $ this -> queue , 'complete' ] , [ $ this -> queue , 'fail' ] ) ; } catch ( Throwable $ exception ) { $ this -> queue -> fail ( new InvalidEmitterError ( $ this -> emitter , $ exception ) ) ; } $ this -> emitter = null ; } ) ; }
Executes the emitter coroutine.
Executes the emitter coroutine .