Preload
property in the options.js
:service-worker.js
file. There you'll need to take notice of the three properties: name
, version
.name
and version
properties are used to control the cache of your game, change the name
to your game's name, with no spaces or special characters and the version
property as a control.version
as a control means? changing the version will force all the assets to re-cache, useful specially when you make significant changes to them but remember that the cache strategy used will update your files eventually without the need of changing this version. Also the version does not need to be changed when removing/adding files to the cache. Most of the times you won't need to change it at all.options.js
file using the 'ServiceWorkers'
property.file://
and then in the console you'll find an error that says:Failed to register a ServiceWorker: The URL protocol of the current origin ('null') is not supported.
Service Workers are available only when serving your files through a server, once you upload your game this warning will go away. You can also try using a simple server like this one for development:
Web Server for Chrome.
​