Skip to content

Commit 1ef00e6

Browse files
committed
#211 - allow smaller values of initial delay, including zero
- also increased the precision to one decimal place (tenths of a second)
1 parent ebd4f7e commit 1ef00e6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/settings.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export interface CustomSortPluginSettings {
1717
}
1818

1919
const MILIS = 1000
20-
const DEFAULT_DELAY_SECONDS = 0
21-
const DELAY_MIN_SECONDS = 1
20+
const DEFAULT_DELAY_SECONDS = 1
21+
const DELAY_MIN_SECONDS = 0
2222
const DELAY_MAX_SECONDS = 30
2323
const DEFAULT_DELAY = DEFAULT_DELAY_SECONDS * MILIS
2424

@@ -78,8 +78,8 @@ export class CustomSortSettingTab extends PluginSettingTab {
7878
.addText(text => text
7979
.setValue(`${this.plugin.settings.delayForInitialApplication/MILIS}`)
8080
.onChange(async (value) => {
81-
let delayS = parseInt(value, 10)
82-
delayS = Number.isNaN(delayS) ? DEFAULT_DELAY_SECONDS : (delayS < DELAY_MIN_SECONDS ? DELAY_MIN_SECONDS :(delayS > DELAY_MAX_SECONDS ? DELAY_MAX_SECONDS : delayS))
81+
let delayS = parseFloat(value)
82+
delayS = (Number.isNaN(delayS) || !Number.isFinite((delayS))) ? DEFAULT_DELAY_SECONDS : (delayS < DELAY_MIN_SECONDS ? DELAY_MIN_SECONDS :(delayS > DELAY_MAX_SECONDS ? DELAY_MAX_SECONDS : delayS))
8383
delayS = Math.round(delayS*10) / 10 // allow values like 0.2
8484
this.plugin.settings.delayForInitialApplication = delayS * MILIS
8585
await this.plugin.saveSettings()

0 commit comments

Comments
 (0)