Skip to content

noneven/pjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

简易的异步流程控制器

API

var pjs = require("../src/pjs.js");

setTimeout(function(){
	pjs.trigger("A", "dataA")
},1000)

setTimeout(function(){
	pjs.trigger("B", "dataB")
},2000)

setTimeout(function(){
	pjs.trigger("C", "dataC")
},1500)

pjs.when(["A", "B"], function(valMap){
	/*把A和B的返回值传到回调函数里面*/
	console.log(valMap)
	console.log("A-B-Done!")
})

pjs.when(["A", "C"], function(valMap){
	console.log(valMap)
	console.log("A-C-Done!")
})

//setTimeout可以是ajax等异步操作

About

一个简易的异步流程控制器

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published