rc-new-window
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -37,2 +37,3 @@ import React from 'react'; | ||
released: boolean; | ||
windowCheckerInterval: any; | ||
container: HTMLDivElement; | ||
@@ -62,3 +63,3 @@ state: State; | ||
*/ | ||
release: (event?: Event) => void; | ||
release: (event?: any) => void; | ||
} | ||
@@ -65,0 +66,0 @@ /** |
@@ -40,2 +40,6 @@ import React from 'react'; | ||
this.released = true; | ||
if (this.windowCheckerInterval) { | ||
clearInterval(this.windowCheckerInterval); | ||
this.windowCheckerInterval = null; | ||
} | ||
window.removeEventListener('beforeunload', this.onMainWindowUnload); | ||
@@ -68,3 +72,3 @@ this.window.removeEventListener('beforeunload', this.release); | ||
openChild() { | ||
const { url, title, name, width, height, initPopupInnerRect, initPopupOuterRect, onBlock, onOpen, } = this.props; | ||
const { url, title, name, width, height, initPopupInnerRect, initPopupOuterRect, onBlock, onOpen, onClose, } = this.props; | ||
let features = { width, height }; | ||
@@ -107,2 +111,9 @@ if (initPopupOuterRect) { | ||
} | ||
if (url && onClose) { | ||
this.windowCheckerInterval = setInterval(() => { | ||
if (!this.window || this.window.closed) { | ||
this.release(true); | ||
} | ||
}, 50); | ||
} | ||
// Release anything bound to this component before the new window unload. | ||
@@ -109,0 +120,0 @@ this.window.addEventListener('beforeunload', this.release); |
@@ -37,2 +37,3 @@ import React from 'react'; | ||
released: boolean; | ||
windowCheckerInterval: any; | ||
container: HTMLDivElement; | ||
@@ -62,3 +63,3 @@ state: State; | ||
*/ | ||
release: (event?: Event) => void; | ||
release: (event?: any) => void; | ||
} | ||
@@ -65,0 +66,0 @@ /** |
@@ -45,2 +45,6 @@ "use strict"; | ||
this.released = true; | ||
if (this.windowCheckerInterval) { | ||
clearInterval(this.windowCheckerInterval); | ||
this.windowCheckerInterval = null; | ||
} | ||
window.removeEventListener('beforeunload', this.onMainWindowUnload); | ||
@@ -73,3 +77,3 @@ this.window.removeEventListener('beforeunload', this.release); | ||
openChild() { | ||
const { url, title, name, width, height, initPopupInnerRect, initPopupOuterRect, onBlock, onOpen, } = this.props; | ||
const { url, title, name, width, height, initPopupInnerRect, initPopupOuterRect, onBlock, onOpen, onClose, } = this.props; | ||
let features = { width, height }; | ||
@@ -112,2 +116,9 @@ if (initPopupOuterRect) { | ||
} | ||
if (url && onClose) { | ||
this.windowCheckerInterval = setInterval(() => { | ||
if (!this.window || this.window.closed) { | ||
this.release(true); | ||
} | ||
}, 50); | ||
} | ||
// Release anything bound to this component before the new window unload. | ||
@@ -114,0 +125,0 @@ this.window.addEventListener('beforeunload', this.release); |
{ | ||
"name": "rc-new-window", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "popup new browser window with react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -66,3 +66,3 @@ # rc-new-window | ||
<td></td> | ||
<td>Use url instead of children content<br/>If cross domain url is used, callbacks might not work</td> | ||
<td>Use url instead of children content</td> | ||
</tr> | ||
@@ -127,3 +127,3 @@ <tr> | ||
<td></td> | ||
<td>callback when window is closed by user</td> | ||
<td>callback when window is closed</td> | ||
</tr> | ||
@@ -130,0 +130,0 @@ <tr> |
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
39953
1013