Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
140 lines (99 sloc) 3.17 KB

{{ properties: { category: "core api" } }}

paperclip.blockBinding(name, blockBindingClass)

Registers a new block binding class. Block bindings allow you to modify how templates behave. Some examples include the {{#if:condition}}{{/}}, and {{html:content}}.


Base class to extend when creating custom block bindings. Here's an example for an {{#each:source}}{{/}} binding:

{{#example}} {{#block:"index-pc"}}

{{/}} {{#block:"eachBlockBinding-js"}}

{{/}} {{#block:"index-js"}}

{{/}} {{/}}

override bind(context)

Called when the block is added, and bound to the DOM. This is where you initialize your binding. Be sure to call, context) if you override. this method

override unbind()

Called when the block is removed from the DOM. This is a cleanup method.

override _onChange(context)

Called whenever the properties change for the block binding. These properties are defined in the template. Here's the syntax:

{{blockName: blockProperties }}


the node factory for creating elements. Use this to make your block binding compatible with the NodeJS and the browser.


the application


the data binding


the name registered for the block binding


the section which contains all the elements


the content template - this might be undefined if your block binding doesn't have {{#block:properties}}content{{/}}.


The child block template. Used in the conditional block.