From d0f01fdec2c36cc491c5af0dec97081f548feaaa Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 19 Jul 2018 00:50:11 +0200 Subject: Add timer --- pointless/viewer/screen.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'pointless/viewer/screen.js') diff --git a/pointless/viewer/screen.js b/pointless/viewer/screen.js index 0c1c3ad..28f4f55 100644 --- a/pointless/viewer/screen.js +++ b/pointless/viewer/screen.js @@ -8,7 +8,7 @@ "use strict"; class Screen { - constructor(window, secondary=false) { + constructor(window, secondary=false, withTimer=false) { this.window = window; this.secondary = secondary; this.canvas = window.document.getElementById("screen"); @@ -19,11 +19,18 @@ class Screen { this.window.addEventListener("resize", function() { self._refreshPage(); }); + + this.timer = withTimer ? new Timer(window) : null; + this.pageTurnCount = 0; } setPage(page) { + if (this.pageTurnCount === 1 && this.timer != null) + this.timer.start(); + this.page = page; this._refreshPage(); + this.pageTurnCount++; } _resizeScreen(ratio) { -- cgit v1.2.3