Closed Daviid-P closed 1 year ago
I think runOnSave runs only again after the first command finishes unless you are using isAsync: true
.
And a delay can be done by sleep 1 && ./yourCommand
(waits 1 second)
Wouldn't that still run the command as many times as I pressed save?
What I'm looking for is a delay before running the command so however many times I press save, the timer gets reset and at the end, if the timer runs out, the command is run only once.
Could be but you need to try it out :)
You could work around it by adapting a script that writes a simple lock file somewhere, like .runOnSaveLock
. If that file exists, skip execution.
Looking at the state of this repo, I guess you would need to introduce it via a PR yourself, if you want it
I didn't even notice last update was 4 years ago, I'll go with the lock file.
Sometimes I made small changes and press ctrl + s by muscle memory.
Would it be possible to add some kind of delay so that it waits n milliseconds before running the command and if before that time the document is saved again the timer starts again from n?