SB 3.10 App on older Android with CanvasGadget crash on ResizeObserver

Found an issue in SpiderBasic ? Please report it here !
hoerbie
Posts: 141
Joined: Sun Mar 17, 2019 5:51 pm
Location: DE/BY/MUC

SB 3.10 App on older Android with CanvasGadget crash on ResizeObserver

Post by hoerbie »

Hi,
at the moment I'm testing one big Android app compiled the first time with SB 3.1 on a lot of devices, starting with Android >= 10 everything seems to work, but on older Sunmi devices with for example Android 7.1.x, the app seems to run only until there is a CanvasGadget() defined, then the Procedure crashes with something like

Code: Select all

Uncaught ReferenceError: ResizeObserver is not defined (file:///android_asset/www/spiderbasic.js?t=xxx, line 3163
Keeping the app directory and looking in the line there is the window.spider_CanvasGadget=function definition with a new ResizeObserver.

I'm not sure, but with older SB I never had this error, is it possible, that it has to do with the in SB 3.1

Code: Select all

- Added: #PB_EventType_Resize support for ContainerGadget(), ScrollAreaGadget(), Canvas() and PanelGadget()
added new feature?

Or is it simply a problem of the new cordova-android 14.0 or Android SDK 35? I can't find any information about the supported Android versions...

I searched a bit and found some hints, for example to define a dummy

Code: Select all

!class ResizeObserver {
!observe() {}
!unobserve() {}
!disconnect() {}
!}
but putting this at the top of my app doesn't change anything.

Greets, hoerbie
hoerbie
Posts: 141
Joined: Sun Mar 17, 2019 5:51 pm
Location: DE/BY/MUC

Re: SB 3.10 App on older Android with CanvasGadget crash on ResizeObserver

Post by hoerbie »

Hi,
I did some further tests, and with SB <= 3.02 this error doesn't happen, so I think it is a regression from the in SB 3.10 added feature:

Code: Select all

- Added: #PB_EventType_Resize support for ContainerGadget(), ScrollAreaGadget(), Canvas() and PanelGadget()
And just in case anyone else stumbles across this error on the above listed SB gadgets, a temporary solution was to put the following code at the front of my SB file:

Code: Select all

! class ResizeObserver {
!   observe() {}
!   unobserve() {}
!   disconnect() {}
! }
! window.ResizeObserver = ResizeObserver;
I simply missed the last line in my first tests. For now I will include such code with an If clause only when running on old Android devices.

As we are actually in a Beta cycle of SB 3.2, maybe this could be fixed for the real 3.2 ;)

Greets, hoerbie
Post Reply