{"action":"created","issue":{"url":"https://api.github.com/repos/NekR/offline-plugin/issues/62","repository_url":"https://api.github.com/repos/NekR/offline-plugin","labels_url":"https://api.github.com/repos/NekR/offline-plugin/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/NekR/offline-plugin/issues/62/comments","events_url":"https://api.github.com/repos/NekR/offline-plugin/issues/62/events","html_url":"https://github.com/NekR/offline-plugin/issues/62","id":158562944,"number":62,"title":"Suggest add a uninstall function","user":{"login":"ericfong","id":237028,"avatar_url":"https://avatars.githubusercontent.com/u/237028?v=3","gravatar_id":"","url":"https://api.github.com/users/ericfong","html_url":"https://github.com/ericfong","followers_url":"https://api.github.com/users/ericfong/followers","following_url":"https://api.github.com/users/ericfong/following{/other_user}","gists_url":"https://api.github.com/users/ericfong/gists{/gist_id}","starred_url":"https://api.github.com/users/ericfong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericfong/subscriptions","organizations_url":"https://api.github.com/users/ericfong/orgs","repos_url":"https://api.github.com/users/ericfong/repos","events_url":"https://api.github.com/users/ericfong/events{/privacy}","received_events_url":"https://api.github.com/users/ericfong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-05T16:43:20Z","updated_at":"2016-06-12T04:41:10Z","closed_at":null,"body":"The code that I used to uninstall sw\r\n\r\n```\r\n  if ('serviceWorker' in navigator) {\r\n    navigator.serviceWorker.getRegistrations().then(registrations => {\r\n      for (const registration of registrations) {\r\n        registration.unregister()\r\n      }\r\n    })\r\n    caches.keys().then(keyList => {\r\n      return Promise.all(keyList.map(key => {\r\n        return caches.delete(key)\r\n      }))\r\n    })\r\n  }\r\n```"},"comment":{"url":"https://api.github.com/repos/NekR/offline-plugin/issues/comments/225409873","html_url":"https://github.com/NekR/offline-plugin/issues/62#issuecomment-225409873","issue_url":"https://api.github.com/repos/NekR/offline-plugin/issues/62","id":225409873,"user":{"login":"NekR","id":1189265,"avatar_url":"https://avatars.githubusercontent.com/u/1189265?v=3","gravatar_id":"","url":"https://api.github.com/users/NekR","html_url":"https://github.com/NekR","followers_url":"https://api.github.com/users/NekR/followers","following_url":"https://api.github.com/users/NekR/following{/other_user}","gists_url":"https://api.github.com/users/NekR/gists{/gist_id}","starred_url":"https://api.github.com/users/NekR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NekR/subscriptions","organizations_url":"https://api.github.com/users/NekR/orgs","repos_url":"https://api.github.com/users/NekR/repos","events_url":"https://api.github.com/users/NekR/events{/privacy}","received_events_url":"https://api.github.com/users/NekR/received_events","type":"User","site_admin":false},"created_at":"2016-06-12T04:41:10Z","updated_at":"2016-06-12T04:41:10Z","body":"> But I think we should have a way to revert the app to a normal mode in case anything happened.\r\n\r\nWhat for example?\r\n\r\n> Or do we have any reference steps to nicely uninstall service worker and caches?\r\n\r\nThere is no special way to \"truly uninstall\" ServiceWorker. Since SW is a scriptable thing, correct uninstallation depends on its implementation.\r\nI think good way to handle it to send a message to SW telling it to \"unregister\". Then SW will put itself in inert state (will stop handling any request), will delete all its caches and then will unregister itself (`registration.unregister()`).\r\n\r\nBut I still do not see any special reason to have this API. Even if there is some sense in it, it won't be in priority in many next releases, because there are more important things right now.\r\n\r\nBut i'll keep this open and if you have any reason for this API to exists, please leave them here. Any feedback is welcome. Thanks!"}}
{"actor":{"display_login":"NekR"}}