blob: db34dcebfd0f0b5108b64dd7346ec74bb471a2a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
export default class Provider {
constructor() {
this.latestPrefix = '';
this.latestComplete = true;
}
handlePretextChanged(suggestionId, pretext) { // eslint-disable-line no-unused-vars
// NO-OP for inherited classes to override
}
startNewRequest(prefix) {
this.latestPrefix = prefix;
this.latestComplete = false;
}
shouldCancelDispatch(prefix) {
if (prefix === this.latestPrefix) {
this.latestComplete = true;
} else if (this.latestComplete) {
return true;
}
return false;
}
}
|