How To: Extend PWAjet Functionality

The application is a monolith with an internal API in the form of globally accessible objects and events.

For full-fledged inclusion in the PWAjet application, the add-on (hereinafter - the extension) should be:

  1. Added to the caching manifest of the service worker. Add new records to the array for files with their revision.

File structure for extensions:

/assets/extensions/__vendor-name__/__addon-name__/__file-name__.js
  1. Included at the application entry point (index.html).

When will enabled extensions start working for a customer? There are 2 scenarios:

  1. The user has already visited the site:

    • The extension is added to the application;
    • The user sees the old app version without updates when visiting the site again;
    • A new service worker activates;
    • On the next visit (refresh the page or close/open the tab), the user will see the new version.
  2. The customer has not visited the site yet:

    • The extension is added to the application;
    • The user immediately sees the current version.