Hi,
Can you tell please how to create an Object Constructor like this in full B4X - BANAno code to be used later with another JS Frameworks & Libs:
I can create Person class like this:
And I can access this class by this name "banano_myproject_person" in JS but I got this in JS:
So:
- Properties names are obfuscated so I won't know them
- Constructor are not the same and I cannot write this in Console:
I would like to propose to have:
- An another Module template to create Javascript class where attributes are not obfuscated (or there is 'ingoreobfuscation BANano directive?)
- Constructor etc will be like here: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Classes/constructor. Transpiled from B4X Initialize subs for example (Initialize, Initialize1, Initialize 2...)
And In B4X, I can get the name of the class easily with something like BANano.GetClassName(Person) where Person is the class name.
Thank you
Can you tell please how to create an Object Constructor like this in full B4X - BANAno code to be used later with another JS Frameworks & Libs:
JavaScript:
function Person(first, last, age, eyecolor) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eyecolor;
}
Person.prototype.name = function() {
return this.firstName + " " + this.lastName;
};
I can create Person class like this:
B4X:
Sub Class_Globals
Public firstName As String
Public lastName As String
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(first As String, last As String)
firstName = first
lastName = last
End Sub
Public Sub fullName() As String
Return firstName + " " + lastName
End Sub
JavaScript:
function banano_vkpae_person() {var _B=this;_B.__d6="";_B.__d7="";_B.__d8=0;_B.initialize=function(__176,_last) {_B.__d6=__176;_B.__d7=_last;};_B.fullname=function() {return _B.__d6+" "+_B.__d7;};}
- Properties names are obfuscated so I won't know them
- Constructor are not the same and I cannot write this in Console:
JavaScript:
var person = new banano_vkpae_person("first", "last");
I would like to propose to have:
- An another Module template to create Javascript class where attributes are not obfuscated (or there is 'ingoreobfuscation BANano directive?)
- Constructor etc will be like here: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Classes/constructor. Transpiled from B4X Initialize subs for example (Initialize, Initialize1, Initialize 2...)
And In B4X, I can get the name of the class easily with something like BANano.GetClassName(Person) where Person is the class name.
Thank you
Last edited: