That sounds awesome!
Wait, so you could actually do all of that and then let it interact with APIs as well? When JS gets involved like this, I can see some crazy applications in my mind packaged as an ".epub" book.
I guess it depends on what reader you're targetting then. A quick cursory search shows that not all of them support JS. Makes sense to me.