Do¶
See also
- Official ReactiveX documentation: Do
-
Observable.
do_action
(on_next=None, on_error=None, on_completed=None, observer=None)¶ Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence. This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
1 - observable.do_action(observer) 2 - observable.do_action(on_next) 3 - observable.do_action(on_next, on_error) 4 - observable.do_action(on_next, on_error, on_completed)
observer – [Optional] Observer, or ... on_next – [Optional] Action to invoke for each element in the
observable sequence.- on_error – [Optional] Action to invoke upon exceptional termination
- of the observable sequence.
- on_completed – [Optional] Action to invoke upon graceful termination
- of the observable sequence.
Returns the source sequence with the side-effecting behavior applied.
-
Observable.
finally_action
(action)¶ Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
Example: res = observable.finally(lambda: print(‘sequence ended’)
Keyword arguments: action – {Function} Action to invoke after the source observable
sequence terminates.Returns {Observable} Source sequence with the action-invoking termination behavior applied.
-
Observable.
tap
(on_next=None, on_error=None, on_completed=None, observer=None)¶ Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence. This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
1 - observable.do_action(observer) 2 - observable.do_action(on_next) 3 - observable.do_action(on_next, on_error) 4 - observable.do_action(on_next, on_error, on_completed)
observer – [Optional] Observer, or ... on_next – [Optional] Action to invoke for each element in the
observable sequence.- on_error – [Optional] Action to invoke upon exceptional termination
- of the observable sequence.
- on_completed – [Optional] Action to invoke upon graceful termination
- of the observable sequence.
Returns the source sequence with the side-effecting behavior applied.