Skip to main content

Class: Module

moralis-monorepo / @moralisweb3/common-core / Module

Class: Module

@moralisweb3/common-core.Module

The base class of every Moralis 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 Core instance
  • type: (optional) CoreModuleType, defaults to CoreModuleType.DEFAULT

When creating an api, or network module, you should use the ApiModule or NetworkModule

Hierarchy

Table of contents

Methods

Constructors

Properties

Methods

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


setup

Abstract setup(): void

Returns

void


start

Abstract start(): void | Promise<void>

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

Returns

void | Promise<void>

Constructors

constructor

new Module(name, core, type?)

Parameters

NameTypeDefault value
namestringundefined
coreCoreundefined
typeModuleTypeModuleType.DEFAULT

Properties

name

Readonly name: string


type

Readonly type: ModuleType = ModuleType.DEFAULT


core

Protected Readonly core: Core


logger

Protected Readonly logger: LoggerController