Skip to content

Commit

Permalink
moved debounce timer to config
Browse files Browse the repository at this point in the history
  • Loading branch information
ivicic-petr committed Mar 29, 2024
1 parent d956d39 commit eb02439
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export abstract class EditorTile extends LitElement {
@state() variableName = ''
@query('#name-field') nameField: HTMLInputElement | undefined
declare aceEditor: ace.Ace.Editor
static DEBOUNCE = 1000

protected constructor () {
super()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ace, { type Ace } from 'ace-builds'
import langTools from 'ace-builds/src-noconflict/ext-language_tools'
import 'ace-builds/esm-resolver'
import { EditorTile } from './editor-tile'
import { functionDebounceTimer } from '../../../util/config'

library.add(faTrash, faMagnifyingGlass)

Expand Down Expand Up @@ -38,6 +39,7 @@ export class FunctionTile extends EditorTile {
})))
}
})
this.aceEditor.setOption('placeholder', '$f_' + this.functions[this.index].id + '(...)')
}

protected firstUpdated (_changedProperties: PropertyValues): void {
Expand All @@ -54,7 +56,7 @@ export class FunctionTile extends EditorTile {
bubbles: true,
composed: true
}))
}, EditorTile.DEBOUNCE
}, functionDebounceTimer
)

functionUpdated = debounce(() => {
Expand All @@ -66,7 +68,7 @@ export class FunctionTile extends EditorTile {
bubbles: true,
composed: true
}))
}, EditorTile.DEBOUNCE
}, functionDebounceTimer
)

async removeVariable (): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ace, { type Ace } from 'ace-builds'
import langTools from 'ace-builds/src-noconflict/ext-language_tools'
import 'ace-builds/esm-resolver'
import { EditorTile } from './editor-tile'
import { functionDebounceTimer } from '../../../util/config'
library.add(faTrash, faMagnifyingGlass)

@customElement('variable-tile')
Expand Down Expand Up @@ -56,7 +57,7 @@ export class VariableTile extends EditorTile {
bubbles: true,
composed: true
}))
}, EditorTile.DEBOUNCE
}, functionDebounceTimer
)

functionUpdated = debounce(() => {
Expand All @@ -68,7 +69,7 @@ export class VariableTile extends EditorTile {
bubbles: true,
composed: true
}))
}, EditorTile.DEBOUNCE
}, functionDebounceTimer
)

toggleEssentiality (regulation: IRegulationData): void {
Expand Down
2 changes: 2 additions & 0 deletions src/html/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ export const tabList: TabData[] = [
icon: 'a'
})
]

export const functionDebounceTimer = 1000

0 comments on commit eb02439

Please sign in to comment.