Skip to content

Commit 7e7178d

Browse files
authored
Adjust spelling in readme and index (#21)
* Adjust spelling in readme and index * Bump version
1 parent ef0219c commit 7e7178d

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The package is available on [npm](https://npmjs.org/package/async-wait-until):
2020
$ npm install --save async-wait-until
2121
```
2222

23-
It ships with a [UMD](https://github.com/umdjs/umd) bundle by default (which works well as-is on Node.js and web browsers), but bundles for other module systems are also available in the package's `dist/` folder.
23+
It ships with an [UMD](https://github.com/umdjs/umd) bundle by default (which works well as-is on Node.js and web browsers), but bundles for other module systems are also available in the package's `dist/` folder.
2424

2525
```ts
2626
import { waitUntil } from 'async-wait-until';
@@ -158,7 +158,7 @@ const doOutThing = async () => {
158158
// Yup! Easy right?
159159
const divNode = await waitUntil(
160160
// Here, we specify a function that will be repeatedly called from time to time
161-
// Let's call this kind of functions a `predicate`
161+
// Let's call this kind of function a `predicate`
162162
() => window.document.body.querySelector('div.spooky-spooky-skeleton'),
163163
// Here, we can specify a timeout in milliseconds. Once it passes,
164164
// we'll stop waiting and throw an exception
@@ -171,7 +171,7 @@ const doOutThing = async () => {
171171

172172
However, we aren't 100% sure that the `<div />` will be added within 10 seconds. What will happen if 10 seconds have passed and the `<div />` node still isn't there?
173173

174-
From the above code, it's clear that our `'predicate'` function (or simply `'preddcate'`) won't return the DOM node. So what `waitUntil` will do in that case is it will throw a `TimeoutException` (also exported from the library so you can handle it).
174+
From the above code, it's clear that our `'predicate'` function (or simply `'predicate'`) won't return the DOM node. So what `waitUntil` will do in that case is it will throw a `TimeoutException` (also exported from the library so you can handle it).
175175

176176
```js
177177
import { doTheDivThing } from './a-sneaky-module.js';
@@ -190,10 +190,10 @@ const doOurThing = async () => {
190190
} catch (e) {
191191
if (e instanceof TimeoutError) {
192192
// Unfortunately, 10 seconds have passed but we haven't detected the `<div />`
193-
// If we had a UI, we could show an error there or allow user to retry
193+
// If we had a UI, we could show an error there or allow the user to retry
194194
alert('No <div /> have been detected unfortunately');
195195
} else {
196-
// Some another error, most likely thrown from the predicate function.
196+
// Some other error, most likely thrown from the predicate function.
197197
alert('Unknown error occurred');
198198
console.error(e);
199199
}
@@ -205,15 +205,15 @@ So, summing up the above, the predicate will run again and again within the give
205205

206206
### API
207207

208-
Lets' start with the `waitUntil` function. It takes up to two parameters (**deprecated**: up to three), and returns a Promise that will be resolved with the first non-falsy value returned by the predicate.
208+
Let's start with the `waitUntil` function. It takes up to two parameters (**deprecated**: up to three), and returns a Promise that will be resolved with the first non-falsy value returned by the predicate.
209209

210210
Parameter | Type | Required | Default | Description
211211
------------ | ------------- | ------------- | ------------- | -------------
212212
`predicate` | Function | ✅ Yes | - | A function that is expected to return a non-falsy (aka a `'truthy'`) value, or a Promise to return such a value. Hence, *both sync and async functions are supported*.
213213
`options` | Options object | 🚫 No | 5000 ms | Options for the wait algorithm implemented by `waitUntil`, see its properties on the below table. **Deprecated**: timeout in milliseconds.
214214
~~intervalBetweenAttempts~~ | number | 🚫 No | 50 ms | **Deprecated parameter**: number of milliseconds between retry attempts. Please use options instead.
215215

216-
Above, you could see the options param. Here are the available **options**:
216+
Above, you can see the options param. Here are the available **options**:
217217

218218
Parameter | Type | Required | Default | Description
219219
------------ | ------------- | ------------- | ------------- | -------------
@@ -224,7 +224,7 @@ Parameter | Type | Required | Default | Description
224224

225225
#### Waiting for something forever
226226

227-
If you aren't sure how long with a process take, you can use `waitUntil.Forever` (which is a shortcut for [Number.POSITIVE_INFINITY](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY)) as the timeout value:
227+
If you aren't sure how long a process will take, you can use `waitUntil.Forever` (which is a shortcut for [Number.POSITIVE_INFINITY](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY)) as the timeout value:
228228

229229
```ts
230230
import { waitUntil, WAIT_FOREVER } from 'async-wait-until';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "async-wait-until",
3-
"version": "2.0.7",
3+
"version": "2.0.8",
44
"description": "Waits for a given predicate callback to return a truthy value and resolves",
55
"main": "dist/index.js",
66
"module": "dist/index.esm.js",

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const WAIT_FOREVER = Number.POSITIVE_INFINITY;
115115
* @param intervalBetweenAttempts *(deprecated)* Interval to wait for between attempts, optional, *50 ms* by default
116116
* @returns A promise to return the given predicate's result, once it resolves with a truthy value
117117
* @template T Result type for the truthy value returned by the predicate
118-
* @throws [[TimeoutError]] An exception throws when the specified timeout interval passes but the predicate doesn't return a truthy value
118+
* @throws [[TimeoutError]] An exception thrown when the specified timeout interval passes but the predicate doesn't return a truthy value
119119
* @throws Error
120120
* @see [[TruthyValue]]
121121
* @see [[FalsyValue]]
@@ -245,7 +245,7 @@ type ScheduleFn = <T>(callback: (...args: T[]) => void, interval: number) => Sch
245245
*/
246246
type CancelScheduledFn = () => void;
247247
/**
248-
* A stateful abstraction over Node.js & web browser timers, that cancels the scheduled task
248+
* A stateful abstraction over Node.js & web browser timers that cancels the scheduled task
249249
* @private
250250
* @category Common Types
251251
*/
@@ -256,7 +256,7 @@ type ScheduleCanceler = {
256256
cancel: CancelScheduledFn;
257257
};
258258
/**
259-
* A stateful abstraction over Node.js & web browser timers, that schedules a task
259+
* A stateful abstraction over Node.js & web browser timers that schedules a task
260260
* @private
261261
* @category Common Types
262262
*/

0 commit comments

Comments
 (0)