Promises based nanoresource
$ npm install nanoresource-promise
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()
})()
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()
})()
🐛 If you found an issue we encourage you to report it on github. Please specify your OS and the actions to reproduce it.
👥 Ideas and contributions to the project are welcome. You must follow this guideline.
MIT © A GEUT project