Class: Binder

Binder.Binder(…extensions)

new Binder(…extensions)

The core of webtini functionality. Renders a view using a data model.

Parameters:
Name Type Attributes Description
extensions Binder.Extension <repeatable>

Loads the Binder instance with Binder.Extensions.

Source:
Examples
```html
<html>
 <body>
   <h1 bind-textcontent="title"></h1>
   <p bind-textcontent="content"></p>
 </body>
</html>
```

```javascript
var datamodel = {
 title: 'The Page Title',
 content: 'The page content',
};
var binder = new Binder();
binder.bind(document.body, data)
```
```javascript
import {TemplateBinder} from './TemplateBinder.js';
import {EventBinder} from './EventBinder.js';
import {StyleBinder} from './StyleBinder.js';
import {ClassBinder} from './ClassBinder.js';
var binder = new Binder(
 new TemplateBinder(), 
 new EventBinder(), 
 new StyleBinder(), 
 new ClassBinder()
);
```

Classes

Extension

Members

(static) ATTRIBUTE :string

The attribute for defining the data scope for descendant elements.

Type:
  • string
Properties:
Name Type Description
ATTRIBUTE
Source:

(static) PREFIX :string

The prefix for identifying binding attributes.

Type:
  • string
Properties:
Name Type Description
PREFIX
Source:

(static) active :boolean

Indicates whether the binder is currently processing a view.

Type:
  • boolean
Properties:
Name Type Description
active
Source:

Methods

(static) bind(view, data) → {Element}

Renders the view using the data.

Parameters:
Name Type Description
view Element

The root element to bind.

data *

The Route or data model to bind from.

Source:
Returns:
Type
Element

(static) defer(view, data)

Queues binding to occur after the current call stack is clear. Only the latest call to this function will execute.

Parameters:
Name Type Description
view Element

The root element to bind.

data *

The Route or data model to bind from.

Source: