question

ydev avatar image
ydev asked ·

eCommerce iFrame SDK Javascript Cannot Remove Listener

Is ther eany way to remove the element listener for the iFrame SDK of Javascript?

Following this guide here: https://docs.clover.com/docs/using-the-clover-hosted-iframe
Then I found that there is no way to remove the event listener.



Paymentse-commerce api
12 comments
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Those look like standard HTML element listeners to me - https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener. Am I missing something?

0 Likes 0 · ·
ydev avatar image ydev David Marginian ♦♦ ·

I debug the SDK and see it's entering the removeEventListener correctly.


But when switching page and enter the payment page again, there are multiple event listeners.
Oh we're using SPA.
We have another iFrame implemented using the same way and works fine.
I'll check deeper and see what's going on.

0 Likes 0 · ·
ydev avatar image ydev David Marginian ♦♦ ·

@

Still have no idea why the event listener not removed.
If you have a chance could you help to take a look please?

Here is the very simple example on Codesandbox:
https://codesandbox.io/s/testing-clover-iframe-zg6h4

You can navigate between page by clicking "Main Page" and "Go To Form"
How to replicate the issue:
1. Click "Go To Form"
2. Input anything in the "Card number" and observer the console, you should see only 1 log triggered when you input 1 character
3. Click "Main Page"
4. Click "Go To Form" again
5. Input anything in the "Card number" and you'll see the event triggered multiple times.

Note: please use Google Chrome

0 Likes 0 · ·

I don't know anything about Vue. This appears to be a problem with your app that has nothing to do with Clover and would be better suited in a Vue forum. If it does have something to do with Clover then please reproduce the problem in a simple manner without external frameworks and share your code.

0 Likes 0 · ·
Show more comments

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community