On Wed, May 23, 2012 at 4:00 PM, Nodir Turakulov <[email protected]> wrote:
> On Wed, May 23, 2012 at 2:17 PM, alessioalex <[email protected]>
> wrote:
>> I've made a OOP module myself a couple of days ago:
>> https://github.com/alessioalex/Cls
>>
>> It uses an extends function and a mixin function under the hood, very basic
>> stuff.
>
> As far as I understand after a quick look at the readme, your mixins
> only overwrites properties without inheriting methods
Sorry, the word "inheriting" is wrong here. I meant that a mixin
method cannot call a base method.
-Nodir
> Can I call a base/super method in a mixin method?
>
> var foo = Cls({
> methods: {
> m: function (x) {
> console.log(x);
> }
> }
> });
>
> var mixin = {
> m: function (x) {
> this.inherited(x * 1);
> }
> };
>
> var doubleFoo = Cls.mixin(foo, mixin);
> doubleFoo.m(1); // will it output 1 or 2?
>
> -Nodir
>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en