a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Shared / Config
Config(
settings
): (target
,propertyKey
?,_descriptor
?) =>void
A decorator for attaching configuration settings to a class or method in game environment. This allows for easy retrieval and management of settings via metadata.
• settings: object
An object containing configuration settings to associate with the class or method.
Function
• target: any
• propertyKey?: string
• _descriptor?: PropertyDescriptor
void
@Config({ maxPlayers: 32, gameMode: 'deathmatch' })
class GameConfig {
}
class PlayerSettings {
@Config({ maxHealth: 100, canRespawn: true })
configurePlayer() {
}
}
// Retrieve configuration metadata
const configMetadata = Reflect.getMetadata('config', GameConfig);
const playerSettings = Reflect.getMetadata('configurePlayer', PlayerSettings.prototype);
console.log(configMetadata, playerSettings);
'config'
in the class’s metadata.