Browse Source

Document `extendFn`/`extendFnView`

pull/2031/head
Artur Arseniev 7 years ago
parent
commit
6079d8a505
  1. 22
      docs/modules/Components.md

22
docs/modules/Components.md

@ -322,6 +322,28 @@ comps.addType('map', {
});
```
### Extend parent functions <Badge text="0.14.60+"/>
When you need to reuse functions, of the parent you're extending, you can avoid writing something like this in any function:
```js
domc.getType('parent-type').model.prototype.init.apply(this, arguments);
```
by using `extendFn` and `extendFnView` arrays:
```js
domc.addType('new-type', {
extend: 'parent-type',
extendFn: ['init'], // array of model functions to extend
model: {
init() {
// do something;
},
}
});
```
The same would be for the view by using `extendFnView`
## Lifecycle Hooks
Each component triggers different lifecycle hooks, which allows you to add custom actions at their specific stages.

Loading…
Cancel
Save