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);
|
2015-10-12 12:33:33 +02:00
|
|
|
|
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);
|
|
|
|
});
|
2015-10-12 12:33:33 +02:00
|
|
|
|
2016-04-21 15:52:23 +02:00
|
|
|
box.addEventListener('disconnect', () => {
|
|
|
|
console.log('disonnect to box', box);
|
2016-07-19 16:14:48 +02:00
|
|
|
});
|
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);
|
2015-07-23 19:12:50 +02:00
|
|
|
});
|
|
|
|
|
2016-04-21 15:26:08 +02:00
|
|
|
doodle3DManager.addEventListener('boxeschanged', ({ boxes }) => {
|
|
|
|
|
|
|
|
});
|