Creates GouterState using required name
, params
and optional stack
.
Readonly
focusedReadonly
nameReadonly
paramsReadonly
stackStatic
emptyEmpty stack for internal state initialization only.
Static
focusingSet of states which will be focused when put into a stack.
Static
listenersListeners of each state.
Static
modifiedCollection of modified states controlled by schedule
and notify
functions.
Static
parentParents of each state.
Static
rootSet of special states which are focused when they have no parent.
Static
schedulerTo check if new scheduler promise could be created. When that promise resolves, each modified state listeners will be called.
Focused state from this state stack when the stack is not empty, undefined
otherwise.
True when this state has a parent and it's focusedIndex
points to this state.
Protected
listenersProtected
Current listeners of this state.
Parent state when this state in a stack, undefined
otherwise.
Deeply clones this state without listeners. Automatically called when some state with parent put into another stack during setStack call.
Focuses on this state by recursively changing focusedIndex
of it's parents. If it has no
parent or parent focusedIndex
is same then nothing happens.
Adds this listener of router state changes to set of listeners and returns unlisten
callback.
Every listener will be called on each update of params
, stack
and/or focusedIndex
.
unlisten
callback
Merges partial params into current params.
Removes current state from it's parent stack or does nothing if it has no parent.
Replaces current state fields including name
, params
, stack
and focusedIndex
.
Focuses on stack state with provided focusedIndex
. If that index is same as before or stack
state is not found then nothing happens.
Sets current params.
Replaces current stack
. It also resets current focusedIndex
to last stack state index so if
you need to preserve or modify that index you should call focus on some stack state
before this operation. If some state in new stack already has parent then it will be cloned using clone.
Adds this state to special set of focusing states. During parent setStack call it will be automatically focused only once and then removed from focusing states. If two or more focusing states occur in same stack then last one will be focused.
Static
notifyNotifies every listener of currently modified states about changes. Modified states could be added using GouterState.schedule.
Static
scheduleAdds state to modified states. That states' listeners will be called using GouterState.notify.
Generated using TypeDoc
Tree-like structure with name, params and stack to build complex navigation. Has useful methods to access and control each part.