Rearrange the slate.js file.

Remaps things so that the framework executes operations at event time instead of at JS_INIT.