| 1 |
/** |
| 2 |
* Created by edseventeen on 11/23/13. |
| 3 |
*/ |
| 4 |
function RedNaoInternalEventManager() |
| 5 |
{ |
| 6 |
this.Events={}; |
| 7 |
}; |
| 8 |
|
| 9 |
RedNaoInternalEventManager.prototype.Subscribe=function(eventName,callBack) |
| 10 |
{ |
| 11 |
if(typeof this.Events[eventName]=='undefined') |
| 12 |
this.Events[eventName]=[]; |
| 13 |
|
| 14 |
this.Events[eventName].push(callBack); |
| 15 |
} |
| 16 |
|
| 17 |
RedNaoInternalEventManager.prototype.Publish=function(eventName,args) |
| 18 |
{ |
| 19 |
var eventArray=this.Events[eventName]; |
| 20 |
if(typeof eventArray=='undefined') |
| 21 |
return; |
| 22 |
for(var i=0;i<eventArray.length;i++) |
| 23 |
{ |
| 24 |
try{ |
| 25 |
if(typeof args=='undefined') |
| 26 |
eventArray[i](); |
| 27 |
else |
| 28 |
eventArray[i](args); |
| 29 |
}catch (Exception){ |
| 30 |
|
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
var RedNaoEventManager=new RedNaoInternalEventManager(); |