The start file
All four of these are equally supported.- Top level
- A class
- An object
- A function
Rules that apply to all of them
onLoadmay be async. The expansion counts as started once it resolves.- If the start file or
onLoadthrows, everything already registered is removed, so nothing is left half-installed. The error and its location show on the Expansions page. onUnloadon an instance takes priority over an exportedonUnload.- You rarely need
onUnload: everything registered throughsdkis removed automatically. Use it for things the SDK does not know about, such as flushing your own buffer.
Components
useProjectState only work inside function components; a class component keeps its own state, or reads and writes through sdk.