Skip to main content

Getting Started

In NavVis IVION, frontend development is based on an NPM package that you can import into your frontend application.

The NavVis IVION Frontend API allows IDE users to access auto-completion features and provides TypeScript users with type-safety features.

Confirming your NavVis IVION Version

Follow these steps to verify your NavVis IVION version:
  1. On the NavVis IVION instance dashboard, click the hamburger icon in the top left corner of your screen.
  2. Click About in the bottom left corner of your screen.
    The box that opens will show which version of NavVis IVION you are currently running.

Setting Up

Follow these steps to set up your development environment:
Note: We recommend using a modular package management system and code bundler. We are using Node Package Manager (NPM) and Webpack as examples here.
  1. Optionally, install a package manager and code bundler such as NPM and Webpack.
  2. If you have installed NPM and Webpack, verify the installation by running:
    $ npm -v

    $ webpack -v
    If NPM and Webpack are installed correctly, running these commands should return the version.
  3. Optionally, download the scaffold project. The scaffold project package contains a simple TypeScript-based NodeJS application to help you get started.
  4. Download the NavVis IVION Frontend API NPM package.
  5. Place a copy of the NPM package into your project folder:
    ├── navvis-ivion-VERSION.tgz <---
    ├── package.json
    ├── src
    │ ├── image
    │ │ └── favicon.ico
    │ ├── index.html
    │ ├── index.scss
    │ └── index.ts
    ├── tsconfig.json
    └── webpack.config.js
  6. If you are not using the scaffold project, add the NPM package to the project dependency by running:
      },
    "dependencies": {
    "@navvis/ivion": "file:navvis-ivion-VERSION.tgz"
    }
    }
    Note: Replace VERSION with the actual version number of the NPM package
  7. Install dependencies by running:
    $ npm install

Checking the Code

Follow these steps to check the code:
Open ./src/index.ts in your code editor.
You should see:
// index.ts
import "./index.scss";
import {getApi, ApiInterface} from "@navvis/ivion";

class TestApp
{
public ivApi: ApiInterface;

constructor()
{
getApi("https://iviondemo.iv.navvis.com/")
.then((iv: ApiInterface) => {
this.ivApi = iv;
// Code added here will execute after NavVis IVION is completely loaded.
})
}
}

(<any>window).TestApp = new TestApp();

Initializing NavVis IVION

Follow these steps to initialize NavVis IVION:
To initialize NavVis IVION, run:
getApi("https://iviondemo.iv.navvis.com/").then((iv: ApiInterface) => { /* run after IV loads. */ });

getApi(instanceUrl [, configuration]) instantiates NavVis IVION and returns a promise, which is used to run code after NavVis IVION is completely loaded.

The first argument of getApi() is the URL of your NavVis IVION instance.

The second, optional argument allows you to configure the behavior and appearance of NavVis IVION on startup. For example, if you want NavVis IVION to be in German, set the option to:
getApi("https://iviondemo.iv.navvis.com/", { "lang=de"}).then((iv: ApiInterface) => { /* run after IV loads. */ });

Embedding NavVis IVION

Follow these steps to embed NavVis IVION:
Open ./src/index.html in your code editor.
You should see:
<!DOCTYPE html>
<html>
<head>
<title>IV API Testing App</title>
</head>
<body>
<ivion></ivion>
</body>
</html>
The <ivion> tag is used by NavVis IVION to bootstrap and dynamically inject DOM elements and scripts into your application. This tag can be placed anywhere within your DOM structure.

Running the Application

Follow these steps to run the application:
If you are using the scaffold project, run:
$ npm run serve
This will compile your code, start your default browser, and load the application.

Fetching Failed

If you receive an error similar to the following, your NavVis IVION instance is not reachable.

Verify that:
  1. The instance URL is correct.
  2. You have network access to the instance.

CORS Disabled

If you receive the following error, you have to revise your CORS security settings.

  1. Go to Instance Settings > Instance Configuration.
  2. Revise your CORS security settings.