Progress bar and Storage Mechanism
I started this week with implementing a progress bar on the code editor component to indicate the status of a background process. I always thought that progress bars were cool, especially the one used by YouTube. Luckily for me i did not have to built one from scratch. NProgress bar has it all sorted out for me. Being a leech, all i had to do was include the script and use it. On top of basic usage, such as
NProgress.done(), a trickle speed configuration is also possible.
Now that the storage mechanism is almost complete, I think it is worth to mention the overall flow of it.
- Project creation
A default project will be created both in the cloud and cache.
- Opening the project
The project is searched in the cache. If not found, a download request will be sent to cloud storage. Consequently, the project will be sent over to the code editor.
- Update mechanism
There are few events that will trigger an update to the storage backend, which will not be discussed here. The updated project will be sent back to the storage backend and stored in the cache.
- Cloud syncing
To reduce on the cloud request, project will not be uploaded for every minor change.