LokiJS: Documentation does not list emitted events
BLUF: I had to dig around in the source to find out what values are valid to pass to db.on().
For example, I have a singleton database instance that I use in several modules. The singleton loads the database from file at startup, but if I try to read a collection immediately in a consuming module, there’s no data, because the load isn’t finished. Since I’m not in the module that’s calling loadDatabase(), I can’t pass a callback to that method.
This is easy to solve by listening to the “loaded” event, but nowhere in the docs does it say that this event exists. We see that Loki implements LokiEventEmitter so it has an on() method, but we don’t know what events it will emit.
The JSDoc usage notes give this example of an @event tag:
/**
* Snowball event.
*
* @event Hurl#snowball
* @type {object}
* @property {boolean} isPacked - Indicates whether the snowball is tightly packed.
*/
You can also use @fires / @emits to annotate methods that (sometimes) cause those events to be emitted.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 18 (2 by maintainers)
gotta find time to address this, damn
i am up the walls but i will try to get this done asap
Marco?