Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Olian04/proxy_pool

Repository files navigation

proxy_pool

An object pool specifically for proxies

Installation

npm install @olian04/proxy_pool

Usage

import { ProxyPool, Proxy } from '@olian04/proxy_pool';

const pool = new ProxyPool<
  Record<string, number>,
  [ctx: { foo: number }, num: number]
>({
  set: () => false,
  get: (data, num, key) => data.foo * num,
});

const obj = pool.get({ foo: 10 }, 2);
assert(obj.foo === 20);

const obj2 = pool.get({ foo: 20 }, 4);
assert(obj2.foo === 80);

pool.release(obj);
pool.release(obj2);

About

An object pool specifically for proxies

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published