<commit_before>/*
* Openbibl Framework v0.1.0
* Copyright 2014, <NAME>
* Contact: https://github.com/kirschbombe/openbibl
* License: GNU AGPL v3 (https://github.com/kirschbombe/openbibl/LICENSE)
*/
/*jslint white: true, todo: true, nomen: true, plusplus: true */
/*global define: true */
/**
 * Openbibl application event controller.
 *
 * @module openbibl/event
 */
define(
  [ 'obpconfig' ]
, function(obpconfig) {
    'use strict';
    var supported_events = [
        "obp:filter-start",      "obp:filter-change",      "obp:filter-mode-change",
        "obp:filter-complete",   "obp:bibliography-added", "obp:search-term-change",
        "obp:browse-term-change"
    ];
    return {
        /**
         *
         */
        init : function() {
            var obpev = this;
            supported_events.forEach(function(event) {
                obpev.events[event] = {};
            });
        },
        /**
         *
         */
        events: {},
        /**
         *
         */
        subscribe : function(ev,obj,cb) {
            if (obpconfig.debug) { obpconfig.console.log(obj + ' subscribed ' + ev); }
            if (this.events.hasOwnProperty(ev)) {
                this.events[ev][obj] = cb;
            } else {
                throw "Unsupported event subscription for '"
                 + ev + "' from object '" + obj + "'";
            }
        },
        /**
         *
         */
        unsubscribe : function(ev,obj) {
            if (this.events.hasOwnProperty(ev)) {
                delete this.events[ev][obj];
            } else {
               throw "Unsupported event subscription for '"<commit_msg>fixed bug in openbibl/event init code that wwas broken during linting<commit_after>/*
* Openbibl Framework v0.1.0
* Copyright 2014, <NAME>
* Contact: https://github.com/kirschbombe/openbibl
* License: GNU AGPL v3 (https://github.com/kirschbombe/openbibl/LICENSE)
*/
/*jslint white: true, todo: true, nomen: true, plusplus: true */
/*global define: true */
/**
 * Openbibl application event controller.
 *
 * @module openbibl/event
 */
define(
  [ 'obpconfig' ]
, function(obpconfig) {
    'use strict';
    var supported_events = [
        "obp:filter-start",      "obp:filter-change",      "obp:filter-mode-change",
        "obp:filter-complete",   "obp:bibliography-added", "obp:search-term-change",
        "obp:browse-term-change"
    ],
    event_map = {},
    init_events = function(obj) {
        supported_events.forEach(function(event) {
            obj[event] = {};
        });
    };
    init_events(event_map);
    return {
        /**
         *
         */
        init : function() {
            init_events(this.events);
        },

        /**
         *
         */
        events: {},
        /**
         *
         */
        subscribe : function(ev,obj,cb) {
            if (obpconfig.debug) { obpconfig.console.log(obj + ' subscribed ' + ev); }
            if (this.events.hasOwnProperty(ev)) {
                this.events[ev][obj] = cb;
            } else {
                throw "Unsupported event subscription for '"
                 + ev + "' from object '" + obj + "'";
            }
        },
        /**
         *
         */
        unsubscribe : function(ev,obj) {
            if (this.events.hasOwnProperty(ev)) {
                delete this.events[ev][obj];
            } else {
               throw "Unsupported event subscription for '"
{'fraction_non_alphanumeric': 0.14612005856515373, 'fraction_numerical': 0.004685212298682284, 'mean_word_length': 1.6961325966850829, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '2089284', 'n_tokens_mistral': 1063, 'n_tokens_neox': 1037, 'n_words': 188}