#Example #Lightbox #Animation #concurrency #async #await #PromiseAll #Beer
![](https://static.wixstatic.com/media/a27d24_6c8330bbc9d544f2b6ff13222bc181ea~mv2.png/v1/fill/w_976,h_577,al_c,q_90,enc_auto/a27d24_6c8330bbc9d544f2b6ff13222bc181ea~mv2.png)
Demonstrates
Concurrency: async, await, Promise.all
Links for this example
About this example
This example is a simple simulation of a Slot Machine. The user enters their name in the input field, and it's passed to a Lightbox that opens to start the game. The user is greeted by name and is invited to play. Upon completion of a turn at the slot machine, the Lightbox is closed and the result of the game is returned to the Page.
As in a regular slot machine, three images that randomly “spin” determine the outcome of the game. Each image component has its own loop where the images are randomly alternated, and each new image is shown and hidden with randomly timed animation. A Promise.all waits for all three loops to finish and the result of the game can then be determined - if all three images are the same the user is a winner.
Hi @Yisrael (Wix) !
Thanks for this !
I'm wondering if, when a logged user/member of a site play with this kind of game, the result could be saved in a "Member Profile Database" ?
For exemple, if the user win an immaterial gift (like ebook), the gift could be automatically added in his "Member Profile field" and so, the user could download it from his dashboard ?
Thanks for your answer,
Best regards,
Angeline
@Yisrael (Wix) For President 2020 🎉🍻