mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2024-12-23 06:13:47 +01:00
29 lines
675 B
JavaScript
29 lines
675 B
JavaScript
import { Doodle3DManager } from 'src/index.js';
|
|
|
|
const doodle3DManager = new Doodle3DManager();
|
|
doodle3DManager.setAutoUpdate(true, 1000);
|
|
|
|
doodle3DManager.addEventListener('boxappeared', ({ box }) => {
|
|
box.setAutoUpdate(true, 1000);
|
|
|
|
box.addEventListener('connect', () => {
|
|
console.log('connect to box', box);
|
|
});
|
|
|
|
box.addEventListener('disconnect', () => {
|
|
console.log('disonnect to box', box);
|
|
});
|
|
|
|
box.addEventListener('update', ({ state }) => {
|
|
console.log(state);
|
|
});
|
|
});
|
|
|
|
doodle3DManager.addEventListener('boxdisappeared', ({ box }) => {
|
|
box.setAutoUpdate(false);
|
|
});
|
|
|
|
doodle3DManager.addEventListener('boxeschanged', ({ boxes }) => {
|
|
|
|
});
|