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

blocking

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blocking

Pseudo-Blocking Async Javascript Functions

0.0.8
latest
npm
Version published
Weekly downloads
7
16.67%
Maintainers
1
Weekly downloads
 
Created
Source

Blocking.js

Pseudo-Blocking Async Javascript Functions

  • Part of the Radioactive Framework
  • Notifying.js compatible

Installation via NPM

npm install blocking

Quickstart

blocking = require 'blocking'

# an async function
get_name_async = ( id, cb ) -> ...

# trasnsform to a blocking/sync function
get_name = blocking get_name_async

# do something using the sync function
f1 = ->
  # notice that we can call toUpperCase on the value
  # because this function now returns sychronously
  get_name( 8 ).toUpperCase()

# to execute the above function we need to unblock it
f1 = blocking.unblock f1

# and the function is async again
f1 (err, res) -> console.log err, res

FAQs

Package last updated on 09 Aug 2013

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