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

Commit

Permalink
feat: add wait (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
RasPhilCo authored May 31, 2018
1 parent 7df8fb4 commit 5abcfa6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ This degrades gracefully when not connected to a TTY. It queues up any writes to

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

# annotation
# cli.annotation

Shows an iterm annotation

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

![annotation demo](assets/annotation.png)

# cli.wait

Waits for 1 second or given milliseconds

```typescript
await cli.wait()
await cli.wait(3000)
```
1 change: 1 addition & 0 deletions src/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const deps = {
get styledHeader(): typeof import ('./styled/header').default { return fetch('./styled/header').default },
get styledJSON(): typeof import ('./styled/json').default { return fetch('./styled/json').default },
get table(): typeof import ('./styled/table').default { return fetch('./styled/table').default },
get wait(): typeof import ('./wait').default { return fetch('./wait').default },
}

const cache: any = {}
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const ux = {
get styledJSON() { return deps.styledJSON },
get table() { return deps.table },
get open() { return deps.open },
get wait() { return deps.wait },

async done() {
config.action.stop()
Expand Down
4 changes: 4 additions & 0 deletions src/wait.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// tslint:disable no-string-based-set-timeout
export default (ms: number = 1000) => {
return new Promise(resolve => setTimeout(resolve, ms))
}

0 comments on commit 5abcfa6

Please sign in to comment.