wrap progress in object

So data could be extended in the future
This commit is contained in:
casperlamboo 2017-07-19 11:02:14 +02:00
parent 83f543b62b
commit 73f0433e00
3 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ const geometry = new THREE.TorusGeometry(20, 10, 30, 30);
const slicer = new SLICER.Slicer();
slicer.setGeometry(geometry);
const gcode = await slicer.slice(settings)
.progress(({ done, total, action }) => {
.progress(({ progress: { done, total, action } }) => {
const percentage = `${(done / total * 100).toFixed()}%`
console.log(action, percentage);
});

View File

@ -17,7 +17,7 @@ jsonLoader.load('models/airplane.json', async geometry => {
const slicer = new Slicer().setGeometry(geometry);
const gcode = await slicer.slice(settings)
.progress(({ done, total, action }) => {
.progress(({ progress: { done, total, action } }) => {
const percentage = `${(done / total * 100).toFixed()}%`
document.write(`<p>${action}, ${percentage}</p>`);
});

View File

@ -6,7 +6,7 @@ const loader = new THREE.JSONLoader();
const onProgress = progress => {
self.postMessage({
message: 'PROGRESS',
data: progress
data: { progress }
});
}