Skip to content

nathan7/concur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

concur Build Status

lightweight generator/promise utility

Installation

$ npm install then-concur

Example

API

Concur(function*(...)) -> function(...)

Returns a wrapped function. It'll return a promise for the return value of the generator.

$('#button').click(Concur(function*() {
  var data = yield $.ajax(url)
  $('#result').html(data)
  var status = $('#status').html('Download complete.')
  yield status.fadeIn().promise()
  yield sleep(2000)
  status.fadeOut()
}))

Concur.run(function*())

Equivalent to Concur(fn)().

Sync(function*(...)) - > function(...)

A shim that just passes yielded values back in. The synchronous analogue of Concur. Given a synchronous analogue of Concur and synchronous analogues of the other stuff you use, you can really easily implement sync and async versions of your code in one go. For an example, see mkdirp.js.

Sync.run(function*())

Equivalent to Sync(fn)().

License

ISC

About

lightweight generator/promise utility

Resources

Stars

Watchers

Forks

Packages

No packages published