Using

See also

  • Official ReactiveX documentation: Using
classmethod Observable.using(resource_factory, observable_factory)

Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence’s lifetime.

Example:

res = rx.Observable.using(lambda: AsyncSubject(), lambda: s: s)
Parameters:
  • resource_factory (types.FunctionType) – Factory function to obtain a resource object.
  • observable_factory (types.FunctionType) – Factory function to obtain an observable sequence that depends on the obtained resource.
Returns:

An observable sequence whose lifetime controls the lifetime of the dependent resource object.

../../_images/using.png