Getting Started with netDecor
Installation
Integrating netDecor into your application is straightforward. Add the netDecor.js
file to your project and call the RunNetDecor
function:
async function RunNetDecor(element: HTMLElement, params: NetDecorRunParams): Promise<int>;
The exact structure of the "params" JSON is client-specific, but it will always include the dbaddr
parameter which specifies the database URL.
Accessing the API
Upon successful initialization, the API becomes available through the global window.NetDecor
object.
Important: The netDecor becomes available after the application has fully loaded (after RunNetDecor promise resolves).
Event Handling
Many of the public API functions override events triggered by the application. To register a custom event handler:
window.NetDecor.Events.RegisterEventHandler("eventName", handlerFunction);
Parameters
- eventName:
string
- The name of the event you want to override (event names are documented elsewhere in this guide) - handlerFunction:
function
- The custom function that will be executed instead of the default implementation when the event is triggered.
Example Implementation
<script src="Build/UnityLoader.js"></script>
<script src="NetPlusAPI.js"></script>
<script>
// Your implementation code here
</script>
Note: API methods may throw exceptions, typically due to invalid parameters. All API calls should be properly error-handled as any of them can throw exceptions.