1var mediator = (function() { 2 var subscribe = function(tracker, fn) { 3 if (!mediator.trackers[tracker]) 4 { 5 mediator.trackers[tracker] = []; 6 } 7 mediator.trackers[tracker].push({context: this, callback: fn}); 8 return this; 9 }, 10 11 publish = function(tracker) { 12 if (!mediator.trackers[tracker]) 13 { 14 return false; 15 } 16 var args = Array.prototype.slice.call(arguments, 1); 17 for (var i = 0, l = mediator.trackers[tracker].length; i < l; i++) 18 { 19 var subscription = mediator.trackers[tracker][i]; 20 subscription.callback.apply(subscription.context, args); 21 } 22 return this; 23 }, 24 25 publishAll = function() { 26 if (Object.keys(mediator.trackers).length === 0) 27 { 28 return false; 29 } 30 for (var tracker in mediator.trackers) 31 { 32 if (mediator.trackers.hasOwnProperty(tracker)) { 33 var args = [tracker].concat(Array.prototype.slice.call(arguments)); 34 mediator.publish.apply(this, args); 35 } 36 } 37 return this; 38 }; 39 40 return { 41 trackers: {}, 42 publish: publish, 43 publishAll: publishAll, 44 subscribe: subscribe 45 } 46})()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.