Skip to content

Commit e27b333

Browse files
authored
Merge pull request #81 from nol13/cleanup-and-opts
Cleanup and opts
2 parents be85864 + 87c6380 commit e27b333

20 files changed

+1424
-646
lines changed

README.md

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import {ratio} from './dist/esm/fuzzball.esm.min.js';
4949
console.log(ratio('fuzz', 'fuzzy'));
5050
</script>
5151
```
52-
See the lite section below if you need the smallest possible file size.
52+
See the lite section below if you need the smallest possible file size. If you need to support IE or node < v14 use v2.1.6 or earlier.
5353
5454
# Usage
5555
@@ -84,9 +84,6 @@ fuzz.extractAsPromised("mr. harry hood", choices, options).then(res => {/* do st
8484
8585
// Cancel search
8686
87-
// For Node versions 14 and below and IE, use the legacy cancelToken option instead
88-
// see the "Async and Cancellation" section below
89-
9087
const abortController = new AbortController();
9188
options.abortController = abortController;
9289
@@ -324,14 +321,12 @@ results = fuzz.extract(query, choices, options);
324321
### Async and Cancellation
325322
326323
When using extractAsPromised or extractAsync, you might want to cancel the action before it has finished.
327-
It can be done using `CancelToken` or `AbortController`.
324+
It can be done using `AbortController`.
328325
329326
For performance, by default only every 256th loop will be async, but set `asyncLoopOffset` to change. It is most likely not worth changing this.
330327
331328
**AbortController**
332329
333-
[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) is present in modern browsers and from node version `15+`. It is currently a standard way how to cancel running operations.
334-
335330
```js
336331
// or use AbortController to cancel search
337332
const abortController = new AbortController();
@@ -348,26 +343,6 @@ fuzz.extractAsPromised("gonna get aborted", choices, options)
348343
abortController.abort();
349344
```
350345
351-
**CancelToken**
352-
353-
For older browsers and node versions you can use cancel token. It is an in
354-
355-
```js
356-
let cancelToken = { canceled: false };
357-
358-
options.cancelToken = cancelToken;
359-
options.asyncLoopOffset = 64;
360-
361-
fuzz.extractAsPromised("gonna get canceled", choices, options)
362-
.then(res => {/* do stuff */})
363-
.catch((e) => {
364-
if (e.message === 'canceled') console.log('I got canceled!')
365-
});
366-
367-
// ...
368-
369-
cancelToken.canceled = true;
370-
```
371346
372347
### Wildcards
373348

0 commit comments

Comments
 (0)