StorageObservableTask
@objc(FIRStorageObservableTask)
open class StorageObservableTask : StorageTask
An extended StorageTask
providing observable semantics that can be used for responding to changes
in task state.
Observers produce a StorageHandle
, which is used to keep track of and remove specific
observers at a later date.
-
Observes changes in the upload status: Resume, Pause, Progress, Success, and Failure.
Declaration
Swift
@discardableResult @objc(observeStatus:handler:) open func observe(_ status: StorageTaskStatus, handler: @escaping (StorageTaskSnapshot) -> Void) -> String
Parameters
status
The
StorageTaskStatus
change to observe.handler
A callback that fires every time the status event occurs, containing a
StorageTaskSnapshot
describing task state.Return Value
A task handle that can be used to remove the observer at a later date.
-
Removes the single observer with the provided handle.
Declaration
Swift
@objc(removeObserverWithHandle:) open func removeObserver(withHandle handle: String)
Parameters
handle
The handle of the task to remove.
-
Removes all observers for a single status.
Declaration
Swift
@objc(removeAllObserversForStatus:) open func removeAllObservers(for status: StorageTaskStatus)
Parameters
status
A
StorageTaskStatus
to remove all listeners for. -
Removes all observers.
Declaration
Swift
@objc open func removeAllObservers()