B4J Question [BANano] How to use PWAFire ESModule

Mashiane

Expert
Licensed User
Longtime User
Good day

I am exploring this PWA es module from https://pwafire.org/

I'm struggling to call functions in this esModule. The file is in the assets folder.

I have made the call

B4X:
Dim pwa As BANanoObject = BANano.Await(BANano.Import("pwa.js"))
log(pwa)

    pwa.RunMethod("setBadge", 10)

The log of pwa does give..

1698248439953.png


however calling setBadge is giving an error, perhaps I'm not doing this correctly.

Any help would be appreciated.

Thanks in advance. BANanoSkeleton Project Attached.
 

Attachments

  • BANanoPWALib.zip
    25.4 KB · Views: 133

alwaysbusy

Expert
Licensed User
Longtime User
Checked it but that won't work. This is some wrapper written in TypeScript to use very experimental stuff that almost no browser supports (badges, contacts, etc). This specific module will also interfere with how the BANano transpiler makes a PWA.

When I checked the code, I don't really see something in it that BANano couldn't do (it just won't work on most browsers). e.g. the setAppBadge:

1698254380078.png


But the code they use is pretty simple stuff like e.g. their setBadge method would basically be in BANano:
B4X:
BANano.Navigator.runmethod("setAppBadge",10)

Alwaysbusy
 
Last edited:
Upvote 0
Top