fivem-ts

a library to speed up the development of Fivem scripts and frameworks


Project maintained by Purpose-Dev Hosted on GitHub Pages — Theme by mattgraham

fivem-ts - Documentation v0.7.5Docs


fivem-ts - Documentation v0.7.5 / Shared / getConfig

Function: getConfig()

getConfig(target, propertyKey?): object | undefined

Retrieves the configuration metadata associated with a class or method.

Parameters

target: object

The target object (class or prototype).

propertyKey?: string

The name of the method being queried, if applicable.

Returns

object | undefined

Example

@Config({ maxPlayers: 32, gameMode: 'deathmatch' })
class GameConfig {

}

class PlayerSettings {
  @Config({ maxHealth: 100, canRespawn: true })
  configurePlayer() {

  }
}

// Retrieve configuration metadata
const classConfig = getConfig(GameConfig);
const methodConfig = getConfig(PlayerSettings.prototype, 'configurePlayer');
console.log('Class Config:', classConfig); // output: { maxPlayers: 32, gameMode: 'deathmatch' }
console.log('Method Config:', methodConfig); // output: { maxHealth: 100, canRespawn: true }

Defined in

shared/decorators/game/Config.ts:74