diff --git a/docs/modules/Components.md b/docs/modules/Components.md index 0916fba6b..213d401a6 100644 --- a/docs/modules/Components.md +++ b/docs/modules/Components.md @@ -322,6 +322,28 @@ comps.addType('map', { }); ``` +### Extend parent functions + +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.