question

01928-7325x2 avatar image
01928-7325x2 asked David Marginian Deactivated edited

eCommerce iFrame Event Listener Issue On Single Page Application

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
19 comments
10 |2000

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

David Marginian avatar image David Marginian ♦♦ commented ·

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 ·
01928-7325x2 avatar image 01928-7325x2 David Marginian ♦♦ commented ·

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 ·
01928-7325x2 avatar image 01928-7325x2 David Marginian ♦♦ commented ·

@

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 ·
David Marginian avatar image David Marginian ♦♦ 01928-7325x2 commented ·

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

Welcome to the
Clover Developer Community