Skip navigation

For all other methods, you can use this.inherited() to call the superclass method of the same name. Take for example:

someMethod: function() {
  // call base class someMethod
  // now do something else

Inherited will climb up the scope chain, from superclass to superclass, until it finds “someMethod”, then it will invoke that method.

The argument is always literally arguments, a special Javascript array-like pseudo-variable which holds all the arguments (like argv in C).

You can send custom parameters to the ancestor function. Just place the extra arguments in array literal notation with brackets:

this.inherited(arguments, [ customArg1, customArg2 ]);

The important part is that arguments is always the first argument to this.inherited, and custom arguments defined in the class are actually passed a second argument inside an array literal.

Posted via web from Apphacker’s learning curve


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: