Skip to content

gryor/await-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

await-promise

Install

npm i --save await-promise

Example

import await from 'await-promise';

function timer(name, time) {
	return new Promise(function(success, fail) {
		setTimeout(() => success(name), time*1000);
	});
}

function *myAsyncFunction(a, b, c) {
	yield timer(a, 3);
	yield timer(b, 1);
	yield timer(c, 2);
}

await(myAsyncFunction('Please', 'hit', 'me!')).then(console.log);
// [ 'Please', 'hit', 'me!' ]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published