code: function Deferred() {
          var that = this
          this.state = 'pending' // resolved rejected
          this.resolvedList = []
          this.resolvedListIndex = 0
          this.rejectedList = []
          this.rejectedListIndex = 0
          this.progressedList = []
          this.progressedListIndex = 0
          this.promise = {
              then: function() {
                  that.then.apply(that, arguments)
                  return this
              },
              'finally': function() {
                  that['finally'].apply(that, arguments)
                  return this
              }
          }
      }
docs: Promise 实现