lib: Rework JS IO backend to store state in JS-land and not C++

More flexible when we want to do more complex things
around automated testing.
test: Actually verify IO behavior of Blink program
components: Fix off-by-one in Timer

Exposed by newly introduced program-wide automated tests :)