Skip to content

Commit

Permalink
Update index.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 20, 2024
1 parent 9a0188e commit 1aed0b6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,24 @@ Clear the internal cache of locked ports.
This can be useful when you want the results to be unaffected by previous calls.
Please note that clearing the cache could cause race conditions.
Please note that clearing the cache could cause [race conditions](https://github.com/sindresorhus/get-port#beware).
@example
```
import getPort, {clearLockedPorts} from 'get-port';
console.log(await getPort({port: [3000, 3001, 3002]}));
const port = [3000, 3001, 3002];
console.log(await getPort({port}));
//=> 3000
console.log(await getPort({port: [3000, 3001, 3002]}));
console.log(await getPort({port}));
//=> 3001
// If you want your results to be unaffected by previous calls, clear the cache.
// If you want the results to be unaffected by previous calls, clear the cache.
clearLockedPorts();
console.log(await getPort({port: [3000, 3001, 3002]}));
console.log(await getPort({port}));
//=> 3000
```
*/
Expand Down

0 comments on commit 1aed0b6

Please sign in to comment.