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

undefined _guid error when using module.on in subclasses #29

Merged
merged 1 commit into from Feb 8, 2013

Conversation

Projects
None yet
3 participants
@ericchaves
Contributor

ericchaves commented Feb 6, 2013

Added a monkey patch to fix error when using events in subclasses.

var Parent = Stapes.subclass({});
var Module = Parent.subclass({ "sleep" : function() { this.emit('sleeping', 'very deep'); } });
var module = new Module();
module.on('sleeping', function(how) { console.log("i'm sleeping " + how); });

TypeError: 'undefined' is not an object (evaluating 'this._.guid')

when instantiating subclasses, the constructor relies on variable named includeEvents that is evaluated to false (due to clojure out of scope, I guess) and therefore does not properly add a _guid, making the use of events to thrown an error.

Cheers,

@Neogavin

This comment has been minimized.

Show comment
Hide comment
@Neogavin

Neogavin Feb 8, 2013

Man, I just ran into this today and it was driving me crazy! Thanks for the fix.

Neogavin commented Feb 8, 2013

Man, I just ran into this today and it was driving me crazy! Thanks for the fix.

hay added a commit that referenced this pull request Feb 8, 2013

Merge pull request #29 from ericchaves/master
undefined _guid error when using module.on in subclasses

@hay hay merged commit f79b934 into hay:master Feb 8, 2013

@hay

This comment has been minimized.

Show comment
Hide comment
@hay

hay Feb 8, 2013

Owner

Thanks! The code for createSubclass has become a bit hairy, so i didn't catch this. I'll add a test and add you to the contributions in the docs as well. Thanks again!

Owner

hay commented Feb 8, 2013

Thanks! The code for createSubclass has become a bit hairy, so i didn't catch this. I'll add a test and add you to the contributions in the docs as well. Thanks again!

hay added a commit that referenced this pull request Feb 8, 2013

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