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

id for setTimeout and setInterval are prone to errors #36

Open
luiza-cicone opened this issue Apr 19, 2024 · 0 comments
Open

id for setTimeout and setInterval are prone to errors #36

luiza-cicone opened this issue Apr 19, 2024 · 0 comments

Comments

@luiza-cicone
Copy link

Hello,

We are using the verification client setTimeout method to compute a custom viewability.
As it is using an internal generation of id's (starting at 0) it is prone to errors as it is using a falsy value and so we need to explicitly check against undefined
if (timeoutId !== undefined) { ... } instead of if(timeoutId) { ... }

I can suggest a PR where we change the id returned to start at 1. WDYT?
https://github.com/InteractiveAdvertisingBureau/Open-Measurement-JSClients/blob/master/src/verification-client/verification-client.js#L381

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant