All Projects → opensourceBIM → BIMserver-JavaScript-API

opensourceBIM / BIMserver-JavaScript-API

Licence: LGPL-3.0 license
BIMserver JavaScript API

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

BIMserver-JavaScript-API

A JavaScript API for the OpenSource BIMserver.

Usage

Static import

Download the combined minified library and include it in your HTML.

<script type="module" src="bimserverapi.js?_v=%VERSION%"></script>

The ?_v=%VERSION% addition is there for efficient caching purposes. Any server system serving these files can tell the client to cache these files indefinitely.

Import as an ES6 module

If you are using a transpiler such as Typescript or Babel, or a bundler such as Webpack or Rollup, you can import the module using the Import syntax.

It is also possible to load the ES6 module directly into the browser, however not all browser support this yet.

import { BimServerClient } from './js/bimserverclient.js';
const api = new BimServerClient("../..");
api.init((client, version) => {
	console.log(version.version);
});

Dynamic import

When the location on the API is not known in advance, you can use dynamic loading, in most browsers you'll need to use a "dev" version for this to work (Chrome 64 for example).

var address = "http://addressofapi";
Promise.all([
	address + "/bimserverclient.js",
	address + "/bimserverapipromise.js"
].map(x => import(x)))
.then(([BimServerClient, BimServerApiPromise]) => {
	var api = new BimServerClient.BimServerClient("../..");
	api.init((client, version) => {
		document.getElementById("version").innerHTML = JSON.stringify(version.version, 0, 2);
	});
});

Version returned from BIMserver instance

To do.

API documentation

To do.

Build the library

  • Install Node.js
  • Clone (or download and unzip) the project to your file system:
git clone https://github.com/opensourceBIM/BIMserver-JavaScript-API.git
  • Go to the project directory
cd BIMserver-JavaScript-API
  • Install build dependencies
npm install
  • Run the build script
npm run build

The compiled file is located at build/bimserverapi.js

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].