1.0.0 • Published 8 years ago

awaitajax v1.0.0

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

awaitajax

Build Status Coverage Status Dependency Status devDependency Status Downloads

Turns Node http.request into single-callback form, for use with await/defer

NPM

What?

Iced CoffeeScript and tamejs offer the await/defer construct that lends itself well to the node-style async pattern callback(err, response), particularly when using a construct like make_esc from iced error.

awaitajax lets you have your await and easy jQuery.ajax() -style options too. By building on najax http calls can be easily handled in one line.

Background and related modules

awaitajax started as a great exercise in using iced.Rendezvous() and iced.Pipeliner(), the first-callback-wins and serial-call helper features of Iced. The original version was created for TigerJS, an MVC framework for cross-platform Titanium mobile apps built in JavaScript/CoffeeScript. Now I can't live without this pattern in node, mobile apps, and the browser.

Example

Regular

await Ajax.awaitGet {url: "https://www.google.com"}, defer err, response

Serial

await Ajax.awaitQueuedGet {url: "https://www.google.com"}, defer err, response
await Ajax.awaitQueuedGet {url: "http://siteaftergoogle.com"}, defer err, response

License

MIT

Copyright 2014-2016 Charles Phillips

1.0.0

8 years ago

0.9.1

9 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago