Implement stateEvent
blikblum opened this issue · 4 comments
blikblum commented
something like
class MyView extends HTMLElement {
@state
model
@stateEvent('model', 'change:name')
onChangeName() {
}
}
blikblum commented
Alternative syntax:
class MyView extends HTMLElement {
@state({
events: {
'change:name': 'onChangeName',
'change:address': function () {
console.log('change:address')
}
}
})
model
onChangeName() {
}
}
blikblum commented
Or add an option to proxy the events:
class MyView extends HTMLElement {
@state({ proxyEvents: true })
model
@on('model:change:name')
onChangeName() {
}
}
blikblum commented
Implemented proxyEvents option
blikblum commented
implemented events interface and removed proxyEvents one:
- one less indirection
- allows more granular event listening