Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ViewManager = {
  2.     currentView : null,
  3.     queuedView: null,
  4.  
  5.     gotoView: function(view) {
  6.       if(this.currentView !== null && this.currentView.cid == view.cid) {
  7.         console.log("same view-die");
  8.  
  9.         return;
  10.       }
  11.  
  12.       if(this.currentView !== null && this.currentView.cid != view.cid) {
  13.         console.log("close view and queue");
  14.  
  15.         this.queuedView = view;
  16.         ViewManager.hideView();
  17.  
  18.         return;
  19.       }
  20.  
  21.       this.queuedView = view;
  22.       ViewManager.showView();
  23.  
  24.     },
  25.  
  26.     showView: function(){
  27.       this.currentView = this.queuedView;
  28.       this.currentView.show();
  29.     },
  30.  
  31.     hideView: function(){
  32.       this.currentView.hide();
  33.     },
  34.  
  35.     onHideView: function(){
  36.       // check if queued, then show that
  37.     }
  38.   };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement