Mod Creation/Sidebar API Reference: Difference between revisions

Line 14: Line 14:
The global <code>sidebar</code> object.
The global <code>sidebar</code> object.


<code>category(id: string, config?: CategoryConfig, builder?: (category: Category) => void): Category</code>
=== category(id: string, config?: CategoryConfig, builder?: (category: Category) => void): Category ===


'''Alternatively <code>category(id: string, builder?: (category: Category) => void): Category</code>'''
'''Alternatively <code>category(id: string, builder?: (category: Category) => void): Category</code>'''
Line 41: Line 41:
});</nowiki>
});</nowiki>


=== <code>categories(): Category[]</code> ===
=== categories(): Category[] ===


'''Returns'''
'''Returns'''
Line 50: Line 50:
  <nowiki>const allCategories = sidebar.categories();</nowiki>
  <nowiki>const allCategories = sidebar.categories();</nowiki>


=== <code>removeCategory(id: string): void</code> ===
=== removeCategory(id: string): void ===


Remove a category by its <code>id</code>.
Remove a category by its <code>id</code>.
Line 61: Line 61:
  <nowiki>sidebar.removeCategory('Combat');</nowiki>
  <nowiki>sidebar.removeCategory('Combat');</nowiki>


=== <code>removeAllCategories(): void</code> ===
=== removeAllCategories(): void ===


Remove all categories from the sidebar. Not completely sure why you'd want to do that, though.
Remove all categories from the sidebar. Not completely sure why you'd want to do that, though.
91

edits