nanoresource-promise

Promises based nanoresource

MIT 18 个版本
安装
npm install nanoresource-promise
yarn add nanoresource-promise
pnpm add nanoresource-promise
bun add nanoresource-promise
README

nanoresource-promise

Build Status JavaScript Style Guide standard-readme compliant

Promises based nanoresource

Install

$ npm install nanoresource-promise

Usage

import { NanoresourcePromise } from 'nanoresource-promise'

;(async () => {
  const resource = new NanoresourcePromise({
    async open() {
      // open the resource
    },
    async close() {
      // close the resource
    }
  })

  await resource.open()
  await resource.close()
})()

Event support

import { NanoresourcePromise } from 'nanoresource-promise/emitter' // for emittery support uses 'nanoresource-promise/emittery'

;(async () => {
  const resource = new NanoresourcePromise({
    async open() {
      // open the resource
    },
    async close() {
      // close the resource
    }
  })

  resource.on('open', () => {})
  resource.on('opened', () => {})
  resource.on('close', () => {})
  resource.on('closed', () => {})

  await resource.open()
  await resource.close()
})()

Issues

:bug: If you found an issue we encourage you to report it on github. Please specify your OS and the actions to reproduce it.

Contributing

:busts_in_silhouette: Ideas and contributions to the project are welcome. You must follow this guideline.

License

MIT © A GEUT project

版本列表
3.2.0 2022-10-23
3.1.0 2022-09-19
3.0.4 2022-09-17
3.0.3 2021-12-03
3.0.2 2021-09-15
3.0.1 2021-08-17
3.0.0 2021-08-05
2.0.0-beta.2 2020-05-28
2.0.0-beta.1 2020-05-28
2.0.0-beta.0 2020-05-19
2.0.0 2020-07-15
1.2.2 2020-05-19
1.2.1 2020-03-27
1.2.0 2020-03-13
1.1.1 2020-03-13
1.1.0 2020-03-13
1.0.1 2020-03-09
1.0.0 2020-03-09