|
|
@ -7,16 +7,16 @@ class ${1:class_name}{ |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
constructor(){ |
|
|
|
constructor(){ |
|
|
|
//Bind this in the following functions to the class |
|
|
|
//Bind this in the following functions to the class |
|
|
|
this.domloaded = this.domloaded.bind(this); |
|
|
|
this.domLoaded = this.domLoaded.bind(this); |
|
|
|
|
|
|
|
|
|
|
|
//check to see if the dom has loaded yet |
|
|
|
//check to see if the dom has loaded yet |
|
|
|
if(document.readystate == "loading"){ |
|
|
|
if(document.readyState == "loading"){ |
|
|
|
//if the dom hasn't loaded, wait until it is |
|
|
|
//if the dom hasn't loaded, wait until it is |
|
|
|
document.addeventlistener("readystatechange",this.domloaded); |
|
|
|
document.addEventListener("readystatechange",this.domLoaded); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//if it has, run the domloaded function |
|
|
|
//if it has, run the domloaded function |
|
|
|
this.domloaded(); |
|
|
|
this.domLoaded(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -24,9 +24,9 @@ class ${1:class_name}{ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* this function is run as soon as the dom is loaded |
|
|
|
* this function is run as soon as the dom is loaded |
|
|
|
**/ |
|
|
|
**/ |
|
|
|
domloaded(){ |
|
|
|
domLoaded(){ |
|
|
|
//make sure we don't run this twice |
|
|
|
//make sure we don't run this twice |
|
|
|
document.removeEventListener("readystatechange",this.domloaded); |
|
|
|
document.removeEventListener("readystatechange",this.domLoaded); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|