
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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*/){
retrun 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
The npm package callstackjs receives a total of 7 weekly downloads. As such, callstackjs popularity was classified as not popular.
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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.