[Premise: Some may have seen my previous threads* regarding ‘this.’ in JS (including PlayCanvas’ use of JS).]
Anyhow: I am getting into a trap, where I declare the following at ‘.initialize’:
uiWeSeTFQ.prototype.initialize = function () {
// create STYLE element
var style = document.createElement('style');
// append to head
document.head.appendChild(style);
style.innerHTML = this.css.resource || '';
// Add the HTML
this.div = document.createElement('div');
this.div.classList.add('container');
this.div.innerHTML = this.html.resource || '';
// append to body
// can be appended somewhere else
// it is recommended to have some container element
// to prevent iOS problems of overfloating elements off the screen
document.body.appendChild(this.div);
this.fontLink = document.createElement('link');
this.fontLink.href = 'https://fonts.googleapis.com/css?family=Merriweather&display=swap';
this.fontLink.rel = 'stylesheet';
document.head.appendChild(this.fontLink);
this.counter = 0; this.bindEvents();
window.addEventListener("resize", this.myRezFunction);
};
{where 'window.addEventListener("resize", this.myRezFunction); '
have been tried as well}
- below I have the ‘myRezFunction’ function:
uiWeSeTFQ.prototype.myRezFunction = function(){
self = this;
app = self.app;
var fingPrMob_ent = this.app.root.findByName("FingPr_Mob");
};
- which results in an error that complaints about ‘not compiling .root => .root as undefined’
*) Rewrites in relation to the whole ‘this.’, ‘self.’ and ‘app = this.app / app = self.app’ does not work either:
uiWeSeTFQ.prototype.myRezFunction = function(){
self = this;
var fingPrMob_ent = self.app.root.findByName("FingPr_Mob");
};
uiWeSeTFQ.prototype.myRezFunction = function(){
self = this;
app = self.app;
var fingPrMob_ent = app.root.findByName("FingPr_Mob");
};
Note: Can we please restrain from ‘truisms’ and off-course’ness in relation to understanding the DOM with a flick of a finger (as often mentioned: this forum’s user’s consists of many different levels from mainly graphics to mainly coders )