HookData

serde. HookData

Information about a hook registered by text, bindings, or tags in the ink story. Contains data required to reregister the hook after foundry reboots or refreshes.

Constructor

new HookData(data)

Properties:
Name Type Description
triggerHook String

the hook that will run the story's callback.

hookType String

one of 'once', 'when', or 'until'.

sessionData SessionData

information about the session that will be made accessible to the hook when called.

callbackFn function

the callback to be serialized (deserializing this is effectively eval running at the privilege of a macro).

Converts a data object into a serde.HookData.

Parameters:
Name Type Description
data Object

the content to be wrapped by serde.HookData

Properties
Name Type Description
triggerHook String

the hook that will run the story's callback.

hookType String

one of 'once', 'when', or 'until'.

sessionData SessionData

information about the session that will be made accessible to the hook when called.

callbackFn function

the callback to be serialized (deserializing this is effectively eval running at the privilege of a macro).

Members

callbackFn

Serialize a javascript function into a string so that it can survive a reload.

Methods

(static) fromFlag(flaggable) → {Array.<HookData>}

Retrieves hook data from a flag, allowing event listeners to be reregistered when the user reboots or refreshes foundry.

Parameters:
Name Type Description
flaggable FlaggableObject

the object that implements foundry's setFlag interface.

Returns:

the hooks that were stored in a flag.

Type
Array.<HookData>

(async) toFlag(flaggable)

Serializes hook data into a flag for a foundry object. This is necessary because hooks do not persist when foundry reboots or refreshes.

Parameters:
Name Type Description
flaggable FlaggableObject

the object that implements foundry's setFlag interface.