Code Monkey home page Code Monkey logo

bimserver-javascript-api's Introduction

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

bimserver-javascript-api's People

Contributors

aothms avatar bastienmenis avatar giacomomanzoli avatar hlg avatar rubendel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.