-
-
Notifications
You must be signed in to change notification settings - Fork 0
Temme syntax
Temme falls under one central function that accepts the input and forwards all of the internal parts to do their thing, and that would be by calling Temme.parse
.
Temme.parse(hierarchy: Object, target: HTMLElement, endCallback: (hierarchy: Hierarchy) => void, nodeCallback: (temmeId: string, hierarchy: Hierarchy) => void): Hierarchy;
The last two arguments endCallback
and nodeCallback
are optional and can be omitted, so the syntax you're probably going to be using the most is the following:
Temme.parse(hierarchy: Object, target: HTMLElement);
This is basically the blueprint of your HTML tree, which will eventually be parsed into valid HTML elements.
The HTML element that will host the parsed HTML tree, this should obviously be a valid HTML element itself, and can actually be modified by the hierarchy object as well.
The optional function that executes when the whole parsing process has finished, it also has accepts a single argument that represents the sanitized version of the input hierarchy. BVy sanitized, that means an object that follows the valid schema that Temme depends on that has all of the options and sub-options with default values pre-populated and all of the duplicates removed.
The optional function that executes whenever a sub-hierarchy within the input hierarchy itself has been parsed into an HTML element, it also accepts two arguments, the first being the temmeId of the current node (those are ids assigned by Temme internally that helps the parsing process). The second argument is the sub-hierarchy object that has been parsed, fully sanitized.
At the end of it all, a valid and fully sanitized hierarchy object is returned by Temme.parse
.