JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5031
  • Score
    100M100P100Q125978F
  • License MIT

Modern single resource management

Package Exports

  • ready-resource
  • ready-resource/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ready-resource) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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