@@ -24,22 +24,27 @@ function suggestionToLabel(sug: Suggestion) {
24
24
}
25
25
}
26
26
27
+ const DEFAULT_DELAY = - 1 ;
28
+
27
29
export type Settings = {
28
30
ignoredLints ?: string ;
29
31
useWebWorker : boolean ;
30
32
dialect ?: Dialect ;
31
33
lintSettings : LintConfig ;
32
34
userDictionary ?: string [ ] ;
35
+ delay ?: number ;
33
36
} ;
34
37
35
38
export default class HarperPlugin extends Plugin {
36
39
private harper : Linter ;
37
40
private editorExtensions : Extension [ ] ;
41
+ private delay : number ;
38
42
39
43
constructor ( app : App , manifest : PluginManifest ) {
40
44
super ( app , manifest ) ;
41
45
this . harper = new WorkerLinter ( { binary : binaryInlined } ) ;
42
46
this . editorExtensions = [ ] ;
47
+ this . delay = DEFAULT_DELAY ;
43
48
}
44
49
45
50
public async initializeFromSettings ( settings : Settings | null ) {
@@ -73,6 +78,8 @@ export default class HarperPlugin extends Plugin {
73
78
await this . harper . setLintConfig ( settings . lintSettings ) ;
74
79
this . harper . setup ( ) ;
75
80
81
+ this . delay = settings . delay ?? DEFAULT_DELAY ;
82
+
76
83
// Reinitialize it.
77
84
if ( this . hasEditorLinter ( ) ) {
78
85
this . disableEditorLinter ( ) ;
@@ -96,6 +103,7 @@ export default class HarperPlugin extends Plugin {
96
103
lintSettings : await this . harper . getLintConfig ( ) ,
97
104
userDictionary : await this . harper . exportWords ( ) ,
98
105
dialect : await this . harper . getDialect ( ) ,
106
+ delay : this . delay ,
99
107
} ;
100
108
}
101
109
@@ -259,7 +267,7 @@ export default class HarperPlugin extends Plugin {
259
267
} ) ;
260
268
} ,
261
269
{
262
- delay : - 1 ,
270
+ delay : this . delay ,
263
271
} ,
264
272
) ;
265
273
}
0 commit comments