@@ -2,6 +2,7 @@ const ClientBase = require('./client_base');
2
2
const SocketCache = require ( '../base/socket_cache' ) ;
3
3
const getLanguage = require ( '../language' ) . get ;
4
4
const State = require ( '../storage' ) . State ;
5
+ const cloneObject = require ( '../utility' ) . cloneObject ;
5
6
const getPropertyValue = require ( '../utility' ) . getPropertyValue ;
6
7
const isEmptyObject = require ( '../utility' ) . isEmptyObject ;
7
8
const getAppId = require ( '../../config' ) . getAppId ;
@@ -69,7 +70,7 @@ const BinarySocketBase = (() => {
69
70
Object . keys ( waiting_list . items )
70
71
. some ( type => (
71
72
type !== msg_type &&
72
- $ . inArray ( pr , waiting_list . items [ type ] ) >= 0
73
+ waiting_list . items [ type ] . indexOf ( pr ) !== - 1
73
74
) )
74
75
) ,
75
76
} ;
@@ -132,7 +133,7 @@ const BinarySocketBase = (() => {
132
133
if ( ! options . forced ) {
133
134
const response = SocketCache . get ( data , msg_type ) ;
134
135
if ( response ) {
135
- State . set ( [ 'response' , msg_type ] , $ . extend ( { } , response ) ) ;
136
+ State . set ( [ 'response' , msg_type ] , cloneObject ( response ) ) ;
136
137
if ( isReady ( ) && is_available ) { // make the request to keep the cache updated
137
138
binary_socket . send ( JSON . stringify ( data ) ) ;
138
139
}
@@ -181,7 +182,7 @@ const BinarySocketBase = (() => {
181
182
sent_requests . add ( msg_type ) ;
182
183
}
183
184
} else if ( + data . time !== 1 ) { // Do not buffer all time requests
184
- buffered_sends . push ( { request : data , options : $ . extend ( options , { promise : promise_obj } ) } ) ;
185
+ buffered_sends . push ( { request : data , options : Object . assign ( options , { promise : promise_obj } ) } ) ;
185
186
}
186
187
187
188
return promise_obj . promise ;
@@ -225,7 +226,7 @@ const BinarySocketBase = (() => {
225
226
226
227
// store in State
227
228
if ( ! getPropertyValue ( response , [ 'echo_req' , 'subscribe' ] ) || / b a l a n c e | w e b s i t e _ s t a t u s / . test ( msg_type ) ) {
228
- State . set ( [ 'response' , msg_type ] , $ . extend ( { } , response ) ) ;
229
+ State . set ( [ 'response' , msg_type ] , cloneObject ( response ) ) ;
229
230
}
230
231
// resolve the send promise
231
232
const this_req_id = response . req_id ;
0 commit comments