@@ -689,9 +689,9 @@ var PahoMQTT = (function (global) {
689
689
* Repeat keepalive requests, monitor responses.
690
690
* @ignore
691
691
*/
692
- var Pinger = function ( client , window , keepAliveInterval ) {
692
+ var Pinger = function ( client , self , keepAliveInterval ) {
693
693
this . _client = client ;
694
- this . _window = window ;
694
+ this . _self = self ;
695
695
this . _keepAliveInterval = keepAliveInterval * 1000 ;
696
696
this . isReset = false ;
697
697
@@ -712,28 +712,28 @@ var PahoMQTT = (function (global) {
712
712
this . isReset = false ;
713
713
this . _client . _trace ( "Pinger.doPing" , "send PINGREQ" ) ;
714
714
this . _client . socket . send ( pingReq ) ;
715
- this . timeout = this . _window . setTimeout ( doTimeout ( this ) , this . _keepAliveInterval ) ;
715
+ this . timeout = this . _self . setTimeout ( doTimeout ( this ) , this . _keepAliveInterval ) ;
716
716
}
717
717
} ;
718
718
719
719
this . reset = function ( ) {
720
720
this . isReset = true ;
721
- this . _window . clearTimeout ( this . timeout ) ;
721
+ this . _self . clearTimeout ( this . timeout ) ;
722
722
if ( this . _keepAliveInterval > 0 )
723
723
this . timeout = setTimeout ( doTimeout ( this ) , this . _keepAliveInterval ) ;
724
724
} ;
725
725
726
726
this . cancel = function ( ) {
727
- this . _window . clearTimeout ( this . timeout ) ;
727
+ this . _self . clearTimeout ( this . timeout ) ;
728
728
} ;
729
729
} ;
730
730
731
731
/**
732
732
* Monitor request completion.
733
733
* @ignore
734
734
*/
735
- var Timeout = function ( client , window , timeoutSeconds , action , args ) {
736
- this . _window = window ;
735
+ var Timeout = function ( client , self , timeoutSeconds , action , args ) {
736
+ this . _self = self ;
737
737
if ( ! timeoutSeconds )
738
738
timeoutSeconds = 30 ;
739
739
@@ -745,7 +745,7 @@ var PahoMQTT = (function (global) {
745
745
this . timeout = setTimeout ( doTimeout ( action , client , args ) , timeoutSeconds * 1000 ) ;
746
746
747
747
this . cancel = function ( ) {
748
- this . _window . clearTimeout ( this . timeout ) ;
748
+ this . _self . clearTimeout ( this . timeout ) ;
749
749
} ;
750
750
} ;
751
751
@@ -905,7 +905,7 @@ var PahoMQTT = (function (global) {
905
905
}
906
906
907
907
if ( subscribeOptions . timeout ) {
908
- wireMessage . timeOut = new Timeout ( this , window , subscribeOptions . timeout , subscribeOptions . onFailure ,
908
+ wireMessage . timeOut = new Timeout ( this , self , subscribeOptions . timeout , subscribeOptions . onFailure ,
909
909
[ { invocationContext :subscribeOptions . invocationContext ,
910
910
errorCode :ERROR . SUBSCRIBE_TIMEOUT . code ,
911
911
errorMessage :format ( ERROR . SUBSCRIBE_TIMEOUT ) } ] ) ;
@@ -930,7 +930,7 @@ var PahoMQTT = (function (global) {
930
930
wireMessage . callback = function ( ) { unsubscribeOptions . onSuccess ( { invocationContext :unsubscribeOptions . invocationContext } ) ; } ;
931
931
}
932
932
if ( unsubscribeOptions . timeout ) {
933
- wireMessage . timeOut = new Timeout ( this , window , unsubscribeOptions . timeout , unsubscribeOptions . onFailure ,
933
+ wireMessage . timeOut = new Timeout ( this , self , unsubscribeOptions . timeout , unsubscribeOptions . onFailure ,
934
934
[ { invocationContext :unsubscribeOptions . invocationContext ,
935
935
errorCode :ERROR . UNSUBSCRIBE_TIMEOUT . code ,
936
936
errorMessage :format ( ERROR . UNSUBSCRIBE_TIMEOUT ) } ] ) ;
@@ -1051,13 +1051,13 @@ var PahoMQTT = (function (global) {
1051
1051
this . socket . onerror = scope ( this . _on_socket_error , this ) ;
1052
1052
this . socket . onclose = scope ( this . _on_socket_close , this ) ;
1053
1053
1054
- this . sendPinger = new Pinger ( this , window , this . connectOptions . keepAliveInterval ) ;
1055
- this . receivePinger = new Pinger ( this , window , this . connectOptions . keepAliveInterval ) ;
1054
+ this . sendPinger = new Pinger ( this , self , this . connectOptions . keepAliveInterval ) ;
1055
+ this . receivePinger = new Pinger ( this , self , this . connectOptions . keepAliveInterval ) ;
1056
1056
if ( this . _connectTimeout ) {
1057
1057
this . _connectTimeout . cancel ( ) ;
1058
1058
this . _connectTimeout = null ;
1059
1059
}
1060
- this . _connectTimeout = new Timeout ( this , window , this . connectOptions . timeout , this . _disconnected , [ ERROR . CONNECT_TIMEOUT . code , format ( ERROR . CONNECT_TIMEOUT ) ] ) ;
1060
+ this . _connectTimeout = new Timeout ( this , self , this . connectOptions . timeout , this . _disconnected , [ ERROR . CONNECT_TIMEOUT . code , format ( ERROR . CONNECT_TIMEOUT ) ] ) ;
1061
1061
} ;
1062
1062
1063
1063
@@ -1548,7 +1548,7 @@ var PahoMQTT = (function (global) {
1548
1548
1549
1549
if ( errorCode !== undefined && this . _reconnecting ) {
1550
1550
//Continue automatic reconnect process
1551
- this . _reconnectTimeout = new Timeout ( this , window , this . _reconnectInterval , this . _reconnect ) ;
1551
+ this . _reconnectTimeout = new Timeout ( this , self , this . _reconnectInterval , this . _reconnect ) ;
1552
1552
return ;
1553
1553
}
1554
1554
@@ -2408,6 +2408,6 @@ var PahoMQTT = (function (global) {
2408
2408
Client : Client ,
2409
2409
Message : Message
2410
2410
} ;
2411
- } ) ( window ) ;
2411
+ } ) ( self ) ;
2412
2412
return PahoMQTT ;
2413
2413
} ) ;
0 commit comments