byteface/domonic

timeouts -

byteface opened this issue · 3 comments

currently missing decent setTimout and clearTimeout methods.

I'd like these to work 2 ways. async and not. so a flag needs to be added to make async=True. currently i doubled up and 2 new ones to 'Global' so the old implementations could be left alone. (not that they worked. its just a sleep.)

ideally somehow utilise the SetInterval work that was done in the past. I had avoided ayncio due to api changes between python versions. I'd get setInterval to work in one version but it would fail in another so went to 'threads' for the Job class. howeer this is only async atm. should it block during exec?

for now I can't see me getting to this for a while. so making a ticket not to use setTimeout and clearTimeout as they aren't done. But will be once I get time and can think about how I resolve these issues.

I've labled this as help wanted as don't think I'll get to it for 2 months at least. it's at least a weekends work for me so not on my roadmap for immediate forseeable with other stuff.

I think the builtin python threading.Timer would work perfectly for this.

You my friend are a genius. this is now in the 0.4.7 release. I did update it to divide/1000 to use milliseconds like the javascript one but the functionality is perfect. I tried and have also now elevated it to a module function as well as on the Global class. This ticket can be closed. Also thanks so much for the unit tests. A friend showed me the Mock object ages ago and I forget about that. Also the dunder acccessors in your assert looked like magic. Then i realised i saw that in a django app once and must've thought it was a esoteric django thing and hadn't realised you could just do that in python. weird i hadn't made the connection. I'm pretty chuffed about these 2 methods being in. so thanks again. I put your name in the contributers.md files as well.