Elements Add-on: Adding a JS-var to an Element

I am creating a CountDown-Element.
To be able to use pause and stuff, I need to have a var added to the elem, so the methods start, pause and reset can all
use the same var.
I have tried:
elem.eval(“var currentTime = 0;”)
and
elem.setAttribute(“currentTime”,“0”)
but when I run:
elem.eval(“start(); function start(){ …do something with currentTime…}”)
it complains that currentTime is not set.

What do I miss?