<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                **簡易Promise:**簡易`Promise`并不完全符合`Promise/A+`規范,但面試時能寫出簡易`Promise`算是已經過關了。 ``` function MyPromise(fn) { let _this = this _this.state = 'pending'_this.value = null _this.reson = null _this.onFulfilledCallbacks = [] _this.onRejectedCallbacks = [] function resolve(value) { if (_this.state === 'pending') { _this.value = value _this.state = 'fulled' _this.onFulfilledCallbacks.map(fn = >fn()) } } function reject(reson) { if (_this.state === 'pending') { _this.reson = reson _this.state = 'rejected' _this.onRejectedCallbacks.map(fn = >fn()) } } fn(resolve, reject) } MyPromise.prototype.then = function(suc, err) { let _this = this if (_this.state === 'pending') { _this.onFulfilledCallbacks.push(() = >{ suc(_this.value); }); _this.onRejectedCallbacks.push(() = >{ err(_this.value); }) } if (_this.state === 'fulled') { suc(_this.value) } if (_this.state === 'rejected') { err(_this.reson) } } let p = new MyPromise(function(resolve, reject) { setTimeout(() = >{ resolve('oj8k') }, 1000) }) p.then(suc = >{ console.log(suc) }, err = >{ console.log(err) }); ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看