本文整理汇总了PHP中onNext函数的典型用法代码示例。如果您正苦于以下问题:PHP onNext函数的具体用法?PHP onNext怎么用?PHP onNext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了onNext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: interval_relative_time_Negative
/**
* @test
*/
public function interval_relative_time_Negative()
{
$results = $this->scheduler->startWithDispose(function () {
return new IntervalObservable(-1, $this->scheduler);
}, 210);
$this->assertMessages([onNext(201, 0), onNext(202, 1), onNext(203, 2), onNext(204, 3), onNext(205, 4), onNext(206, 5), onNext(207, 6), onNext(208, 7), onNext(209, 8)], $results->getMessages());
}
示例2: range_dispose
/**
* @test
*/
public function range_dispose()
{
$results = $this->scheduler->startWithDispose(function () {
return Observable::range(-10, 5, $this->scheduler);
}, 204);
$this->assertMessages([onNext(201, -10), onNext(202, -9), onNext(203, -8)], $results->getMessages());
}
示例3: timer_one_shot_relative_time_negative
/**
* @test
*/
public function timer_one_shot_relative_time_negative()
{
$results = $this->scheduler->startWithCreate(function () {
return new TimerObservable(-1, $this->scheduler);
});
$this->assertMessages([onNext(201, 0), onCompleted(201)], $results->getMessages());
}
示例4: fromArray_dispose
/**
* @test
*/
public function fromArray_dispose()
{
$xs = Observable::fromArray(['foo', 'bar', 'baz']);
$results = $this->scheduler->startWithDispose(function () use($xs) {
return $xs;
}, 202);
$this->assertMessages([onNext(201, 'foo')], $results->getMessages());
}
示例5: switchLatest_Dispose
/**
* @test
*/
public function switchLatest_Dispose()
{
$xs = $this->createHotObservable([onNext(300, $this->createColdObservable([onNext(10, 101), onNext(20, 102), onNext(110, 103), onNext(120, 104), onNext(210, 105), onNext(220, 106), onCompleted(230)])), onNext(400, $this->createColdObservable([onNext(10, 201), onNext(20, 202), onNext(30, 203), onNext(40, 204), onCompleted(50)])), onNext(500, $this->createColdObservable([onNext(10, 301), onNext(20, 302), onNext(30, 303), onNext(40, 304), onCompleted(150)])), onCompleted(600)]);
$results = $this->scheduler->startWithDispose(function () use($xs) {
return $xs->switchLatest();
}, 500);
$this->assertMessages([onNext(310, 101), onNext(320, 102), onNext(410, 201), onNext(420, 202), onNext(430, 203), onNext(440, 204)], $results->getMessages());
}
示例6: sum_number_never
/**
* Adapted from RxJS
*
* @test
*/
public function sum_number_never()
{
$xs = $this->createHotObservable([onNext(150, 1)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->sum();
});
$this->assertMessages([], $results->getMessages());
}
示例7: timestamp_dispose
/**
* @test
*/
public function timestamp_dispose()
{
$xs = $this->createHotObservable([onNext(150, 1), onNext(210, 2), onNext(230, 3), onNext(260, 4), onNext(300, 5), onNext(350, 6), onCompleted(400)]);
$results = $this->scheduler->startWithDispose(function () use($xs) {
return $xs->timestamp($this->scheduler);
}, 275);
$this->assertMessages([onNext(210, new Timestamped(210, 2)), onNext(230, new Timestamped(230, 3)), onNext(260, new Timestamped(260, 4))], $results->getMessages());
}
示例8: it_schedules_all_elements_from_the_array
/**
* @test
*/
public function it_schedules_all_elements_from_the_array()
{
$xs = BaseObservable::fromArray(array('foo', 'bar', 'baz'), $this->scheduler);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs;
});
$this->assertCount(4, $results->getMessages());
$this->assertMessages(array(onNext(201, 'foo'), onNext(202, 'bar'), onNext(203, 'baz'), onCompleted(204)), $results->getMessages());
}
示例9: startWith_error
/**
* @test
*/
public function startWith_error()
{
$error = new \Exception();
$xs = $this->createHotObservable([onNext(150, 1), onError(250, $error)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->startWithArray([1, 2, 3]);
});
$this->assertMessages([onNext(201, 1), onNext(202, 2), onNext(203, 3), onError(250, $error)], $results->getMessages());
}
示例10: pluck_array_numeric_index
/**
* @test
*/
public function pluck_array_numeric_index()
{
$xs = $this->createHotObservable([onNext(180, [-1, -1, -1, -1]), onNext(210, [4, 3, 2, 1]), onNext(240, [4, 3, 20, 10]), onNext(290, [4, 3, 200, 100]), onNext(350, [4, 3, 2000, 1000]), onCompleted(400)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->pluck(2);
});
$this->assertMessages([onNext(210, 2), onNext(240, 20), onNext(290, 200), onNext(350, 2000), onCompleted(400)], $results->getMessages());
$this->assertSubscriptions([subscribe(200, 400)], $xs->getSubscriptions());
}
示例11: subscribeOn_never
/**
* @test
*/
public function subscribeOn_never()
{
$xs = $this->createHotObservable([onNext(150, 1)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->subscribeOn($this->scheduler);
});
$this->assertMessages([], $results->getMessages());
$this->assertSubscriptions([subscribe(201, 1001)], $xs->getSubscriptions());
}
示例12: it_skips_multiple_values
/**
* @test
*/
public function it_skips_multiple_values()
{
$scheduler = $this->createTestScheduler();
$xs = $this->createHotObservable(array(onNext(300, 21), onNext(500, 42), onNext(800, 84), onNext(850, 168), onCompleted(870)));
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->skip(2);
});
$this->assertMessages(array(onNext(800, 84), onNext(850, 168), onCompleted(870)), $results->getMessages());
}
示例13: start_action_number
/**
* @test
*/
public function start_action_number()
{
$results = $this->scheduler->startWithCreate(function () {
return Observable::start(function () {
return 1;
}, $this->scheduler);
});
$this->assertMessages([onNext(200, 1), onCompleted(200)], $results->getMessages());
}
示例14: take_zero_calls_on_completed
/**
* @test
*/
public function take_zero_calls_on_completed()
{
$scheduler = $this->createTestScheduler();
$xs = $this->createHotObservable(array(onNext(300, 21), onNext(500, 42), onNext(800, 84), onCompleted(820)));
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->take(0);
});
$this->assertMessages(array(onCompleted(201)), $results->getMessages());
}
示例15: testToArrayDisposed
public function testToArrayDisposed()
{
$xs = $this->createHotObservable([onNext(110, 1), onNext(220, 2), onNext(330, 3), onNext(440, 4), onNext(550, 5)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->toArray();
});
$this->assertMessages([], $results->getMessages());
$this->assertSubscriptions([subscribe(200, 1000)], $xs->getSubscriptions());
}