<commit_before>/**
 * Copyright (c) 2014 by Center Open Middleware. All Rights Reserved.
 * Titanium Appcelerator 3.2.0GA
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 *
 */

(function () {

    "use strict";

    var eventHandlers = {};
    var id = null;
    var prefs = null;
    var inputs = {};

    // APIBridge definition
    Object.defineProperty(window, 'API', {value: {}});
    Object.defineProperty(window.API, 'addEventListener', {
        value: function addEventListener(publicEvent, handler) {

            if (!eventHandlers[publicEvent]) {
                eventHandlers[publicEvent] = [];
            }
            eventHandlers[publicEvent].push(handler);

            // Subscribe this view to publicEvent
            Ti.App.fireEvent('APIEvent', {'action': 'addEventListener', 'event': publicEvent, 'viewId': id});
        }
    });

    Object.preventExtensions(API.addEventListener);

    Object.defineProperty(window.API, 'removeEventListener', {
        value: function removeEventListener(publicEvent, handler) {
            var index;

            if (!eventHandlers[publicEvent]) {
                return false;
            }
            index = eventHandlers[publicEvent].indexOf(handler);
            eventHandlers[publicEvent].slice(index, 1);

            // Unsubscribe this view to publicEvent
            Ti.App.fireEvent('APIEvent', {'action': 'removeEventListener', 'event': publicEvent, 'viewId': id});
        }
    });

    Object.preventExtensions(API.removeEventListener);

    Object.defineProperty(window.MashupPlatform, 'eventNotification', {
        value: function eventNotification(publicEvent, data) {
            var i;

            for (i = 0; i < eventHandlers[publicEvent].length; i ++) {
                eventHandlers[publicEvent][i](data);
            }
        }
    });

    Object.preventExtensions(API.eventNotification);

})();<commit_msg>[APIBridge] Improve format<commit_after>/**
 * Copyright (c) 2014 by Center Open Middleware. All Rights Reserved.
 * Titanium Appcelerator 3.2.0GA
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 *
 */

(function () {

    "use strict";

    var eventHandlers = {};
    var id = null;
    var prefs = null;
    var inputs = {};

    // APIBridge definition
    Object.defineProperty(window, 'API', {value: {}});
    Object.defineProperty(window.API, 'addEventListener', {
        value: function addEventListener(publicEvent, handler) {

            if (!eventHandlers[publicEvent]) {
                eventHandlers[publicEvent] = [];
            }
            eventHandlers[publicEvent].push(handler);

            // Subscribe this view to publicEvent
            Ti.App.fireEvent('APIEvent', {'action': 'addEventListener', 'event': publicEvent, 'viewId': id});
        }
    });

    Object.preventExtensions(window.API.addEventListener);

    Object.defineProperty(window.API, 'removeEventListener', {
        value: function removeEventListener(publicEvent, handler) {
            var index;

            if (!eventHandlers[publicEvent]) {
                return false;
            }
            index = eventHandlers[publicEvent].indexOf(handler);
            eventHandlers[publicEvent].slice(index, 1);

            // Unsubscribe this view to publicEvent
            Ti.App.fireEvent('APIEvent', {'action': 'removeEventListener', 'event': publicEvent, 'viewId': id});
        }
    });

    Object.preventExtensions(window.API.removeEventListener);

    Object.defineProperty(window.MashupPlatform, 'eventNotification', {
        value: function eventNotification(publicEvent, data) {
            var i;

            for (i = 0; i < eventHandlers[publicEvent].length; i ++) {
                eventHandlers[publicEvent][i](data);
            }
        }
    });

    Object.preventExtensions(window.API.eventNotification);

}());
{'fraction_non_alphanumeric': 0.12037037037037036, 'fraction_numerical': 0.0045045045045045045, 'mean_word_length': 2.575134168157424, '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': '7221986', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1015, 'n_words': 240}