fix(core): update
This commit is contained in:
parent
9413c5bcdc
commit
29f0307ef8
@ -9,10 +9,19 @@ export class Smartstate<StatePartNameType> {
|
|||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows getting and initializing a new statepart
|
||||||
|
* initMode === 'soft' it will allow existing stateparts
|
||||||
|
* initMode === 'mandatory' will fail if there is an exiting statepart
|
||||||
|
* initMode === 'force' will overwrite any existing statepart
|
||||||
|
* @param statePartNameArg
|
||||||
|
* @param initialArg
|
||||||
|
* @param initMode
|
||||||
|
*/
|
||||||
public getStatePart<PayloadType>(
|
public getStatePart<PayloadType>(
|
||||||
statePartNameArg: string & StatePartNameType,
|
statePartNameArg: string & StatePartNameType,
|
||||||
initialArg?: PayloadType,
|
initialArg?: PayloadType,
|
||||||
initMode?: 'soft' | 'mandatory'
|
initMode?: 'soft' | 'mandatory' | 'force'
|
||||||
): StatePart<StatePartNameType, PayloadType> {
|
): StatePart<StatePartNameType, PayloadType> {
|
||||||
if (this.statePartMap[statePartNameArg as any]) {
|
if (this.statePartMap[statePartNameArg as any]) {
|
||||||
if (initialArg && (!initMode || initMode !== 'soft')) {
|
if (initialArg && (!initMode || initMode !== 'soft')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user