1.0.0 • Published 8 years ago

callsync v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

Callsync

Overview

Being built on top of deasync, this simple utility is to simplify the process of de-async callback functions.

Install

$ npm install --save callsync

Usage

const callsync = require('callsync')

// Download a resource
// @param url: (String) A valid url
// @param callback: (Function) a function (err, result) to process result
function download(url, callback){
	console.log('Downloading url = ' + url + '...')
	var content = 'hi hi hi' // just fake it
	callback(null, content)
}

var res = callsync( download, null, ['https://github.com/anhldbk/callsync'] )
// err = res[0], result = res[1]

For more usecases, have a look at ./test.js

License

The MIT License (MIT)

1.0.0

8 years ago