That's the pattern we tend to use for modules, and while it involves writing self and not this, it is a bit more efficient both in speed and memory usage.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
As DrAzzy says, you need:
not:
That's almost certainly your problem... Personally though I'd also skip defining the small second function, and do:
That's the pattern we tend to use for modules, and while it involves writing self and not this, it is a bit more efficient both in speed and memory usage.