<commit_before>/**
 * Flux Store
 *
 * Is where the `Core` and all of our feature `Modules` access data and business
 * logic in our SPA.
 */

F.Store = (function(undefined){
	"use strict";

	var CHANGE = 'CHANGE',
		ACTION = 'ACTION';

	var Store = function (dispatcher, name) {
		this._dispatcher = dispatcher;
		this._name = name;

		// Indicates if this store is updating.
		// When updating must not accept dispatch calls.
		this._isUpdating = false;

		this._data = [];
		this.actions = {};

		this.init.apply(this, arguments);
	};

	// Attach all inheritable methods to the Store prototype.
	F.compose(Store.prototype, {

		/**
		* Initialize is an empty function by default. Override it with your own
		* initialization logic.
		* 
		* @param {PubSub} dispatcher - the dispatcher
		* @param {String} name - the name of this store
		*/
		init : function() {
			throw new Error("Store initialization not done. Override this function");
		},

		/**
		* Allows views to subscribe to this store's change event
		* @param {function} callback
		*/
		addChangeListener: function(callback) {
			// Create _callbacks object, unless it already exists
			var calls = this._callbacks || (this._callbacks = {});

			// Create an array for the given event key, unless it exists, then
			// append the callback to the array
			(this._callbacks[CHANGE] || (this._callbacks[CHANGE] = [])).push({ callback : callback });
		},

		/**
		* @param {function} callback
		*/
		removeChangeListener: function(callback) {
			// Return if there isn't a _callbacks object, or
			// if it doesn't contain an array for the given event
			var list, calls, i, l;
			if (!(calls = this._callbacks[CHANGE])) return this;
			if (!(list  = this._callbacks[CHANGE])) return this;

			// remove callback
			for (i = 0, l = list.length; i < l; i++) {
				var handler = list[i];
				if (handler === callback) {
					list.splice(i);
				}
			}
		},

		/**
		* Runs the callbacks which were registered by views on this store
		* @method
		* @private
		*/
		emitChange: function() {
			// Return if there isn't a _callbacks object, or
			// if it doesn't contain an array for the given event
			var list, calls, i, l;
			if (!(calls = this._callbacks)) return this;
			if (!(list  = this._callbacks[CHANGE])) return this;

			// Invoke the callbacks
			for (i = 0, l = list.length; i < l; i++) {
				var handler = list[i];
				handler.callback.apply();
			}
		}
	});<commit_msg>fix class definition and remove change listener method in store<commit_after>/**
 * Flux Store
 *
 * Is where the `Core` and all of our feature `Modules` access data and business
 * logic in our SPA.
 */

F.Store = (function(undefined){
	"use strict";

	var CHANGE = 'CHANGE',
		ACTION = 'ACTION';

	function Store (dispatcher, name) {
		this._dispatcher = dispatcher;
		this._name = name;

		// Indicates if this store is updating.
		// When updating must not accept dispatch calls.
		this._isUpdating = false;

		this._data = [];
		this.actions = {};

		this.init.apply(this, arguments);
	}

	// Attach all inheritable methods to the Store prototype.
	F.compose(Store.prototype, {

		/**
		* Initialize is an empty function by default. Override it with your own
		* initialization logic.
		* 
		* @param {PubSub} dispatcher - the dispatcher
		* @param {String} name - the name of this store
		*/
		init : function() {
			throw new Error("Store initialization not done. Override this function");
		},

		/**
		* Allows views to subscribe to this store's change event
		* @param {function} callback
		*/
		addChangeListener: function(callback) {
			// Create _callbacks object, unless it already exists
			var calls = this._callbacks || (this._callbacks = {});

			// Create an array for the given event key, unless it exists, then
			// append the callback to the array
			(this._callbacks[CHANGE] || (this._callbacks[CHANGE] = [])).push({ callback : callback });
		},

		/**
		 * Allows views to unsubscribe to this store's change event
		* @param {function} callback
		*/
		removeChangeListener: function(callback) {
			// Return if there isn't a _callbacks object, or
			// if it doesn't contain an array for the given event
			var list, calls, i, l;
			if (!(calls = this._callbacks)) return this;
			if (!(list  = this._callbacks[CHANGE])) return this;

			// remove callback
			for (i = 0, l = list.length; i < l; i++) {
				var handler = list[i];
				if (handler === callback) {
					list.splice(i);
				}
			}
		},

		/**
		* Runs the callbacks which were registered by views on this store
		* @method
		* @private
		*/
		emitChange: function() {
			// Return if there isn't a _callbacks object, or
			// if it doesn't contain an array for the given event
			var list, calls, i, l;
			if (!(calls = this._callbacks)) return this;
			if (!(list  = this._callbacks[CHANGE])) return this;

			// Invoke the callbacks
			for (i = 0, l = list.length; i < l; i++) {
				var handler = list[i];
				handler.callback.apply();
			}
		}
	});
{'fraction_non_alphanumeric': 0.12728367797631, 'fraction_numerical': 0.0008030515960650472, 'mean_word_length': 2.9634049323786793, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3771762', 'n_tokens_mistral': 1749, 'n_tokens_neox': 1518, 'n_words': 559}