Class: ApiModule<Events>

moralis-monorepo / @moralisweb3/core / ApiModule

Class: ApiModule<Events>

@moralisweb3/core.ApiModule

The base class of every Moralis Api class that gets registered as a module via MoralisModules
It should always be created with:

  • name: name of the module (should be unique)
  • core: the MoralisCore instance
  • baseUrl: the base url where of the api

Type parameters

NameType
Eventsextends EventMap = any

Hierarchy

  • Module<Events>

    ApiModule

Table of contents

Methods

Methods

start

Abstract start(): void | Promise<void>

Start the module (if needed).
This function can be used to initialize variables etc.

Returns

void | Promise<void>

Inherited from

Module.start


cleanUp

cleanUp(): void

Any cleanup that needs to be done for removing this module.
It also should remove the module via this.core.modules.remove(this.name)

Returns

void

Inherited from

Module.cleanUp


listen

listen<Event>(eventName, listener): () => TypedEventEmitter<Events>

Listen to an event, and returns a cleanup function

Type parameters

NameType
Eventextends string | number | symbol

Parameters

NameType
eventNameEvent
listenerEvents[Event]

Returns

fn

▸ (): TypedEventEmitter<Events>

Returns

TypedEventEmitter<Events>

Inherited from

Module.listen


Did this page help you?