Built-in Functions
Components come with a series of built-in functions that will make it easier to interact with them.

Modify the HTML structure

1
static template ()
Copied!
This function allows you to either get the HTML structure from a component, or set a new one to it.

Examples

1
monogatari.component ('main-screen').template (() => {
2
return `
3
<h1>My Awesome Game</h1>
4
<main-menu></main-menu>
5
`;
6
});
Copied!

Running an arbitrary line of Monogatari

1
monogatari.run ("string")
Copied!
Runs a line of the script as though it were a regular line in the script array. Can be invoked from the JavaScript development console for testing, such as monogatari.run("jump myLabel") if you want to rapidly test a particular label. This can also be used as part of a function if you need to do something specific or fancy. Up to you.
Last modified 1yr ago