blikblum/nextbone

Allow to override event decorator handler?

blikblum opened this issue · 0 comments

currently the event handler is bound to the method from class where is declared so

class Test extends HTMLElement {
  @event('click', '.my-button')
  onButtonClick () {
    console.log('from Test')
  }
}


class SubTest extends Test {
  onButtonClick () {
    console.log('from SubTest')
  }
}

In the above example currently logs 'from Test'.

Should log 'from SubTest'?

Actual usage (using nextbone-routing elEvent but logic is the same )

edit route listens to 'save:model' event: https://github.com/blikblum/nextbone-contact-manager/blob/master/src/contacts/edit/route.js#L31

The new route also: https://github.com/blikblum/nextbone-contact-manager/blob/master/src/contacts/new/route.js#L20

The new route could just extend the edit route and implement onSaveModel method without registering a new event