-
Notifications
You must be signed in to change notification settings - Fork 36
/
index.html
82 lines (71 loc) · 3.21 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!doctype html>
<html>
<head>
</head>
<h1>BIMserver JavaScript API</h1>
<p>
To make it easier to interact with the OpenSource BIMserver from a web environment (like a browser or NodeJS) you can use this library.
This library uses the ECMAScript6 Modules concept. Not all browsers support this yet.
</p>
<h3>Caching</h3>
<p>
The "?_v=%VERSION%" additions are there for efficient caching purposes. Any server system serving these files can tell the client to cache these files indefinitely.
</p>
<h3>Links</h3>
<ul>
<li><a href="bimserverapipromise.js?_v=%VERSION%">bimserverapipromise.js?_v=%VERSION%</a></li>
<li><a href="bimserverapiwebsocket.js?_v=%VERSION%">bimserverapiwebsocket.js?_v=%VERSION%</a></li>
<li><a href="bimserverclient.js?_v=%VERSION%">bimserverclient.js?_v=%VERSION%</a></li>
<li><a href="ifc2x3tc1.js?_v=%VERSION%">ifc2x3tc1.js?_v=%VERSION%</a></li>
<li><a href="ifc4.js?_v=%VERSION%">ifc4.js?_v=%VERSION%</a></li>
<li><a href="model.js?_v=%VERSION%">model.js?_v=%VERSION%</a></li>
<li><a href="translations_en.js?_v=%VERSION%">translations_en.js?_v=%VERSION%</a></li>
</ul>
To include this library in your project, copy this to your <pre><head></pre>
<pre>
<script type="module" src="bimserverapipromise.js?_v=%VERSION%"></script>
<script type="module" src="bimserverapiwebsocket.js?_v=%VERSION%"></script>
<script type="module" src="bimserverclient.js?_v=%VERSION%"></script>
<script type="module" src="ifc2x3tc1.js?_v=%VERSION%"></script>
<script type="module" src="ifc4.js?_v=%VERSION%"></script>
<script type="module" src="model.js?_v=%VERSION%"></script>
<script type="module" src="translations_en.js?_v=%VERSION%"></script>
</pre>
Combined minified version (only available on a released version):
<a href="bimserverapi.js?_v=%VERSION%">bimserverapi.js?_v=%VERSION%</a>
<h1>Static import example</h1>
<pre>
// Import the library, all dependencies will be handled by the module system
import BimServerClient from './bimserverclient.js';
// Create a new API, the path given should point to the base path of a BIMserver. This can also be a full URL like "http://bimserveraddress"
var api = new BimServerClient("../..");
api.init((client, version) => {
console.log(version.version);
});
</pre>
<h1>Dynamic import example</h1>
<pre>
// 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);
});
});
</pre>
<h1>(Live) Version returned from local BIMserver</h1>
<pre id="version">
</pre>
<script type="module">
import BimServerClient from './bimserverclient.js';
var api = new BimServerClient("../..");
api.init((client, version) => {
document.getElementById("version").innerHTML = JSON.stringify(version.version, 0, 2);
});
</script>
</html>