nanoresource-promise

3.2.0 • Public • Published

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

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

Contributing

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

License

MIT © A GEUT project

Readme

Keywords

Package Sidebar

Install

npm i nanoresource-promise

Weekly Downloads

5,807

Version

3.2.0

License

MIT

Unpacked Size

97.1 kB

Total Files

16

Last publish

Collaborators

  • tinchoz49