-
Notifications
You must be signed in to change notification settings - Fork 0
UI5 Classes and Objects
In order to create a class you have to .extend the component/class "sap.ui.base.Object". The extended class has a constructor comparable to other languages like ABAP or JAVA for example.
The constructor will be called when you create an object of your class.
//create a new object of class myClass
const oNewObject = new myClass(someParameters);
Where does the sap.ui.base.Object even come from? Here is an overview of the class hierarchy in UI5:
The this
-keyword within the class or the class constructor refers to the object itself. Somewhat like me->
does in ABAP. But be careful, the this
-keyword means more than that in JS.
A short but helpful explanation of what the this
-keyword is (or can be):
In JS it isn't really possible to declare functions or attributes as private. To do so you adhere to common development 'standards/best practices'. By prefixing the function or attribute with an underscore you declare it as private. There is no difference to this when developing in UI5.
//declare a private method in my class
_someMethod : function(){
//some code
}