simple-resource-pool-fixed
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

simple-resource-pool-fixed

The original simple-resource-pool npm package can trigger the following error in its index.d.ts file:

Type annotation cannot appear on a constructor declaration.ts(1093)

This repo fixed the type annotation issue and repackged the original simple-resource-pool npm package as a new npm package.

The original npm package page can be found here.

Installation

To use with node or a bundler:

$ npm i simple-resource-pool

Directly in the browser:

<script src="path/to/yourCopyOf/simple-resource-pool.js"></script>

or using the minified version:

<script src="path/to/yourCopyOf/simple-resource-pool.min.js"></script>

or from UNPKG:

<script src="https://unpkg.com/simple-resource-pool@[version]/dist/simple-resource-pool.min.js"></script>

Typings

Included for Typescript in index.d.ts

Usage

import { ResourcePool } from 'simple-resource-pool'

import { MyResource } from './MyResource'

interface MyResource {
  foo: baz
}

const creator = () => new MyResource()

const rp = new ResourcePool<MyResource>(creator)

rp.getRes().then(res => {
  // ...do stuff with res...
  // ...
  // then release the resource
  rp.release(res)
})

Documentation

Pending

Also since this package is in UNPKG you can use dynamic-cdn-webpack-plugin with it.

Build

npm run build simply runs webpack using the included configuration file. Creates a universal module in the lib/ directory.

Linting

npm run lint

Running The Test Suite

Run the tests:

# npm run test

Package Sidebar

Install

npm i simple-resource-pool-fixed

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

29.3 kB

Total Files

16

Last publish

Collaborators

  • kelayamatoz