@@ -157,34 +157,48 @@ var SwupProgressPlugin = function (_Plugin) {
157
157
158
158
_this . stopShowingProgress = function ( ) {
159
159
_this . progressBar . setValue ( 1 ) ;
160
- _this . hideProgressBar ( ) ;
160
+ if ( _this . options . hideImmediately ) {
161
+ _this . hideProgressBar ( ) ;
162
+ } else {
163
+ _this . finishAnimationAndHideProgressBar ( ) ;
164
+ }
161
165
} ;
162
166
163
167
_this . showProgressBar = function ( ) {
168
+ if ( _this . hideProgressBarTimeout != null ) {
169
+ window . clearTimeout ( _this . hideProgressBarTimeout ) ;
170
+ delete _this . hideProgressBarTimeout ;
171
+ }
164
172
_this . progressBar . show ( ) ;
165
173
} ;
166
174
167
175
_this . showProgressBarAfterDelay = function ( ) {
168
- _this . progressBarTimeout = window . setTimeout ( _this . showProgressBar , _this . options . delay ) ;
176
+ _this . showProgressBarTimeout = window . setTimeout ( _this . showProgressBar , _this . options . delay ) ;
169
177
} ;
170
178
171
179
_this . hideProgressBar = function ( ) {
172
180
_this . progressBar . hide ( ) ;
173
- if ( _this . progressBarTimeout != null ) {
174
- window . clearTimeout ( _this . progressBarTimeout ) ;
175
- delete _this . progressBarTimeout ;
181
+ } ;
182
+
183
+ _this . finishAnimationAndHideProgressBar = function ( ) {
184
+ _this . hideProgressBarTimeout = window . setTimeout ( _this . hideProgressBar , _this . options . transition ) ;
185
+
186
+ if ( _this . showProgressBarTimeout != null ) {
187
+ window . clearTimeout ( _this . showProgressBarTimeout ) ;
188
+ delete _this . showProgressBarTimeout ;
176
189
}
177
190
} ;
178
191
179
192
var defaultOptions = {
180
193
className : 'swup-progress-bar' ,
181
194
transition : 300 ,
182
- delay : 300
195
+ delay : 300 ,
196
+ hideImmediately : true
183
197
} ;
184
198
185
199
_this . options = _extends ( { } , defaultOptions , options ) ;
186
200
187
- _this . progressBarTimeout = null ;
201
+ _this . showProgressBarTimeout = null ;
188
202
_this . progressBar = new _ProgressBar2 . default ( {
189
203
className : _this . options . className ,
190
204
animationDuration : _this . options . transition
0 commit comments