Skip to content
On this page

Athena.session.vehicle

Functions

clearAll

Usage

Athena.session.vehicle.clearAll(vehicle): void

Clear all keys, and remove all data for a session.

Export

Parameters

NameType
vehicleVehicle

Returns

void

Defined in

server/session/vehicle.ts:122


clearKey

Usage

Athena.session.vehicle.clearKey(vehicle, key): void

Clear a key from the vehicle.

Export

Parameters

NameType
vehicleany
keykeyof Vehicle

Returns

void

Defined in

server/session/vehicle.ts:100


get

Usage

Athena.session.vehicle.get<K>(vehicle, key): AthenaSession.Vehicle[K] | undefined

Retrieve data from a vehicle's session storage.

Type parameters

NameType
Kextends keyof Vehicle

Parameters

NameTypeDescription
vehicleVehicle
keyKThe value you want to get from the vehicle.

Returns

AthenaSession.Vehicle[K] | undefined

Any type of value, can be specified with a generic type.

Defined in

server/session/vehicle.ts:78


getAll

Usage

Athena.session.vehicle.getAll<K>(key): AthenaSession.Vehicle[K][]

Get all vehicles's that have a specific key.

Export

Type parameters

NameType
Kextends keyof Vehicle

Parameters

NameType
keyK

Returns

AthenaSession.Vehicle[K][]

Defined in

server/session/vehicle.ts:140


has

Usage

Athena.session.vehicle.has(vehicle, key): boolean

Returns true, if it has any value set for a given key.

Export

Parameters

NameType
vehicleVehicle
keystring

Returns

boolean

Defined in

server/session/vehicle.ts:59


set

Usage

Athena.session.vehicle.set<K>(vehicle, key, value): void

Set data for a vehicle's session

This data is not persistent, and automatically clears on disconnect / vehicle destroy

Example

ts
declare global {
    namespace AthenaSession {
        export interface Vehicle {
            myCustomValue: boolean;
        }
    }
}

Athena.session.vehicle.set(someVehicle, 'myCustomValue', true);

Type parameters

NameType
Kextends keyof Vehicle

Parameters

NameTypeDescription
vehicleVehicle
keykeyof VehicleThe key you want to put the value under
valueVehicle[K]The value you want to set

Returns

void

Any type of value, can be specified with a generic type.

Defined in

server/session/vehicle.ts:36

Created by Stuyk | Est. 2020