aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-10-20 19:41:59 +0200
committerVen <vendicated@riseup.net>2022-10-20 20:23:14 +0200
commite4068ef9a6fb1bb0ec120b776f6d67c6c2f8efac (patch)
tree280d1548d7fe48a4747a90f5de17e4930bc3f927 /src
parentc80ed1b824b9f0b8aab8103cbde5e9b1f2c951c1 (diff)
downloadVencord-e4068ef9a6fb1bb0ec120b776f6d67c6c2f8efac.tar.gz
Vencord-e4068ef9a6fb1bb0ec120b776f6d67c6c2f8efac.tar.bz2
Vencord-e4068ef9a6fb1bb0ec120b776f6d67c6c2f8efac.zip
Document apis
Diffstat (limited to 'src')
-rw-r--r--src/api/index.ts51
1 files changed, 47 insertions, 4 deletions
diff --git a/src/api/index.ts b/src/api/index.ts
index 036fed6..2ee5883 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -1,4 +1,47 @@
-export * as MessageEvents from "./MessageEvents";
-export * as Notices from "./Notices";
-export * as Commands from "./Commands";
-export * as DataStore from "./DataStore";
+/**
+ * Creating a local alias for wildcard imports seems to be
+ * the only way to add JsDoc to them t_t
+ */
+import * as $MessageEventsAPI from "./MessageEvents";
+import * as $Notices from "./Notices";
+import * as $Commands from "./Commands";
+import * as $DataStore from "./DataStore";
+
+/**
+ * An API allowing you to listen to Message Clicks or run your own logic
+ * before a message is sent
+ *
+ * If your plugin uses this, you must add MessageEventsAPI to its dependencies
+ */
+const MessageEvents = $MessageEventsAPI;
+/**
+ * An API allowing you to create custom notices
+ * (snackbars on the top, like the Update prompt)
+ */
+const Notices = $Notices;
+/**
+ * An API allowing you to register custom commands
+ */
+const Commands = $Commands;
+/**
+ * A wrapper around IndexedDB. This can store arbitrarily
+ * large data and supports a lot of datatypes (Blob, Map, ...).
+ * For a full list, see the mdn link below
+ *
+ * This should always be preferred over the Settings API if possible, as
+ * localstorage has very strict size restrictions and blocks the event loop
+ *
+ * Make sure your keys are unique (tip: prefix them with ur plugin name)
+ * and please clean up no longer needed entries.
+ *
+ * This is actually just idb-keyval, so if you're familiar with that, you're golden!
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types}
+*/
+const DataStore = $DataStore;
+
+export {
+ DataStore,
+ MessageEvents,
+ Notices,
+ Commands
+};