Can we execute a custom script function in Wappler?

Here is an example,
I have a form which send data to a server connect api on submit. If it fails to do so due to some unknown error then I am storing the form data in local storage using Wappler functionality. but along with this method I want to register a service worker sync tag. I have written a simple script function in the script tag of main layout and I want to execute that function from Wappler.

How can I fix this issue ? And how can I access IndexedDB in Wappler ?

I am working on background syncing feature of PWA service worker in node js application. If there are other fixes for the above issue It will be very helpful !

<script>
    function syncComment(){
     if ('serviceWorker' in navigator && 'SyncManager' in window) {
        navigator.serviceWorker.ready.then(function(swRegistration) {
        return swRegistration.sync.register('myFirstSync');
      });
     }
    }
  </script>
Community Page
Last updated: