isBaseMemberOf(cls: Function, memberName: String, checkOverride: Boolean);
cls. Class instance.
memberName. Class member name.
checkOverride. Indicates if the specified member is redetermined in the parent class. Available Values:
true. It is checked if the specified member is redetermined in the parent class.
false. Default. It is not checked if the specified member is redetermined in the parent class.
The isBaseMemberOf method returns whether the specified member is determined in one of the specified class's parents.
Available values:
true. The specified member is determined in one of the specified class's parents.
false. The specified member is not determined in one of the specified class's parents.
To execute the example, add a link to PP.js scenario file to HTML page in the <head> tag. Check if the setImageList, setWidth, hide and clone methods are determined for parents of the PP.Ui.Button class:
var checkMemberOf = function(className, memberName) { var isBaseMemberOf = PP.isBaseMemberOf(PP.getTypeByName(className), memberName, True); console.log("The %s%s member belongs to parent of the %s" class, memberName, (isBaseMemberOf ? "" : " not"), className); }; checkMemberOf("PP.Ui.Button", "setImageList"); checkMemberOf("PP.Ui.Button", "setWidth"); checkMemberOf("PP.Ui.Button", "hide"); checkMemberOf("PP.Ui.Button", "clone");
After executing the example the browser console displays whether the setImageList, setWidth, hide and clone methods are determined for parents of the PP.Ui.Button class:
The setImageList member does not belong to parent of the PP.Ui.Button class
The setWidth member does not belong to parent of the PP.Ui.Button class
The hide member belongs to parent of the PP.Ui.Button class
The clone member belongs to parent of the PP.Ui.Button class
To check without taking into account redetermined members, set the checkOverride parameter to False:
var checkOverrideMemberOf = function(className, memberName) { var isBaseMemberOf = PP.isBaseMemberOf(PP.getTypeByName(className), memberName, false); console.log("The %s%s member belongs to parent of the %s class", memberName, (isBaseMemberOf ? "" : " not"), className); }; checkOverrideMemberOf("PP.Ui.Button", "setImageList"); checkOverrideMemberOf("PP.Ui.Button", "setWidth"); checkOverrideMemberOf("PP.Ui.Button", "hide"); checkOverrideMemberOf("PP.Ui.Button", "clone");
After executing the example the browser console displays the value information that differs from the previous request: the setWidth method is redetermined in the PP.Ui.Button class and that is why it is marked as no belonging to parent in the first request:
The setImageList member does not belong to parent of the PP.Ui.Button class
The setWidth member belongs to parent of the PP.Ui.Button class
The hide member belongs to parent of the PP.Ui.Button class
The clone member belongs to parent of the PP.Ui.Button class
See also: