Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | 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
 
11
dojo.provide("dojo.data.old.Observable");
12
dojo.require("dojo.lang.common");
13
dojo.require("dojo.lang.assert");
14
dojo.data.old.Observable = function () {
15
};
16
dojo.data.old.Observable.prototype.addObserver = function (observer) {
17
	dojo.lang.assertType(observer, Object);
18
	dojo.lang.assertType(observer.observedObjectHasChanged, Function);
19
	if (!this._arrayOfObservers) {
20
		this._arrayOfObservers = [];
21
	}
22
	if (!dojo.lang.inArray(this._arrayOfObservers, observer)) {
23
		this._arrayOfObservers.push(observer);
24
	}
25
};
26
dojo.data.old.Observable.prototype.removeObserver = function (observer) {
27
	if (!this._arrayOfObservers) {
28
		return;
29
	}
30
	var index = dojo.lang.indexOf(this._arrayOfObservers, observer);
31
	if (index != -1) {
32
		this._arrayOfObservers.splice(index, 1);
33
	}
34
};
35
dojo.data.old.Observable.prototype.getObservers = function () {
36
	return this._arrayOfObservers;
37
};
38