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 var args = [tracker].concat(Array.prototype.slice.call(arguments)); 33 mediator.publish.apply(this, args); 34 } 35 return this; 36 }; 37 38 return { 39 trackers: {}, 40 publish: publish, 41 publishAll: publishAll, 42 subscribe: subscribe 43 } 44})()
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.