Skip to content

Commit 523f3e3

Browse files
captDaylightgaearon
authored andcommitted
Updating the Service Worker opt-out documentation (facebook#3108)
1 parent 22120b1 commit 523f3e3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

template/README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -1628,14 +1628,18 @@ that your web app is reliably fast, even on a slow or unreliable network.
16281628
### Opting Out of Caching
16291629
16301630
If you would prefer not to enable service workers prior to your initial
1631-
production deployment, then remove the call to `serviceWorkerRegistration.register()`
1631+
production deployment, then remove the call to `registerServiceWorker()`
16321632
from [`src/index.js`](src/index.js).
16331633
16341634
If you had previously enabled service workers in your production deployment and
16351635
have decided that you would like to disable them for all your existing users,
1636-
you can swap out the call to `serviceWorkerRegistration.register()` in
1637-
[`src/index.js`](src/index.js) with a call to `serviceWorkerRegistration.unregister()`.
1638-
After the user visits a page that has `serviceWorkerRegistration.unregister()`,
1636+
you can swap out the call to `registerServiceWorker()` in
1637+
[`src/index.js`](src/index.js) first by modifying the service worker import:
1638+
```javascript
1639+
import { unregister } from './registerServiceWorker';
1640+
```
1641+
and then call `unregister()` instead.
1642+
After the user visits a page that has `unregister()`,
16391643
the service worker will be uninstalled. Note that depending on how `/service-worker.js` is served,
16401644
it may take up to 24 hours for the cache to be invalidated.
16411645

0 commit comments

Comments
 (0)