4.3.9 • Published 5 years ago

@js-entity-repos/memory v4.3.9

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
5 years ago

memory

A concrete implementation of js-entity-repos for memory.

Usage

  1. Install it with npm i @js-entity-repos/memory.
  2. For each entity you will need to do the following.
    1. Create Entity interface.
    2. Construct the facade.
    3. Use the facade.

Entity Interface

import Entity from '@js-entity-repos/core/dist/types/Entity';

export interface TodoEntity extends Entity {
  readonly description: string;
  readonly completed: boolean;
}

Construct the Facade

import factory from '@js-entity-repos/memory/dist/factory';

interface State { todos: TodoEntity[]; }
const state: State = { todos: [] };

const todosFacade = factory({
  // Optional property. Defaults to 10.
  defaultPaginationLimit: 10,
  entityName: 'todo',
  // Optional property. Defaults to using entities stored locally in the factory.
  getEntities: () => state.todos,
  // Optional property. Defaults to using entities stored locally in the factory.
  setEntities: (todos) => state.todos = todos,
});
4.3.9

5 years ago

4.3.8

5 years ago

4.3.7

5 years ago

4.3.6

5 years ago

4.3.5

6 years ago

4.3.4

6 years ago

4.3.3

6 years ago

4.3.2

6 years ago

4.3.1

6 years ago

4.3.0

6 years ago

4.2.0

6 years ago

4.1.0

6 years ago

4.0.3

6 years ago

4.0.2

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago