Created
October 31, 2013 12:14
-
-
Save thebuilder/7248688 to your computer and use it in GitHub Desktop.
Revisions
-
thebuilder created this gist
Oct 31, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ class Tracker { count = 0; constructor() { window.addEventListener("mousedown", this.mouseDown); window.addEventListener("mouseup", this.mouseUp); } mouseDown = (ev: MouseEvent) => { window.addEventListener("mousemove", this.mouseMove); } mouseUp = (ev: MouseEvent) => { window.removeEventListener("mousemove", this.mouseMove); } mouseMove = (ev: MouseEvent) => { this.count++; console.log(this.count); } } new Tracker();