waitress.js :sparkles:
一个精益的JS库,使等待异步调用集合的痛苦变得更小。
例子:
var bootup = new Waitress ( ) ;
$ . ajax ( {
type : "GET" ,
url : "/api/notifications"
} ) . done ( function ( response ) {
bootup . add ( 'notifications' ) ;
} ) ;
$ . ajax ( {
type : "GET" ,
url : "/api/messages"
} ) . done ( function ( response ) {
bootup . add ( 'messages' ) ;
} ) ;
bootup . when ( [ 'notifications' , 'messages' ] ,
1