0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-11-15 00:37:55 +01:00
Doodle3D-API/example/app.js

29 lines
674 B
JavaScript
Raw Normal View History

2016-04-21 15:26:08 +02:00
import { Doodle3DManager } from 'src/index.js';
2015-07-15 15:06:18 +02:00
2015-10-13 11:03:18 +02:00
const doodle3DManager = new Doodle3DManager();
2016-04-21 15:26:08 +02:00
doodle3DManager.setAutoUpdate(true, 1000);
2016-04-21 15:26:08 +02:00
doodle3DManager.addEventListener('boxappeared', ({ box }) => {
2016-04-21 15:52:23 +02:00
box.setAutoUpdate(true, 1000);
2015-10-15 10:56:01 +02:00
2016-04-21 15:52:23 +02:00
box.addEventListener('connect', () => {
console.log('connect to box', box);
});
2016-04-21 15:52:23 +02:00
box.addEventListener('disconnect', () => {
console.log('disonnect to box', box);
})
2015-10-15 10:56:01 +02:00
2016-04-21 15:52:23 +02:00
box.addEventListener('update', ({ state }) => {
console.log(state);
});
2015-10-13 11:03:18 +02:00
});
2015-07-16 13:55:13 +02:00
2016-04-21 15:26:08 +02:00
doodle3DManager.addEventListener('boxdisappeared', ({ box }) => {
2016-04-21 15:52:23 +02:00
box.setAutoUpdate(false);
});
2016-04-21 15:26:08 +02:00
doodle3DManager.addEventListener('boxeschanged', ({ boxes }) => {
});