Opposed to my expectation I can't access my class field myLibrary in the class method initialize().
class ViewController {
myLibrary = new Library();
initialize() {
console.log(myLibrary); // undefined
The only "solution" I found was to declare myLibrary outside of the class as a global variable. Is there a way to declare fields in a class and then, well, use them?
this.myLibrary…?thisto access member variables.thismay or may not refer to the instance ofViewControllerthat OP has initialized. This depends on the context in which it is called.