ConsolePanel.js 1.8 KB

12345678910111213141516
  1. export default class ConsolePanel extends UI.Panel{constructor(){super('console');this._view=Console.ConsoleView.instance();}
  2. static instance(){return(self.runtime.sharedInstance(Console.ConsolePanel));}
  3. static _updateContextFlavor(){const consoleView=Console.ConsolePanel.instance()._view;UI.context.setFlavor(Console.ConsoleView,consoleView.isShowing()?consoleView:null);}
  4. wasShown(){super.wasShown();const wrapper=Console.ConsolePanel.WrapperView._instance;if(wrapper&&wrapper.isShowing()){UI.inspectorView.setDrawerMinimized(true);}
  5. this._view.show(this.element);Console.ConsolePanel._updateContextFlavor();}
  6. willHide(){super.willHide();UI.inspectorView.setDrawerMinimized(false);if(Console.ConsolePanel.WrapperView._instance){Console.ConsolePanel.WrapperView._instance._showViewInWrapper();}
  7. Console.ConsolePanel._updateContextFlavor();}
  8. searchableView(){return Console.ConsoleView.instance().searchableView();}}
  9. export class WrapperView extends UI.VBox{constructor(){super();this.element.classList.add('console-view-wrapper');Console.ConsolePanel.WrapperView._instance=this;this._view=Console.ConsoleView.instance();}
  10. wasShown(){if(!Console.ConsolePanel.instance().isShowing()){this._showViewInWrapper();}else{UI.inspectorView.setDrawerMinimized(true);}
  11. Console.ConsolePanel._updateContextFlavor();}
  12. willHide(){UI.inspectorView.setDrawerMinimized(false);Console.ConsolePanel._updateContextFlavor();}
  13. _showViewInWrapper(){this._view.show(this.element);}}
  14. export class ConsoleRevealer{reveal(object){const consoleView=Console.ConsoleView.instance();if(consoleView.isShowing()){consoleView.focus();return Promise.resolve();}
  15. UI.viewManager.showView('console-view');return Promise.resolve();}}
  16. self.Console=self.Console||{};Console=Console||{};Console.ConsolePanel=ConsolePanel;Console.ConsolePanel.WrapperView=WrapperView;Console.ConsolePanel.ConsoleRevealer=ConsoleRevealer;