node.js - bluebird中的.cancel方法
黄舟
黄舟 2017-04-17 13:43:46
0
1
698
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

membalas semua(1)
阿神

默认情况下是关闭的,加上Promise.config({cancellation:true});这句即可。官方文档里有:

.cancel js .cancel() -> undefined Cancel this promise. Will not do anything if this promise is already settled or if the Cancellation feature has not been enabled. See Cancellation for how to use cancellation.

Cancellation Cancellation has been redesigned for bluebird 3.x, any code that relies on 2.x cancellation semantics won't work in 3.x. The cancellation feature is by default turned off, you can enable it using Promise.config.

demo:

结果

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan