var event = {
_cache: [],
publish: function(topic, args, scope){
if(_cache[topic]){
for(let i = 0; i < _cache[topic].length; i++){
_cache[topic].apply(scope || this, args || []);
}
}
},
subscribe:function(topic, callback){
if(!_cache[topic]){
_cache[topic] = [];
}
_cache[topic].push(callback);
},
unsubscribe:function(topic, completly, item){
if(_cache[topic]){
if(completly){
delete _cache[topic];
}else{
for(let i = 0; i < _cache.length; i++){
if(_cache[topic][i] === item){
cache[t].splice(i, 1);
}
}
}
}
};
}