BindingData

serde. BindingData

Information about external bindings that is used to serialize them. Ensures that bindings created by macros, console commands, or callbacks can be rebound when foundry reboots or refreshes.

You can write a Fallback Function so that inky continues to preview your story, or so that you can run the story without all of its bindings for testing purposes.

Constructor

new BindingData(data)

Properties:
Name Type Description
data Object

the content to be wrapped by serde.BindingData

Properties
Name Type Description
name String

the name of the binding in ink by the when bound by the EXTERNAL command or called as a function.

sessionData SessionData

information about the session that will be used to rebind the external function.

externalFn function

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

Converts a data object into a serde.BindingData.

Parameters:
Name Type Description
data Object

the content to be wrapped by serde.BindingData

Properties
Name Type Description
name String

the name of the binding in ink by the when bound by the EXTERNAL command or called as a function.

sessionData SessionData

information about the session that will be used to rebind the external function.

externalFn function

the binding 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

fromFlag(flaggable) → {BindingData}

Retrieves external binding data, allowing ink's FFI external bindings to be reregistered when a story needs to resume.

Parameters:
Name Type Description
flaggable FlaggableObject

the object that implements foundry's setFlag interface.

Returns:

the external binding stored in a flag.

Type
BindingData

toFlag(flaggable)

Serializes external binding data into a flag for a foundry object. This is necessary because external bindings created by macros or through console commands do not persist when foundry is rebooted or refreshed.

Parameters:
Name Type Description
flaggable FlaggableObject

the object that implements foundry's setFlag interface.