🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

exec-stack

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exec-stack

0.1.2
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

ExecStack npm version

Installation

$ npm install exec-stack

Example

var ExecStack = require('exec-stack');
var stack = new ExecStack();

stack.push(function(next) {
    console.log('This is called for every execution of the stack!');
    next();
});

stack.push('event', function(next) {
    console.log('This is called whenever `event` is being executed!');
    next();
});

stack.execute(); 
// OUTPUT: This is called for every execution of the stack!

stack.execute('event');
// OUTPUT: This is called for every execution of the stack!
// OUTPUT: This is called whenever `event` is being executed!

Options

Options are passed to the constructor.

strict (false)

If true, only functions subscribed to the executed event are being called by .execute().

Methods

Optional arguments are written in cursive.

.push(event, callback)

Push a function on the stack. If event is ommited, the callback will be called for every execution of the stack. Returns the position of the item in the stack.

.remove(item)

Removes a specified item from the stack. The item is being referenced by a number representing its position, just like in an array.

.execute(event, callback, context, [...])

Execute the stack in the given context (context is set to an empty object by default). If callback is a function, it will be called when the stack has finished.
Any other argument that is given to .execute() will also be passed to the functions in the stack.

FAQs

Package last updated on 20 Dec 2015

Did you know?

Socket

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.

Install

Related posts