Closed twang2218 closed 7 years ago
Could this interval be customizable from the .zazurc.json
file? It should give more control to users.
@avaly That's a good idea, currently I don't think it's possible to customize the plugin block's configuration.
@blainesch WDYT, should we add such feature?
We could kind of customize it. We could set up the service like this:
const realFunc = () => {
console.log('the real work')
}
module.exports = (pluginContext) => {
let interval = null
return (env = {}) => {
if (!interval) {
interval = setInterval(realFunc, env.timeout || 3000)
}
Promise.resolve('ping')
}
}
What do you think? We could also find a way to make this a core feature, but I'm not sure how useful it would be for most cases.
Yeah, I was just thinking about this way, I will update this PR in this approach.
I'm not quite sure we need put this into the core feature either, we can decide it later if there are more request like this.
Updated the PR to enable the customized update interval, and also increased the default interval.
Updated this PR with unified time unit in the documents, and removed the extra catch/console/throw
section. I submitted a PR fix for the log issue in zazu
project instead: https://github.com/tinytacoteam/zazu/pull/224
@blainesch , could you review this PR? Thanks.
Looks great. I'll merge after that last comment! [:
1 second interval will cause high CPU usage on Linux system, with this PR, the interval has been increased to 3 seconds, which reduced the CPU usage in this case, however, more frequent clipboard register will be missed.
Fixes https://github.com/tinytacoteam/zazu/issues/189
Signed-off-by: Tao Wang twang2218@gmail.com