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

fire does not work when used in other instance or class #3

Closed
mqu opened this issue Mar 23, 2013 · 1 comment
Closed

fire does not work when used in other instance or class #3

mqu opened this issue Mar 23, 2013 · 1 comment

Comments

@mqu
Copy link

mqu commented Mar 23, 2013

hello Nathan,

I can't make "fire" work in second case (classes) in this script : https://gist.github.com/mqu/5228483 ; it works as expected in first case (simple).

can you suggest me something ?

@nathankleyn
Copy link
Owner

Hey Marc!

Really sorry for not getting back to you sooner - only noticed this issue was here by sheer chance, must've missed the notification!

When you call :fire or :listen on self or @some_object, it'll only fire and listen to other events on self and @some_object, respectively. As a result, on line 44 of your gist, if you change:

self.events.fire(:move)

to

@piece.events.fire(:move)

I think you'll get the behavior you expect. I've forked your Gist as an example, see that at https://gist.github.com/nathankleyn/5487683.

Let me know if I can be of any further help!

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

No branches or pull requests

2 participants