JSPM

reference-count

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

count references to resources and clean up after sweeps

Package Exports

  • reference-count

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 (reference-count) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

reference-count

count references to resources and clean up after sweeps

Usage

var Context = require('reference-count');

var context = new Context();

context.on('resource', function(resource) {
  // called anytime there is a new resource counted
});

context.on('garbage', function(resource) {
  // clean up the resource here
});

context.sweep('actor1')
  .count('resource1')
  .count(['resource2', 'resource3'])
  .done();

context.sweep('actor1')
  .count('resource1')
  .count('resource2'])
  .done();

context.destory('actor1');