Socket
Socket
Sign inDemoInstall

@esayemm/react-popout

Package Overview
Dependencies
5
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 0.7.0

2

dist/react-popout.min.js

@@ -1,1 +0,1 @@

!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("react-dom"));else if("function"==typeof define&&define.amd)define(["react","react-dom"],t);else{var n="object"==typeof exports?t(require("react"),require("react-dom")):t(e.React,e.ReactDOM);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=n(2),l=o(c),a=n(3),p=o(a),d=Symbol("container_id"),f=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={openedWindow:null},n.defaultOptions={toolbar:"no",location:"no",directories:"no",status:"no",menubar:"no",scrollbars:"yes",resizable:"yes",width:500,height:400,top:function(e,t){return(t.innerHeight-e.height)/2+t.screenY},left:function(e,t){return(t.innerWidth-e.width)/2+t.screenX}},n[d]=e.containerId||"popout-content-container",n.closeWindow=n.closeWindow.bind(n),n}return u(t,e),s(t,[{key:"componentWillReceiveProps",value:function(e){e.containerId&&(this[d]=e.containerId)}},{key:"componentWillUnmount",value:function(){this.closeWindow()}},{key:"componentDidMount",value:function(){var e=this,t=void 0,n=void 0,o=Object.assign({},this.defaultOptions,this.props.options),r=this.props.window||window,i={update:function(e){p.default.render(e,n)},close:function(){t&&t.close()}};if(r){var u=function(){var t=[];for(var n in o)o.hasOwnProperty(n)&&t.push(n+"="+("function"==typeof o[n]?o[n].call(e,o,r):o[n]));return t.join(",")};t=r.open(this.props.url||"about:blank",this.props.title,u()),t.onbeforeunload=function(){n&&p.default.unmountComponentAtNode(n),e.windowClosing()},r.addEventListener("unload",this.closeWindow);var s=function(){if(n){if(t.document.getElementById(e[d]))return;p.default.unmountComponentAtNode(n),n=null}t.document.title=e.props.title,n=t.document.createElement("div"),n.id=e[d],t.document.body.appendChild(n),p.default.render(e.props.children,n)};t.onload=s,"complete"===t.document.readyState&&s(),this.setState({openedWindow:i})}}},{key:"closeWindow",value:function(){this.state.openedWindow&&this.state.openedWindow.close(),(this.props.window||window).removeEventListener("unload",this.closeWindow)}},{key:"windowClosing",value:function(){this.props.onClosing&&this.props.onClosing()}},{key:"componentDidUpdate",value:function(){this.state.openedWindow&&this.state.openedWindow.update(this.props.children)}},{key:"render",value:function(){return l.default.createElement("div",null)}}]),t}(l.default.Component);f.propTypes={title:l.default.PropTypes.string.isRequired,url:l.default.PropTypes.string,onClosing:l.default.PropTypes.func,options:l.default.PropTypes.object,window:l.default.PropTypes.object,containerId:l.default.PropTypes.string,children:l.default.PropTypes.element},t.default=f},function(t,n){t.exports=e},function(e,n){e.exports=t}])});
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("react-dom"));else if("function"==typeof define&&define.amd)define(["react","react-dom"],t);else{var n="object"==typeof exports?t(require("react"),require("react-dom")):t(e.React,e.ReactDOM);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=n(2),l=o(c),a=n(3),d=o(a),p=Symbol("container_id"),f=function(e){function t(e){i(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={openedWindow:null},n.defaultOptions={toolbar:"no",location:"no",directories:"no",status:"no",menubar:"no",scrollbars:"yes",resizable:"yes",width:500,height:400,top:function(e,t){return(t.innerHeight-e.height)/2+t.screenY},left:function(e,t){return(t.innerWidth-e.width)/2+t.screenX}},n[p]=e.containerId||"popout-content-container",n.closeWindow=n.closeWindow.bind(n),n}return u(t,e),s(t,[{key:"componentWillReceiveProps",value:function(e){e.containerId&&(this[p]=e.containerId)}},{key:"componentWillUnmount",value:function(){this.closeWindow()}},{key:"componentDidMount",value:function(){var e=this,t=void 0,n=void 0,o=Object.assign({},this.defaultOptions,this.props.options),i=this.props.window||window,r={update:function(e){d.default.render(e,n)},close:function(){t&&t.close()}};if(i){var u=function(){var t=[];for(var n in o)o.hasOwnProperty(n)&&t.push(n+"="+("function"==typeof o[n]?o[n].call(e,o,i):o[n]));return t.join(",")};t=i.open(this.props.url||"about:blank",this.props.title,u()),t.onbeforeunload=function(){n&&d.default.unmountComponentAtNode(n),e.windowClosing()},t.pagehide=function(){n&&d.default.unmountComponentAtNode(n),e.windowClosing()},i.addEventListener("unload",this.closeWindow);var s=function(){if(n){if(t.document.getElementById(e[p]))return;d.default.unmountComponentAtNode(n),n=null}t.document.title=e.props.title,n=t.document.createElement("div"),n.id=e[p],t.document.body.appendChild(n),d.default.render(e.props.children,n)};t.onload=s,"complete"===t.document.readyState&&s(),this.setState({openedWindow:r})}}},{key:"closeWindow",value:function(){this.state.openedWindow&&this.state.openedWindow.close(),(this.props.window||window).removeEventListener("unload",this.closeWindow)}},{key:"windowClosing",value:function(){this.props.onClosing&&this.props.onClosing()}},{key:"componentDidUpdate",value:function(){this.state.openedWindow&&this.state.openedWindow.update(this.props.children)}},{key:"render",value:function(){return l.default.createElement("div",null)}}]),t}(l.default.Component);f.propTypes={title:l.default.PropTypes.string.isRequired,url:l.default.PropTypes.string,onClosing:l.default.PropTypes.func,options:l.default.PropTypes.object,window:l.default.PropTypes.object,containerId:l.default.PropTypes.string,children:l.default.PropTypes.element},t.default=f},function(t,n){t.exports=e},function(e,n){e.exports=t}])});

@@ -102,2 +102,6 @@ import React from 'react';

};
popoutWindow.pagehide = () =>{
container && ReactDOM.unmountComponentAtNode(container);
this.windowClosing();
};
// Close any open popouts when page unloads/refeshes

@@ -104,0 +108,0 @@ ownerWindow.addEventListener('unload', this.closeWindow);

{
"name": "@esayemm/react-popout",
"version": "0.6.0",
"version": "0.7.0",
"description": "Wraps window.open in a react component, allowing the contents to be part of your react render tree",

@@ -5,0 +5,0 @@ "main": "dist/react-popout.min.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc