My script doesn't works when I use requirejs library to launch it.
It's a simple game. After I click "start" program draws squares and when a green square appear the user has to click it as quick as possible. Then on the screen shows result how quick he did it.
Under this link script working properly: http://doomini2.linuxpl.info/correct/
When the script was loaded from normal js file everything was fine. But when it's loaded as a module then after the user click the green square in the "Last 5 results" box there's an extra result. The first time is the proper one (time between green square appears and user click) and the second time is the time which gone from moment when page loaded.
I don't have any idea why that second time appears and I don't know why it appears sometimes not every drawing.
This is the link to the version using "requirejs" library: http://doomini2.linuxpl.info/test/
I also tried to use "Event delegation", but it doesn't count the time from last "start" click but always from the first click after the page loaded.
This is the link to the version using "event delegation": http://doomini2.linuxpl.info/test2/
Why do the last two version not work? What causes the extra result?