PP.isBaseClass

Syntax

isBaseClass(child: Function, base: Array|Function);

Parameters

child. Child class.

base. Parent class or array of parent classes.

Description

The isBaseClass method determines whether the class inherits from at least one of the specified parent classes.

Comments

This method returns True if the class inherits from at least one of the specified parent classes, and False, if it does not inherit from either of these classes.

Example

To execute the example, add a link to PP.js scenario file to HTML page. Check if the PP.Ui.Button and PP.Color classes are inherited from the PP.Ui.Control class:

// Check if the PP.Ui.Control class is parent of PP.Ui.Button
var isBaseClass = PP.isBaseClass(PP.Ui.Button, PP.Ui.Control);
console.log("The PP.Ui.Button class " + (isBaseClass ? "is" : "is not") + "inherited from the PP.Ui.Control class");
// Check if the PP.Ui.Control class is parent of PP.Color
isBaseClass = PP.isBaseClass(PP.Color, PP.Ui.Control);
console.log("The PP.Color class " + (isBaseClass ? "is" : "is not ") + "inherited from the PP.Ui.Control class");

After executing the example the browser console displays notifications if the PP.Ui.Button and PP.Color classes are inherited from the PP.Ui.Control class:

The PP.Ui.Button class is inherited from the PP.Ui.Control class
The PP.Color class is not inherited from the PP.Ui.Control class

See also:

PP