SessionData

serde. SessionData

SessionData Information about the user's session with the inkjs interpreter. Contains data required to reboot the story.

Constructor

new SessionData(data)

Properties:
Name Type Description
state String

a JSON save-file produced by inkjs.Story.state.toJson().

sourcefile String

the path (url, relative, absolute) at which the ink story's compiled .json file is located.

visited boolean

whether users have made choices and progressed beyond this story state.

Converts a data object into a serde.SessionData.

Parameters:
Name Type Description
data SessionData

the content to be wrapped by serde.SessionData

Properties
Name Type Description
state String

a JSON save-file produced by inkjs.Story.state.toJson().

sourcefile String

the path (url, relative, absolute) at which the ink story's compiled .json file is located.

visited boolean

whether users have made choices and progressed beyond this story state.

Methods

(static) fromFlag(flaggable) → {SessionData}

Retrieves ink session data from a flag, allowing the users choices to resume a story that was in progress before a refresh.

Parameters:
Name Type Description
flaggable FlaggableObject

the object that implements foundry's getFlag interface.

Returns:

the session data that was stored in a flag.

Type
SessionData

toFlag(flaggable)

Serializes ink session data into a flag for a foundry object. This is necessary in order to reboot the ink interpreter when users reboot or refresh foundry but wish to continue a story.

Parameters:
Name Type Description
flaggable FlaggableObject

the object that implements foundry's setFlag interface.