]> git.wh0rd.org - tt-rss.git/blob - lib/dojo/Stateful.js
add dijit/dojo stuff; initial ui mockup
[tt-rss.git] / lib / dojo / Stateful.js
1 /*
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
5 */
6
7
8 if(!dojo._hasResource["dojo.Stateful"]){
9 dojo._hasResource["dojo.Stateful"]=true;
10 dojo.provide("dojo.Stateful");
11 dojo.declare("dojo.Stateful",null,{postscript:function(_1){
12 if(_1){
13 dojo.mixin(this,_1);
14 }
15 },get:function(_2){
16 return this[_2];
17 },set:function(_3,_4){
18 if(typeof _3==="object"){
19 for(var x in _3){
20 this.set(x,_3[x]);
21 }
22 return this;
23 }
24 var _5=this[_3];
25 this[_3]=_4;
26 if(this._watchCallbacks){
27 this._watchCallbacks(_3,_5,_4);
28 }
29 return this;
30 },watch:function(_6,_7){
31 var _8=this._watchCallbacks;
32 if(!_8){
33 var _9=this;
34 _8=this._watchCallbacks=function(_a,_b,_c,_d){
35 var _e=function(_f){
36 for(var i=0,l=_f&&_f.length;i<l;i++){
37 try{
38 _f[i].call(_9,_a,_b,_c);
39 }
40 catch(e){
41 console.error(e);
42 }
43 }
44 };
45 _e(_8[_a]);
46 if(!_d){
47 _e(_8["*"]);
48 }
49 };
50 }
51 if(!_7&&typeof _6==="function"){
52 _7=_6;
53 _6="*";
54 }
55 var _10=_8[_6];
56 if(typeof _10!=="object"){
57 _10=_8[_6]=[];
58 }
59 _10.push(_7);
60 return {unwatch:function(){
61 _10.splice(dojo.indexOf(_10,_7),1);
62 }};
63 }});
64 }