Rev 969 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 969 | runge | 1 | |
| 999 | runge | 2 | function Service(type, name, id) |
| 969 | runge | 3 | { |
| 999 | runge | 4 | this.myType = type; |
| 969 | runge | 5 | this.myName = name; |
| 6 | this.myId = id; |
||
| 7 | this.myEventCallbacks = new Array(); |
||
| 8 | this.myInitialArguments = new Array(); |
||
| 9 | } |
||
| 10 | |||
| 999 | runge | 11 | Service.prototype.myType = null; |
| 969 | runge | 12 | Service.prototype.myName = null; |
| 13 | Service.prototype.myId = null; |
||
| 14 | Service.prototype.myInitialArguments = null; |
||
| 15 | Service.prototype.myEventCallbacks = null; |
||
| 16 | |||
| 17 | Service.prototype.initialize = function(initialArguments) |
||
| 18 | { |
||
| 19 | this.myInitialArguments = initialArguments; |
||
| 20 | } |
||
| 21 | |||
| 999 | runge | 22 | Service.prototype.getType = function() |
| 23 | { |
||
| 24 | return this.myType; |
||
| 25 | } |
||
| 26 | |||
| 969 | runge | 27 | Service.prototype.getName = function() |
| 28 | { |
||
| 29 | return this.myName; |
||
| 30 | } |
||
| 31 | |||
| 32 | Service.prototype.getId = function() |
||
| 33 | { |
||
| 34 | return this.myId; |
||
| 35 | } |
||
| 36 | |||
| 37 | Service.prototype.registerEventCallback = function(eventName, callback) |
||
| 38 | { |
||
| 39 | if (!this.myEventCallbacks[eventName]) |
||
| 40 | this.myEventCallbacks[eventName] = new Array(); |
||
| 41 | |||
| 42 | this.myEventCallbacks[eventName].push(callback); |
||
| 43 | } |
||
| 44 | |||
| 45 | Service.prototype.callEvent = function(eventName, args) |
||
| 46 | { |
||
| 47 | if (this.myEventCallbacks[eventName]) |
||
| 48 | { |
||
| 49 | for (var n = 0; n < this.myEventCallbacks[eventName].length; n++) |
||
| 50 | { |
||
| 51 | this.myEventCallbacks[eventName][n](args); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | } |