Skip to content

anhldbk/callsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

A simple library for de-async callback functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published