{"id":13807827,"url":"https://github.com/topaxi/ember-service-worker-update-notify","last_synced_at":"2025-08-24T09:21:12.800Z","repository":{"id":24632429,"uuid":"102096244","full_name":"topaxi/ember-service-worker-update-notify","owner":"topaxi","description":"Update notification for service workers","archived":false,"fork":false,"pushed_at":"2024-04-30T23:51:56.000Z","size":809,"stargazers_count":28,"open_issues_count":28,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-01T10:39:38.764Z","etag":null,"topics":["ember","pwa","serviceworker"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/topaxi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-01T09:17:56.000Z","updated_at":"2024-05-30T02:43:52.000Z","dependencies_parsed_at":"2024-06-19T00:22:16.149Z","dependency_job_id":"d4835120-56e7-4cf6-9de5-fdb3d407d666","html_url":"https://github.com/topaxi/ember-service-worker-update-notify","commit_stats":{"total_commits":55,"total_committers":13,"mean_commits":4.230769230769231,"dds":0.5818181818181818,"last_synced_commit":"cbca465e0539c3a0746a7673cc5401f4ebf83fa8"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topaxi%2Fember-service-worker-update-notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topaxi%2Fember-service-worker-update-notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topaxi%2Fember-service-worker-update-notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topaxi%2Fember-service-worker-update-notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/topaxi","download_url":"https://codeload.github.com/topaxi/ember-service-worker-update-notify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254688894,"owners_count":22112514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ember","pwa","serviceworker"],"created_at":"2024-08-04T01:01:30.851Z","updated_at":"2025-05-17T09:40:47.097Z","avatar_url":"https://github.com/topaxi.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":["Service Workers"],"readme":"# ember-service-worker-update-notify\n\nAdds a `service-worker-update-notify` service and `\u003cServiceWorkerUpdateNotify /\u003e` \ncomponent which displays a reload link if the service-worker has found an update.\n\n## Usage\n\n### Using the component \n\nThe component will show a message to the user when the availability of an update\nhas been detected. Overwrite the default message using the component in block form:\n\n```handlebars\n\u003cServiceWorkerUpdateNotify\u003e\n  \u003ca class=\"service-worker-update-notify\" href={{this.router.currentURL}}\u003e\n    A new version is available, click here to update.\n  \u003c/a\u003e\n\u003c/ServiceWorkerUpdateNotify\u003e\n```\n\n### Using the service\n\nThe service allows you to react to an app update in a more programmatic manner, e.g. \nyou could force reload the app. The service emits an `update` event once an update\nhas been detected. Here is an example of an application route that reloads the app\nautomatically:\n\n```js\nimport Route from '@ember/routing/route';\nimport { inject as service } from '@ember/service';\n\nexport default class ApplicationRoute extends Route {\n  @service\n  serviceWorkerUpdateNotify;\n  \n  beforeModel() {\n    this.serviceWorkerUpdateNotify.on('update', () =\u003e {\n      window.location.reload();\n    });\n  }\n}\n```\n\n## Configuration\n\nThe poll interval can be configured in your `config/environment.js` with:\n\n```js\nmodule.exports = function(environment) {\n  let ENV = {\n    'ember-service-worker-update-notify': {\n      pollingInterval: 1200000 // Default is 20min\n    }\n  };\n\n return ENV;\n};\n```\n\n## Testing in Your App\n\nTesting this in your app should mainly be concerned with presence\nand and what it looks like.\n\nDuring testing, the polling will be disabled,\nand the reveal of the \"New version available\" content\nis controlled by a promise set on the `window`.\nIn your tests, two helpers will aid you in asserting\npresence and appearance: `setupServiceWorkerUpdater`,\nand `hasServiceWorkerUpdate`.\n\n```js\n// ...\nimport {\n  setupServiceWorkerUpdater,\n  hasServiceWorkerUpdate\n} from 'ember-service-worker-update-notify/test-support/updater';\n\nmodule('Application | Index', function(hooks) {\n  setupApplicationTest(hooks);\n  setupServiceWorkerUpdater(hooks);\n\n  test('the update is shown', async function(assert) {\n    // assert that the content is not shown\n\n    await serviceWorkerUpdate();\n\n    // assert that the content is shown\n\n  });\n});\n```\n\n\n## Installation\n\n```bash\nyarn add --dev ember-concurrency # peer-dependency\nyarn add --dev ember-service-worker-update-notify\n```\n\n### Local installation\n\n- `git clone \u003crepository-url\u003e` this repository\n- `cd ember-service-worker-update-notify`\n- `npm install`\n\n### Linting\n\n- `npm run lint:hbs`\n- `npm run lint:js`\n- `npm run lint:js -- --fix`\n\n### Running tests\n\n- `ember test` – Runs the test suite on the current Ember version\n- `ember test --server` – Runs the test suite in \"watch mode\"\n- `ember try:each` – Runs the test suite against multiple Ember versions\n\n### Running the dummy application\n\n- `ember serve`\n- Visit the dummy application at [http://localhost:4200](http://localhost:4200).\n\nFor more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopaxi%2Fember-service-worker-update-notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftopaxi%2Fember-service-worker-update-notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopaxi%2Fember-service-worker-update-notify/lists"}