src/session/loading/loading_activity.ts
This service can be used for receiving notifications regarding loading activity of a Blueriq session. To obtain an instance of this service, inject GlobalLoadingActivity and request a session specific instance using forSession.
Methods |
constructor(global: LoadingActivity | null)
|
||||||
Parameters :
|
destroy |
destroy()
|
Returns :
void
|
isActive | ||||||||
isActive(activity: ActivityType)
|
||||||||
Creates a stream of activity events for the given type. When the given loading activity starts, the value true will be emitted, followed by false once the loading activity completes. The observable is guaranteed to emit the current activity immediately (i.e. synchronously) on subscription. If you need activity events but want to account for a small delay before actually showing a spinner for example, consider using isActiveWithDelay instead.
Parameters :
Returns :
Observable<boolean>
|
isActiveWithDelay | ||||||||||||
isActiveWithDelay(activity: ActivityType, delayInMilliseconds: number)
|
||||||||||||
Creates a stream of activity events for the given type, while allowing for the announcement of starting the activity being delayed a certain number of milliseconds. If within this delay the loading activity has already completed, you will not receive a notification at all. Immediately when subscribed, you will synchronously receive false to indicate that no activity is currently taking place. It will always take the given delay in milliseconds to potentially receive a signal of true. This behavior is chosen as it guarantees a synchronous emission on subscription, which is preferable in the typical situation where multiple types of activity are combined together using combineLatest.
Parameters :
Returns :
Observable<boolean>
|
start | ||||||
start(activity: ActivityType)
|
||||||
Starts a given activity.
Parameters :
Returns :
void
|
stop | ||||||
stop(activity: ActivityType)
|
||||||
Stops a given activity. This must be kept in sync with start to avoid invalid state.
Parameters :
Returns :
void
|