Split platform JS to before.js and after.js