Skip to content

Commit 095b472

Browse files
committed
show new cancel method in overview and add a note for the legacy option
1 parent 13c16ef commit 095b472

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,16 @@ fuzz.extract("mr. harry hood", choices, options);
8080
8181
fuzz.extractAsync("mr. harry hood", choices, options, function (err, results){/* do stuff */});
8282
83-
// In supported environments, Promise will not be polyfilled
8483
fuzz.extractAsPromised("mr. harry hood", choices, options).then(res => {/* do stuff */});
8584
8685
// Cancel search
87-
let cancelToken = {canceled: false};
88-
options.cancelToken = cancelToken;
89-
fuzz.extractAsPromised("gonna get canceled", choices, options)
90-
.then(res => {/* do stuff */})
91-
.catch((e) => {
92-
if (e.message === 'canceled') console.log('I got canceled!')
93-
});
94-
cancelToken.canceled = true;
9586
96-
// or use AbortController to cancel search
97-
const abortController = new AbortController();
87+
// For Node versions 14 and below and IE, use the legacy cancelToken option instead
88+
// see the "Async and Cancellation" section below
9889
90+
const abortController = new AbortController();
9991
options.abortController = abortController;
92+
10093
fuzz.extractAsPromised("gonna get canceled", choices, options)
10194
.then(res => {/* do stuff */})
10295
.catch((e) => {

0 commit comments

Comments
 (0)