1、howdo
前期说到的howdo(《nodejs学习18:howdo——如何做,一个简易的流程控制,v1.0.0版本发布》)都是服务于nodejs端的,目前已更新到1.1.x版本,已经支持了IE6/7/8/9/10/11、chrome和firefox。
2、howdo VS AJAX
这里以jquery为例:
- // 首先来改装下 $.ajax
- function request(options, callback) {
- $.ajax(options).done(function (json) {
- if (json.error) {
- return callback(new Error(json.error));
- }
- callback(null, json.data);
- }).fail(function (jqXHR) {
- callback(new Error(jqXHR.responseText));
- });
- }
- howdo.task(function (next) {
- request({
- url: '1'
- }, next);
- }).task(function (next) {
- request({
- url: '2'
- }, next);
- }).follow(function (err, data) {
- // do sth...
- });
- howdo.task(function (done) {
- request({
- url: '1'
- }, done);
- }).task(function (done) {
- request({
- url: '2'
- }, done);
- }).together(function (err, data1, data2) {
- // do sth...
- });
3、项目主页