aboutsummaryrefslogtreecommitdiff
path: root/static/ts/globals.ts
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-09-05 11:41:46 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-09-05 11:41:46 +0200
commitf653a01328be3b8be6af35c0c96867623765ca5b (patch)
treeaee9a5d3abfc39270f55defd7bc1a7e47920ffc3 /static/ts/globals.ts
parentMinor whitespace cleanup. (diff)
downloadcalp-f653a01328be3b8be6af35c0c96867623765ca5b.tar.gz
calp-f653a01328be3b8be6af35c0c96867623765ca5b.tar.xz
Move JS documentation into the JS-code.
Texinfo was a bad match for how TypeScript is structured. This also allows generation of jsdoc pages, which can be nice. Another large win is that this opens up for the texinfo pages to replace the Guile heading with different subheadings, including - external library - internal library - C library - ...
Diffstat (limited to 'static/ts/globals.ts')
-rw-r--r--static/ts/globals.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/static/ts/globals.ts b/static/ts/globals.ts
index 243e15e4..75fb1df9 100644
--- a/static/ts/globals.ts
+++ b/static/ts/globals.ts
@@ -1,3 +1,10 @@
+/**
+ * Different variables and values which for different reasons needs to be
+ * global. Window Value's are those that are bound to the `window`
+ * context in JavaScript, so is really always available, no opt out.
+ * @module
+ */
+
export {
find_block,
vcal_objects, event_calendar_mapping
@@ -10,14 +17,38 @@ import { ComponentBlock } from './components/vevent-block'
import { v4 as uuid } from 'uuid'
import { setup_popup_element } from './components/popup-element'
+/**
+ * All VEvent objects on current page, indexed by their unique identifiers.
+ *
+ * A global object store.
+ *
+ * Also bound to the window object for easy access.
+ */
const vcal_objects: Map<uid, VEvent> = new Map;
+
+/**
+ * Mapping from VEvent unique identifier, to name of its calendar. Should
+ * probably not be global, so refrain from using it.
+ */
const event_calendar_mapping: Map<uid, string> = new Map;
declare global {
interface Window {
vcal_objects: Map<uid, VEvent>;
+ /**
+ * How the calendar is currently formatted. Should be set by the backend
+ * through a simple `script`-tag.
+ */
VIEW: 'month' | 'week';
+ /**
+ * However editing of events is enabled or not.
+ * Should be set by the backend through a simple `script`-tag.
+ */
EDIT_MODE: boolean;
+ /**
+ * Name of the calendar to assume when creating new events.
+ * Should be set by the backend through a simple `script`-tag.
+ */
default_calendar: string;
addNewEvent(): void;