@pikokr/command.ts / Exports / Registry
Class: Registry
Table of contents
Constructors
Properties
Methods
- addGlobalHook
- getComponentsWithType
- getComponentsWithTypeGlobal
- loadAllModulesInDirectory
- loadModulesAtPath
- registerEventEmitter
- registerEventListeners
- registerModule
- registerModules
- reloadModules
- runModuleHook
- unregisterEventListeners
- unregisterModule
Constructors
constructor
• new Registry(logger
, client
): Registry
Parameters
Name | Type |
---|---|
logger | Logger <unknown > |
client | CommandClient |
Returns
Defined in
src/core/structures/Registry.ts:24 (opens in a new tab)
Properties
client
• client: CommandClient
Defined in
src/core/structures/Registry.ts:26 (opens in a new tab)
emitters
• emitters: Collection
<string
, __module
>
Defined in
src/core/structures/Registry.ts:18 (opens in a new tab)
extensions
• extensions: object
[] = []
Defined in
src/core/structures/Registry.ts:16 (opens in a new tab)
globalHooks
• globalHooks: Record
<string
, ComponentHookFn
<unknown
[]>[]> = {}
Defined in
src/core/structures/Registry.ts:22 (opens in a new tab)
logger
• logger: Logger
<unknown
>
Defined in
src/core/structures/Registry.ts:20 (opens in a new tab)
Methods
addGlobalHook
▸ addGlobalHook(name
, fn
): void
Parameters
Name | Type |
---|---|
name | string |
fn | ComponentHookFn <unknown []> |
Returns
void
Defined in
src/core/structures/Registry.ts:33 (opens in a new tab)
getComponentsWithType
▸ getComponentsWithType<T
>(ext
, type
): T
[]
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
ext | object |
type | unknown |
Returns
T
[]
Defined in
src/core/structures/Registry.ts:54 (opens in a new tab)
getComponentsWithTypeGlobal
▸ getComponentsWithTypeGlobal<T
>(type
): T
[]
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
type | unknown |
Returns
T
[]
Defined in
src/core/structures/Registry.ts:44 (opens in a new tab)
loadAllModulesInDirectory
▸ loadAllModulesInDirectory(dir
, pattern?
): Promise
<object
[]>
Parameters
Name | Type |
---|---|
dir | string |
pattern? | RegExp |
Returns
Promise
<object
[]>
Defined in
src/core/structures/Registry.ts:89 (opens in a new tab)
loadModulesAtPath
▸ loadModulesAtPath(file
): Promise
<object
[]>
Parameters
Name | Type |
---|---|
file | string |
Returns
Promise
<object
[]>
Defined in
src/core/structures/Registry.ts:103 (opens in a new tab)
registerEventEmitter
▸ registerEventEmitter(name
, emitter
): void
Parameters
Name | Type |
---|---|
name | string |
emitter | __module |
Returns
void
Defined in
src/core/structures/Registry.ts:201 (opens in a new tab)
registerEventListeners
▸ registerEventListeners(ext
): void
Parameters
Name | Type |
---|---|
ext | object |
Returns
void
Defined in
src/core/structures/Registry.ts:60 (opens in a new tab)
registerModule
▸ registerModule(ext
): Promise
<void
>
Parameters
Name | Type |
---|---|
ext | object |
Returns
Promise
<void
>
Defined in
src/core/structures/Registry.ts:173 (opens in a new tab)
registerModules
▸ registerModules(modules
, p
): Promise
<object
[]>
Parameters
Name | Type |
---|---|
modules | object | object [] |
p | string |
Returns
Promise
<object
[]>
Defined in
src/core/structures/Registry.ts:118 (opens in a new tab)
reloadModules
▸ reloadModules(): Promise
<{ error?
: Error
; extensions?
: object
[] ; file
: string
; result
: boolean
}[]>
Returns
Promise
<{ error?
: Error
; extensions?
: object
[] ; file
: string
; result
: boolean
}[]>
Defined in
src/core/structures/Registry.ts:135 (opens in a new tab)
runModuleHook
▸ runModuleHook(ext
, hookName
, ...args
): void
Parameters
Name | Type |
---|---|
ext | object |
hookName | string |
...args | unknown [] |
Returns
void
Defined in
src/core/structures/Registry.ts:189 (opens in a new tab)
unregisterEventListeners
▸ unregisterEventListeners(ext
): void
Parameters
Name | Type |
---|---|
ext | object |
Returns
void
Defined in
src/core/structures/Registry.ts:76 (opens in a new tab)
unregisterModule
▸ unregisterModule(ext
): Promise
<void
>
Parameters
Name | Type |
---|---|
ext | object |
Returns
Promise
<void
>