简体   繁体   中英

Q return a resolved promise?

I am glancing over some example code that uses promise npm module and returns a resolved promise like so return promise.resolve(true); .

Since we use Q, is it possible to do the same with Q?

I think the solution your looking for is

> q(true).then(console.log.bind(console));
> true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM