Skip to content
Snippets Groups Projects
Commit 86dbd2e2 authored by baletiballo's avatar baletiballo
Browse files

Added JSDoc Type annotations

parent 601f4fd5
No related branches found
No related tags found
No related merge requests found
/**
* @typedef Point
* @typedef point
* @type {object}
* @property {number} x
* @property {number} y
* @property {number} z
*/
/**
* @typedef {Object} fact
* @property {string} id Fact id
* @property {string} s_type Fact type
* @property {string} label used in unity
* @property {string | null} _CustomLabel Custom label
* @property {boolean} hasCustomLabel
* @property {number} labelId
*/
/**
* @property {Point} point
* @property {Point} normal
......@@ -122,7 +132,7 @@ function dropHandler(event) {
//const data = event.dataTransfer.getData("text/plain")
console.log(`Dropped data: '${event.dataTransfer.types}'`, event.dataTransfer.types)
/** @type {Fact} */
/** @type {fact} */
const fact = JSON.parse(data)
console.warn(`Dropped Fact '${fact.label}':`, fact)
......
/**
* A MMT..whatever. Somewhere between the first and second "meta-" MMT had to leave common nomenclature behind
* @typedef {{kind : string, uri: string}} MMTReference
*/
/**
* Facts, as they are send by MMT. Not *quite* the same format as Unity uses \*sigh\*, and everything has shortened names to avoid five additional letters \*double sigh\*
* @typedef {Object} MMTFact
* @property {MMTReference} ref the reference MMT uses to identify this fact
* @property {string} label the human readable lable to display this fact.
* @property {?any} df the definition of the Fact. May be null for {@link MMTScroll.requiredFacts}
* @property {?MMTReference} tp the MMT type of this fact
* @property {string} kind since a Fact is a MMTThingy, they also have a {@link MMTReference.kind}
*/
/**
* @typedef {Object} MMTScroll
* @property {string} ref The MMT URI
* @property {string} label The human-readable name
* @property {string} description The description to be rendered here
* @property {MMTFact[]} requiredFacts List of all facts required to apply the scroll. If the scroll has been partially applied these Facts may be the assigned ones
* @property {MMTFact[]} acquiredFacts List of all facts that will be acquired when applying the scroll
* @property {string} name Unity artifact; The URI again
* @property {?string} path Unity artifact; will always be null
*/
let currentScrollRef = "" // ref of the scroll currently displayed
function RenderScroll() {
/** @type {MMTScroll} */
const scroll = JSON.parse(document.querySelector("#Unity-Data-Interface").dataset.scrollDynamic);
console.log(scroll.requiredFacts);
const scrollContainer = document.querySelector("#scrollContainer");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment