Skip to content

Instantly share code, notes, and snippets.

@ericf
Forked from lsmith/gist:1305121
Created October 21, 2011 22:28
Show Gist options
  • Select an option

  • Save ericf/1305153 to your computer and use it in GitHub Desktop.

Select an option

Save ericf/1305153 to your computer and use it in GitHub Desktop.

Revisions

  1. ericf revised this gist Oct 21, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ Y.FooExtA = ExtA;
    function FooBase() {}
    ...
    Y.FooBase = Y.Base.create('foo', Y.Base, [FooBase, Y.FooExtA]);
    Y.Foo = Y.FooBase;
    Y.Foo = Y.Base.create('foo', Y.FooBase, []);

    // Optional class extensions
    function ExtB() {}
  2. ericf revised this gist Oct 21, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -8,11 +8,11 @@ Y.FooExtA = ExtA;
    // Base Class definition
    function FooBase() {}
    ...
    Y.FooBase = Y.Base.create('foo', Y.Base, [FooBase, Y.Foo.ExtA]);
    Y.FooBase = Y.Base.create('foo', Y.Base, [FooBase, Y.FooExtA]);
    Y.Foo = Y.FooBase;

    // Optional class extensions
    function ExtB() {}
    ...
    Y.FooExtB = ExtB;
    Y.Foo = Y.Base.mix(Y.Foo.Base, [Y.FooExtB]);
    Y.Foo = Y.Base.mix(Y.Foo, [Y.FooExtB]);
  3. ericf revised this gist Oct 21, 2011. 1 changed file with 5 additions and 14 deletions.
    19 changes: 5 additions & 14 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -3,25 +3,16 @@
    // Class extensions that will be used in the base class
    function ExtA() {}
    ...
    Y.namespace('Foo').ExtA = ExtA;
    Y.FooExtA = ExtA;

    // Base Class definition
    function FooBase() {}
    ...
    Y.Foo.Base = Y.Base.create('foo', Y.Base, [FooBase, Y.Foo.ExtA]);
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );
    Y.FooBase = Y.Base.create('foo', Y.Base, [FooBase, Y.Foo.ExtA]);
    Y.Foo = Y.FooBase;

    // Optional class extensions
    function ExtB() {}
    ...
    Y.Foo.ExtB = ExtB;
    Y.Base.mix(Y.Foo, [ExtB]);

    // If there aren't any other class extensions used to define the base class
    Y.namespace('Foo').Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics });
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );

    // Alternate for constructing the base class with extensions:
    Y.Foo.Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics });
    Y.Base.mix(Y.Foo.Base, [ Y.Foo.ExtA ]);
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );
    Y.FooExtB = ExtB;
    Y.Foo = Y.Base.mix(Y.Foo.Base, [Y.FooExtB]);
  4. @lsmith lsmith revised this gist Oct 21, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,6 @@ Y.namespace('Foo').Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );

    // Alternate for constructing the base class with extensions:
    Y.namespace('Foo').Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics });
    Y.Foo.Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics });
    Y.Base.mix(Y.Foo.Base, [ Y.Foo.ExtA ]);
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );
  5. @lsmith lsmith revised this gist Oct 21, 2011. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,6 @@ Y.namespace('Foo').Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );

    // Alternate for constructing the base class with extensions:

    Y.namespace('Foo').Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics });
    Y.Base.mix(Y.Foo.Base, [ Y.Foo.ExtA ]);
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );
  6. @lsmith lsmith revised this gist Oct 21, 2011. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,10 @@ Y.Base.mix(Y.Foo, [ExtB]);

    // If there aren't any other class extensions used to define the base class
    Y.namespace('Foo').Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics });
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );

    // Alternate for constructing the base class with extensions:

    Y.namespace('Foo').Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics });
    Y.Base.mix(Y.Foo.Base, [ Y.Foo.ExtA ]);
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );
  7. @lsmith lsmith renamed this gist Oct 21, 2011. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. @lsmith lsmith created this gist Oct 21, 2011.
    22 changes: 22 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    // For Y.Foo

    // Class extensions that will be used in the base class
    function ExtA() {}
    ...
    Y.namespace('Foo').ExtA = ExtA;

    // Base Class definition
    function FooBase() {}
    ...
    Y.Foo.Base = Y.Base.create('foo', Y.Base, [FooBase, Y.Foo.ExtA]);
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );

    // Optional class extensions
    function ExtB() {}
    ...
    Y.Foo.ExtB = ExtB;
    Y.Base.mix(Y.Foo, [ExtB]);

    // If there aren't any other class extensions used to define the base class
    Y.namespace('Foo').Base = Y.Base.create('foo', Y.Base, [], { proto }, { statics });
    Y.Foo = Y.mix( Y.Base.create('foo', Y.Foo.Base, []), Y.Foo, true );