Aerys\BodyParser::watch PHP Method

watch() public method

public watch ( callable $cb, $cbData = null )
$cb callable
    public function watch(callable $cb, $cbData = null)
    {
        if ($this->req) {
            $this->watchers[] = [$cb, $cbData];
            if (!$this->parsing) {
                $this->parsing = true;
                \Amp\immediately(function () {
                    return $this->initIncremental();
                });
            }
        } elseif (!$this->parsing) {
            $this->watchers[] = [$cb, $cbData];
        }
        return $this;
    }