mojo icon indicating copy to clipboard operation
mojo copied to clipboard

Small introduction to promises

Open kraih opened this issue 6 years ago • 3 comments

This is very similar to #1119, there is no real documentation in Mojo::Promise. I think it would be nice to explain at the least the basics of how to use promises, their possible states, what returning promises in the ->then(...) callbacks means and so on.

kraih avatar Dec 19 '17 22:12 kraih

Somewhat related: http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Synchronizing-non-blocking-operations talks about promises having the possible states pending, fulfilled or rejected, but I was slightly confused not to find a way to check a promise for these states. I suspect I wouldn’t have wanted to try to do this in the first place, had I understood how best to use promises.

mavit avatar Jan 10 '18 17:01 mavit

I'll try to provide a short introduction to promises with examples and open a pull request for further discussion soon.

lammel avatar Apr 13 '18 21:04 lammel

I've started with the promise states. https://github.com/kraih/mojo/commit/8b3e17b3c7d6da776d67b5dfbece7ea3ae9790d4

kraih avatar May 27 '18 13:05 kraih