Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit 5abcfa6

Browse files
authored
feat: add wait (#32)
1 parent 7df8fb4 commit 5abcfa6

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ This degrades gracefully when not connected to a TTY. It queues up any writes to
7777

7878
![action demo](assets/action.gif)
7979

80-
# annotation
80+
# cli.annotation
8181

8282
Shows an iterm annotation
8383

@@ -87,3 +87,12 @@ cli.annotation('sometest', 'annotated with this text')
8787
```
8888

8989
![annotation demo](assets/annotation.png)
90+
91+
# cli.wait
92+
93+
Waits for 1 second or given milliseconds
94+
95+
```typescript
96+
await cli.wait()
97+
await cli.wait(3000)
98+
```

src/deps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const deps = {
1111
get styledHeader(): typeof import ('./styled/header').default { return fetch('./styled/header').default },
1212
get styledJSON(): typeof import ('./styled/json').default { return fetch('./styled/json').default },
1313
get table(): typeof import ('./styled/table').default { return fetch('./styled/table').default },
14+
get wait(): typeof import ('./wait').default { return fetch('./wait').default },
1415
}
1516

1617
const cache: any = {}

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const ux = {
2323
get styledJSON() { return deps.styledJSON },
2424
get table() { return deps.table },
2525
get open() { return deps.open },
26+
get wait() { return deps.wait },
2627

2728
async done() {
2829
config.action.stop()

src/wait.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// tslint:disable no-string-based-set-timeout
2+
export default (ms: number = 1000) => {
3+
return new Promise(resolve => setTimeout(resolve, ms))
4+
}

0 commit comments

Comments
 (0)