Class: default<DataType>
client/lib/DataStoreManager/structures/GlobalDataStore.default
Type parameters
Name | Type |
---|---|
DataType |
any |
Hierarchy
- default<DataType>
↳ default
Table of contents
Constructors
Properties
Methods
- buildGetUrl
- buildIncrementUrl
- buildPostDataForKey
- buildRemoveUrl
- buildSetIfUrl
- buildSetUrl
- createQueryString
- getAsync
- incrementAsync
- parseIncomingData
- parseRetrievedData
- performPreflightChecks
- removeAsync
- safeEncodeValue
- serializeOutgoingData
- setAsync
- setDataConverters
Constructors
constructor
+ new default<DataType>(manager
: default, placeId
: number, name
: string, scope?
: string, legacy?
: boolean): default<DataType>
Type parameters:
Name | Type |
---|---|
DataType |
unknown |
Parameters:
Name | Type |
---|---|
manager |
default |
placeId |
number |
name |
string |
scope? |
string |
legacy? |
boolean |
Returns: default<DataType>
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GlobalDataStore.ts:5
Properties
advanced
• advanced: object
Type declaration:
Name | Type |
---|---|
parseData ? |
undefined | (data : string) => DataType |
serializeData ? |
undefined | (data : DataType) => string |
Inherited from: default.advanced
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:25
baseAPIUrl
• baseAPIUrl: string
Inherited from: default.baseAPIUrl
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:22
dataStoreType
• dataStoreType: DataStoreType
Inherited from: default.dataStoreType
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:24
legacy
• legacy: boolean
Inherited from: default.legacy
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:21
manager
• manager: default
Inherited from: default.manager
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:18
name
• name: string
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:19
placeId
• placeId: number
Inherited from: default.placeId
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:23
scope
• scope: string
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:20
Methods
buildGetUrl
▸ buildGetUrl(): string
Returns: string
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:66
buildIncrementUrl
▸ buildIncrementUrl(key
: string, delta
: number): string
Parameters:
Name | Type |
---|---|
key |
string |
delta |
number |
Returns: string
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:93
buildPostDataForKey
▸ buildPostDataForKey(key
: string, index?
: number): string
Parameters:
Name | Type | Default value |
---|---|---|
key |
string | - |
index |
number | 0 |
Returns: string
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:56
buildRemoveUrl
▸ buildRemoveUrl(key
: string): string
Parameters:
Name | Type |
---|---|
key |
string |
Returns: string
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:103
buildSetIfUrl
▸ buildSetIfUrl(key
: string, valueLength
: number, expectedValueLength
: number): string
Parameters:
Name | Type |
---|---|
key |
string |
valueLength |
number |
expectedValueLength |
number |
Returns: string
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:82
buildSetUrl
▸ buildSetUrl(key
: string, valueLength
: number): string
Parameters:
Name | Type |
---|---|
key |
string |
valueLength |
number |
Returns: string
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:72
createQueryString
▸ createQueryString(addition
: Record<string, unknown>): string
Parameters:
Name | Type |
---|---|
addition |
Record<string, unknown> |
Returns: string
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:224
getAsync
▸ getAsync(key
: string): Promise<unknown>
Retrieves the value associated with the key (if any), otherwise returns null. Equivalent of DataStoreService:GetDataStore("name"):GetAsync("key");
Parameters:
Name | Type |
---|---|
key |
string |
Returns: Promise<unknown>
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:134
incrementAsync
▸ incrementAsync(key
: string, delta?
: number): Promise<RESTResponseDataType>
Parameters:
Name | Type | Default value |
---|---|---|
key |
string | - |
delta |
number | 1 |
Returns: Promise<RESTResponseDataType>
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:196
parseIncomingData
▸ Private
parseIncomingData(data
: string): DataType
This will (possibly) use a custom provided converter function that turns string into DataType.
Parameters:
Name | Type |
---|---|
data |
string |
Returns: DataType
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:239
parseRetrievedData
▸ parseRetrievedData<Result>(data
: string): [boolean, any]
Type parameters:
Name | Type |
---|---|
Result |
unknown |
Parameters:
Name | Type |
---|---|
data |
string |
Returns: [boolean, any]
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:112
performPreflightChecks
▸ Private
performPreflightChecks(options
: { key?
: undefined | string ; value?
: undefined | string }): void
Performs various checks before sending any requests to make sure the requests are valid before sent
Parameters:
Name | Type |
---|---|
options |
object |
options.key? |
undefined | string |
options.value? |
undefined | string |
Returns: void
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:287
removeAsync
▸ removeAsync(key
: string): Promise<RESTResponseDataType>
Parameters:
Name | Type |
---|---|
key |
string |
Returns: Promise<RESTResponseDataType>
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:210
safeEncodeValue
▸ safeEncodeValue(input
: string): string
Parameters:
Name | Type |
---|---|
input |
string |
Returns: string
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:278
serializeOutgoingData
▸ Private
serializeOutgoingData(data
: DataType): string
This will (possibly) use a custom provided converter function that turns DataType into string so it can be saved to data stores
Parameters:
Name | Type |
---|---|
data |
DataType |
Returns: string
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:254
setAsync
▸ setAsync(key
: string, value
: DataType): Promise<DataType>
Sets a value in data stores to the given key. Equivalent of DataStoreService:GetDataStore("name"):SetAsync("key", "value")
Parameters:
Name | Type |
---|---|
key |
string |
value |
DataType |
Returns: Promise<DataType>
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:173
setDataConverters
▸ setDataConverters(parseDataFunction
: (data
: string) => DataType, serializeDataFunction
: (data
: DataType) => string): void
When data is retrieved from data stores, it will be returned unmodified Using your own data converter will allow you to return it if you handle your data in a special way, such as JSON parsing it etc.
Parameters:
Name | Type |
---|---|
parseDataFunction |
(data : string) => DataType |
serializeDataFunction |
(data : DataType) => string |
Returns: void
Inherited from: default
Defined in: client/lib/DataStoreManager/structures/GenericDataStore.ts:51