MCPcopy Create free account
hub / github.com/CreateJS/SoundJS / addLoadEvent

Function addLoadEvent

lib/flashaudioplugin-NEXT.js:185–205  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

183 - Will fire an event as soon as a web page including all of its assets are loaded
184 */
185 function addLoadEvent(fn) {
186 if (typeof win.addEventListener != UNDEF) {
187 win.addEventListener("load", fn, false);
188 }
189 else if (typeof doc.addEventListener != UNDEF) {
190 doc.addEventListener("load", fn, false);
191 }
192 else if (typeof win.attachEvent != UNDEF) {
193 addListener(win, "onload", fn);
194 }
195 else if (typeof win.onload == "function") {
196 var fnOld = win.onload;
197 win.onload = function() {
198 fnOld();
199 fn();
200 };
201 }
202 else {
203 win.onload = fn;
204 }
205 }
206
207 /* Main function
208 - Will preferably execute onDomLoad, otherwise onload (as a fallback)

Callers 1

Calls 1

addListenerFunction · 0.70

Tested by

no test coverage detected