MDL-63044 javascript: add simple pubsub implementation
[moodle.git] / lib / amd / build / pubsub.min.js
1 define([],function(){var a={},b=function(b,c){a[b]=a[b]||[],a[b].push(c)},c=function(b,c){if(a[b])for(var d=0;d<a[b].length;d++)if(a[b][d]===c){a[b].splice(d,1);break}},d=function(b,c){a[b]&&a[b].forEach(function(a){a(c)})};return{subscribe:b,unsubscribe:c,publish:d}});