panel.js (1142B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const EventEmitter = require("resource://devtools/shared/event-emitter.js"); 8 9 loader.lazyRequireGetter( 10 this, 11 "StorageUI", 12 "resource://devtools/client/storage/ui.js", 13 true 14 ); 15 16 class StoragePanel { 17 constructor(panelWin, toolbox, commands) { 18 EventEmitter.decorate(this); 19 20 this._toolbox = toolbox; 21 this._commands = commands; 22 this._panelWin = panelWin; 23 } 24 25 get panelWindow() { 26 return this._panelWin; 27 } 28 29 /** 30 * open is effectively an asynchronous constructor 31 */ 32 async open() { 33 this.UI = new StorageUI(this._panelWin, this._toolbox, this._commands); 34 35 await this.UI.init(); 36 37 return this; 38 } 39 40 /** 41 * Destroy the storage inspector. 42 */ 43 destroy() { 44 if (this._destroyed) { 45 return; 46 } 47 this._destroyed = true; 48 49 this.UI.destroy(); 50 this.UI = null; 51 52 this._toolbox = null; 53 this._panelWin = null; 54 } 55 } 56 57 exports.StoragePanel = StoragePanel;