Advertisement
Guest User

Attempts to wrangle a UI blocker

a guest
Apr 26th, 2015
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // UI blocker library:
  2. window.uiBlocker = (function() {
  3.     // [ some private functions ]
  4.  
  5.     function show() {
  6.         // ...
  7.     }
  8.  
  9.     function hide() {
  10.         // ...
  11.     }
  12.    
  13.     return {
  14.         show: show,
  15.         hide: hide
  16.     }
  17. } () );
  18.  
  19. // Other components, which might go treading on each others' toes:
  20. window.uiBlocker.show();
  21. window.uiBlocker.hide();
  22.  
  23. // The way I'd LIKE it to work:
  24. var miniController = window.uiBlocker.getMiniController();
  25.     // This creates a new mini-controller for you. The UI controller will remember it in an array.
  26. miniController.activate();
  27. miniController.deactivate();
  28. // As long as any mini-controller is in the active state, the UI blocker is present.
  29. // Each time a mini-controller's altered, it signals the UI blocker controller to update.
  30. // The UI blocker controller will check each of the mini-controllers it's handed out,
  31. // and as long as any is active, it'll show up.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement