Socket
Socket
Sign inDemoInstall

async-try-catch

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-try-catch - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

53

browser/AsyncTryCatch.js

@@ -73,2 +73,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.AsyncTryCatch = f()}})(function(){var define,module,exports;return (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){

global.AsyncTryCatch.substituted = false ;
global.AsyncTryCatch.NextGenEvents = [] ;
}

@@ -273,3 +274,14 @@

{
AsyncTryCatch.addListenerWrapper.call( this , AsyncTryCatch.NextGenEvents.on , eventName , fn , options ) ;
/*
console.log( 'this:' , this ) ;
console.log( 'this.asyncTryCatchId:' , this.asyncTryCatchId ) ;
console.log( 'called with:' , Array.from( arguments ) ) ;
try {*/
AsyncTryCatch.addListenerWrapper.call( this , AsyncTryCatch.NextGenEvents[ this.asyncTryCatchId ].on , eventName , fn , options ) ;
/*}
catch ( error ) {
console.error( error ) ;
console.log( index ) ;
throw error ;
}*/
} ;

@@ -280,3 +292,3 @@

{
AsyncTryCatch.addListenerWrapper.call( this , AsyncTryCatch.NextGenEvents.once , eventName , fn , options ) ;
AsyncTryCatch.addListenerWrapper.call( this , AsyncTryCatch.NextGenEvents[ this.asyncTryCatchId ].once , eventName , fn , options ) ;
} ;

@@ -287,3 +299,3 @@

{
AsyncTryCatch.removeListenerWrapper.call( this , AsyncTryCatch.NextGenEvents.off , eventName , fn ) ;
AsyncTryCatch.removeListenerWrapper.call( this , AsyncTryCatch.NextGenEvents[ this.asyncTryCatchId ].off , eventName , fn ) ;
} ;

@@ -297,4 +309,4 @@

// E.g. browser case: Node Events or NextGen Events are not loaded/accessible at time
//if ( global.AsyncTryCatch.substituted ) { return ; }
//if ( global.AsyncTryCatch.substituted ) { return ; }
global.AsyncTryCatch.substituted = true ;

@@ -311,5 +323,7 @@

/*
try {
AsyncTryCatch.NextGenEvents = global.NextGenEvents || require( 'nextgen-events' ) ;
} catch ( error ) {}
*/

@@ -339,2 +353,13 @@ if ( AsyncTryCatch.NodeEvents )

for ( var i = 0 ; i < AsyncTryCatch.NextGenEvents.length ; i ++ )
{
//console.log( 'substituting NextGenEvents' , i ) ;
AsyncTryCatch.NextGenEvents[ i ].prototype.on = AsyncTryCatch.ngevAddListener ;
AsyncTryCatch.NextGenEvents[ i ].prototype.addListener = AsyncTryCatch.ngevAddListener ;
AsyncTryCatch.NextGenEvents[ i ].prototype.once = AsyncTryCatch.ngevAddListenerOnce ;
AsyncTryCatch.NextGenEvents[ i ].prototype.off = AsyncTryCatch.ngevRemoveListener ;
AsyncTryCatch.NextGenEvents[ i ].prototype.removeListener = AsyncTryCatch.ngevRemoveListener ;
}
/*
if ( AsyncTryCatch.NextGenEvents )

@@ -348,2 +373,3 @@ {

}
*/
} ;

@@ -357,4 +383,4 @@

// E.g. browser case: Node Events or NextGen Events are not loaded/accessible at time
//if ( ! global.AsyncTryCatch.substituted ) { return ; }
//if ( ! global.AsyncTryCatch.substituted ) { return ; }
global.AsyncTryCatch.substituted = false ;

@@ -374,2 +400,12 @@

for ( var i = 0 ; i < AsyncTryCatch.NextGenEvents.length ; i ++ )
{
AsyncTryCatch.NextGenEvents[ i ].prototype.on = AsyncTryCatch.NextGenEvents[ i ].on ;
AsyncTryCatch.NextGenEvents[ i ].prototype.addListener = AsyncTryCatch.NextGenEvents[ i ].on ;
AsyncTryCatch.NextGenEvents[ i ].prototype.once = AsyncTryCatch.NextGenEvents[ i ].once ;
AsyncTryCatch.NextGenEvents[ i ].prototype.off = AsyncTryCatch.NextGenEvents[ i ].off ;
AsyncTryCatch.NextGenEvents[ i ].prototype.removeListener = AsyncTryCatch.NextGenEvents[ i ].removeListener ;
}
/*
if ( AsyncTryCatch.NextGenEvents )

@@ -383,2 +419,3 @@ {

}
*/
} ;

@@ -389,3 +426,3 @@

}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../package.json":4,"_process":3,"events":2,"nextgen-events":2}],2:[function(require,module,exports){
},{"../package.json":4,"_process":3,"events":2}],2:[function(require,module,exports){

@@ -491,3 +528,3 @@ },{}],3:[function(require,module,exports){

"name": "async-try-catch",
"version": "0.2.1",
"version": "0.3.0",
"description": "Async try catch",

@@ -504,3 +541,3 @@ "main": "lib/AsyncTryCatch.js",

"mocha": "^2.5.3",
"nextgen-events": "^0.5.16",
"nextgen-events": "^0.9.5",
"uglify-js": "^2.6.2"

@@ -507,0 +544,0 @@ },

2

browser/AsyncTryCatch.min.js

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

(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.AsyncTryCatch=e()}})(function(){var e,t,n;return function r(e,t,n){function s(i,a){if(!t[i]){if(!e[i]){var c=typeof require=="function"&&require;if(!a&&c)return c(i,!0);if(o)return o(i,!0);var p=new Error("Cannot find module '"+i+"'");throw p.code="MODULE_NOT_FOUND",p}var y=t[i]={exports:{}};e[i][0].call(y.exports,function(t){var n=e[i][1][t];return s(n?n:t)},y,y.exports,r,e,t,n)}return t[i].exports}var o=typeof require=="function"&&require;for(var i=0;i<n.length;i++)s(n[i]);return s}({1:[function(e,t,n){(function(n,r){"use strict";function s(){throw new Error("Use AsyncTryCatch.try() instead.")}t.exports=s;s.prototype.__prototypeUID__="async-try-catch/AsyncTryCatch";s.prototype.__prototypeVersion__=e("../package.json").version;if(r.AsyncTryCatch){if(r.AsyncTryCatch.prototype.__prototypeUID__==="async-try-catch/AsyncTryCatch"){var o=s.prototype.__prototypeVersion__.split(".");var i=r.AsyncTryCatch.prototype.__prototypeVersion__.split(".");if(i[0]!==o[0]||o[0]==="0"&&i[1]!==o[1]){throw new Error("Incompatible version of AsyncTryCatch already installed on global.AsyncTryCatch: "+r.AsyncTryCatch.prototype.__prototypeVersion__+", current version: "+s.prototype.__prototypeVersion__)}}else{throw new Error("Incompatible module already installed on global.AsyncTryCatch")}}else{r.AsyncTryCatch=s;r.AsyncTryCatch.stack=[];r.AsyncTryCatch.substituted=false}if(n.browser&&!r.setImmediate){r.setImmediate=function a(e){return setTimeout(e,0)};r.clearImmediate=function c(e){return clearTimeout(e)}}if(!r.Vanilla){r.Vanilla={}}if(!r.Vanilla.setTimeout){r.Vanilla.setTimeout=setTimeout}if(!r.Vanilla.setImmediate){r.Vanilla.setImmediate=setImmediate}if(!r.Vanilla.nextTick){r.Vanilla.nextTick=n.nextTick}s.try=function p(e){var t=Object.create(s.prototype,{fn:{value:e,enumerable:true},parent:{value:r.AsyncTryCatch.stack[r.AsyncTryCatch.stack.length-1]}});return t};s.prototype.catch=function y(e){Object.defineProperties(this,{catchFn:{value:e,enumerable:true}});if(!r.AsyncTryCatch.substituted){s.substitute()}try{r.AsyncTryCatch.stack.push(this);this.fn();r.AsyncTryCatch.stack.pop()}catch(t){r.AsyncTryCatch.stack.pop();this.callCatchFn(t)}};s.prototype.callCatchFn=function d(e){if(!this.parent){this.catchFn(e);return}try{r.AsyncTryCatch.stack.push(this.parent);this.catchFn(e);r.AsyncTryCatch.stack.pop()}catch(e){r.AsyncTryCatch.stack.pop();this.parent.callCatchFn(e)}};s.timerWrapper=function l(e,t){var t,n,s,o=Array.prototype.slice.call(arguments,1);if(typeof t!=="function"||!r.AsyncTryCatch.stack.length){return e.apply(this,o)}n=r.AsyncTryCatch.stack[r.AsyncTryCatch.stack.length-1];s=function(){try{r.AsyncTryCatch.stack.push(n);t.apply(this,arguments);r.AsyncTryCatch.stack.pop()}catch(e){r.AsyncTryCatch.stack.pop();n.callCatchFn(e)}};o[0]=s;return e.apply(this,o)};s.addListenerWrapper=function f(e,t,n,s){var n,o,i;if(typeof n==="object"){s=n;n=s.fn;delete s.fn}if(typeof n!=="function"||!r.AsyncTryCatch.stack.length){return e.call(this,t,n,s)}o=r.AsyncTryCatch.stack[r.AsyncTryCatch.stack.length-1];if(this.__fnToWrapperMap){i=this.__fnToWrapperMap.get(n)}else{Object.defineProperty(this,"__fnToWrapperMap",{value:new WeakMap})}if(!i){i=function(){try{r.AsyncTryCatch.stack.push(o);n.apply(this,arguments);r.AsyncTryCatch.stack.pop()}catch(e){r.AsyncTryCatch.stack.pop();o.callCatchFn(e)}};this.__fnToWrapperMap.set(n,i)}return e.call(this,t,i,s)};s.removeListenerWrapper=function u(e,t,n){if(typeof n==="function"&&this.__fnToWrapperMap){n=this.__fnToWrapperMap.get(n)||n}return e.call(this,t,n)};s.setTimeout=s.timerWrapper.bind(undefined,r.Vanilla.setTimeout);s.setImmediate=s.timerWrapper.bind(undefined,r.Vanilla.setImmediate);s.nextTick=s.timerWrapper.bind(n,r.Vanilla.nextTick);s.addListener=function h(e,t){s.addListenerWrapper.call(this,s.NodeEvents.__addListener,e,t)};s.addListenerOnce=function v(e,t){s.addListenerWrapper.call(this,s.NodeEvents.__addListenerOnce,e,t)};s.removeListener=function m(e,t){s.removeListenerWrapper.call(this,s.NodeEvents.__removeListener,e,t)};s.ngevAddListener=function T(e,t,n){s.addListenerWrapper.call(this,s.NextGenEvents.on,e,t,n)};s.ngevAddListenerOnce=function _(e,t,n){s.addListenerWrapper.call(this,s.NextGenEvents.once,e,t,n)};s.ngevRemoveListener=function E(e,t){s.removeListenerWrapper.call(this,s.NextGenEvents.off,e,t)};s.substitute=function N(){r.AsyncTryCatch.substituted=true;r.setTimeout=s.setTimeout;r.setImmediate=s.setTimeout;n.nextTick=s.nextTick;try{s.NodeEvents=r.EventEmitter||e("events")}catch(t){}try{s.NextGenEvents=r.NextGenEvents||e("nextgen-events")}catch(t){}if(s.NodeEvents){if(!s.NodeEvents.__addListener){s.NodeEvents.__addListener=s.NodeEvents.prototype.on}if(!s.NodeEvents.__addListenerOnce){s.NodeEvents.__addListenerOnce=s.NodeEvents.prototype.once}if(!s.NodeEvents.__removeListener){s.NodeEvents.__removeListener=s.NodeEvents.prototype.removeListener}s.NodeEvents.prototype.on=s.addListener;s.NodeEvents.prototype.addListener=s.addListener;s.NodeEvents.prototype.once=s.addListenerOnce;s.NodeEvents.prototype.removeListener=s.removeListener}if(s.NextGenEvents){s.NextGenEvents.prototype.on=s.ngevAddListener;s.NextGenEvents.prototype.addListener=s.ngevAddListener;s.NextGenEvents.prototype.once=s.ngevAddListenerOnce;s.NextGenEvents.prototype.off=s.ngevRemoveListener;s.NextGenEvents.prototype.removeListener=s.ngevRemoveListener}};s.restore=function L(){r.AsyncTryCatch.substituted=false;r.setTimeout=r.Vanilla.setTimeout;r.setImmediate=r.Vanilla.setImmediate;n.nextTick=r.Vanilla.nextTick;if(s.NodeEvents){s.NodeEvents.prototype.on=s.NodeEvents.__addListener;s.NodeEvents.prototype.addListener=s.NodeEvents.__addListener;s.NodeEvents.prototype.once=s.NodeEvents.__addListenerOnce;s.NodeEvents.prototype.removeListener=s.NodeEvents.__removeListener}if(s.NextGenEvents){s.NextGenEvents.prototype.on=s.NextGenEvents.on;s.NextGenEvents.prototype.addListener=s.NextGenEvents.on;s.NextGenEvents.prototype.once=s.NextGenEvents.once;s.NextGenEvents.prototype.off=s.NextGenEvents.off;s.NextGenEvents.prototype.removeListener=s.NextGenEvents.removeListener}}}).call(this,e("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../package.json":4,_process:3,events:2,"nextgen-events":2}],2:[function(e,t,n){},{}],3:[function(e,t,n){var r=t.exports={};var s=[];var o=false;var i;var a=-1;function c(){if(!o||!i){return}o=false;if(i.length){s=i.concat(s)}else{a=-1}if(s.length){p()}}function p(){if(o){return}var e=setTimeout(c);o=true;var t=s.length;while(t){i=s;s=[];while(++a<t){if(i){i[a].run()}}a=-1;t=s.length}i=null;o=false;clearTimeout(e)}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}}s.push(new y(e,t));if(s.length===1&&!o){setTimeout(p,0)}};function y(e,t){this.fun=e;this.array=t}y.prototype.run=function(){this.fun.apply(null,this.array)};r.title="browser";r.browser=true;r.env={};r.argv=[];r.version="";r.versions={};function d(){}r.on=d;r.addListener=d;r.once=d;r.off=d;r.removeListener=d;r.removeAllListeners=d;r.emit=d;r.binding=function(e){throw new Error("process.binding is not supported")};r.cwd=function(){return"/"};r.chdir=function(e){throw new Error("process.chdir is not supported")};r.umask=function(){return 0}},{}],4:[function(e,t,n){t.exports={name:"async-try-catch",version:"0.2.1",description:"Async try catch",main:"lib/AsyncTryCatch.js",directories:{test:"test"},dependencies:{},devDependencies:{browserify:"^13.0.1","expect.js":"^0.3.1",jshint:"^2.9.2",mocha:"^2.5.3","nextgen-events":"^0.5.16","uglify-js":"^2.6.2"},scripts:{test:"mocha -R dot"},repository:{type:"git",url:"https://github.com/cronvel/async-try-catch.git"},keywords:["async","try","catch"],author:"Cédric Ronvel",license:"MIT",bugs:{url:"https://github.com/cronvel/async-try-catch/issues"},copyright:{title:"Async Try-Catch",years:[2015,2016],owner:"Cédric Ronvel"}}},{}]},{},[1])(1)});
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.AsyncTryCatch=e()}})(function(){var e,t,n;return function r(e,t,n){function s(i,a){if(!t[i]){if(!e[i]){var c=typeof require=="function"&&require;if(!a&&c)return c(i,!0);if(o)return o(i,!0);var p=new Error("Cannot find module '"+i+"'");throw p.code="MODULE_NOT_FOUND",p}var y=t[i]={exports:{}};e[i][0].call(y.exports,function(t){var n=e[i][1][t];return s(n?n:t)},y,y.exports,r,e,t,n)}return t[i].exports}var o=typeof require=="function"&&require;for(var i=0;i<n.length;i++)s(n[i]);return s}({1:[function(e,t,n){(function(n,r){"use strict";function s(){throw new Error("Use AsyncTryCatch.try() instead.")}t.exports=s;s.prototype.__prototypeUID__="async-try-catch/AsyncTryCatch";s.prototype.__prototypeVersion__=e("../package.json").version;if(r.AsyncTryCatch){if(r.AsyncTryCatch.prototype.__prototypeUID__==="async-try-catch/AsyncTryCatch"){var o=s.prototype.__prototypeVersion__.split(".");var i=r.AsyncTryCatch.prototype.__prototypeVersion__.split(".");if(i[0]!==o[0]||o[0]==="0"&&i[1]!==o[1]){throw new Error("Incompatible version of AsyncTryCatch already installed on global.AsyncTryCatch: "+r.AsyncTryCatch.prototype.__prototypeVersion__+", current version: "+s.prototype.__prototypeVersion__)}}else{throw new Error("Incompatible module already installed on global.AsyncTryCatch")}}else{r.AsyncTryCatch=s;r.AsyncTryCatch.stack=[];r.AsyncTryCatch.substituted=false;r.AsyncTryCatch.NextGenEvents=[]}if(n.browser&&!r.setImmediate){r.setImmediate=function a(e){return setTimeout(e,0)};r.clearImmediate=function c(e){return clearTimeout(e)}}if(!r.Vanilla){r.Vanilla={}}if(!r.Vanilla.setTimeout){r.Vanilla.setTimeout=setTimeout}if(!r.Vanilla.setImmediate){r.Vanilla.setImmediate=setImmediate}if(!r.Vanilla.nextTick){r.Vanilla.nextTick=n.nextTick}s.try=function p(e){var t=Object.create(s.prototype,{fn:{value:e,enumerable:true},parent:{value:r.AsyncTryCatch.stack[r.AsyncTryCatch.stack.length-1]}});return t};s.prototype.catch=function y(e){Object.defineProperties(this,{catchFn:{value:e,enumerable:true}});if(!r.AsyncTryCatch.substituted){s.substitute()}try{r.AsyncTryCatch.stack.push(this);this.fn();r.AsyncTryCatch.stack.pop()}catch(t){r.AsyncTryCatch.stack.pop();this.callCatchFn(t)}};s.prototype.callCatchFn=function d(e){if(!this.parent){this.catchFn(e);return}try{r.AsyncTryCatch.stack.push(this.parent);this.catchFn(e);r.AsyncTryCatch.stack.pop()}catch(e){r.AsyncTryCatch.stack.pop();this.parent.callCatchFn(e)}};s.timerWrapper=function l(e,t){var t,n,s,o=Array.prototype.slice.call(arguments,1);if(typeof t!=="function"||!r.AsyncTryCatch.stack.length){return e.apply(this,o)}n=r.AsyncTryCatch.stack[r.AsyncTryCatch.stack.length-1];s=function(){try{r.AsyncTryCatch.stack.push(n);t.apply(this,arguments);r.AsyncTryCatch.stack.pop()}catch(e){r.AsyncTryCatch.stack.pop();n.callCatchFn(e)}};o[0]=s;return e.apply(this,o)};s.addListenerWrapper=function f(e,t,n,s){var n,o,i;if(typeof n==="object"){s=n;n=s.fn;delete s.fn}if(typeof n!=="function"||!r.AsyncTryCatch.stack.length){return e.call(this,t,n,s)}o=r.AsyncTryCatch.stack[r.AsyncTryCatch.stack.length-1];if(this.__fnToWrapperMap){i=this.__fnToWrapperMap.get(n)}else{Object.defineProperty(this,"__fnToWrapperMap",{value:new WeakMap})}if(!i){i=function(){try{r.AsyncTryCatch.stack.push(o);n.apply(this,arguments);r.AsyncTryCatch.stack.pop()}catch(e){r.AsyncTryCatch.stack.pop();o.callCatchFn(e)}};this.__fnToWrapperMap.set(n,i)}return e.call(this,t,i,s)};s.removeListenerWrapper=function u(e,t,n){if(typeof n==="function"&&this.__fnToWrapperMap){n=this.__fnToWrapperMap.get(n)||n}return e.call(this,t,n)};s.setTimeout=s.timerWrapper.bind(undefined,r.Vanilla.setTimeout);s.setImmediate=s.timerWrapper.bind(undefined,r.Vanilla.setImmediate);s.nextTick=s.timerWrapper.bind(n,r.Vanilla.nextTick);s.addListener=function h(e,t){s.addListenerWrapper.call(this,s.NodeEvents.__addListener,e,t)};s.addListenerOnce=function v(e,t){s.addListenerWrapper.call(this,s.NodeEvents.__addListenerOnce,e,t)};s.removeListener=function m(e,t){s.removeListenerWrapper.call(this,s.NodeEvents.__removeListener,e,t)};s.ngevAddListener=function T(e,t,n){s.addListenerWrapper.call(this,s.NextGenEvents[this.asyncTryCatchId].on,e,t,n)};s.ngevAddListenerOnce=function _(e,t,n){s.addListenerWrapper.call(this,s.NextGenEvents[this.asyncTryCatchId].once,e,t,n)};s.ngevRemoveListener=function E(e,t){s.removeListenerWrapper.call(this,s.NextGenEvents[this.asyncTryCatchId].off,e,t)};s.substitute=function C(){r.AsyncTryCatch.substituted=true;r.setTimeout=s.setTimeout;r.setImmediate=s.setTimeout;n.nextTick=s.nextTick;try{s.NodeEvents=r.EventEmitter||e("events")}catch(t){}if(s.NodeEvents){if(!s.NodeEvents.__addListener){s.NodeEvents.__addListener=s.NodeEvents.prototype.on}if(!s.NodeEvents.__addListenerOnce){s.NodeEvents.__addListenerOnce=s.NodeEvents.prototype.once}if(!s.NodeEvents.__removeListener){s.NodeEvents.__removeListener=s.NodeEvents.prototype.removeListener}s.NodeEvents.prototype.on=s.addListener;s.NodeEvents.prototype.addListener=s.addListener;s.NodeEvents.prototype.once=s.addListenerOnce;s.NodeEvents.prototype.removeListener=s.removeListener}for(var o=0;o<s.NextGenEvents.length;o++){s.NextGenEvents[o].prototype.on=s.ngevAddListener;s.NextGenEvents[o].prototype.addListener=s.ngevAddListener;s.NextGenEvents[o].prototype.once=s.ngevAddListenerOnce;s.NextGenEvents[o].prototype.off=s.ngevRemoveListener;s.NextGenEvents[o].prototype.removeListener=s.ngevRemoveListener}};s.restore=function L(){r.AsyncTryCatch.substituted=false;r.setTimeout=r.Vanilla.setTimeout;r.setImmediate=r.Vanilla.setImmediate;n.nextTick=r.Vanilla.nextTick;if(s.NodeEvents){s.NodeEvents.prototype.on=s.NodeEvents.__addListener;s.NodeEvents.prototype.addListener=s.NodeEvents.__addListener;s.NodeEvents.prototype.once=s.NodeEvents.__addListenerOnce;s.NodeEvents.prototype.removeListener=s.NodeEvents.__removeListener}for(var e=0;e<s.NextGenEvents.length;e++){s.NextGenEvents[e].prototype.on=s.NextGenEvents[e].on;s.NextGenEvents[e].prototype.addListener=s.NextGenEvents[e].on;s.NextGenEvents[e].prototype.once=s.NextGenEvents[e].once;s.NextGenEvents[e].prototype.off=s.NextGenEvents[e].off;s.NextGenEvents[e].prototype.removeListener=s.NextGenEvents[e].removeListener}}}).call(this,e("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../package.json":4,_process:3,events:2}],2:[function(e,t,n){},{}],3:[function(e,t,n){var r=t.exports={};var s=[];var o=false;var i;var a=-1;function c(){if(!o||!i){return}o=false;if(i.length){s=i.concat(s)}else{a=-1}if(s.length){p()}}function p(){if(o){return}var e=setTimeout(c);o=true;var t=s.length;while(t){i=s;s=[];while(++a<t){if(i){i[a].run()}}a=-1;t=s.length}i=null;o=false;clearTimeout(e)}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}}s.push(new y(e,t));if(s.length===1&&!o){setTimeout(p,0)}};function y(e,t){this.fun=e;this.array=t}y.prototype.run=function(){this.fun.apply(null,this.array)};r.title="browser";r.browser=true;r.env={};r.argv=[];r.version="";r.versions={};function d(){}r.on=d;r.addListener=d;r.once=d;r.off=d;r.removeListener=d;r.removeAllListeners=d;r.emit=d;r.binding=function(e){throw new Error("process.binding is not supported")};r.cwd=function(){return"/"};r.chdir=function(e){throw new Error("process.chdir is not supported")};r.umask=function(){return 0}},{}],4:[function(e,t,n){t.exports={name:"async-try-catch",version:"0.3.0",description:"Async try catch",main:"lib/AsyncTryCatch.js",directories:{test:"test"},dependencies:{},devDependencies:{browserify:"^13.0.1","expect.js":"^0.3.1",jshint:"^2.9.2",mocha:"^2.5.3","nextgen-events":"^0.9.5","uglify-js":"^2.6.2"},scripts:{test:"mocha -R dot"},repository:{type:"git",url:"https://github.com/cronvel/async-try-catch.git"},keywords:["async","try","catch"],author:"Cédric Ronvel",license:"MIT",bugs:{url:"https://github.com/cronvel/async-try-catch/issues"},copyright:{title:"Async Try-Catch",years:[2015,2016],owner:"Cédric Ronvel"}}},{}]},{},[1])(1)});

@@ -71,2 +71,3 @@ /*

global.AsyncTryCatch.substituted = false ;
global.AsyncTryCatch.NextGenEvents = [] ;
}

@@ -271,3 +272,14 @@

{
AsyncTryCatch.addListenerWrapper.call( this , AsyncTryCatch.NextGenEvents.on , eventName , fn , options ) ;
/*
console.log( 'this:' , this ) ;
console.log( 'this.asyncTryCatchId:' , this.asyncTryCatchId ) ;
console.log( 'called with:' , Array.from( arguments ) ) ;
try {*/
AsyncTryCatch.addListenerWrapper.call( this , AsyncTryCatch.NextGenEvents[ this.asyncTryCatchId ].on , eventName , fn , options ) ;
/*}
catch ( error ) {
console.error( error ) ;
console.log( index ) ;
throw error ;
}*/
} ;

@@ -278,3 +290,3 @@

{
AsyncTryCatch.addListenerWrapper.call( this , AsyncTryCatch.NextGenEvents.once , eventName , fn , options ) ;
AsyncTryCatch.addListenerWrapper.call( this , AsyncTryCatch.NextGenEvents[ this.asyncTryCatchId ].once , eventName , fn , options ) ;
} ;

@@ -285,3 +297,3 @@

{
AsyncTryCatch.removeListenerWrapper.call( this , AsyncTryCatch.NextGenEvents.off , eventName , fn ) ;
AsyncTryCatch.removeListenerWrapper.call( this , AsyncTryCatch.NextGenEvents[ this.asyncTryCatchId ].off , eventName , fn ) ;
} ;

@@ -295,4 +307,4 @@

// E.g. browser case: Node Events or NextGen Events are not loaded/accessible at time
//if ( global.AsyncTryCatch.substituted ) { return ; }
//if ( global.AsyncTryCatch.substituted ) { return ; }
global.AsyncTryCatch.substituted = true ;

@@ -309,5 +321,7 @@

/*
try {
AsyncTryCatch.NextGenEvents = global.NextGenEvents || require( 'nextgen-events' ) ;
} catch ( error ) {}
*/

@@ -337,2 +351,13 @@ if ( AsyncTryCatch.NodeEvents )

for ( var i = 0 ; i < AsyncTryCatch.NextGenEvents.length ; i ++ )
{
//console.log( 'substituting NextGenEvents' , i ) ;
AsyncTryCatch.NextGenEvents[ i ].prototype.on = AsyncTryCatch.ngevAddListener ;
AsyncTryCatch.NextGenEvents[ i ].prototype.addListener = AsyncTryCatch.ngevAddListener ;
AsyncTryCatch.NextGenEvents[ i ].prototype.once = AsyncTryCatch.ngevAddListenerOnce ;
AsyncTryCatch.NextGenEvents[ i ].prototype.off = AsyncTryCatch.ngevRemoveListener ;
AsyncTryCatch.NextGenEvents[ i ].prototype.removeListener = AsyncTryCatch.ngevRemoveListener ;
}
/*
if ( AsyncTryCatch.NextGenEvents )

@@ -346,2 +371,3 @@ {

}
*/
} ;

@@ -355,4 +381,4 @@

// E.g. browser case: Node Events or NextGen Events are not loaded/accessible at time
//if ( ! global.AsyncTryCatch.substituted ) { return ; }
//if ( ! global.AsyncTryCatch.substituted ) { return ; }
global.AsyncTryCatch.substituted = false ;

@@ -372,2 +398,12 @@

for ( var i = 0 ; i < AsyncTryCatch.NextGenEvents.length ; i ++ )
{
AsyncTryCatch.NextGenEvents[ i ].prototype.on = AsyncTryCatch.NextGenEvents[ i ].on ;
AsyncTryCatch.NextGenEvents[ i ].prototype.addListener = AsyncTryCatch.NextGenEvents[ i ].on ;
AsyncTryCatch.NextGenEvents[ i ].prototype.once = AsyncTryCatch.NextGenEvents[ i ].once ;
AsyncTryCatch.NextGenEvents[ i ].prototype.off = AsyncTryCatch.NextGenEvents[ i ].off ;
AsyncTryCatch.NextGenEvents[ i ].prototype.removeListener = AsyncTryCatch.NextGenEvents[ i ].removeListener ;
}
/*
if ( AsyncTryCatch.NextGenEvents )

@@ -381,4 +417,5 @@ {

}
*/
} ;
{
"name": "async-try-catch",
"version": "0.2.1",
"version": "0.3.0",
"description": "Async try catch",

@@ -15,3 +15,3 @@ "main": "lib/AsyncTryCatch.js",

"mocha": "^2.5.3",
"nextgen-events": "^0.5.16",
"nextgen-events": "^0.9.5",
"uglify-js": "^2.6.2"

@@ -18,0 +18,0 @@ },

@@ -271,2 +271,3 @@ /*

asyncTry( function() {
//emitter.on( 'damage' , function() { console.log( 'Damage event!' ) ; throw new Error( 'argh!' ) ; } ) ;
emitter.on( 'damage' , function() { throw new Error( 'argh!' ) ; } ) ;

@@ -273,0 +274,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