Wednesday 17 January 2018

Operator - Empty, Never and Throw



classmethodObservable.empty(scheduler=None)

create an Observable that emits no items but terminates normally

Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
1 - res = rx.Observable.empty() 2 - res = rx.Observable.empty(rx.Scheduler.timeout)
scheduler – Scheduler to send the termination call on.
Returns an observable sequence with no elements.


--------------------------
Observable.empty();
----------------------------
classmethodObservable.never()

create an Observable that emits no items and does not terminate

Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
Returns an observable sequence whose observers will never get called.

--------------------------------------------------
Observable.never();
--------------------------------------------------
classmethodObservable.throw(exceptionscheduler=None)
Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
1 - res = rx.Observable.throw_exception(Exception(‘Error’)) 2 - res = rx.Observable.throw_exception(Exception(‘Error’),
rx.Scheduler.timeout)
Keyword arguments: exception – An object used for the sequence’s termination. scheduler – Scheduler to send the exceptional termination call on. If
not specified, defaults to ImmediateScheduler.
Returns the observable sequence that terminates exceptionally with the specified exception object.
classmethodObservable.throw_exception(exceptionscheduler=None)
Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
1 - res = rx.Observable.throw_exception(Exception(‘Error’)) 2 - res = rx.Observable.throw_exception(Exception(‘Error’),
rx.Scheduler.timeout)
Keyword arguments: exception – An object used for the sequence’s termination. scheduler – Scheduler to send the exceptional termination call on. If
not specified, defaults to ImmediateScheduler.
Returns the observable sequence that terminates exceptionally with the specified exception object.



------------------------------

-----------------------------

No comments:

Post a Comment

Calling method Sequencely

1. Execute multiple task sequencly (WAY-1) ------------------------------------------------------------------------------ import io.re...