blob: b65068d472eebf5439b7e72c8d42e29f3e87e4df (
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-present 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;
}
}
|