Constructor
new Listener(database, routingFn)
A Fireproof database Listener allows you to react to events in the database.
Parameters:
Name | Type | Description |
---|---|---|
database | Fireproof | The Fireproof database instance to index. |
routingFn | function | The routing function to apply to each entry in the database. |
- Source
Methods
on(topic, subscriber) → {function}
Subscribe to a topic emitted by the event function.
Parameters:
Name | Type | Description |
---|---|---|
topic | string | The topic to subscribe to. |
subscriber | function | The function to call when the topic is emitted. |
- Source
Returns:
A function to unsubscribe from the topic.
- Type:
- function