Merge pull request #363 from drobert8584/master

push event when service loaded
This commit is contained in:
Amauri CHAMPEAUX 2019-10-29 17:34:36 +01:00 committed by GitHub
commit ee2f2f4690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -602,6 +602,7 @@ var tarteaucitron = {
if (tarteaucitron.launch[service.key] !== true) {
tarteaucitron.launch[service.key] = true;
service.js();
tarteaucitron.sendEvent(service.key + '_loaded');
}
tarteaucitron.state[service.key] = true;
tarteaucitron.userInterface.color(service.key, true);
@ -629,6 +630,21 @@ var tarteaucitron = {
tarteaucitron.cookie.checkCount(service.key);
},
"sendEvent" : function(event_key) {
if(event_key !== undefined) {
//ie compatibility
var send_event_item;
if(typeof(Event) === 'function') {
send_event_item = new Event(event_key);
}else{
send_event_item = document.createEvent('Event');
send_event_item.initEvent(event_key, true, true);
}
//end ie compatibility
document.dispatchEvent(send_event_item);
}
},
"cleanArray": function cleanArray(arr) {
"use strict";
var i,