//UI Component // JS Code 'use strict'; class ValetDashboardController { /*@ngInject*/ constructor($q, $scope, $cookies , Pusher) { this.isValetOnline = false; this.Pusher = Pusher; this.toggleVisibilityStatus = this.toggleVisibilityStatus.bind(this) } // ========================== UI RELATED ================== PusherListenIncomingAndCancelling() { //.... } toggleVisibilityStatus() { this.isValetOnline = !this.isValetOnline; this.checkVisibility(this.isValetOnline) } checkVisibility(bool) { bool ? this.PusherListenIncomingAndCancelling() : this.Pusher.unsubscribe(`valet-station-${this.valetDetails.garages_id}`); } } ValetDashboardController.$inject = [ '$q', '$scope', '$cookies', 'Pusher', ]; export default ValetDashboardController;