Rev 977 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 969 | runge | 1 | |
| 2 | function ServiceManager() {} |
||
| 3 | |||
| 4 | ServiceManager.Services = new Array(); |
||
| 5 | |||
| 6 | ServiceManager.getService = function(type, name, id) |
||
| 7 | { |
||
| 8 | var fullId = name + id; |
||
| 9 | |||
| 10 | if (!ServiceManager.Services[fullId]) |
||
| 11 | { |
||
| 12 | if (eval("typeof " + name + " != 'function'"))///FIXME: eval = evil! |
||
| 13 | { |
||
| 14 | if (!loadScript(type + "/" + name + ".js")) |
||
| 15 | { |
||
| 972 | runge | 16 | //log("Could not load " + name + ".js\n"); |
| 969 | runge | 17 | return null; |
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 999 | runge | 21 | ServiceManager.Services[fullId] = eval("(new " + name + "('" + type + "', '" + name + "', " + id + "))");///FIXME: Can we do this without eval?? |
| 969 | runge | 22 | } |
| 23 | |||
| 24 | return ServiceManager.Services[fullId]; |
||
| 25 | } |
||
| 26 | |||
| 27 | ServiceManager.startService = function(type, name, id, args) |
||
| 28 | { |
||
| 29 | var service = ServiceManager.getService(type, name, id); |
||
| 30 | if (service != null) |
||
| 31 | { |
||
| 32 | service.initialize(args); |
||
| 33 | } |
||
| 34 | } |