Skip to content

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