File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -215,17 +215,11 @@ export class HolyProgress {
215
215
} ;
216
216
217
217
/**
218
- * Completes the progress, moving it to 100% and then hiding it.
219
- * Optionally, it can force completion even if the bar hasn't started.
218
+ * Completes the progress, moving it to 100%
220
219
* @public
221
- * @param {boolean } [force] - Force completion even if the bar hasn't started.
222
220
* @returns {HolyProgress } The current instance for chaining methods.
223
221
*/
224
- public done = ( force ?: boolean ) : HolyProgress => {
225
- if ( force === false && this . status === null ) return this ;
226
-
227
- return this . increment ( 0.3 + 0.5 * Math . random ( ) ) . setTo ( 1 ) ;
228
- } ;
222
+ public complete = ( ) : HolyProgress => this . setTo ( 1 ) ;
229
223
230
224
/**
231
225
* Calculates an increment value based on the current status of the progress.
@@ -235,11 +229,9 @@ export class HolyProgress {
235
229
* @returns {number } The calculated increment value.
236
230
*/
237
231
private readonly calculateIncrement = ( status : number ) : number => {
238
- if ( status < 0.2 ) return 0.1 ;
239
- if ( status < 0.5 ) return 0.04 ;
240
- if ( status < 0.8 ) return 0.02 ;
241
- if ( status < 0.99 ) return 0.005 ;
242
- return 0 ;
232
+ const base = 0.1 ;
233
+ const scale = 5 ;
234
+ return base * Math . exp ( - scale * status ) ;
243
235
} ;
244
236
245
237
/**
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ const HolyLoader = ({
124
124
125
125
const stopProgress = ( ) : void => {
126
126
try {
127
- holyProgress . done ( ) ;
127
+ holyProgress . complete ( ) ;
128
128
} catch ( error ) { }
129
129
} ;
130
130
You can’t perform that action at this time.
0 commit comments