awaitajax
Turns Node http.request
into single-callback form, for use with await/defer
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 AjaxawaitGet url: "https://www.google.com"defer errresponse
Serial
await AjaxawaitQueuedGet url: "https://www.google.com"defer errresponseawait AjaxawaitQueuedGet url: "http://siteaftergoogle.com"defer errresponse
License
MIT
Copyright 2014-2016 Charles Phillips