Service worker and webmanifest

‹ Back

Controller and views

Ornament generates a service_worker_controller and a view for both the webmanifest and the service worker itself.

The webmanifest file will append staging and development flags at the start of the application names so that you can differentiate them when adding to homescreen.


Local development

Due to local development often resulting in service workers being registered and then continued to be used when switching to a different local rails application, you must opt-in to use local service workers. You can do so by executing the following code in your javascript console:

Ornament.localServiceWorkerOptIn();

To opt-out again later on, simply run this code:

Ornament.localServiceWorkerOptOut();

Once opted-out, you will need to unregister your service workers, which can be done in Chrome under the "application" tab in the developer tools.


Disabling service workers

Service workers can be disabled entirely by opening up application.js and disabling the require statement for the service worker code: //= require ornament/register-service-worker