diff options
author | 2022-09-06 22:32:04 +0200 | |
---|---|---|
committer | 2022-09-08 01:24:50 +0200 | |
commit | 5f8f4e6484faff23821ca7c009e309382fba914d (patch) | |
tree | 6d399fb90b4aa3527c30c502ba474cd83b5c94b2 /subprojects/frontend/src/xtext/OccurrencesService.ts | |
parent | feat(frontend): handle page hide events (diff) | |
download | refinery-5f8f4e6484faff23821ca7c009e309382fba914d.tar.gz refinery-5f8f4e6484faff23821ca7c009e309382fba914d.tar.zst refinery-5f8f4e6484faff23821ca7c009e309382fba914d.zip |
feat(frontend): check for updates periodically
Diffstat (limited to 'subprojects/frontend/src/xtext/OccurrencesService.ts')
-rw-r--r-- | subprojects/frontend/src/xtext/OccurrencesService.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/subprojects/frontend/src/xtext/OccurrencesService.ts b/subprojects/frontend/src/xtext/OccurrencesService.ts index 9d738d76..248a9a87 100644 --- a/subprojects/frontend/src/xtext/OccurrencesService.ts +++ b/subprojects/frontend/src/xtext/OccurrencesService.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { Transaction } from '@codemirror/state'; | 1 | import { Transaction } from '@codemirror/state'; |
2 | import { debounce } from 'lodash-es'; | 2 | import { debounce } from 'lodash-es'; |
3 | import ms from 'ms'; | ||
3 | 4 | ||
4 | import type EditorStore from '../editor/EditorStore'; | 5 | import type EditorStore from '../editor/EditorStore'; |
5 | import { | 6 | import { |
@@ -11,7 +12,7 @@ import getLogger from '../utils/getLogger'; | |||
11 | import type UpdateService from './UpdateService'; | 12 | import type UpdateService from './UpdateService'; |
12 | import type { TextRegion } from './xtextServiceResults'; | 13 | import type { TextRegion } from './xtextServiceResults'; |
13 | 14 | ||
14 | const FIND_OCCURRENCES_TIMEOUT_MS = 1000; | 15 | const FIND_OCCURRENCES_TIMEOUT = ms('1s'); |
15 | 16 | ||
16 | const log = getLogger('xtext.OccurrencesService'); | 17 | const log = getLogger('xtext.OccurrencesService'); |
17 | 18 | ||
@@ -33,7 +34,7 @@ export default class OccurrencesService { | |||
33 | 34 | ||
34 | private readonly findOccurrencesLater = debounce( | 35 | private readonly findOccurrencesLater = debounce( |
35 | () => this.findOccurrences(), | 36 | () => this.findOccurrences(), |
36 | FIND_OCCURRENCES_TIMEOUT_MS, | 37 | FIND_OCCURRENCES_TIMEOUT, |
37 | ); | 38 | ); |
38 | 39 | ||
39 | constructor( | 40 | constructor( |