electron-panel
Advanced tools
Comparing version 1.3.4 to 1.3.5
## CHANGELOG | ||
### v1.3.5 | ||
- Add `panel.closeAll()`. | ||
### v1.3.4 | ||
- Return closed results when calling `panel.close()`. | ||
- Return closed results when calling `panelFrame.close()`. | ||
@@ -7,0 +11,0 @@ ### v1.3.2 |
@@ -43,1 +43,5 @@ # Panel (renderer process) | ||
Find panel frame via `panelID`. | ||
### panel.closeAll () | ||
Close all panels. If any of the panel cancel close, none of the panel will be closed. |
@@ -387,4 +387,4 @@ 'use strict'; | ||
if ( this.beforeUnload ) { | ||
let stopUnload = this.beforeUnload(); | ||
if ( stopUnload ) { | ||
let cancel = this.beforeUnload(); | ||
if ( cancel ) { | ||
return false; | ||
@@ -395,14 +395,3 @@ } | ||
// handle unload | ||
if ( this._ipcListener ) { | ||
this._ipcListener.clear(); | ||
} | ||
if ( this._mousetrapList ) { | ||
this._mousetrapList.forEach(mousetrap => { | ||
mousetrap.reset(); | ||
}); | ||
} | ||
this.remove(); | ||
// remove it from panel list | ||
panel._remove(this); | ||
this._unload(); | ||
return true; | ||
@@ -488,2 +477,18 @@ } | ||
_unload () { | ||
// handle unload | ||
if ( this._ipcListener ) { | ||
this._ipcListener.clear(); | ||
} | ||
if ( this._mousetrapList ) { | ||
this._mousetrapList.forEach(mousetrap => { | ||
mousetrap.reset(); | ||
}); | ||
} | ||
this.remove(); | ||
// remove it from panel list | ||
panel._remove(this); | ||
} | ||
_apply ( proto ) { | ||
@@ -490,0 +495,0 @@ let mode = proto.mode; // can be 'light', 'shadow' and 'iframe', default is 'shadow' |
@@ -87,2 +87,28 @@ 'use strict'; | ||
/** | ||
* @method closeAll | ||
* | ||
* Close all panels. If any of the panel cancel close, none of the panel will be closed. | ||
*/ | ||
panel.closeAll = function () { | ||
let panelFrames = Object.values(_id2panelFrame); | ||
for ( let i = 0; i < panelFrames.length; ++i ) { | ||
let frameEL = panelFrames[i]; | ||
if ( frameEL.beforeUnload ) { | ||
let stopUnload = frameEL.beforeUnload(); | ||
if ( stopUnload ) { | ||
return false; | ||
} | ||
} | ||
} | ||
for ( let i = 0; i < panelFrames.length; ++i ) { | ||
let frameEL = panelFrames[i]; | ||
frameEL._unload(); | ||
} | ||
return true; | ||
}; | ||
/** | ||
* @property panels | ||
@@ -89,0 +115,0 @@ * |
{ | ||
"name": "electron-panel", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Manipulate panels in window for Electron", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -99,2 +99,4 @@ # electron-panel | ||
- [Test] panel2panel-reply | ||
- [Test] panelFrame.close() | ||
- [Test] panel.closeAll() | ||
@@ -101,0 +103,0 @@ ## License |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56635
1594
105