static class DelayedUpdate { Runnable renderer; volatile long version; long lastUpdate; // AWT time int delay = 1000; *(Runnable *renderer) {} void trigger() { awt { awt_quickUpdate(); } final long n = ++version; javax.swing.Timer timer = new javax.swing.Timer(delay, actionListener { awt_show(n); }); timer.setRepeats(false); timer.start(); } void awt_quickUpdate() { if (lastUpdate < now()-delay) { render(); lastUpdate = now(); // This can be rough, no problem } } void awt_show(long n) { if (n == version) { render(); lastUpdate = now(); } } void render() { try { renderer.run(); } catch (Throwable e) { e.printStackTrace(); } } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment