Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
callstackjs
Advanced tools
JavaScript call stack controller.
:Object
, fn:String
, options:Object
):Function
):Function
:Object
, fn:String
):Function
:Object
, fn:Function
):Function
:Object
, fn:String
, options:Object
):Function
:String
):Stack
— get call stack by name:String
, secondName:String
[, etc]):String
):Object
, method:String
, callback:Function
):Function
var MyView = framework.View.extend({
initialize: function (){
callStack('vis').wrap(this, 'visibility');
callStack('render').wrap(this, 'render', { uniq: 'once' });
},
visibility: function (state){
console.log(this.id+'.vis:', state);
this.$el.css('display', state ? '' : 'none');
},
render: function (){
console.log(this.id+'.render');
this.$el.empty().html( ... );
}
})
callStack.order('render', 'vis');
var viewHeader = new MyView({ id: 'header' });
var viewContent = new MyView({ id: 'content' });
var viewFooter = new MyView({ id: 'footer' });
// (1) Somewhere in the code.
viewHeader.visibility(true);
viewContent.visibility(true);
viewFooter.visibility(true);
// (2)
viewFooter.render(); // (!)
viewHeader.render();
viewContent.render();
// (3)
viewFooter.visibility(false);
viewFooter.render(); // (!!)
Next tick: console
header.render
content.render
footer.render
header.vis: true
content.vis: true
footer.vis: true
footer.vis: false
var module = {
name: "callStack",
toString: function (){
return this.name;
}
};
module.toString(); // "callStack"
// Owerride `toString` method
callStack.override(module, 'toString', function (toStringFn/*Function*/){
return function (){
return '['+ toStringFn.call(this) +']';
};
});
module.toString(); // "[callStack]"
var foo = callStack.wrap(function (){ console.log("foo:", arguments) }, { weight: 100 });
var bar = callStack.wrap(function (){ console.log("bar:", arguments) }, { weight: 10 });
bar(1);
foo(1);
bar(2);
foo(2);
Console:
foo: 1
foo: 2
bar: 1
bar: 2
var foo = callStack.wrap(function (){ console.log("foo:", arguments) }, { uniq: true, weight: 100 });
var bar = callStack.wrap(function (){ console.log("bar:", arguments) }, { uniq: "once" });
foo(1);
bar(1);
foo(2);
foo(2);
bar(1)
bar(1);
foo(3);
foo(3);
foo(1);
bar(5);
Console:
foo: 1
foo: 2
foo: 3
foo: 1
bar: 5
FAQs
JavaScript call stack controller
We found that callstackjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.