It Can Be Done!
until after it is released. void release() • Release the protection on the protected value • Often done automatically through RAII types void retire(T* p) • Indicate that an object has been removed from0 码力 | 45 页 | 5.12 MB | 5 月前3JavaScript Promise迷你书(中文版)
....................................................................... 76 什么是 Promise.prototype.done ? ................................................................................ 85 Promise和方法链(method function () { it('should use `done` for test', function (done) { setTimeout(function () { assert(true); done(); }, 0); 35 http://mochajs }); }); context('When promise object', function () { it('should use `done` for test?', function (done) { var promise = Promise.resolve(1); // このテストコードはある欠陥があります0 码力 | 112 页 | 1010.02 KB | 1 年前3Pro Git 2nd Edition 2.1.413
system to basically dominating commercial and open source version control. I’m happy that Pro Git has done so well and has also been able to be one of the few technical books on the market that is both quite as Git’s killer feature. Here you’ll learn what truly sets Git apart from the pack. When you’re done, you may feel the need to spend a quiet moment pondering how you lived before Git branching was part over in full detail various distributed workflows and how to accomplish them with Git. When you are done with this chapter, you should be able to work expertly with multiple remote repositories, use Git0 码力 | 731 页 | 21.49 MB | 1 年前3Pro Git 2nd Edition 2.1.413
system to basically dominating commercial and open source version control. I’m happy that Pro Git has done so well and has also been able to be one of the few technical books on the market that is both quite described as Git’s killer feature. Here you’ll learn what truly sets Git apart from the pack. When you’re done, you may feel the need to spend a quiet moment pondering how you lived before Git branching was part over in full detail various distributed workflows and how to accomplish them with Git. When you are done with this chapter, you should be able to work expertly with multiple remote repositories, use Git0 码力 | 501 页 | 17.96 MB | 1 年前3Pro Git 2nd Edition 2.1.413
system to basically dominating commercial and open source version control. I’m happy that Pro Git has done so well and has also been able to be one of the few technical books on the market that is both quite as Git’s killer feature. Here you’ll learn what truly sets Git apart from the pack. When you’re done, you may feel the need to spend a quiet moment pondering how you lived before Git branching was part over in full detail various distributed workflows and how to accomplish them with Git. When you are done with this chapter, you should be able to work expertly with multiple remote repositories, use Git0 码力 | 691 页 | 13.35 MB | 1 年前3JavaScript Promiseの本 v1
raceとdelayによるXHRのキャンセル ..................................................... 78 Promise.prototype.done とは何か? .................................................................. 88 1 JavaScript Promiseの本 js var assert = require('assert'); it('should use `done` for test', function (done) { setTimeout(function () { assert(true); done(); }, 0); }); このテストを basic-test.js というファイル名で作成し、 basic-test.js Mochaは it の仮引数に done のように指定してあげると、 done() が呼ばれるまでテス トの終了を待つことで非同期のテストをサポートしています。 Mochaでの非同期テストは以下のような流れで実行されます。 it("should use `done` for test", function (done) { setTimeout(function0 码力 | 115 页 | 1.06 MB | 1 年前3阮一峰 《ECMAScript 6入门》 第三版
_action.get(this)(); } } } const c = new Countdown(2, () => console.log('DONE')); c.dec() c.dec() // DONE 上面代码中, Countdown 类的两个内部属性 _counter 和 _action ,是实例的 弱引用,所以如果删除实例,它们也就随之消失,不会造成内存泄漏。 function timeout(ms) { return new Promise((resolve, reject) => { setTimeout(resolve, ms, 'done'); }); } timeout(100).then((value) => { console.log(value); }); 上面代码中, timeout 方法返回一个 API提供的方法不是很多,有些有用的方法可以自己部署。下面介 绍如何部署两个不在ES6之中、但很有用的方法。 done() Promise对象的回调链,不管以 then 方法或 catch 方法结尾,要是最后一个方 法抛出错误,都有可能无法捕捉到(因为Promise内部的错误不会冒泡到全局)。 因此,我们可以提供一个 done 方法,总是处于回调链的尾端,保证抛出任何可能 出现的错误。 asyncFunc()0 码力 | 679 页 | 2.66 MB | 1 年前3JavaScript Promiseの本 v2
.................................................. 83 1 JavaScript Promiseの本 Promise.prototype.done とは何か? .................................................................. 93 Promiseとメソッドチェーン .... basic-test.js const assert = require("assert"); it("should use `done` for test", (done) => { setTimeout(() => { assert(true); done(); }, 0); }); このテストを basic-test.js というファイル名で作成し、 先ほどインストールしたMocha basic-test.js Mochaは it の仮引数に done のように指定してあげると、 done() が呼ばれるまでテス トの終了を待つことで非同期のテストをサポートしています。 Mochaでの非同期テストは以下のような流れで実行されます。 it("should use `done` for test", (done) => { setTimeout(() =>0 码力 | 137 页 | 1.17 MB | 1 年前3Working with Asynchrony Generically: A Tour of C++ Executors
transforms the result value of the operation with a function. upon_[error|done](sender, fn) → sender … transforms the error and done signals with a function. let_[value|…](sender, fn) → sender … passes the connected (forks the execution graph). done_as_optional(sender) → sender … commutes the done signal into a nullopt. done_as_error(sender, error) → sender … commutes the done signal into an error.19 SENDER/RECEIVER then(sender, fn) -> sender22 SHAPE OF A RECEIVER RECEIVER set_value(values... ) set_error(error ) set_done() Operation state notifies receiver by calling one of these exactly once.23 CONCEPTUAL BUILDING0 码力 | 121 页 | 7.73 MB | 5 月前3Tornado 6.0 Documentation
set_result(f.result().body) fetch_future.add_done_callback(on_fetch) return my_future Notice that the coroutine returns its Future before the fetch is done. This is what makes coroutines asynchronous send(self.next) def callback(f): self.next = f.result() self.run() future.add_done_callback(callback) The decorator receives a Future from the generator, waits (without blocking) for Queue maintains a count of unfinished tasks, which begins at zero. put increments the count; task_done decrements it. In the web-spider example here, the queue begins containing only base_url. When a0 码力 | 869 页 | 692.83 KB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100