SceneAssistant.js 1.6 KB

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