From 87b92edbb1fa1a0a2d8f78bb5dce962357263b1d Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Sun, 22 May 2016 17:48:43 -0400 Subject: [PATCH 1/2] setInterval was dying for no apparent reason. Couldn't figure out why, but setTImeout cycle doesn't due so... - Sigh... --- src/main.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main.js b/src/main.js index d4bd1fab..476fa7c2 100644 --- a/src/main.js +++ b/src/main.js @@ -32,10 +32,13 @@ canvas.width = canvasDiv.clientWidth; canvas.height = window.innerHeight*0.9; let haveLoaded = false; let historyPusher = new HistoryPusher(); -let semiStableRng = new RestartableRng(); -setInterval(() => { - semiStableRng = new RestartableRng(); -}, Config.SEMI_STABLE_RANDOM_VALUE_LIFETIME_MILLIS*0.95); +let semiStableRng = {cur: new RestartableRng()}; +let cycleRng; +cycleRng = () => { + semiStableRng.cur = new RestartableRng(); + setTimeout(cycleRng, Config.SEMI_STABLE_RANDOM_VALUE_LIFETIME_MILLIS*0.99); +}; +cycleRng(); //noinspection JSValidateTypes /** @type {!HTMLDivElement} */ @@ -143,7 +146,7 @@ const redrawNow = () => { let size = desiredCanvasSizeFor(shown); canvas.width = size.w; canvas.height = size.h; - let painter = new Painter(canvas, semiStableRng.restarted()); + let painter = new Painter(canvas, semiStableRng.cur.restarted()); shown.updateArea(painter.paintableArea()); shown.paint(painter, stats, isShiftHeld); painter.paintDeferred(); From ee4ccf27732896575bced03f4a95411ae85c7c19 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Sun, 22 May 2016 17:49:49 -0400 Subject: [PATCH 2/2] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d5d472a..9188e1f6 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "title": "Quirk", "description": "An HTML5 toy for exploring and understanding small quantum circuits.", "license": "Apache-2.0", - "version": "1.2.0", + "version": "1.4.0", "homepage": "https://github.com/Strilanc/Quirk", "bugs": { "url": "https://github.com/Strilanc/Quirk/issues"