Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library cannot be used in iOS v13 and older #580

Closed
bowozer opened this issue Dec 8, 2021 · 6 comments
Closed

Library cannot be used in iOS v13 and older #580

bowozer opened this issue Dec 8, 2021 · 6 comments
Labels

Comments

@bowozer
Copy link

bowozer commented Dec 8, 2021

It happened ever since using event emitter that merged by this PR #567

i setup a simple html script that opened from iPhone (iOS 13.6) emulator. The script pretty much the same with the fiddler on the README.md (https://jsfiddle.net/szimek/jq9cyzuc/), but i wrapped the SignaturePad object creation with try-catch to see the error.

Original Code:

var signaturePad = new SignaturePad(canvas, {
  backgroundColor: 'rgb(255, 255, 255)' // necessary for saving image as JPEG; can be removed is only saving as PNG or SVG
});

Modified to:

var signaturePad;
try {
    signaturePad = new SignaturePad(canvas, {
        backgroundColor: 'rgb(255, 255, 255)' // necessary for saving image as JPEG; can be removed is only saving as PNG or SVG
    });
} catch (error) {
    alert(`oh no '${error.message}', it means current browser does not have EventTarget() constructor..`);
}

Here is the error:
image

I think it is because the SignaturePad inherits from EventTarget and call EventTarget constructor. Hence the "super()" error.
iOS only start support EventTarget constructor from iOS 14....
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/eventTarget

@bowozer
Copy link
Author

bowozer commented Dec 8, 2021

oh yeah i probably should say: user cannot stroke any lines in the canvas after that error. I guess it is pretty much breaking the pad.

I think it is important to make it runs on iOS 13 because many devices still works on them.

@bowozer
Copy link
Author

bowozer commented Dec 8, 2021

i hope this PR #581 suffices to solve this issue. Just awaiting for approval

@welsh
Copy link

welsh commented Dec 9, 2021

I noticed on Android 6.0.1 that also upgrading it stopped working, reverting back to v3.0.0-beta.3 resolved the problem.

The error was about an illegal constructor typescript, I wonder if this is the same issue that you're running into.

@bowozer
Copy link
Author

bowozer commented Dec 9, 2021

@welsh well luckily on Android OS, the browser engine actually decoupled with the OS itself. So you just need to upgrade the browser to the latest and it would have the newest browser engine, and thus it would work with the latest library.

Unfortunately, it is different with iOS, though. No matter the browser in iOS, it always uses webkit engine . The engine (webkit) is coupled with the iOS. That is why to upgrade browser engine, you would need to upgrade iOS as well.. It doesn't sit really well because it would make this library unusable in many devices that currently being used.

@UziTech UziTech added the bug label Dec 15, 2021
@strivelen
Copy link

strivelen commented Dec 21, 2021

For the current problem, my solution is to introduce an EventTarget polyfill in the head tag of html.
It is recommended to use it in transition or in emergencies. I still hope that this library can be compatible with the IOS13 version. There are indeed many people who use this version.

@UziTech
Copy link
Collaborator

UziTech commented Dec 21, 2021

fixed by #581

@UziTech UziTech closed this as completed Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants