From 980e4e83606ab31715c5ef487548c2be076f08d5 Mon Sep 17 00:00:00 2001 From: nichoth Date: Tue, 1 Oct 2024 14:17:05 -0700 Subject: [PATCH] better docs --- README.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a22aab3..73cbb78 100644 --- a/README.md +++ b/README.md @@ -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 +function waitFor (selector?:string|null, args?:{ + visible?:boolean, + timeout?:number +}|null, lambda?):Promise ``` #### `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`