July 2018
Beginner
236 pages
5h 34m
English
There is also a more generalized form of lazyObservable() called fromResource(). Similar to lazyResource(), it takes in a function with the sink callback. This acts as a subscribing function, which is invoked only when the resource is actually requested. Additionally, it takes a second argument, an unsubscribing function, which can be used to clean up when the resource is no longer needed:
resource = fromResource(subscriber: sink => {}, unsubscriber: () => {}, initialValue)
fromResource() gives back an observable which will start fetching values when its current() method is invoked the first time. It gives back an observable that also has the dispose() method to stop updating values.
In ...
Read now
Unlock full access