[ 3 posts ]

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile

Y.Base.create() extensions API

Post Posted: Tue Jul 03, 2012 6:03 pm
+0-
Hello,

Can anyone point me to the 'interface/API' that the extension objects must adhere to in the array argument for Y.Base.create(...,[extensions],.....)?

From the code sample here (http://yuilibrary.com/yui/docs/base/#create), I can somewhat get a gist of what's needed, but I can't find it explicitly documented.

On a side note, I found it interesting that the Resizable extension class is a function and has properties...

Code:
function Resizable() {
    this._initResizable();
}
Resizable.ATTRS = {
    handles : { ... },
    constrain : { ... }
};


which results in the fact that if I changed the code around to make ATTRS a part of 'this', then it wont work!


Code:
function Resizable() {
    this._initResizable();
    this.ATTRS = {   // THIS WILL NOT WORK!  Somewhat confused about why it wont work...
       handles : { ... },
       constrain : { ... }
     };
}


Thanks.

Eric Ferraiuolo

YUI Developer

  • Username: ericf
  • Joined: Mon Jan 12, 2009 8:26 pm
  • Posts: 380
  • Location: Boston, MA
  • Twitter: ericf
  • GitHub: ericf
  • Gists: ericf
  • IRC: eric_f
  • YUI Developer
  • Offline
  • Profile

Re: Y.Base.create() extensions API

Post Posted: Thu Jul 05, 2012 7:25 am
+0-
Daniel,

There isn't any explicit requirement for extensions beyond them being function objects. That said, there is some extra stuff they can leverage, like changed lifecycle via implementing `initializer()` and `destructor()` functions, and specifying `ATTRS` either as overriding existing Attribute configurations or adding new Attributes.

Eric Ferraiuolo

YUI Developer

  • Username: ericf
  • Joined: Mon Jan 12, 2009 8:26 pm
  • Posts: 380
  • Location: Boston, MA
  • Twitter: ericf
  • GitHub: ericf
  • Gists: ericf
  • IRC: eric_f
  • YUI Developer
  • Offline
  • Profile
Tags:

Re: Y.Base.create() extensions API

Post Posted: Thu Jul 05, 2012 7:34 am
+0-
`ATTRS` are always defined statically on the function, whether it's a class or extension.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum