<commit_before>GRUNT.Observable = function() {
    var listeners = {},
        callbackCounter = 0;
    
    var self = {
        bind: function(eventName, callback) {
            if (! listeners[eventName]) {
                listeners[eventName] = [];
            } // if
            
            // increment the event counter
            callbackCounter += 1;
            
            // add the callback to the list of listeners
            listeners[eventName].push({
                callback: callback,
                callbackId: callbackCounter
            });
            
            return callbackCounter;
        },
        
        trigger: function(eventName) {
            var eventCallbacks = listeners[eventName];
                
            // check that we have callbacks
            if (! eventCallbacks) {
                return;
            } // if
            
            for (var ii = eventCallbacks.length; ii--; ) {
                eventCallbacks[ii].callback.apply(self, Array.prototype.slice.call(arguments, 1));
            } // for
        },
        
        unbind: function(eventName, callbackId) {
            var eventCallbacks = listeners[eventName];
            for (var ii = 0; eventCallbacks && (ii < eventCallbacks.length); ii++) {
                if (eventCallbacks[ii].callbackId === callbackId) {
                    eventCallbacks.splice(ii, 1);
                    break;
                } // if
            } // for
        }
    };
    
    return self;
}; 

// TODO: add functionality that allows you to stop listening to messages
GRUNT.WaterCooler = (function() {
    // initialise variables
    var messageListeners = {},
        pipes = [];
    
    // define the module
    var module = {
        addPipe: function(callback) {
            // test the pipe because if it is broke it will break everything
            callback("pipe.test", {});
            
            // given that didn't throw an exception and we got here, we can now add the pipe<commit_msg>Modified event framework to singleton instance<commit_after>GRUNT.Observable = (function() {
    var callbackCounter = 0;
    
    var module = {
        bind: function(target, eventName, callback) {
            if (! target.observableEvents) {
                target.observableEvents = {};
            } // if
    
            if (! target.observableEvents[eventName]) {
                target.observableEvents[eventName] = [];
            } // if
            
            // increment the event counter
            callbackCounter += 1;
            
            // add the callback to the list of listeners
            target.observableEvents[eventName].push({
                callback: callback,
                callbackId: callbackCounter
            });
            
            return callbackCounter;
        },
        
        trigger: function(target, eventName) {
            if (target.observableEvents) {
                var eventCallbacks = target.observableEvents[eventName];

                // check that we have callbacks
                if (! eventCallbacks) {
                    return;
                } // if

                for (var ii = eventCallbacks.length; ii--; ) {
                    eventCallbacks[ii].callback.apply(self, Array.prototype.slice.call(arguments, 1));
                } // for
            } // if
        },
        
        unbind: function(target, eventName, callbackId) {
            if (target.observableEvents) {
                var eventCallbacks = target.observableEvents[eventName];
                for (var ii = 0; eventCallbacks && (ii < eventCallbacks.length); ii++) {
                    if (eventCallbacks[ii].callbackId === callbackId) {
                        eventCallbacks.splice(ii, 1);
                        break;
                    } // if
                } // for
            } // if
        }
    };
    
    return module;
})(); 

// TODO: add functionality that allows you to stop listening to messages
GRUNT.WaterCooler = (function() {
    // initialise variables
    var messageListeners = {},
        pipes = [];
    
    // define the module
    var module = {
        addPipe: function(callback) {
            // test the pipe because if it is broke it will break everything
            callback("pipe.test", {});
            
            // given that didn't throw an exception and we got here, we can now add the pipe
{'fraction_non_alphanumeric': 0.09626274065685164, 'fraction_numerical': 0.0022650056625141564, 'mean_word_length': 1.3690987124463518, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3893338', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1043, 'n_words': 290}