-
HTTPS:TSL/SSL查看全部
-
Then方法等待前面的回調函數執行完后在執行查看全部
-
then方法返回promise對象,2個參數分別是成功回調函數和,失敗回調函數。第一個參數是上一個promise的結果,第二個參數是上一個promise失敗的原因查看全部
-
異步通信的解決方案查看全部
-
var Promise = window.Promise function promiseAnimate(ball,distance) { return new Promise(function (resolve,reject) { function _animate() { setTimeout(function () { var marginLeft = parseInt(ball.style.marginLeft, 10) if (marginLeft === distance){ return resolve(); }else{ if (marginLeft > distance){ marginLeft -- }else{ marginLeft ++ } ball.style.marginLeft = marginLeft+'px'; _animate() } },13) } _animate() }) }查看全部
-
promise A與A+規范查看全部
-
function promiseAnimate(ball,distance){ console.log(ball) return new Promise(function(resolve,reject){ function _animate(){ setTimeout(function(){ console.log("animate") var marginLeft = parseInt(ball.style.marginLeft,10) if(marginLeft == distance){ return resolve() }else{ if(marginLeft < distance)marginLeft ++ else{marginLeft --} } ball.style.marginLeft = marginLeft + "px" _animate() },13 ) } _animate() }) }查看全部
-
ball.style.marginLeft,這樣取屬性必須寫在html中, ball.style.marginLeft = marginLeft +"px"查看全部
-
一個https服務器查看全部
-
<script> var ball1 = document.querySelector(".ball1"); var ball2 = document.querySelector(".ball2"); var ball3 = document.querySelector(".ball3"); function animate(ball, distance, callBack) { setTimeout(function() { var marginLeft = parseInt(window.getComputedStyle(ball, null).marginLeft, 10); if (marginLeft == distance) { callBack(); } else { if (marginLeft < distance) { marginLeft++; } else { marginLeft--; } ball.style.marginLeft = marginLeft + "px"; animate(ball, distance, callBack); } }, 13) } animate(ball1, 100, function() { animate(ball2, 200, function() { animate(ball3, 300, function() { animate(ball3, 150, function() { animate(ball2, 150, function() { animate(ball1, 150) }) }) }) }) }) </script>查看全部
-
writStream._write?查看全部
-
可讀流負責讀取外部數據,并把數據緩存到內部buffer數組;可寫流負責消費數據,從內部buffer數據獲取數據,然后對得到的chunk塊進行處理。查看全部
-
在這里,pipe()方法,會自動的監聽data和end事件。查看全部
-
讀寫文件,并防止爆倉的代碼段查看全部
-
readStream.resume(),事件重啟。查看全部
舉報
0/150
提交
取消