Bindings
Bindings allow players to reference an element of their character sheet in the chat. With this API, you have full control over what bindings are available, and how they are displayed.
A binding is created with 4 elements :
namestring: The name used in the chat to reference the binding.componentIdstring: The id of the component referenced. You can have several bindings for a single componentId, for example in repeaters.viewIdstring: The id of the view used to display the binding.dataFunction: A function that returns an object of data passed to the view for rendering. This data will be available in the view.
Bindings are available thought the global Bindings constant.
Bindings.add(name, componentId, viewId, dataCallback)
name, type:stringrequired: The name used in the chat.componentId, type:stringrequired: The id of the component used.viewId, type:stringrequired: The view used for rendering.dataCallback, type:Function: A function returning an object that will be passed to the view. The object must be serializable in JSON.
Bindings.send(sheet, name)
sheet, type:Sheetrequired: The sheet element attached to the binding.name, type:stringrequired: The name of the binding.
Sends a binding into the chat. The binding must have been registered
with Binding.add().
Bindings.remove(name)
name, type:stringrequired: The name of the binding.
Remove one binding by its name.
Bindings.clear(componentId)
componentId, type:stringrequired: The component's id to clear.
Remove all the bindings of a component.