- `self._view` is the HTML view renderered by `yo-yo` in the `render` function
- `self._view` is the HTML view renderered by `yo-yo` in the `render` function.
- `render()` this function should be called:
* At the first rendering (make sure that the returned node element is put on the DOM),
* When some property has changed in order to update the view
* At the first rendering (make sure that the returned node element is put on the DOM).
- look them up, discuss them, update them
* When some property has changed in order to update the view.
- `self.state` contains state properties of the module. These properties are either given from the parent through `òpts` or computed during the life of the object.
- `update(state)` allow the parent to update some of the state properties.
- for all functions / properties, prefixing by underscore (`_`) means the scope is private.
- look them up, discuss them, update them.
## Module Definition (example)
```js
@ -47,7 +48,7 @@ class UserCard {
self.event = new EventManager()
self._api = opts.api
self._view = undefined
self.data = {
self.state = {
title: opts.title,
name: opts.name,
surname: opts.surname,
@ -58,8 +59,8 @@ class UserCard {
var events = opts.events
events.funds.register('fundsChanged', function (amount) {
if (amount <self.data._funds)self.data.totalSpend+=self.data._funds-amount
self.data._funds = amount
if (amount <self.state._funds)self.state.totalSpend+=self.state._funds-amount