Class: TableEventBus
helpers.TableEventBus
TableEventBus provides a way to listen for: mutations, transfers, and changes to controller
Constructors
constructor
• new TableEventBus(config?)
Create a TableEventBus instance with the specified connection configuration.
Parameters
| Name | Type | Description |
|---|---|---|
config | Partial<Partial<ReadConfig & SignerConfig>> | The connection configuration. This must include an ethersjs Signer. If passing the config from a pre-existing Database instance, it must have a non-null signer key defined. |
Defined in
@tableland/sdk/src/helpers/subscribe.ts:77
Properties
config
• Readonly config: Partial<ReadConfig & SignerConfig>
Defined in
@tableland/sdk/src/helpers/subscribe.ts:67
contracts
• Readonly contracts: ContractMap
Defined in
@tableland/sdk/src/helpers/subscribe.ts:68
listeners
• Readonly listeners: ListenerMap
Defined in
@tableland/sdk/src/helpers/subscribe.ts:69
Methods
_attachEmitter
▸ _attachEmitter(contract, emitter, tableIdentifier): ContractEventListener[]
Parameters
| Name | Type |
|---|---|
contract | TablelandTables |
emitter | EventEmitter |
tableIdentifier | TableIdentifier |
Returns
ContractEventListener[]
Defined in
@tableland/sdk/src/helpers/subscribe.ts:224
_ensureListening
▸ _ensureListening(listenerId, emitter): Promise<ContractEventListener[]>
Parameters
| Name | Type |
|---|---|
listenerId | string |
emitter | EventEmitter |
Returns
Promise<ContractEventListener[]>
Defined in
@tableland/sdk/src/helpers/subscribe.ts:214
_getContract
▸ _getContract(chainId): Promise<TablelandTables>
Parameters
| Name | Type |
|---|---|
chainId | number |
Returns
Promise<TablelandTables>
Defined in
@tableland/sdk/src/helpers/subscribe.ts:198
addListener
▸ addListener(tableName): Promise<EventEmitter>
Start listening to the Registry Contract for events that are associated with a given table. There's only ever one "listener" for a table, but the emitter that Contract listener has can have as many event listeners as the environment supports.
Parameters
| Name | Type | Description |
|---|---|---|
tableName | string | The full name of table that you want to listen for changes to. |
Returns
Promise<EventEmitter>
Defined in
@tableland/sdk/src/helpers/subscribe.ts:97
addTableIterator
▸ addTableIterator<T>(tableName): Promise<AsyncIterable<T>>
A simple wrapper around addListener that returns an async iterable
which can be used with the for await ... of pattern.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
tableName | string | The full name of table that you want to listen for changes to. |
Returns
Promise<AsyncIterable<T>>
Defined in
@tableland/sdk/src/helpers/subscribe.ts:132
removeAllListeners
▸ removeAllListeners(): void
Returns
void
Defined in
@tableland/sdk/src/helpers/subscribe.ts:163
removeListener
▸ removeListener(params): void
Remove a listener (or iterator) based on chain and tableId
Parameters
| Name | Type | Description |
|---|---|---|
params | TableIdentifier | A TableIdentifier Object. Must have chainId and tableId keys. |
Returns
void
Defined in
@tableland/sdk/src/helpers/subscribe.ts:145