1- import { ACTIONCABLE_TYPE , WEBSOCKET_MESSAGE_COMMAND } from './../../../shared/constants'
1+ import { ACTIONCABLE_TYPE , WEBSOCKET_MESSAGE_COMMAND } from './../../../shared/constants'
22
33const UNSUBSCRIBE_CHECK_TIMEOUT = 300 // give time to unsubscribe from channels
44
@@ -71,10 +71,10 @@ export const initCableWrapper = (apiType = ACTIONCABLE_TYPE, api, options = {},
7171 }
7272 return resolve ( )
7373 } ) ,
74- subscribeTo : ( { port, portID, id, channel, params = { } } ) => {
74+ subscribeTo : ( { port, portID, id, channel, params = { } } ) => {
7575 resumeConnectionIfNeeded ( )
7676
77- const channelData = { channel, params}
77+ const channelData = { channel, params }
7878
7979 const addSubscription = ( subscriptionChannel ) => {
8080 portReceiverMapping = {
@@ -97,7 +97,7 @@ export const initCableWrapper = (apiType = ACTIONCABLE_TYPE, api, options = {},
9797 } ,
9898 {
9999 received : ( data ) => {
100- port . postMessage ( { command : WEBSOCKET_MESSAGE_COMMAND , data, id} )
100+ port . postMessage ( { command : WEBSOCKET_MESSAGE_COMMAND , data, id } )
101101 }
102102 }
103103 )
@@ -106,22 +106,22 @@ export const initCableWrapper = (apiType = ACTIONCABLE_TYPE, api, options = {},
106106 } else {
107107 return websocketConnection . subscribeTo ( channel , params ) . then ( ( subscriptionChannel ) => {
108108 subscriptionChannel . on ( 'message' , ( data ) => {
109- port . postMessage ( { command : WEBSOCKET_MESSAGE_COMMAND , data, id} )
109+ port . postMessage ( { command : WEBSOCKET_MESSAGE_COMMAND , data, id } )
110110 } )
111111
112112 return addSubscription ( subscriptionChannel )
113113 } )
114114 }
115115 } ,
116- performInChannel : ( portID , id , { action, params = { } } ) => {
116+ performInChannel : ( portID , id , { action, params = { } } ) => {
117117 if ( portReceiverMapping [ portID ] && portReceiverMapping [ portID ] [ id ] ?. channel ) {
118- const { channel} = portReceiverMapping [ portID ] [ id ]
118+ const { channel } = portReceiverMapping [ portID ] [ id ]
119119 channel . perform ( action , params )
120120 }
121121 } ,
122122 unsubscribeFrom : ( portID , id ) => {
123123 if ( portReceiverMapping [ portID ] && portReceiverMapping [ portID ] [ id ] ?. channel ) {
124- const { channel} = portReceiverMapping [ portID ] [ id ]
124+ const { channel } = portReceiverMapping [ portID ] [ id ]
125125 if ( isActioncableAPI ) {
126126 channel . unsubscribe ( )
127127 } else {
@@ -158,7 +158,7 @@ export const initCableWrapper = (apiType = ACTIONCABLE_TYPE, api, options = {},
158158 if ( portKey === portID ) {
159159 Object . keys ( portReceiverMapping [ portKey ] ) . forEach ( ( keySub ) => {
160160 if ( portReceiverMapping [ portKey ] [ keySub ] ?. channel ) {
161- const { channel} = portReceiverMapping [ portKey ] [ keySub ]
161+ const { channel } = portReceiverMapping [ portKey ] [ keySub ]
162162 if ( isActioncableAPI ) {
163163 channel . unsubscribe ( )
164164 } else {
@@ -179,7 +179,7 @@ export const initCableWrapper = (apiType = ACTIONCABLE_TYPE, api, options = {},
179179 setTimeout ( ( ) => pauseConnectionIfNeeded ( ) , UNSUBSCRIBE_CHECK_TIMEOUT )
180180 }
181181 } ,
182- resumeChannels : ( { id, port} ) => {
182+ resumeChannels : ( { id, port } ) => {
183183 if ( portReceiverMapping [ id ] ) {
184184 resumeConnectionIfNeeded ( )
185185
@@ -201,15 +201,15 @@ export const initCableWrapper = (apiType = ACTIONCABLE_TYPE, api, options = {},
201201 portReceiverMapping [ id ] [ keySub ] ?. channelData &&
202202 ! portReceiverMapping [ id ] [ keySub ] ?. channel
203203 ) {
204- const { channel, params} = portReceiverMapping [ id ] [ keySub ] . channelData
204+ const { channel, params } = portReceiverMapping [ id ] [ keySub ] . channelData
205205 const subscriptionChannel = websocketConnection . subscriptions . create (
206206 {
207207 ...params ,
208208 channel
209209 } ,
210210 {
211211 received : ( data ) => {
212- port . postMessage ( { command : WEBSOCKET_MESSAGE_COMMAND , data, id : keySub } )
212+ port . postMessage ( { command : WEBSOCKET_MESSAGE_COMMAND , data, id : keySub } )
213213 }
214214 }
215215 )
@@ -236,13 +236,13 @@ export const initCableWrapper = (apiType = ACTIONCABLE_TYPE, api, options = {},
236236 portReceiverMapping [ id ] [ keySub ] ?. channelData &&
237237 ! portReceiverMapping [ id ] [ keySub ] ?. channel
238238 ) {
239- const { channelData} = portReceiverMapping [ id ] [ keySub ]
240- const { channel, params} = channelData
239+ const { channelData } = portReceiverMapping [ id ] [ keySub ]
240+ const { channel, params } = channelData
241241 return websocketConnection
242242 . subscribeTo ( channel , params )
243243 . then ( ( subscriptionChannel ) => {
244244 subscriptionChannel . on ( 'message' , ( data ) => {
245- port . postMessage ( { command : WEBSOCKET_MESSAGE_COMMAND , data, id : keySub } )
245+ port . postMessage ( { command : WEBSOCKET_MESSAGE_COMMAND , data, id : keySub } )
246246 } )
247247
248248 return [
@@ -275,7 +275,7 @@ export const initCableWrapper = (apiType = ACTIONCABLE_TYPE, api, options = {},
275275 }
276276 }
277277 } ,
278- pauseChannels : ( { id } ) => {
278+ pauseChannels : ( { id } ) => {
279279 if ( portReceiverMapping [ id ] ) {
280280 portReceiverMapping = {
281281 ...portReceiverMapping ,
@@ -284,7 +284,7 @@ export const initCableWrapper = (apiType = ACTIONCABLE_TYPE, api, options = {},
284284 portReceiverMapping [ id ] [ keySub ] ?. channel &&
285285 portReceiverMapping [ id ] [ keySub ] ?. channelData
286286 ) {
287- const { channel, ...restData } = portReceiverMapping [ id ] [ keySub ]
287+ const { channel, ...restData } = portReceiverMapping [ id ] [ keySub ]
288288 if ( isActioncableAPI ) {
289289 channel . unsubscribe ( )
290290 } else {
0 commit comments