NodeCache.js 274 B

1234567891011121314151617181920212223242526
  1. let id = 0;
  2. class NodeCache {
  3. constructor() {
  4. this.id = id ++;
  5. this.nodesData = new WeakMap();
  6. }
  7. getNodeData( node ) {
  8. return this.nodesData.get( node );
  9. }
  10. setNodeData( node, data ) {
  11. this.nodesData.set( node, data );
  12. }
  13. }
  14. export default NodeCache;