strong-roots-capital / until

Await until event or callback

Home Page:https://www.npmjs.com/package/@strong-roots-capital/until

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

until Build status npm version codecov

Await until event

Compatible with

Install

npm install @strong-roots-capital/until

Use

import { until } from '@strong-roots-capital/until'

test('should await until event', async t => {
    class TestClient extends EventEmitter {
        open = false
        constructor() {
            super()
            setTimeout(() => {
                this.open = true
                this.emit('open')
            }, 100)
        }
    }
    const client = new TestClient()
    await until(client, 'open')
    t.true(client.open)
})

Related

About

Await until event or callback

https://www.npmjs.com/package/@strong-roots-capital/until


Languages

Language:TypeScript 77.7%Language:JavaScript 22.3%