Skip to main content

Getting started

Starting netDecor is easy: add two JavaScript files to your document (NetPlusAPI.js, UnityLoader.js) and call RunNetPlusApp:

function RunNetPlusApp(containerId: string, buildPath: string, params: string, onAPIInitialised);
containerId: string – ID of element where netDecor will be embedded.
buildPath: string – URL to app data (comes in package delivered by CADProjekt).
params: string – JSON containing startup info.
dbaddr: string - startup paremeter, database address
onAPIInitialised : Function – no-argument-method that will be called right after API initialisation is complete, parametr opcjonalny.
info

How exaclty "params" JSON looks like is client-dependant, but one of parameters will be dbaddr : string – database URL.

RunNetPlusAPP returns integer (errorCode):

0 – no error

1 – app is running already

If this call is executed properly there will be new object available: window.NetDecor, which contains API (also window.NetPlusAPI, API calls in that object are DEPRECATED and will be removed in a future.)

IMPORTANT netDecor API is not asynchronous and is available only after app is initially loaded. In order to be sure it is callable you need to implement onAPIInitialised parameter from runNetPlusAPP

Many of publicly facing API calls are overrides of events fired up by an app, in order to register override for event you need to call window.NetDecor.Events.RegisterEventHandler

window.NetDecor.Events.RegisterEventHandler("eventName",methodToCall);

„eventName” : string – name of an event you want to override (names are included in this document)

methodToCall : function – method that will be called instead of default implementation when firing event.

Example:

src="Build/UnityLoader.js">

src="NetPlusAPI.js">

Method can throw exceptions, most often because of bad call parameters. ALL API calls can throw exceptions!