You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't call init() from the constructor.
Let the user call it or another function called start, etc.
Why not define defaultTimerInSeconds as a const, and put it next to the default event?
Consider renaming defaultTimerInSeconds in the constructor to something that does not include default. Maybe timerInSeconds or intervalInSeconds.
Change either timerInSeconds or timerInMs. eventHandler(fn: CallbackFunctionVariadic, timerInMs: number) says it accepts the timer in ms, but you are passing it in seconds.
Why are we passing fn and timer anyways? We can access them as instance properties.
Because of how the code is written (mostly because of Point No. 1), it's not possible (in an acceptable way anyway) to specify what events we want to listen to.
Add it as an arg to the constructor or, even better, use a parameter to specify params.
The lib's logic, which is basically a debounce function, feels off.
It won't start the timer until the user generates an event. What if the user opens something like youtube that starts playing the vid automatically?
It will keep triggering, with no stop condition. What if we have already logged out the user and displayed an annoying notification? Print it again and try to invalidate an invalid token/session?
In the readme, it suggests including the script v0.0.1, but the latest version is v0.0.2
https://unpkg.com/browse/hamid.js@0.0.2/dist/lib.js links to a web page. The correct link to the raw file should be: https://unpkg.com/hamid.js@0.0.1/dist/lib.js (notice that we remove "browse").
Even this script is not compiled properly to be included on the web.
To actually make it work (as a hack):
Don't call
init()
from the constructor.Let the user call it or another function called start, etc.
Why not define
defaultTimerInSeconds
as a const, and put it next to the default event?Consider renaming
defaultTimerInSeconds
in the constructor to something that does not includedefault
. MaybetimerInSeconds
orintervalInSeconds
.Change either
timerInSeconds
ortimerInMs
.eventHandler(fn: CallbackFunctionVariadic, timerInMs: number)
says it accepts the timer in ms, but you are passing it in seconds.Why are we passing fn and timer anyways? We can access them as instance properties.
Because of how the code is written (mostly because of Point No. 1), it's not possible (in an acceptable way anyway) to specify what events we want to listen to.
Add it as an arg to the constructor or, even better, use a parameter to specify params.
The lib's logic, which is basically a debounce function, feels off.
In the readme, it suggests including the script v0.0.1, but the latest version is v0.0.2
https://unpkg.com/browse/hamid.js@0.0.2/dist/lib.js
links to a web page. The correct link to the raw file should be:https://unpkg.com/hamid.js@0.0.1/dist/lib.js
(notice that we remove "browse").Even this script is not compiled properly to be included on the web.
To actually make it work (as a hack):
The text was updated successfully, but these errors were encountered: