Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unload

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unload - npm Package Compare versions

Comparing version 1.3.8 to 1.3.9

10

dist/unload.js

@@ -301,2 +301,12 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){

// used for testing purposes
exports._getCache = function(){
return cache;
};
// used for testing purposes
exports._resetUnloaded = function(){
unloaded = false;
};
return exports;

@@ -303,0 +313,0 @@ })({

2

dist/unload.min.js

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

!function i(c,u,f){function s(n,e){if(!u[n]){if(!c[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(a)return a(n,!0);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o}var r=u[n]={exports:{}};c[n][0].call(r.exports,function(e){return s(c[n][1][e]||e)},r,r.exports,i,c,u,f)}return u[n].exports}for(var a="function"==typeof require&&require,e=0;e<f.length;e++)s(f[e]);return s}({1:[function(e,n,t){var o,r,i=n.exports={};function c(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function f(n){if(o===setTimeout)return setTimeout(n,0);if((o===c||!o)&&setTimeout)return o=setTimeout,setTimeout(n,0);try{return o(n,0)}catch(e){try{return o.call(null,n,0)}catch(e){return o.call(this,n,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:c}catch(e){o=c}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var s,a=[],l=!1,d=-1;function h(){l&&s&&(l=!1,s.length?a=s.concat(a):d=-1,a.length&&v())}function v(){if(!l){var e=f(h);l=!0;for(var n=a.length;n;){for(s=a,a=[];++d<n;)s&&s[d].run();d=-1,n=a.length}s=null,l=!1,function(n){if(r===clearTimeout)return clearTimeout(n);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(n);try{r(n)}catch(e){try{return r.call(null,n)}catch(e){return r.call(this,n)}}}(e)}}function p(e,n){this.fun=e,this.array=n}function m(){}i.nextTick=function(e){var n=new Array(arguments.length-1);if(1<arguments.length)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];a.push(new p(e,n)),1!==a.length||l||f(v)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],2:[function(e,n,t){n.exports={add:function(e){var n={};return"object"==typeof window&&window.addEventListener&&"function"==typeof window.addEventListener&&(window.addEventListener("beforeunload",e,!1),n.beforeunload=e),n},remove:function(e,t){Object.keys(t).forEach(function(e){var n=t[e];switch(e){case"beforeunload":window.removeEventListener("beforeunload",n,!1)}})}}},{}],3:[function(e,n,t){var o=e("./index.js");window.unload=o},{"./index.js":4}],4:[function(e,n,t){var r,o,i,c,u,f;n.exports=(r={node:e("./node.js"),browser:e("./browser.js")},c=i=!(o={}),u=0,f={},o.debug=function(){c=!0},o.add=function(o){u++;var n=function(e,n,t){if(!i)return i=!0,o(e,n,t)},t={};Object.keys(r).forEach(function(e){t[e]=r[e].add(n)});var e=function(){Object.keys(t).forEach(function(e){r[e].remove(n,t[e])}),c&&console.log("unload.stopListening()"),c&&console.dir(f[u])};return e.run=function(){n()},f[u]={fn:o,remove:e,listeners:t},c&&console.log("unload.add()"),c&&console.dir(f[u]),e},o.runAll=function(){i||(i=!0,Object.keys(f).forEach(function(e){f[e].fn()}))},o.removeAll=function(){Object.keys(f).forEach(function(e){f[e].remove()})},o)},{"./browser.js":2,"./node.js":5}],5:[function(e,n,t){(function(o){n.exports={add:function(t){var e={};return"object"==typeof o&&o.on&&"function"==typeof o.on&&(e.beforeExit=function(e){var n=t(e);Promise.resolve(n).then(function(){o.exit()})},o.on("beforeExit",e.beforeExit),e.exit=function(e){var n=t(e);Promise.resolve(n)},o.on("exit",e.exit),e.SIGINT=function(e){var n=t(e);Promise.resolve(n).then(function(){o.exit()})},o.on("SIGINT",e.SIGINT),e.uncaughtException=function(e){var n=t(e);Promise.resolve(n).then(function(){o.exit()})},o.on("uncaughtException",e.uncaughtException)),e},remove:function(e,t){Object.keys(t).forEach(function(e){var n=t[e];switch(e){case"beforeExit":case"SIGINT":case"uncaughtException":case"exit":o.removeListener(e,n)}})}}}).call(this,e("_process"))},{_process:1}]},{},[3]);
!function i(c,u,f){function s(n,e){if(!u[n]){if(!c[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(a)return a(n,!0);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o}var r=u[n]={exports:{}};c[n][0].call(r.exports,function(e){return s(c[n][1][e]||e)},r,r.exports,i,c,u,f)}return u[n].exports}for(var a="function"==typeof require&&require,e=0;e<f.length;e++)s(f[e]);return s}({1:[function(e,n,t){var o,r,i=n.exports={};function c(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function f(n){if(o===setTimeout)return setTimeout(n,0);if((o===c||!o)&&setTimeout)return o=setTimeout,setTimeout(n,0);try{return o(n,0)}catch(e){try{return o.call(null,n,0)}catch(e){return o.call(this,n,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:c}catch(e){o=c}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var s,a=[],l=!1,d=-1;function h(){l&&s&&(l=!1,s.length?a=s.concat(a):d=-1,a.length&&v())}function v(){if(!l){var e=f(h);l=!0;for(var n=a.length;n;){for(s=a,a=[];++d<n;)s&&s[d].run();d=-1,n=a.length}s=null,l=!1,function(n){if(r===clearTimeout)return clearTimeout(n);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(n);try{r(n)}catch(e){try{return r.call(null,n)}catch(e){return r.call(this,n)}}}(e)}}function p(e,n){this.fun=e,this.array=n}function m(){}i.nextTick=function(e){var n=new Array(arguments.length-1);if(1<arguments.length)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];a.push(new p(e,n)),1!==a.length||l||f(v)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],2:[function(e,n,t){n.exports={add:function(e){var n={};return"object"==typeof window&&window.addEventListener&&"function"==typeof window.addEventListener&&(window.addEventListener("beforeunload",e,!1),n.beforeunload=e),n},remove:function(e,t){Object.keys(t).forEach(function(e){var n=t[e];switch(e){case"beforeunload":window.removeEventListener("beforeunload",n,!1)}})}}},{}],3:[function(e,n,t){var o=e("./index.js");window.unload=o},{"./index.js":4}],4:[function(e,n,t){var r,o,i,c,u,f;n.exports=(r={node:e("./node.js"),browser:e("./browser.js")},c=i=!(o={}),u=0,f={},o.debug=function(){c=!0},o.add=function(o){u++;var n=function(e,n,t){if(!i)return i=!0,o(e,n,t)},t={};Object.keys(r).forEach(function(e){t[e]=r[e].add(n)});var e=function(){Object.keys(t).forEach(function(e){r[e].remove(n,t[e])}),c&&console.log("unload.stopListening()"),c&&console.dir(f[u])};return e.run=function(){n()},f[u]={fn:o,remove:e,listeners:t},c&&console.log("unload.add()"),c&&console.dir(f[u]),e},o.runAll=function(){i||(i=!0,Object.keys(f).forEach(function(e){f[e].fn()}))},o.removeAll=function(){Object.keys(f).forEach(function(e){f[e].remove()})},o._getCache=function(){return f},o._resetUnloaded=function(){i=!1},o)},{"./browser.js":2,"./node.js":5}],5:[function(e,n,t){(function(o){n.exports={add:function(t){var e={};return"object"==typeof o&&o.on&&"function"==typeof o.on&&(e.beforeExit=function(e){var n=t(e);Promise.resolve(n).then(function(){o.exit()})},o.on("beforeExit",e.beforeExit),e.exit=function(e){var n=t(e);Promise.resolve(n)},o.on("exit",e.exit),e.SIGINT=function(e){var n=t(e);Promise.resolve(n).then(function(){o.exit()})},o.on("SIGINT",e.SIGINT),e.uncaughtException=function(e){var n=t(e);Promise.resolve(n).then(function(){o.exit()})},o.on("uncaughtException",e.uncaughtException)),e},remove:function(e,t){Object.keys(t).forEach(function(e){var n=t[e];switch(e){case"beforeExit":case"SIGINT":case"uncaughtException":case"exit":o.removeListener(e,n)}})}}}).call(this,e("_process"))},{_process:1}]},{},[3]);
{
"name": "unload",
"version": "1.3.8",
"version": "1.3.9",
"description": "Execute code when the js-process exits. On all javascript-environments",

@@ -5,0 +5,0 @@ "scripts": {

@@ -6,2 +6,5 @@ declare interface Unload {

debug(): void;
_getCache(): any;
_resetUnloaded(): void;
};

@@ -8,0 +11,0 @@

@@ -71,2 +71,12 @@ module.exports = (function(

// used for testing purposes
exports._getCache = function(){
return cache;
};
// used for testing purposes
exports._resetUnloaded = function(){
unloaded = false;
};
return exports;

@@ -73,0 +83,0 @@ })({

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc