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

Include onEvent in Type events mixin #136

Merged
merged 3 commits into from
Aug 30, 2019
Merged

Include onEvent in Type events mixin #136

merged 3 commits into from
Aug 30, 2019

Conversation

nlundquist
Copy link
Contributor

I noticed that classes that extend ObservableObject aren't able to be event targets since they don't implement the onKeyValue or onEvent symbols. Trying to set up a listener for an event on the class results in an error, e.g:

class Todo extends ObservableObject {
    ...
}

class CreatedTodos extends StacheElement {
  ...
  connected() {
    this.listenTo(Todo, "created", (ev, created) => {
      this.todos.unshift(created);
    })
  }
}

This will cause the error "Uncaught Error: can-event-queue: Unable to bind created".

To resolve this Justin suggested I add the can-event-queue/map/map mixin to mixin-typeevents.js.

Copy link
Contributor

@phillipskevin phillipskevin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test?

@nlundquist
Copy link
Contributor Author

I've added a test that dispatches an event on a type inheriting from the mixin object.

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

Successfully merging this pull request may close these issues.

2 participants