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

Is it possible to stop using setTimeout throughout the code? #71

Closed
brizental opened this issue Jun 14, 2021 · 2 comments
Closed

Is it possible to stop using setTimeout throughout the code? #71

brizental opened this issue Jun 14, 2021 · 2 comments

Comments

@brizental
Copy link
Contributor

How to reproduce

Attempt to use this library in an environment that does not provide the setTimeout API. In my case, that is QML.

The problem

QML does not provide the setTimeout API. I can fake it, but from looking at the code it seems it might be possible to stop using setTimeout completely.

@101arrowz
Copy link
Owner

101arrowz commented Jun 14, 2021

I'll remove it for v0.7.1. It's mainly to avoid confusion when an asynchronous function calls the callback before it finishes executing.

@101arrowz
Copy link
Owner

As of v0.7.1 the library checks for setTimeout in the environment before using it. Thanks for the bug report, and let me know if it still doesn't work in QML.

brizental added a commit to brizental/fflate that referenced this issue Jun 17, 2021
This one is related to 101arrowz#71 :) After the `setTiemout` issues was sorted I found antoher one.

In the hMap function there is a moment where the program may try to access a negative index. Although in Node.js and browser that does not raise an error, in QML it does raise a TypeError.

Good thing is after this fix it all works over there. 

I was not able to run the complete fflate test suite in my machine, so hopefully this works fine.
101arrowz added a commit that referenced this issue Jun 17, 2021
* Check if index in negative before incrementing

This one is related to #71 :) After the `setTiemout` issues was sorted I found antoher one.

In the hMap function there is a moment where the program may try to access a negative index. Although in Node.js and browser that does not raise an error, in QML it does raise a TypeError.

Good thing is after this fix it all works over there. 

I was not able to run the complete fflate test suite in my machine, so hopefully this works fine.

* Update src/index.ts

Co-authored-by: Manu MA <manu.valladolid@gmail.com>

* Use implicit comparison to zero

Co-authored-by: Manu MA <manu.valladolid@gmail.com>
Co-authored-by: 101arrowz <arjunbarrett@gmail.com>
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

2 participants