Skip to content

Commit

Permalink
better docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nichoth committed Oct 1, 2024
1 parent 6242c89 commit 980e4e8
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,23 @@ __`dom.byId`__ is equal to `document.getElementById`
Look for a DOM element by slector. Default timeout is 5 seconds. Throws if the element is not found.

```ts
export function waitFor (
args:{
selector?:string,
visible?:boolean,
timeout?:number
}|string,
lambda?:() => Element|null
):Promise<Element|null>
function waitFor (selector?:string|null, args?:{
visible?:boolean,
timeout?:number
}|null, lambda?):Promise<Element|null>
```

#### `waitFor` example
```js
import { waitFor } from '@bicycle-codes/dom'
const foundElement = await waitFor({
selector: 'p'
})
// or pass in a query selector string
const el = await waitFor('#my-element')
// example of using a lambda function only
const el2 = dom.waitFor(null, null, () => {
return document.querySelector('p')
})
```

### `waitForText`
Expand Down

0 comments on commit 980e4e8

Please sign in to comment.