mech-ajax
v0.2.2
Published
Ajax mechanisms.
Downloads
1
Maintainers
Readme
mech-ajax
Mechanisms which support asynchronous ajax calls without the need for fibers or promises.
See Mechanisms Home for more information and other libraries.
Supported Mechanisms
- ajax.get - Submits a get request to a server for a given
uri
.
Supported Mechanisms
ajax.get
ajax.get
makes an ajax GET request against a uri
. It works in conjunction with the core async
mechanism.
Traditionally, asynchronous callbacks are handled using a function:
var httpRequest = new XMLHttpRequest(); // or new ActiveXObject(...);
var strURL = "http://www.example.org/some.file";
// ...
xmlHttpReq.onreadystatechange = function() {
console.log(xmlHttpReq.responseText);
}
With mechanisms and cell scoping:
m.cell("A:1");
m.async(
m.ajax.get("http://www.example.org/some.file"),
m.cellRef("A:1"),
m.writeLn(m.cellGet("A:1"))
).go;
The result of the ajax.get
call is placed into cell A:1
. The value of that cell is then written to the console.
Setup
Using In Your Projects
Change directory to your node ajax.
$ npm install --save mech-ajax
Development
Get Involved!
There are a lot of core mechanisms just waiting to be created. Many of them can be created in a few hours including in-depth tests. Clone mech-library to get started!
Setup
Install:
$ npm install
Continuous test:
$ gulp
Test:
$ gulp webtests
Test Server
Read documentation in gulpfile.js to see how to setup automated web testing.
$ gulp webserver