예제 #1
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$observable = Rx\Observable::range(0, 5)->skipLast(3);
$observable->subscribe($stdoutObserver);
예제 #2
0
파일: average.php 프로젝트: ReactiveX/RxPHP
<?php

require_once __DIR__ . '/../bootstrap.php';
$source = Rx\Observable::range(0, 9)->average();
$subscription = $source->subscribe($stdoutObserver);
예제 #3
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$source = Rx\Observable::range(0, 3)->map(function ($x) {
    return \Rx\Observable::range($x, 3);
})->concatAll();
$subscription = $source->subscribe($stdoutObserver);
예제 #4
0
파일: flatMap.php 프로젝트: mbonneau/RxPHP
<?php

require_once __DIR__ . '/../bootstrap.php';
$loop = React\EventLoop\Factory::create();
$scheduler = new Rx\Scheduler\EventLoopScheduler($loop);
$observable = Rx\Observable::range(1, 5);
$selectManyObservable = $observable->flatMap(function ($value) {
    return Rx\Observable::range(1, $value);
}, $scheduler);
$disposable = $selectManyObservable->subscribe($stdoutObserver, $scheduler);
$loop->run();
예제 #5
0
<?php

require_once __DIR__ . '/../bootstrap.php';
//With a seed
$source = Rx\Observable::range(1, 3);
$subscription = $source->scan(function ($acc, $x) {
    return $acc * $x;
}, 1)->subscribe($createStdoutObserver());
예제 #6
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$loop = \React\EventLoop\Factory::create();
$scheduler = new \Rx\Scheduler\EventLoopScheduler($loop);
$obs = \Rx\Observable::interval(100, $scheduler)->take(3)->mapWithIndex(function ($i) {
    return $i;
});
$source = Rx\Observable::range(0, 5)->concatMapTo($obs);
$subscription = $source->subscribe($stdoutObserver);
$loop->run();
예제 #7
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$observable = Rx\Observable::range(1, 5)->skipWhile(function ($x) {
    return $x < 3;
});
$observable->subscribe($stdoutObserver);
예제 #8
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$loop = \React\EventLoop\Factory::create();
$scheduler = new \Rx\Scheduler\EventLoopScheduler($loop);
$source = Rx\Observable::range(0, 5)->concatMap(function ($x, $i) use($scheduler) {
    return \Rx\Observable::interval(100, $scheduler)->take($x)->map(function () use($i) {
        return $i;
    });
});
$subscription = $source->subscribe($stdoutObserver);
$loop->run();
예제 #9
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$loop = React\EventLoop\Factory::create();
$scheduler = new Rx\Scheduler\EventLoopScheduler($loop);
$sources = Rx\Observable::range(0, 3)->map(function ($x) {
    return Rx\Observable::range($x, 3);
});
$merged = \Rx\Observable::mergeAll($sources);
$disposable = $merged->subscribe($stdoutObserver, $scheduler);
$loop->run();
예제 #10
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$observable = Rx\Observable::range(1, 5)->skipWhileWithIndex(function ($i, $value) {
    return $i < 3;
});
$observable->subscribe($stdoutObserver);
예제 #11
0
파일: sum.php 프로젝트: ReactiveX/RxPHP
<?php

require_once __DIR__ . '/../bootstrap.php';
$source = Rx\Observable::range(1, 10)->sum();
$subscription = $source->subscribe($stdoutObserver);
예제 #12
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$loop = React\EventLoop\Factory::create();
$scheduler = new Rx\Scheduler\EventLoopScheduler($loop);
$observable = Rx\Observable::range(1, 5);
$selectManyObservable = $observable->flatMapTo(\Rx\Observable::range(0, 2));
$disposable = $selectManyObservable->subscribe($stdoutObserver, $scheduler);
$loop->run();
예제 #13
0
<?php

require_once __DIR__ . '/../bootstrap.php';
$source = Rx\Observable::range(1, 6)->bufferWithCount(2, 1)->subscribe($stdoutObserver);