I recently decided to use a promise mechanism to solve interactions with the user (clicks, keyboard input), and I was wondering if I was missing the point of promises.
For instance the algorithm would look like this
- launch main menu (function that returns a promise)
- then (takes a param input, sets some external data according to the input)
- then (waits for a series of clicks)
- then (navigate to another menu, also returning a promise)
- catch (something was rejected -> then launch everything again from start)
It is a cycle, meaning that if it fails somewhere, it starts all again. I'm wondering if made a total idiot of myself with this decision or if I'm actually doing promises right, or almost but not quite.
Can you enlighten me please?