Mod Creation/Mod Context API Reference: Difference between revisions

(User:Coolrox95 Add mod guide navigation)
Line 208: Line 208:


  <nowiki>ctx.onCharacterSelectionLoaded(async (ctx) => {
  <nowiki>ctx.onCharacterSelectionLoaded(async (ctx) => {
  // ...
});</nowiki>
=== onInterfaceAvailable(callback: (ctx: ModContext) => void | Promise<void>): void ===
Execute code before the character is loaded but after the game interface is initially injected into the page (but not initialized). Mostly useful for adding interface elements for custom skills that need to be present before <code>onCharacterLoaded</code>.
'''Parameters'''
<code>callback: (ctx: ModContext) => void | Promise<void></code> A callback function that receives the mod's context object as a parameter. Can be synchronous or asynchronous.
'''Example'''
<nowiki>ctx.onInterfaceAvailable(async (ctx) => {
   // ...
   // ...
});</nowiki>
});</nowiki>
91

edits