Mod Creation/Mod Context API Reference: Difference between revisions

m
fix double "the"
m (fix double "the")
 
(6 intermediate revisions by 2 users not shown)
Line 118: Line 118:
// my-independent-script.js has NOT run yet</syntaxhighlight>
// my-independent-script.js has NOT run yet</syntaxhighlight>


=== loadTemplates(path: string): void ===
=== loadTemplates(path: string): Promise<void> ===


Inject all <template> elements contained in a given HTML file into the document body.
Inject all <template> elements contained in a given HTML file into the document body.
Line 125: Line 125:


<code>path: string</code> The relative path to the HTML resource
<code>path: string</code> The relative path to the HTML resource
'''Returns'''
<code>Promise<void></code> A promise that is resolved once all templates have been injected into the document body.


'''Example'''
'''Example'''
Line 217: Line 221:
=== onCharacterSelectionLoaded(callback: (ctx: ModContext) => void | Promise<void>): void ===
=== onCharacterSelectionLoaded(callback: (ctx: ModContext) => void | Promise<void>): void ===


Execute code after the the character selection screen has fully loaded.
Execute code after the character selection screen has fully loaded.


'''Parameters'''
'''Parameters'''
Line 329: Line 333:


== Mod Settings ==
== Mod Settings ==
{{Disclaimer|When loading your mod as a Local Mod via the Creator Toolkit, the mod must be linked to mod.io and you must have subscribed to and installed the mod via mod.io in order for this data to persist.}}


The mod settings API can be accessed through the <code>settings</code> property on the root context object.
The mod settings API can be accessed through the <code>settings</code> property on the root context object.
Line 640: Line 646:


== Character Data Storage ==
== Character Data Storage ==
{{Disclaimer|When loading your mod as a Local Mod via the Creator Toolkit, the mod must be linked to mod.io and you must have subscribed to and installed the mod via mod.io in order for this data to persist.}}


The character storage API can be accessed through the <code>characterStorage</code> property on the root context object.
The character storage API can be accessed through the <code>characterStorage</code> property on the root context object.
Line 701: Line 709:


== Account Data Storage ==
== Account Data Storage ==
{{Disclaimer|When loading your mod as a Local Mod via the Creator Toolkit, the mod must be linked to mod.io and you must have subscribed to and installed the mod via mod.io in order for this data to persist.}}


The account storage API can be accessed through the <code>accountStorage</code> property on the root context object.
The account storage API can be accessed through the <code>accountStorage</code> property on the root context object.
2

edits