Skip to content

1681-engine / mobile / BackStack

Class: BackStack ​

Defined in: src/mobile/backButton.ts:10

Who answers Android's back button (and the back gesture): the most recently pushed handler first, then the ones under it, then onRoot when none took it. A dialog pushes "close me" when it opens and pops it when it closes; a pause menu pushes "resume"; the title screen leaves the press to onRoot, which by default asks for a second press to quit, so a stray swipe never ends a run.

Constructors ​

Constructor ​

ts
new BackStack(onRoot?): BackStack;

Defined in: src/mobile/backButton.ts:13

Parameters ​

ParameterType
onRoot() => void

Returns ​

BackStack

Accessors ​

size ​

Get Signature ​

ts
get size(): number;

Defined in: src/mobile/backButton.ts:24

Returns ​

number

Methods ​

press() ​

ts
press(): boolean;

Defined in: src/mobile/backButton.ts:29

A back press: offered from the top down; onRoot when none uses it. True when a handler used it.

Returns ​

boolean


push() ​

ts
push(handler): () => void;

Defined in: src/mobile/backButton.ts:16

Puts handler on top; the returned function takes it off (from anywhere in the stack).

Parameters ​

ParameterType
handlerBackHandler

Returns ​

() => void

Released under the MIT License.