-
promise對象三種狀態 1、未完成(pending) 2、已完成(fulfilled) 3、失敗(rejected)查看全部
-
pipe方法的使用。學會數據流和buffer的操作。查看全部
-
Buffer在初始化的時候長度就被指定了,沒法修改。寫入內容會覆蓋原先的內容。查看全部
-
定制讀寫流和轉換流查看全部
-
利用pipe讀寫數據查看全部
-
利用流復制視頻查看全部
-
var Promise = window.Promise; function promiseAnimate(ball, distance) { return new Promise(function(resolve, reject){ function _animate (ball, distance){ setTimeout(function(){ var marginLeft = parseInt(ball.style.marginLeft, 10); if(marginLeft === distance){ //需要運行 resolve 改為 resolve(); resolve(); return; } else { if(marginLeft < distance){ marginLeft ++; }else{ marginLeft --; } } ball.style.marginLeft = marginLeft + 'px'; _animate(ball, distance); }, 13); }; _animate(ball, distance); }) }; promiseAnimate(ball1, 100) .then(function(){ return promiseAnimate(ball2, 200) }) .then(function(){ return promiseAnimate(ball3, 300) }) .then(function(){ return promiseAnimate(ball3, 150) }) .then(function(){ return promiseAnimate(ball3, 150) }) .then(function(){ return promiseAnimate(ball1, 150) })查看全部
-
buffer用來保存原始數據。流用來暫存和移動數據。流里面傳遞,是以buffer來傳遞的。如果只用buffer的話,當請求太多的時候,有可能一下子就把內存用完了。所以要利用流邊讀邊寫。查看全部
-
為什么運行https.js出錯 提示是沒有ssh_key.pem的文件查看全部
-
HTTPS服務器查看全部
-
Promise使用bluebird庫查看全部
-
重寫轉換流查看全部
-
重寫可寫流查看全部
-
重寫可讀流查看全部
-
pipe能連接readstream和writestream的數據流操作,這樣就不用去關注怎么從輸入流流到輸出流的過程查看全部
舉報
0/150
提交
取消