Rx.Observable.using(resourceFactory, observableFactory)

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

Arguments

  1. resourceFactory (Function): Factory function to obtain a resource object.
  2. observableFactory (Scheduler): Factory function to obtain an observable sequence that depends on the obtained resource.

Returns

(Function): An observable sequence whose lifetime controls the lifetime of the dependent resource object.

Example