![]() ![]() This will log status messages as the Service Worker identifies whether it is up-to-date or if an update is available, as it starts downloading a new version, when it's ready to use, and so on. If you want to check the status of the Service Worker's saving or updating of your project, you can check the browser console. Before then if the user goes offline, it hasn't finished saving yet so will not work offline. From that point on the project can work offline. This runs the first time the project is loaded after it has finished being saved to disk. ![]() The Browser object also has an On offline ready trigger. Clearing your browser cache and inspecting the server's HTTP response headers can help identify this. If it allows the files to be permanently cached, you may never see an update happen. For example if your server sends offline.json with a caching header that says "you can keep reading this file from the cache for 24 hours", then you won't see an update happen for another 24 hours. If you are not seeing an update happen even after uploading a whole new set of files including offline.json, check the caching configuration of your web server. The simplest way to remember to do this is to simply always re-upload all files after exporting. (The offline.json file must have changed for the browser to check for an update, and Construct adds a timestamp to the top of the file to ensure it always changes.) If you're updating even just one file of your project, you must also re-upload the exported offline.json file - every time! Otherwise the browser will assume nothing has changed and won't bother downloading the update. When On update ready triggers, you might want to show a message saying an update is ready, and display a button which reloads the page when clicked. You could show a text object saying "Downloading an update." to notify the user an update is being downloaded after On update found triggers. This allows you to easily make a simple auto-updater for your project. However, you probably don't want to interrupt them if they're already interacting with it. If this triggers on the project's title screen, you might want to prompt the user to reload the page (using the Browser's Reload action) so they're seeing the latest and greatest version. On update ready triggers when the download has finished and the new version is ready to be loaded. It is not ready to use yet, though - it's just started downloading the update. On update found triggers as soon as the browser detects a new version in the background. The Browser object has two conditions to detect this happening: On update found and On update ready. Until then, the user keeps using the old version. Then, next time you load the project (including refreshing the page), the browser loads the new version. If you've uploaded a new version, the browser downloads it and saves it to disk. ![]() However, as the project is running, it checks for an update in the background. If you're online and you load the project, the browser loads from disk instantly as before. You might wonder: if the project is always loaded from disk, how do you update it? Your imported project files are cached for offline use, too. This means even if you're offline, you can still load and view the project. Nothing is downloaded at all! Usually that means the project loads very quickly as well. After that, if you load the web page again, it loads from disk. Upon loading your project on the web (and assuming your server is using HTTPS), the browser will save your entire project to disk after loading it for the first time. However we recommend to leave offline support enabled for release. This can be useful for testing purposes, as otherwise the offline caching can make it slower to test updates. You can uncheck Offline support when exporting to disable offline support. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |