Installation

This initialization can be done through NPM or local files.

If you have other ServiceWorkers on your website, you can create a service-worker.js file and import all your ServiceWorkers into it. Follow these steps to do so:

  • Create a file in your root project named service-worker.js **
  • Add this one of these lines to your service-worker.js file:
  • If you use NPM:
importScripts('/node_modules/indigitall-web-sdk/worker.min.js');
// Other imports
  • If you use local files:
importScripts('/indigitall/worker.min.js');
// Other imports

Your project will have the following structure:

  • Con NPM:
/
|   node_modules/
|   |   indigitall-webpush/
|   |   |   index.js
|   |   |   package.json
|   |   |   readme.md
|   |   |   sdk.min.js
|   |   |   worker.min.js
|   |   ...
|   service-worker.js
|   ...
  • Using local files:
/
|   indigitall/
|   |   sdk.min.js
|   |   worker.min.js
|   service-worker.js
|   ...

Remove the workerPath parameter in the indigitall.init method ({... ~~ workerPath: '/indigitall/worker.min.js'~~ ...})

<!-- Replace this snippet with your appKey -->
<script
  src="/en/indigitall/sdk.min.js"
  onload="indigitall.init({
    appKey:'765b4222-ae48-xxxx-80e2-213c62f337df'
  })"
  async>
</script>