File

src/session/loading/loading_activity.ts

Description

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.

Index

Methods

Constructor

constructor(global: LoadingActivity | null)
Parameters :
Name Type Optional
global LoadingActivity | null No

Methods

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 :
Name Type Optional Description
activity ActivityType No

The type of activity you want to receive events for.

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 :
Name Type Optional Description
activity ActivityType No

The type of activity you want to receive events for.

delayInMilliseconds number No

Delay in milliseconds to wait for when announcing the start of the activity.

Returns : Observable<boolean>
start
start(activity: ActivityType)

Starts a given activity.

Parameters :
Name Type Optional
activity ActivityType No
Returns : void
stop
stop(activity: ActivityType)

Stops a given activity. This must be kept in sync with start to avoid invalid state.

Parameters :
Name Type Optional
activity ActivityType No
Returns : void

result-matching ""

    No results matching ""