Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing additional parameters to listeners #19

Closed
buschtoens opened this issue Mar 14, 2019 · 0 comments
Closed

Passing additional parameters to listeners #19

buschtoens opened this issue Mar 14, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@buschtoens
Copy link
Collaborator

As suggested by @pzuraq on Discord.

Action Parameters:

You can optionally pass arguments to the action handler. Any values passed to the {{action}} helper after the action name will be passed to the handler as arguments.

So for us this means:

<button {{on "click" this.onClick "foo" "bar"}}>Click me</button>
export default class extends Component {
  @action
  onClick(foo: string, bar: string, event: MouseEvent) {
    console.log({ foo, bar, event }); // => { foo: "foo", bar: "bar", event: Event { ... } }
  }
}

This will make the transition from {{action}} to {{on}} much easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant