Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
chain-able-deps / dist / typings / cache / pooler.d.ts
Size: Mime:
import { Class, ArgumentPooler, PooledClass } from '../_typings';
/**
 * Augments `CopyConstructor` to be a poolable class, augmenting only the class
 * itself (statically) not adding any prototypical fields. Any CopyConstructor
 * you give this may have a `poolSize` property, and will look for a
 * prototypical `destructor` on instances.
 *
 * @since 5.0.0
 * @memberOf pooler
 *
 * @param {Function | Object} CopyConstructor Constructor that can be used to reset.
 * @param {Function} pooler Customizable pooler.
 * @return {Object} enhanced constructor, decorated with pooler
 *
 * @prop {Array} instancePool
 * @prop {number} poolSize
 * @prop {Function} release
 * @prop {Function} getPooled
 *
 * @example
 *
 *    class Eh {}
 *    addPoolingTo(Eh) // can optionally pass in pooler as second arg
 *    //=> Eh.instancePool = []
 *    //=> Eh.getPooled = pooler || singleArgumentPooler
 *    //=> Eh.poolSize = 10
 *    //=> Eh.release = standardReleaser
 *
 */
declare function addPoolingTo<T extends Class & PooledClass>(CopyConstructor: T, pooler: ArgumentPooler): T;
export default addPoolingTo;