@es-git/read-combiner-mixin

This is part of the [ES-Git](https://github.com/es-git/es-git) project.

Stats

StarsIssuesVersionUpdatedCreatedSize
@es-git/read-combiner-mixin
0.10.0a year ago4 years agoMinified + gzip package size for @es-git/read-combiner-mixin in KB

Readme

read-combiner-mixin

This is part of the ES-Git project.

Install

npm install --save @es-git/read-combiner-mixin

Usage

Mix this in with an IObjectRepo.

This is a performance enhancing mixin. If reads for the same object are made at the same time, this mixin wil ensure that only one read is made to the repo.

import objectsMixin from '@es-git/objects-mixin';
import readCombinerMixin from '@es-git/read-combiner-mixin';
import MemoryRepo from '@es-git/memory-repo';

const Repo = mix(MemoryRepo)
            .with(objectsMixin)
            .with(readCombinerMixin);

const repo = new Repo();
const [object1, object2, object3] = await Promise.all([
  repo.loadObject(hash),
  repo.loadObject(hash),
  repo.loadObject(hash)
]);

Interfaces

This mixin does not enhance the repo in any observable way, it only wraps the loadObject methody

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.