New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

callstackjs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callstackjs - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

69

callStack.js

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

"use strict";
/**!

@@ -11,13 +9,17 @@ * Call stack controller

(function (factory){
if( typeof define === "function" && define.amd ){
define("callStack", [], factory);
}
else if( typeof module != "undefined" && typeof module.exports != "undefined" ){
module.exports = factory();
}
else {
window["callStack"] = factory();
}
"use strict";
if( typeof define === "function" && define.amd ){
define("callStack", [], factory);
}
else if( typeof module != "undefined" && typeof module.exports != "undefined" ){
module.exports = factory();
}
else {
window["callStack"] = factory();
}
})(function (){
var _pid;
"use strict";
var _pid; // immediate id
var _order = ['default'];

@@ -45,23 +47,6 @@ var _pause = false;

var _setImmediate = (function (){
return (
window.setImmediate
|| window.requestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.mozRequestAnimationFrame
|| function (fn){ window.setTimeout(fn, 0); }
);
})();
var _setImmediate = window.setImmediate || function (fn){ window.setTimeout(fn, 0); };
var _clearImmediate = window.clearImmediate || window.clearTimeout;
var _clearImmediate = (function (){
return (
window.clearImmediate
|| window.cancelAnimationFrame
|| window.webkitCancelAnimationFrame
|| window.mozCancelAnimationFrame
|| window.clearTimeout
);
})();
/**

@@ -120,4 +105,6 @@ * Checking the call in stack[, and filtering by uniq].

function _walkStackTick(){
_clearImmediate(_pid);
_pid = _setImmediate(_walkStack);
if( _pid === void 0 || callStack.debounce === true ){
_clearImmediate(_pid);
_pid = _setImmediate(_walkStack);
}
}

@@ -131,2 +118,4 @@

function _walkStack(){
_pid = void 0;
if( _pause === false ){

@@ -198,2 +187,7 @@ var name, stack, i, n, callee, s = 0, sn = _order.length, ctx, fn, args;

if( callStack.disabled ){
return fn;
}
return function (){

@@ -395,6 +389,13 @@ if( !opts.uniq || _ifNotInStack(stack.calls, fn, arguments, opts.uniq) ){

/**
* Debounce flag
* @type {Boolean}
*/
callStack.debounce = false;
// @export
callStack.version = '0.3.0';
callStack.version = '0.4.0';
return callStack;
});

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

/*! callStack 0.3 - MIT | git://github.com/rubaxa/callStack.git */
"use strict";(function(n){"function"==typeof define&&define.amd?define("callStack",[],n):"undefined"!=typeof module&&module.exports!==void 0?module.exports=n():window.callStack=n()})(function(){function n(n,t,i,a){for(var r,o=n.length;o--;)if(r=n[o],r.fn===t)return"once"===a?(n.splice(o,1),!0):e(r.args,i);return!0}function e(n,e){if(n.length!==e.length)return!0;for(var t=s(n.length,e.length);t--;)if(n[t]!==e[t])return!0;return!1}function t(){h(o),o=w(i)}function i(){if(c===!1){for(var n,e,t,i,a,r,o,s,d=0,w=u.length;w>d;d++)if(n=u[d],e=l[n],void 0!==e&&e.paused===!1)for(e=e.calls,l[n].calls=[],t=0,i=e.length;i>t;t++)switch(a=e[t],r=a.ctx,o=a.fn,s=a.args,s.length){case 0:o.call(r);break;case 1:o.call(r,s[0]);break;case 2:o.call(r,s[0],s[1]);break;case 3:o.call(r,s[0],s[1],s[2]);break;case 4:o.call(r,s[0],s[1],s[2],s[3]);break;default:o.apply(r,s)}for(t=f.length;t--;)f[t]()}}function a(e,i,a){var r=this;return"string"==typeof i?e[i]=this.wrap(e,e[i],a):(void 0!==i&&i instanceof Function||(a=i,i=e,e=null),a=a||{uniq:!1,weight:0},function(){if(!a.uniq||n(r.calls,i,arguments,a.uniq)){var o=r.calls;o.push({fn:i,ctx:e,args:arguments,weight:0|a.weight}),0!==a.weight&&d(o),t()}})}function r(n){return void 0==l[n]&&(l[n]={calls:[],paused:!1,wrap:a,add:function(n,e,t){this.wrap(n,e,t)()},pause:function(){this.paused=!0},unpause:function(){this.paused=!1},clear:function(){this.calls=[]}},u.push(n)),l[n]}var o,u=["default"],c=!1,l={},f=[],s=Math.max,d=function(n){var e,t=n.length;if(t>1)for(;t-->1&&n[t].weight>n[t-1].weight;)e=n[t],n[t]=n[t-1],n[t-1]=e},w=function(){return window.setImmediate||window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(n){window.setTimeout(n,0)}}(),h=function(){return window.clearImmediate||window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.clearTimeout}();return r.wrap=function(n,e,t){return r("default").wrap(n,e,t)},r.add=function(n,e,t){r("default").add(n,e,t)},r.tick=function(n){f.push(n)},r.untick=function(n){for(var e=f.length;e--;)if(f[e]===n){f.splice(e,1);break}},r.tick.one=function(n){r.tick(function e(){r.untick(e),n()})},r.order=function(){for(var n,e=arguments,t=e.length;t--;)for(n=u.length;n--;)if(u[n]===e[t]){u.splice(n,1);break}u.splice.apply(u,[1,0].concat([].slice.call(e)))},r.pause=function(){c=!0},r.unpause=function(){c=!1,t()},r.clear=function(n){r(n||"default").clear()},r.override=function(n,e,t){return"string"==typeof e?n[e]=r.override(n,n[e],t):(void 0===t&&(t=e,e=n),t(e))},r.version="0.3",r});
/*! callStack 0.4.0 - MIT | git://github.com/rubaxa/callStack.git */
(function(n){"use strict";"function"==typeof define&&define.amd?define("callStack",[],n):"undefined"!=typeof module&&module.exports!==void 0?module.exports=n():window.callStack=n()})(function(){"use strict";function n(n,t,i,a){for(var c,u=n.length;u--;)if(c=n[u],c.fn===t)return"once"===a?(n.splice(u,1),!0):e(c.args,i);return!0}function e(n,e){if(n.length!==e.length)return!0;for(var t=s(n.length,e.length);t--;)if(n[t]!==e[t])return!0;return!1}function t(){(void 0===u||c.debounce===!0)&&(p(u),u=h(i))}function i(){if(u=void 0,o===!1){for(var n,e,t,i,a,c,s,d,h=0,p=r.length;p>h;h++)if(n=r[h],e=l[n],void 0!==e&&e.paused===!1)for(e=e.calls,l[n].calls=[],t=0,i=e.length;i>t;t++)switch(a=e[t],c=a.ctx,s=a.fn,d=a.args,d.length){case 0:s.call(c);break;case 1:s.call(c,d[0]);break;case 2:s.call(c,d[0],d[1]);break;case 3:s.call(c,d[0],d[1],d[2]);break;case 4:s.call(c,d[0],d[1],d[2],d[3]);break;default:s.apply(c,d)}for(t=f.length;t--;)f[t]()}}function a(e,i,a){var u=this;return"string"==typeof i?e[i]=this.wrap(e,e[i],a):(void 0!==i&&i instanceof Function||(a=i,i=e,e=null),a=a||{uniq:!1,weight:0},c.disabled?i:function(){if(!a.uniq||n(u.calls,i,arguments,a.uniq)){var c=u.calls;c.push({fn:i,ctx:e,args:arguments,weight:0|a.weight}),0!==a.weight&&d(c),t()}})}function c(n){return void 0==l[n]&&(l[n]={calls:[],paused:!1,wrap:a,add:function(n,e,t){this.wrap(n,e,t)()},pause:function(){this.paused=!0},unpause:function(){this.paused=!1},clear:function(){this.calls=[]}},r.push(n)),l[n]}var u,r=["default"],o=!1,l={},f=[],s=Math.max,d=function(n){var e,t=n.length;if(t>1)for(;t-->1&&n[t].weight>n[t-1].weight;)e=n[t],n[t]=n[t-1],n[t-1]=e},h=window.setImmediate||function(n){window.setTimeout(n,0)},p=window.clearImmediate||window.clearTimeout;return c.wrap=function(n,e,t){return c("default").wrap(n,e,t)},c.add=function(n,e,t){c("default").add(n,e,t)},c.tick=function(n){f.push(n)},c.untick=function(n){for(var e=f.length;e--;)if(f[e]===n){f.splice(e,1);break}},c.tick.one=function(n){c.tick(function e(){c.untick(e),n()})},c.order=function(){for(var n,e=arguments,t=e.length;t--;)for(n=r.length;n--;)if(r[n]===e[t]){r.splice(n,1);break}r.splice.apply(r,[1,0].concat([].slice.call(e)))},c.pause=function(){o=!0},c.unpause=function(){o=!1,t()},c.clear=function(n){c(n||"default").clear()},c.override=function(n,e,t){return"string"==typeof e?n[e]=c.override(n,n[e],t):(void 0===t&&(t=e,e=n),t(e))},c.debounce=!1,c.version="0.4.0",c});

@@ -33,2 +33,6 @@ 'use strict';

version: {
src: '<%= pkg.exportName %>.js'
},
qunit: {

@@ -52,2 +56,3 @@ files: ['tests/**/*.html']

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-version');
grunt.loadNpmTasks('grunt-contrib-jshint');

@@ -63,3 +68,3 @@ grunt.loadNpmTasks('grunt-contrib-qunit');

// Default task.
grunt.registerTask('default', ['test', 'uglify']);
grunt.registerTask('default', ['version', 'test', 'uglify']);
};
{
"name": "callstackjs",
"exportName": "callStack",
"version": "0.3.0",
"version": "0.4.0",
"devDependencies": {
"grunt": "~0.4.0",
"grunt-version": "*",
"grunt-contrib-jshint": "~0.2.0",

@@ -8,0 +9,0 @@ "grunt-contrib-qunit": "~0.2.0",

@@ -219,1 +219,55 @@ module('callStack');

});
test('disabled', function (){
callStack.disabled = true;
var log = [];
var obj = {
baz: function (a, b, c){
log.push('baz'+(a + b + c));
}
};
var bar = callStack.wrap(function (){ log.push('bar'); });
var baz = callStack('bbb').wrap(obj, 'baz');
callStack('aaa').add(function (){ log.push('foo'); });
bar();
obj.baz(1, 2, 3);
equal(log.join('->'), 'foo->bar->baz6');
callStack.disabled = false;
});
/*
test('batch', function (){
var log = [], state = [];
callStack('foo').add(function (){ log.push(4); });
callStack.add(function (){ log.push(2); });
callStack.add(function (){ log.push(1); }, { weight: 100 });
callStack('foo').add(function (){ log.push(3); });
// @test
stop();
callStack.on('default', function (){
state.push(2);
equal(log.join('->'), '1->2->4->3');
});
callStack.on('default', function (){
state.push(1);
equal(log.join('->'), '1->2');
});
callStack.tick.one(function (){
start();
equal(state.join('->'), '1->2');
});
});
*/
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