SceneAssistant.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dojox.mobile.app.SceneAssistant"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.mobile.app.SceneAssistant"] = true;
  8. dojo.provide("dojox.mobile.app.SceneAssistant");
  9. dojo.experimental("dojox.mobile.app.SceneAssistant");
  10. dojo.declare("dojox.mobile.app.SceneAssistant", null, {
  11. // summary:
  12. // The base class for all scene assistants.
  13. constructor: function(){
  14. },
  15. setup: function(){
  16. // summary:
  17. // Called to set up the widget. The UI is not visible at this time
  18. },
  19. activate: function(params){
  20. // summary:
  21. // Called each time the scene becomes visible. This can be as a result
  22. // of a new scene being created, or a subsequent scene being destroyed
  23. // and control transferring back to this scene assistant.
  24. // params:
  25. // Optional paramters, only passed when a subsequent scene pops itself
  26. // off the stack and passes back data.
  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. destroy: function(){
  35. var children =
  36. dojo.query("> [widgetId]", this.containerNode).map(dijit.byNode);
  37. dojo.forEach(children, function(child){ child.destroyRecursive(); });
  38. this.disconnect();
  39. },
  40. connect: function(obj, method, callback){
  41. if(!this._connects){
  42. this._connects = [];
  43. }
  44. this._connects.push(dojo.connect(obj, method, callback));
  45. },
  46. disconnect: function(){
  47. dojo.forEach(this._connects, dojo.disconnect);
  48. this._connects = [];
  49. }
  50. });
  51. }