[General] Why using Object.extend?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[General] Why using Object.extend?

Haowei Ruan
Hi, i do not understand why still uses Object.extend, can't those
properties be defined within the "subclass" construct?
Thanks in advance!

regards,
Haowei

code snippet:
--------------------------------------------------------
Gradient.subclass("LinearGradient", {

    initialize: function($super, stopColor1, stopColor2, vector) {
        vector = vector || LinearGradient.NorthSouth;
        this.rawNode = NodeFactory.create("linearGradient",
                       {x1: vector.x, y1: vector.y,
                        x2: vector.maxX(), y2: vector.maxY()});
        this.addStop(0, stopColor1).addStop(1, stopColor2);
        return this;
    }

});

Object.extend(LinearGradient, {
    NorthSouth: rect(pt(0, 0), pt(0, 1)),
    SouthNorth: rect(pt(0, 1), pt(0, 0)),
    EastWest:   rect(pt(0, 0), pt(1, 0)),
    WestEast:   rect(pt(1, 0), pt(0, 0))
});
---------------------------------------------------------