isBaseClass(child: Function, base: Array|Function);
child. Child class.
base. Parent class or array of parent classes.
The isBaseClass method determines whether the class inherits from at least one of the specified parent classes.
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.
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: