-
Notifications
You must be signed in to change notification settings - Fork 6
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
Reload delay debounce #4
base: master
Are you sure you want to change the base?
Conversation
Also added a simple clearConsole option to make it easier to see reload changes |
Could you tell me your system specs? OS/arch/version? May be there is something we can do in the watcher itself. Clear console is a nice feature 👍🏽 |
I am running Debian 10.13 on amd64. Maybe it is an issue with my systems. But I think it is still an important feature to include. If lets say you delete a folder with files, every file delete will trigger a reload. With delay, reload will be only triggered once as intended. |
@@ -11,12 +12,15 @@ import 'package:watcher/watcher.dart'; | |||
class Recharge { | |||
final String path; | |||
final void Function()? onReload; | |||
int delay; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make this Duration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is up to you. I think keeping it the way it is now is okay too. Because delays are generally in millisecond range (500ms-20ms). 200ms seems like a good default value in my opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not talking about the number. I meant to make the datatype Duration(milliseconds: 200) instead of int. It is better to use the built in datatype that is meant for this purpose.
|
||
// print("application reloaded") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
@romanzy313 Sorry got a bit busy. I will merge after these minor changes. |
Added a simple de-bounce with a default delay of 200ms. On my system every file save fires the event twice, and this fixes the issue