@@ -164,33 +164,39 @@ var SwupProgressPlugin = function (_Plugin) {
164
164
} else {
165
165
_this . finishAnimationAndHideProgressBar ( ) ;
166
166
}
167
-
168
- if ( _this . showProgressBarTimeout != null ) {
169
- window . clearTimeout ( _this . showProgressBarTimeout ) ;
170
- delete _this . showProgressBarTimeout ;
171
- }
172
167
} ;
173
168
174
169
_this . showProgressBar = function ( ) {
175
- if ( _this . hideProgressBarTimeout != null ) {
176
- window . clearTimeout ( _this . hideProgressBarTimeout ) ;
177
- delete _this . hideProgressBarTimeout ;
178
- }
170
+ _this . cancelHideProgressBarTimeout ( ) ;
179
171
_this . progressBar . show ( ) ;
180
172
} ;
181
173
182
174
_this . showProgressBarAfterDelay = function ( ) {
175
+ _this . cancelShowProgressBarTimeout ( ) ;
176
+ _this . cancelHideProgressBarTimeout ( ) ;
183
177
_this . showProgressBarTimeout = window . setTimeout ( _this . showProgressBar , _this . options . delay ) ;
184
178
} ;
185
179
186
180
_this . hideProgressBar = function ( ) {
181
+ _this . cancelShowProgressBarTimeout ( ) ;
187
182
_this . progressBar . hide ( ) ;
188
183
} ;
189
184
190
185
_this . finishAnimationAndHideProgressBar = function ( ) {
186
+ _this . cancelShowProgressBarTimeout ( ) ;
191
187
_this . hideProgressBarTimeout = window . setTimeout ( _this . hideProgressBar , _this . options . transition ) ;
192
188
} ;
193
189
190
+ _this . cancelShowProgressBarTimeout = function ( ) {
191
+ window . clearTimeout ( _this . showProgressBarTimeout ) ;
192
+ delete _this . showProgressBarTimeout ;
193
+ } ;
194
+
195
+ _this . cancelHideProgressBarTimeout = function ( ) {
196
+ window . clearTimeout ( _this . hideProgressBarTimeout ) ;
197
+ delete _this . hideProgressBarTimeout ;
198
+ } ;
199
+
194
200
var defaultOptions = {
195
201
className : 'swup-progress-bar' ,
196
202
delay : 300 ,
@@ -203,6 +209,7 @@ var SwupProgressPlugin = function (_Plugin) {
203
209
_this . options = _extends ( { } , defaultOptions , options ) ;
204
210
205
211
_this . showProgressBarTimeout = null ;
212
+ _this . hideProgressBarTimeout = null ;
206
213
207
214
_this . progressBar = new _ProgressBar2 . default ( {
208
215
className : _this . options . className ,
0 commit comments