<!DOCTYPE html> <html lang="en"> <head> <title>xmlhttprequest ajax demo</title> <script type ="text/javascript" language ="javascript" > var req; //定义变量,用来创建xmlhttprequest对象 function creatR…
简单的co用例: var co=require("co") class view{ constructor(){ co(function*(){ var p1=this.ajax1() var p2=this.ajax2() try{ var result=yield [p1,p2] console.log(result) }catch (err){ console.info(err) } }.bind(this)) } ajax1(){ return new Promise(func…