Load and test Nextspace library

HTML

<script src="https://nextspace-limited.github.io/nextspace-web-bundle/dist/nextspace.js?v1"></script>
<div id="RESULT"></div>

CSS

#RESULT {
    font-size: 50px;
}

JavaScript

// Setup global defaults.
BModels.ENVIRONMENT.Reset({
    // Replace with your account ID.
    accountId: "template",
    // UAT is for early access to features, for a stable release use PROD.
    env: BModels.Api.EEnv.UAT,
    sessionId: "anonymous"
});

const init = async () => {
    // Get default api instance.
    // Normally you'd never have to do this.
    const api = BModels.ENVIRONMENT.Api().GetBruceApi({});
    await api.Loading;

    // Perform a test request to see if both the library and communication to the API are working.
    await api.GET("test");

    document.getElementById("RESULT").innerText = "You've loaded the library!";
};

init();