Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
1422 alexandre_ 11
 
12
 
1318 alexandre_ 13
dojo.provide("dojo.data.old.Observable");
14
dojo.require("dojo.lang.common");
15
dojo.require("dojo.lang.assert");
16
dojo.data.old.Observable = function () {
17
};
18
dojo.data.old.Observable.prototype.addObserver = function (observer) {
19
	dojo.lang.assertType(observer, Object);
20
	dojo.lang.assertType(observer.observedObjectHasChanged, Function);
21
	if (!this._arrayOfObservers) {
22
		this._arrayOfObservers = [];
23
	}
24
	if (!dojo.lang.inArray(this._arrayOfObservers, observer)) {
25
		this._arrayOfObservers.push(observer);
26
	}
27
};
28
dojo.data.old.Observable.prototype.removeObserver = function (observer) {
29
	if (!this._arrayOfObservers) {
30
		return;
31
	}
32
	var index = dojo.lang.indexOf(this._arrayOfObservers, observer);
33
	if (index != -1) {
34
		this._arrayOfObservers.splice(index, 1);
35
	}
36
};
37
dojo.data.old.Observable.prototype.getObservers = function () {
38
	return this._arrayOfObservers;
39
};
40