That is actually one of the design choices of prime that it doesn't do the
extra copying of property objects by default, rather it does less which is
better if you consider performance when creating new objects.

Probably setOptions could lookup the 'options' property of the inherited
prototypes and do the merge.


On Thu, Dec 5, 2013 at 1:15 PM, Dimitar Christoff <christ...@gmail.com>wrote:

> this works out of the box in primish.
>
> https://bitbucket.org/DimitarChristoff/primish-example/src
>
> recrusive object merges in options was added recently - see
> https://github.com/DimitarChristoff/primish/issues/3
>
> previously you had to manually merge from parent prototypes.
> --
> Dimitar Christoff
>
> "JavaScript is to JAVA what hamster is to ham"
> @D_mitar - https://github.com/DimitarChristoff
>
> On 5 Dec 2013, at 11:50, santos <brunoleug...@gmail.com> wrote:
>
> > I have a better example:
> >
> > var A = prime({
> >     options: {
> >         name: 'image',
> >         tag: 'span',
> >         src: '/'
> >     },
> >     constructor: function(options){
> >         //console.debug(this.options);
> >         this.setOptions(options);
> >     },
> >     getOptions: function(){
> >         console.log(this.options);
> >     }
> > });
> >
> > var B = prime({
> >     inherits: A,
> >     options: {
> >         name: 'B'
> >     },
> >     some: function(){
> >         return;
> >     }
> > });
> >
> > var C = prime({
> >     inherits: B,
> >     options: {
> >         name: 'C'
> >     },
> >     some: function(){
> >         return;
> >     }
> > });
> >
> > mixin(A, Options);
> > mixin(B, Options);
> > mixin(C, Options);
> >
> > var c = new C({
> >     tag: 'div'
> > });
> >
> > c.getOptions();
> >
> > console.log(c.options); //the result should be: {name: "C", tag: "div",
> src: "/"}
> >
> > Thank you again.
> >
> > --
> >
> > ---
> > You received this message because you are subscribed to the Google
> Groups "MooTools Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to mootools-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "MooTools Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mootools-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mootools-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to