recherche

Maison  >  Questions et réponses  >  le corps du texte

node.js - bluebird中的.cancel方法

黄舟黄舟2822 Il y a quelques jours696

répondre à tous(1)je répondrai

  • 阿神

    阿神2017-04-17 13:45:46

    默认情况下是关闭的,加上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:

    结果

    répondre
    0
  • Annulerrépondre