mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Service workers need to load "Odoo Bootstrap" to be able to use "require". The problem is that "Odoo Bootstrap" does operations on the DOM (by using jQuery) and to avoid errors a minimal compatibility layer "jquery-sw-compat.js" has been created to allow using "require" in the service worker. Moved Service Worker (js) code from the xml to python.
36 lines
1.4 KiB
ReStructuredText
36 lines
1.4 KiB
ReStructuredText
* Integrate `Notification API <https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification>`_
|
|
* Integrate `Web Share API <https://web.dev/web-share/>`_
|
|
* Create ``portal_pwa`` module, intended to be used by front-end users (customers, suppliers...)
|
|
* Current *John Resig's inheritance* implementation doesn't support ``async``
|
|
functions because ``this._super`` can't be called inside a promise. So we
|
|
need to use the following workaround:
|
|
|
|
- Natural 'async/await' example (This breaks "_super" call):
|
|
|
|
.. code-block:: javascript
|
|
|
|
var MyClass = OdooClass.extend({
|
|
myFunc: async function() {
|
|
const mydata = await ...do await stuff...
|
|
return mydata;
|
|
}
|
|
});
|
|
|
|
- Same code with the workaround:
|
|
|
|
.. code-block:: javascript
|
|
|
|
var MyClass = OdooClass.extend({
|
|
myFunc: function() {
|
|
return new Promise(async (resolve, reject) => {
|
|
const mydata = await ...do await stuff...
|
|
return resolve(mydata);
|
|
});
|
|
}
|
|
});
|
|
|
|
* Fix issue when trying to run in localhost with several databases. The browser
|
|
doesn't send the cookie and web manifest returns 404.
|
|
* Firefox can't detect 'standalone' mode. See https://bugzilla.mozilla.org/show_bug.cgi?id=1285858
|
|
* Firefox disable service worker in private mode. See https://bugzilla.mozilla.org/show_bug.cgi?id=1601916
|