@@ -253,14 +253,12 @@ var Phoenix = (() => {
253253 } ) ;
254254 this . onClose ( ( ) => {
255255 this . rejoinTimer . reset ( ) ;
256- if ( this . socket . hasLogger ( ) )
257- this . socket . log ( "channel" , `close ${ this . topic } ${ this . joinRef ( ) } ` ) ;
256+ if ( this . socket . hasLogger ( ) ) this . socket . log ( "channel" , `close ${ this . topic } ${ this . joinRef ( ) } ` ) ;
258257 this . state = CHANNEL_STATES . closed ;
259258 this . socket . remove ( this ) ;
260259 } ) ;
261260 this . onError ( ( reason ) => {
262- if ( this . socket . hasLogger ( ) )
263- this . socket . log ( "channel" , `error ${ this . topic } ` , reason ) ;
261+ if ( this . socket . hasLogger ( ) ) this . socket . log ( "channel" , `error ${ this . topic } ` , reason ) ;
264262 if ( this . isJoining ( ) ) {
265263 this . joinPush . reset ( ) ;
266264 }
@@ -270,8 +268,7 @@ var Phoenix = (() => {
270268 }
271269 } ) ;
272270 this . joinPush . receive ( "timeout" , ( ) => {
273- if ( this . socket . hasLogger ( ) )
274- this . socket . log ( "channel" , `timeout ${ this . topic } (${ this . joinRef ( ) } )` , this . joinPush . timeout ) ;
271+ if ( this . socket . hasLogger ( ) ) this . socket . log ( "channel" , `timeout ${ this . topic } (${ this . joinRef ( ) } )` , this . joinPush . timeout ) ;
275272 let leavePush = new Push ( this , CHANNEL_EVENTS . leave , closure ( { } ) , this . timeout ) ;
276273 leavePush . send ( ) ;
277274 this . state = CHANNEL_STATES . errored ;
@@ -417,8 +414,7 @@ var Phoenix = (() => {
417414 this . joinPush . cancelTimeout ( ) ;
418415 this . state = CHANNEL_STATES . leaving ;
419416 let onClose = ( ) => {
420- if ( this . socket . hasLogger ( ) )
421- this . socket . log ( "channel" , `leave ${ this . topic } ` ) ;
417+ if ( this . socket . hasLogger ( ) ) this . socket . log ( "channel" , `leave ${ this . topic } ` ) ;
422418 this . trigger ( CHANNEL_EVENTS . close , "leave" ) ;
423419 } ;
424420 let leavePush = new Push ( this , CHANNEL_EVENTS . leave , closure ( { } ) , timeout ) ;
@@ -452,8 +448,7 @@ var Phoenix = (() => {
452448 return false ;
453449 }
454450 if ( joinRef && joinRef !== this . joinRef ( ) ) {
455- if ( this . socket . hasLogger ( ) )
456- this . socket . log ( "channel" , "dropping outdated message" , { topic, event, payload, joinRef } ) ;
451+ if ( this . socket . hasLogger ( ) ) this . socket . log ( "channel" , "dropping outdated message" , { topic, event, payload, joinRef } ) ;
457452 return false ;
458453 } else {
459454 return true ;
@@ -796,7 +791,7 @@ var Phoenix = (() => {
796791 } ;
797792
798793 // js/phoenix/presence.js
799- var Presence = class {
794+ var Presence = class _Presence {
800795 constructor ( channel , opts = { } ) {
801796 let events = opts . events || { state : "presence_state" , diff : "presence_diff" } ;
802797 this . state = { } ;
@@ -814,9 +809,9 @@ var Phoenix = (() => {
814809 this . channel . on ( events . state , ( newState ) => {
815810 let { onJoin, onLeave, onSync } = this . caller ;
816811 this . joinRef = this . channel . joinRef ( ) ;
817- this . state = Presence . syncState ( this . state , newState , onJoin , onLeave ) ;
812+ this . state = _Presence . syncState ( this . state , newState , onJoin , onLeave ) ;
818813 this . pendingDiffs . forEach ( ( diff ) => {
819- this . state = Presence . syncDiff ( this . state , diff , onJoin , onLeave ) ;
814+ this . state = _Presence . syncDiff ( this . state , diff , onJoin , onLeave ) ;
820815 } ) ;
821816 this . pendingDiffs = [ ] ;
822817 onSync ( ) ;
@@ -826,7 +821,7 @@ var Phoenix = (() => {
826821 if ( this . inPendingSyncState ( ) ) {
827822 this . pendingDiffs . push ( diff ) ;
828823 } else {
829- this . state = Presence . syncDiff ( this . state , diff , onJoin , onLeave ) ;
824+ this . state = _Presence . syncDiff ( this . state , diff , onJoin , onLeave ) ;
830825 onSync ( ) ;
831826 }
832827 } ) ;
@@ -841,7 +836,7 @@ var Phoenix = (() => {
841836 this . caller . onSync = callback ;
842837 }
843838 list ( by ) {
844- return Presence . list ( this . state , by ) ;
839+ return _Presence . list ( this . state , by ) ;
845840 }
846841 inPendingSyncState ( ) {
847842 return ! this . joinRef || this . joinRef !== this . channel . joinRef ( ) ;
@@ -1390,8 +1385,7 @@ var Phoenix = (() => {
13901385 clearTimeout ( this . heartbeatTimeoutTimer ) ;
13911386 }
13921387 onConnOpen ( ) {
1393- if ( this . hasLogger ( ) )
1394- this . log ( "transport" , `${ this . transport . name } connected to ${ this . endPointURL ( ) } ` ) ;
1388+ if ( this . hasLogger ( ) ) this . log ( "transport" , `${ this . transport . name } connected to ${ this . endPointURL ( ) } ` ) ;
13951389 this . closeWasClean = false ;
13961390 this . disconnecting = false ;
13971391 this . establishedConnections ++ ;
@@ -1476,12 +1470,10 @@ var Phoenix = (() => {
14761470 } , 150 * tries ) ;
14771471 }
14781472 onConnClose ( event ) {
1479- if ( this . conn )
1480- this . conn . onclose = ( ) => {
1481- } ;
1473+ if ( this . conn ) this . conn . onclose = ( ) => {
1474+ } ;
14821475 let closeCode = event && event . code ;
1483- if ( this . hasLogger ( ) )
1484- this . log ( "transport" , "close" , event ) ;
1476+ if ( this . hasLogger ( ) ) this . log ( "transport" , "close" , event ) ;
14851477 this . triggerChanError ( ) ;
14861478 this . clearHeartbeats ( ) ;
14871479 if ( ! this . closeWasClean && closeCode !== 1e3 ) {
@@ -1493,8 +1485,7 @@ var Phoenix = (() => {
14931485 * @private
14941486 */
14951487 onConnError ( error ) {
1496- if ( this . hasLogger ( ) )
1497- this . log ( "transport" , error ) ;
1488+ if ( this . hasLogger ( ) ) this . log ( "transport" , error ) ;
14981489 let transportBefore = this . transport ;
14991490 let establishedBefore = this . establishedConnections ;
15001491 this . stateChangeCallbacks . error . forEach ( ( [ , callback ] ) => {
@@ -1618,8 +1609,7 @@ var Phoenix = (() => {
16181609 this . pendingHeartbeatRef = null ;
16191610 this . heartbeatTimer = setTimeout ( ( ) => this . sendHeartbeat ( ) , this . heartbeatIntervalMs ) ;
16201611 }
1621- if ( this . hasLogger ( ) )
1622- this . log ( "receive" , `${ payload . status || "" } ${ topic } ${ event } ${ ref && "(" + ref + ")" || "" } ` , payload ) ;
1612+ if ( this . hasLogger ( ) ) this . log ( "receive" , `${ payload . status || "" } ${ topic } ${ event } ${ ref && "(" + ref + ")" || "" } ` , payload ) ;
16231613 for ( let i = 0 ; i < this . channels . length ; i ++ ) {
16241614 const channel = this . channels [ i ] ;
16251615 if ( ! channel . isMember ( topic , event , payload , join_ref ) ) {
@@ -1636,8 +1626,7 @@ var Phoenix = (() => {
16361626 leaveOpenTopic ( topic ) {
16371627 let dupChannel = this . channels . find ( ( c ) => c . topic === topic && ( c . isJoined ( ) || c . isJoining ( ) ) ) ;
16381628 if ( dupChannel ) {
1639- if ( this . hasLogger ( ) )
1640- this . log ( "transport" , `leaving duplicate topic "${ topic } "` ) ;
1629+ if ( this . hasLogger ( ) ) this . log ( "transport" , `leaving duplicate topic "${ topic } "` ) ;
16411630 dupChannel . leave ( ) ;
16421631 }
16431632 }
0 commit comments