[483] | 1 | dojo.provide("dojox.mobile.app.SceneAssistant"); |
---|
| 2 | dojo.experimental("dojox.mobile.app.SceneAssistant"); |
---|
| 3 | |
---|
| 4 | dojo.declare("dojox.mobile.app.SceneAssistant", null, { |
---|
| 5 | // summary: |
---|
| 6 | // The base class for all scene assistants. |
---|
| 7 | |
---|
| 8 | constructor: function(){ |
---|
| 9 | |
---|
| 10 | }, |
---|
| 11 | |
---|
| 12 | setup: function(){ |
---|
| 13 | // summary: |
---|
| 14 | // Called to set up the widget. The UI is not visible at this time |
---|
| 15 | |
---|
| 16 | }, |
---|
| 17 | |
---|
| 18 | activate: function(params){ |
---|
| 19 | // summary: |
---|
| 20 | // Called each time the scene becomes visible. This can be as a result |
---|
| 21 | // of a new scene being created, or a subsequent scene being destroyed |
---|
| 22 | // and control transferring back to this scene assistant. |
---|
| 23 | // params: |
---|
| 24 | // Optional parameters, only passed when a subsequent scene pops itself |
---|
| 25 | // off the stack and passes back data. |
---|
| 26 | }, |
---|
| 27 | |
---|
| 28 | deactivate: function(){ |
---|
| 29 | // summary: |
---|
| 30 | // Called each time the scene becomes invisible. This can be as a result |
---|
| 31 | // of it being popped off the stack and destroyed, |
---|
| 32 | // or another scene being created and pushed on top of it on the stack |
---|
| 33 | }, |
---|
| 34 | |
---|
| 35 | destroy: function(){ |
---|
| 36 | |
---|
| 37 | var children = |
---|
| 38 | dojo.query("> [widgetId]", this.containerNode).map(dijit.byNode); |
---|
| 39 | dojo.forEach(children, function(child){ child.destroyRecursive(); }); |
---|
| 40 | |
---|
| 41 | this.disconnect(); |
---|
| 42 | }, |
---|
| 43 | |
---|
| 44 | connect: function(obj, method, callback){ |
---|
| 45 | if(!this._connects){ |
---|
| 46 | this._connects = []; |
---|
| 47 | } |
---|
| 48 | this._connects.push(dojo.connect(obj, method, callback)); |
---|
| 49 | }, |
---|
| 50 | |
---|
| 51 | disconnect: function(){ |
---|
| 52 | dojo.forEach(this._connects, dojo.disconnect); |
---|
| 53 | this._connects = []; |
---|
| 54 | } |
---|
| 55 | }); |
---|
| 56 | |
---|