Update phoenix.js for better window throwing