Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-box

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

async-box

Your main application object with promise async api API

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source

AsyncBox

AsyncBox is a library for your main application object, it supports Sync and Async APIs

App object provides own API plus evented EventEmitter API

Usage:

var AsyncBox = require('async-box');

var app = new AsyncBox();

app.respondAsync('some-request-name', function(requestData) {
    // response can be any plain JavaScript value or object or ...
    return 'response-text';
});

app.respondAsync('async-promise-request', function(requestData) {
    // ... or Promise
    return new Promise(function(resolve, reject) {
        resolve('response-promise');
    });
});

app.requestAsync('some-request-name').then(function(response) {
    console.log(response); // -> response-text
});

app.requestAsync('async-promise-request').then(function(response) {
    console.log(response); // -> response-promise
});

TODO: Batch API example
TODO: Sync API example

Keywords

FAQs

Package last updated on 27 Oct 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

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