forked from JaylyDev/ScriptAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
64 lines (63 loc) · 2.09 KB
/
index.d.ts
File metadata and controls
64 lines (63 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Script example for ScriptAPI
// Author: iBlqzed <https://github.com/iBlqzed>
// Project: https://github.com/JaylyDev/ScriptAPI
export declare class Database<V = any> {
readonly name: string;
private readonly defaultValue;
static readonly databases: Database<any>[];
private cache;
constructor(name: string, defaultValue?: string);
/**
* Set a value from a key
* @remarks Doesn't save instantly, call .save() or wait 1 minute to save automatically
* @param {string} property Key to set
* @param {V} value The value
*/
set(property: string, value: V): void;
/**
* Get a value from a key
* @param {string} property Key to get
* @returns {V} The value that was set for the key (or undefined)
*/
get(property: string): V;
/**
* Test for whether or not the database has the key
* @param {string} property Key to test for
* @returns {boolean} Whether or not the database has the key
*/
has(property: string): boolean;
/**
* Delete a key from the database
* @remarks Doesn't save instantly, call .save() or wait 1 minute to save automatically
* @param {string} property Key to delete from the database
* @returns {boolean} Whether the database had the key to begin with
*/
delete(property: string): boolean;
/**
* Get an array of all keys in the database
* @returns {string[]} An array of all keys in the database
*/
keys(): string[];
/**
* Get an array of all values in the database
* @returns {V[]} An array of all values in the database
*/
values(): V[];
/**
* Clears all values in the database
* @remarks Saves instantly
*/
clear(): void;
/**
* Get an object with all keys and values
* @remarks All changes will save
* @returns {Record<string, V>} An object of all keys and values
*/
getAll(): Record<string, V>;
/**
* Save the database instantly
*/
save(): void;
protected static save(): void;
protected static getAll(name: string, defaultValue: string): Record<string, any>;
}