metarhia / swayer

Schema based frontend framework 👀
MIT License
52 stars 11 forks source link

Add sugar for events #24

Open tshemsedinov opened 2 years ago

tshemsedinov commented 2 years ago

Support if-style https://github.com/metarhia/swayer/blob/9ffa7bd3018a8e1e3c403d296c26a22e0810c6df/examples/todo-app/app/features/todo/main/todo-item/todo-item.component.js#L48-L56 but implement something like this:

keyup: {
  enter(event) {
    const value = this.props.value;
    if (value) {
      todoCtrl.updateEditingTodo(todo, value);
      this.emitCustomEvent('updateTitleEvent', todo);
      this.blur();
    }
  },
  escape() { 
    this.blur(); 
  }
}