CreateModel
keet/CreateModel
Example
import { CreateModel } from 'keet'
class myModel extends CreateModel {
contructor() {
super()
// props
}
// new extended method
myMethod(...args){
this.list = args
}
}
const MyModel = new myModel()
keet/CreateModel.subscribe(fn)
Subscribe to the model changes, the function callback first argument
is the model.list
and the second argument is model.listFilter
Kind: instance method of keet/CreateModel
Param | Type | Description |
---|---|---|
fn | function | the function callback for the subscribe |
keet/CreateModel.add(obj)
Add new object to the model list
Kind: instance method of keet/CreateModel
Param | Type | Description |
---|---|---|
obj | Object | new object to add into the model list |
keet/CreateModel.update(updateObj)
Update existing object in the model list
Kind: instance method of keet/CreateModel
Param | Type | Description |
---|---|---|
updateObj | Object | the updated properties |
keet/CreateModel.filter(prop, value)
Filter the model data by selected properties, constructor instantiation should be apply with boolean true as argument to enable filtering
Kind: instance method of keet/CreateModel
Param | Type | Description |
---|---|---|
prop | string | property of the object |
value | Object string number Boolean | property value |
keet/CreateModel.destroy(destroyObj)
Removed existing object in the model list
Kind: instance method of keet/CreateModel
Param | Type | Description |
---|---|---|
destroyObj | Object | the object ref to remove from the model |