estk-events-in-memory
v0.0.8
Published
In-memory, non-durable storage for estk EventStore Useful for testing and/or prototyping.
Downloads
3
Readme
estk-events-in-memory
In-memory, non-durable storage for estk EventStore Useful for testing and/or prototyping.
InMemoryEventStorage
usage:
const { InMemoryEventStorage } = require('estk-events-in-memory');
const { createEventStore } = require('estk-events');
const store = await createEventStore(InMemoryStorage());
await store.publish({
targetType: 'example-type',
targetId: 'example-id',
action: 'example-action',
data: { hello: 'world'}
});
const stream = await store.getEventStream({});
let event;
do {
event = await stream.next();
console.log(event);
} while (!event.ended);