Socket
Socket
Sign inDemoInstall

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.6 to 1.3.7

.travis.yml

2

dist/unload.js

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

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(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){
// shim for using process in browser

@@ -3,0 +3,0 @@ var process = module.exports = {};

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

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

@@ -13,3 +13,4 @@ "scripts": {

"pretest": "npm run build",
"test": "concurrently --kill-others -s first \"npm run pingserver\" \"mocha -b test/\""
"test": "concurrently --kill-others -s first \"npm run pingserver\" \"mocha -b test/nodejs.test.js\"",
"test:typings": "npm run build && mocha ./test/typings.test.js -b --timeout 12000 --exit"
},

@@ -38,24 +39,29 @@ "repository": {

"assert": "1.4.1",
"browserify": "14.5.0",
"async-test-util": "1.6.1",
"browserify": "16.2.2",
"child-process-promise": "2.2.1",
"child_process": "1.0.2",
"concurrently": "3.5.0",
"eslint": "4.11.0",
"express": "4.16.2",
"http-server": "0.10.0",
"karma": "1.7.1",
"karma-browserify": "5.1.2",
"concurrently": "3.6.0",
"eslint": "5.0.1",
"express": "4.16.3",
"http-server": "0.11.1",
"karma": "2.0.4",
"karma-browserify": "5.3.0",
"karma-chrome-launcher": "2.2.0",
"karma-mocha": "1.3.0",
"mocha": "4.0.1",
"mocha": "5.2.0",
"node": "10.5.0",
"node-cmd": "3.0.0",
"npm-run-all": "4.1.2",
"npm-run-all": "4.1.3",
"pre-commit": "1.2.2",
"request": "2.83.0",
"request": "2.87.0",
"request-promise-native": "1.0.5",
"rimraf": "2.6.2",
"uglify-js": "3.1.9",
"util": "0.10.3",
"ts-node": "7.0.0",
"typescript": "2.9.2",
"uglify-js": "3.4.2",
"util": "0.11.0",
"watch": "1.0.2",
"watchify": "3.9.0"
"watchify": "3.11.0"
}
}

@@ -1,12 +0,10 @@

export function add(runMe: Function): Function;
declare interface Unload {
add(fn: () => void): () => void
runAll(): void
removeAll(): void
debug(): void;
};
export function runAll()
export function removeAll()
declare const unload: Unload;
declare const _default: {
add,
runAll,
removeAll
};
export default _default;
export default unload;

Sorry, the diff of this file is not supported yet

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