|
|
|
@ -7,16 +7,16 @@ class ${1:class_name}{ |
|
|
|
|
**/ |
|
|
|
|
constructor(){ |
|
|
|
|
//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 |
|
|
|
|
if(document.readystate == "loading"){ |
|
|
|
|
if(document.readyState == "loading"){ |
|
|
|
|
//if the dom hasn't loaded, wait until it is |
|
|
|
|
document.addeventlistener("readystatechange",this.domloaded); |
|
|
|
|
document.addEventListener("readystatechange",this.domLoaded); |
|
|
|
|
return; |
|
|
|
|
} else { |
|
|
|
|
//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 |
|
|
|
|
**/ |
|
|
|
|
domloaded(){ |
|
|
|
|
domLoaded(){ |
|
|
|
|
//make sure we don't run this twice |
|
|
|
|
document.removeEventListener("readystatechange",this.domloaded); |
|
|
|
|
document.removeEventListener("readystatechange",this.domLoaded); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|