| 1 | define(["dojo/_base/declare", "dojo/topic"], function(declare, topic){ |
| 2 | return declare(null, { |
| 3 | |
| 4 | lifecycle: { |
| 5 | UNKNOWN: 0, //unknown |
| 6 | STARTING: 1, //starting |
| 7 | STARTED: 2, //started |
| 8 | STOPPING: 3, //stopping |
| 9 | STOPPED: 4 //stopped |
| 10 | }, |
| 11 | |
| 12 | _status: 0, //unknown |
| 13 | |
| 14 | getStatus: function(){ |
| 15 | return this._status; |
| 16 | }, |
| 17 | |
| 18 | setStatus: function(newStatus){ |
| 19 | this._status = newStatus; |
| 20 | |
| 21 | // publish /app/status event. |
| 22 | // application can subscribe this event to do some status change operation. |
| 23 | topic.publish("/app/status", newStatus); |
| 24 | } |
| 25 | }); |
| 26 | }); |