Sha256: ae2728d4f90eaa7a07de8bd8fb14d04c4d84f23a5cb2aa4da4242c324f829f1c

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

/*!
 * This file is part of Aloha Editor
 * Author & Copyright (c) 2010 Gentics Software GmbH, aloha@gentics.com
 * Licensed unter the terms of http://www.aloha-editor.com/license.html
 */

/**
 * Registry base class.
 * TODO: document that it also contains Observable.
 *
 */
define(
['aloha/jquery', 'aloha/observable'],
function(jQuery, Observable) {
	

	return Class.extend(Observable, {

		_entries: null,

		_constructor: function() {
			this._entries = {};
		},

		/**
		 * @event register
		 * @param entry
		 * @param id
		 */
		register: function(id, entry) {
			this._entries[id] = entry;
			this.trigger('register', entry, id);
		},

		/**
		 * @event unregister
		 * @param odEntry
		 * @param id
		 */
		unregister: function(id) {
			var oldEntry = this._entries[id];
			delete this._entries[id];
			this.trigger('unregister', oldEntry, id);
		},
		
		get: function(id) {
			return this._entries[id];
		},
		
		has: function(id) {
			return (this._entries[id] ? true : false);
		},
		
		getEntries: function() {
			// clone the entries so the user does not accidentally modify our _entries object.
			return jQuery.extend({}, this._entries);
		}
	});
});

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
locomotive-aloha-rails-0.20.1.5 vendor/assets/javascripts/aloha/lib/aloha/registry.js
aloha-rails-0.0.2 vendor/assets/javascripts/aloha/lib/aloha/registry.js
locomotive-aloha-rails-0.20.1.4 vendor/assets/javascripts/aloha/lib/aloha/registry.js
locomotive-aloha-rails-0.20.1.3 vendor/assets/javascripts/aloha/lib/aloha/registry.js
locomotive-aloha-rails-0.20.1.2 vendor/assets/javascripts/aloha/lib/aloha/registry.js
locomotive-aloha-rails-0.20.1.1 vendor/assets/javascripts/aloha/lib/aloha/registry.js
aloha-rails-0.0.1 vendor/assets/javascripts/aloha/lib/aloha/registry.js
locomotive-aloha-rails-0.20.1 vendor/assets/javascripts/aloha/lib/aloha/registry.js