Started refactoring of pusher.js