appWaits

Waits the whole app is in, which outlive the screen that started them: a playback start runs from a press on one screen to a player on another. The scene's AppWaitHost keeps them, and the scene shows them as its loading spinner over the active screen's own waits (screenWaits).

Each wait is a Promise, one per wait, and it ends when the promise settles:

wait = appWaits.begin(LoadingKind.PLAYBACK_START, channelName) appWaits.done(wait) ' the player holds a stream appWaits.fail(wait, "failed") ' it failed, or the viewer left

The first settle wins and the rest do nothing, so every exit path can end the wait without checking whether another already has, and code holding one wait can never end another, which is what a wait ended by name could not promise (a player being replaced by the next channel's would end the next channel's). A wait nobody ends is ended by its kind's time limit and logged as an error.

Methods

(static) begin(kind, labelopt) → {dynamic}

Opens a wait of kind, labeled label (shown above the spinner; "" for none), and returns its Promise, or invalid when there is no host to keep it.

Parameters:
NameTypeAttributesDefaultDescription
kindstring
labelstring<optional>
""
Returns:
Type: 
dynamic

(static) done(appWait) → {void}

Ends appWait because what it waited for arrived. Does nothing once it has ended.

Parameters:
NameTypeDescription
appWaitdynamic
Returns:
Type: 
void

(static) fail(appWait, reason) → {void}

Ends appWait because what it waited for will not arrive (reason, for the log). Does nothing once it has ended.

Parameters:
NameTypeDescription
appWaitdynamic
reasonstring
Returns:
Type: 
void

(static) hides(entries, view) → {boolean}

Whether an open wait hides view. A start that replaced another from the same screen keeps it hidden when the replaced one ends.

Parameters:
NameTypeDescription
entriesobject
viewobject
Returns:
Type: 
boolean

(static) hidesLaunchingScreen(kind) → {boolean}

Whether a wait of kind hides the screen it was started from while it is open. A playback start does, so the viewer sees the item's backdrop and the spinner rather than the screen they pressed Play on, unless that screen is itself a player (a channel switch).

Parameters:
NameTypeDescription
kindstring
Returns:
Type: 
boolean

(static) hiding(entries) → {object}

The keys of the open waits that hide the screen they were started from.

Parameters:
NameTypeDescription
entriesobject
Returns:
Type: 
object

(static) isOpen(appWait) → {boolean}

Whether appWait is a wait that has not ended yet.

Parameters:
NameTypeDescription
appWaitdynamic
Returns:
Type: 
boolean

(static) isPlaybackScreen(view) → {boolean}

Whether view is a screen that plays: reaching it is where a playback start is meant to go.

Parameters:
NameTypeDescription
viewdynamic
Returns:
Type: 
boolean

(static) leftBehind(entries, newView) → {object}

The keys of the playback starts the viewer has left, now that newView is the active screen: it is neither the screen the start was pressed on nor a player. The start has nowhere to go any more: Back during a Play all must not start playback on whatever screen the viewer went back to.

Parameters:
NameTypeDescription
entriesobject
newViewdynamic
Returns:
Type: 
object

(static) limitMs(kind) → {dynamic}

How long a wait of kind may stay open before its time limit ends it. 0 for a kind that is not an app wait, which the scene ends at once: an app-wait kind without a limit is a bug.

Parameters:
NameTypeDescription
kindstring
Returns:
Type: 
dynamic

(static) msUntilNextDeadline(entries, now) → {integer}

Milliseconds from now until the next time limit, or -1 when no wait is open.

Parameters:
NameTypeDescription
entriesobject
nowdynamic
Returns:
Type: 
integer

(static) overdue(entries, now) → {object}

The keys of the open waits whose time limit has passed at now.

Parameters:
NameTypeDescription
entriesobject
nowdynamic
Returns:
Type: 
object