Prevent multi init()
This commit is contained in:
parent
c186089797
commit
57cc4c87f4
|
|
@ -3,7 +3,8 @@
|
|||
// define correct path for files inclusion
|
||||
var scripts = document.getElementsByTagName('script'),
|
||||
path = scripts[scripts.length - 1].src.split('?')[0],
|
||||
cdn = path.split('/').slice(0, -1).join('/') + '/';
|
||||
cdn = path.split('/').slice(0, -1).join('/') + '/',
|
||||
alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch;
|
||||
|
||||
var tarteaucitron = {
|
||||
"cdn": cdn,
|
||||
|
|
@ -14,11 +15,14 @@ var tarteaucitron = {
|
|||
"launch": [],
|
||||
"init": function (params) {
|
||||
"use strict";
|
||||
if (alreadyLaunch === 0) {
|
||||
alreadyLaunch = 1;
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener("load", tarteaucitron.load(params), false);
|
||||
} else {
|
||||
window.attachEvent('onload', tarteaucitron.load(params));
|
||||
}
|
||||
}
|
||||
},
|
||||
"load": function (params) {
|
||||
"use strict";
|
||||
|
|
|
|||
Loading…
Reference in New Issue