-
Notifications
You must be signed in to change notification settings - Fork 3
The Basics
Arthur Guiot edited this page Apr 30, 2018
·
1 revision
ProType is Object Oriented, which mean you'll need to define your objects using class.
According to MDN:
Classes are in fact "special functions", and just as you can define function expressions and function declarations, the class syntax has two components: class expressions and class declarations.
Here is a simple example of a ViewController class using ProType:
const P = new ProType() // This line will initiate the ProType instance.
class MainController extends P.ViewController {
willShow() {
this.pEl = this.view.querySelector("p") // selects an element in the view
this.pEl.innerHTML = "The main view is visible"
}
willDisappear() {
this.pEl.innerHTML = "The main view is hidden, and you can't see me"
}
}To use ProType, you'll need to create an instance. You'll need to create an instance every time you need ProType. Just copy and paste the following line to create an instance of ProType:
const P = new ProType()