1.简单的promise: //极简promise雏形 function Promise(fn){ var value = null; callbacks = [];//callback为数组,因为可以同时有很多个回调 this.then = function(onFulfilled){ callbacks.push(onFulfilled); } function resolve(value){ callbacks.forEach(function(callback){ callback(va