import { ObsCyclingRecordings } from '../../../../src/types/schemas/obs_cyclingRecordings' ; import { Status as CONNECTION_STATUS , Websocket as WebsocketStatus } from 'nodecg-utility-obs/types/schemas/websocket' ; const { customElement , property } = Polymer . decorators ; const cyclingRecordingsRep = nodecg . Replicant < ObsCyclingRecordings > ( 'obs_cyclingRecordings' ) ; customElement polymer appliesMixin @ customElement ( 'ui-system-status-obs' ) export default class UiSystemStatusObsElement extends Polymer . MutableData ( Polymer . Element ) { @ property ( { type : String } ) namespace : string ; @ property ( { type : String , reflectToAttribute : true } ) status : string ; @ property ( { type : String } ) label : string ; _websocket : WebsocketStatus ; _cyclingRecordings : boolean ; static get observers ( ) { return [ '_updateStatus(_websocket.status, _cyclingRecordings)' ] ; } ready ( ) { super . ready ( ) ; cyclingRecordingsRep . on ( 'change' , newVal => { this . _cyclingRecordings = newVal ; } ) ; } _transformsNamespace ( namespace ) { return namespace . slice ( 0 , - 3 ) ; } _updateStatus ( websocketStatus , cyclingRecordings ) { this . status = this . _calcStatus ( websocketStatus , cyclingRecordings ) ; } _calcStatus ( websocketStatus , cyclingRecordings ) { if ( websocketStatus === 'connected' ) { return cyclingRecordings ? 'cycling' : websocketStatus ; } return websocketStatus ; } }