Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/client/lib/workActivity

"Work is going on": the one signal behind the Cockpit's processing indicator (the top-bar brand mark animates only while this is true, and is still otherwise).

Cockpit client (shared), next. Source: ui/client/lib/workActivity.ts.

Functions#

beginWork()#

beginWork(): () => void

Defined in: ui/client/lib/workActivity.ts:21

Work started. Returns the function that ends it (safe to call twice).

Returns#

() => void


getWorkCount()#

getWorkCount(): number

Defined in: ui/client/lib/workActivity.ts:34

How many pieces of work are going on right now.

Returns#

number


isWorkRequest()#

isWorkRequest(method, path): boolean

Defined in: ui/client/lib/workActivity.ts:14

Is this request the framework doing work (as opposed to reading a list, saving a note or moving a pane)?

Parameters#

method

string

path

string

Returns#

boolean


subscribeWork()#

subscribeWork(fn): () => void

Defined in: ui/client/lib/workActivity.ts:37

Subscribe to changes (for useSyncExternalStore). Returns the unsubscribe.

Parameters#

fn

() => void

Returns#

() => void


trackWork()#

trackWork<T>(method, path, call): Promise<T>

Defined in: ui/client/lib/workActivity.ts:45

Run call, counting it as work for as long as it is in flight when it is a work request.

Type Parameters#

T

T

Parameters#

method

string

path

string

call

() => Promise<T>

Returns#

Promise<T>