ready-resource
Modern single resource management
Last updated a year ago by mafintosh .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install ready-resource 
SYNC missed versions from official npm registry.

ready-resource

Modern single resource management

npm install ready-resource

Usage

const ReadyResource = require('ready-resource')

class Thing extends ReadyResource {
  constructor () {
    super()
  }

  async _open () {
    // open the resource
  }

  async _close () {
    // close the resource
  }
}

const r = new Thing()

await r.ready() // calls _open once
await r.ready() // noop

await r.close() // calls _close after _open has finished
await r.close() // noop

License

MIT

Current Tags

  • 1.2.0                                ...           latest (a year ago)

9 Versions

  • 1.2.0                                ...           a year ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           4 years ago
  • 0.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Total 15
Today 0
This Week 1
This Month 11
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE