Skip to content

set() and push() should return the module #17

Closed
mahonnaise opened this Issue Aug 30, 2012 · 2 comments

3 participants

@mahonnaise
var Foo = Stapes.create().extend({
    ...
}).set({
    ...
});

Looks useful, doesn't it? Well, right now Foo would end up being undefined instead of being something useful.

Other methods which don't return anything else, could do the same. jQuery works like that, too. If the function doesn't return something in particular, it returns this jQuery collection.

[Speaking of which, is there a reason why I can't get those things from the extend block?]

@contra
contra commented Oct 12, 2012

The stuff in extend is added to the object as normal properties not as observable ones (like with set) so you can't use .get on them. The difference between the two can get confusing at times. I agree that set should return the base object it gets annoying having to do it on different lines

@hay hay added a commit that referenced this issue Oct 14, 2012
@hay added chaining as requested in #17 c80caec
@hay
Owner
hay commented Oct 14, 2012

This issue has been fixed in master. set, remove, push and update now return the module instead of undefined. Thanks for the suggestion!

@hay hay closed this Oct 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.