rename sliceWorker to slicerWorker

This commit is contained in:
casperlamboo 2016-10-13 14:22:04 +02:00
parent 868748ee2c
commit 45514218af
2 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
import THREE from 'three.js';
import slice from './sliceActions/slice.js';
import SliceWorker from './sliceActions/sliceWorker.js!worker';
import SlicerWorker from './slicerWorker.js!worker';
export default class {
setMesh(mesh) {
@ -34,26 +34,26 @@ export default class {
return slice(this.geometry, settings);
}
slice(settings) {
const sliceWorker = new SliceWorker();
const slicerWorker = new SlicerWorker();
const geometry = this.geometry.toJSON();
const { config } = settings;
return new Promise((resolve, reject) => {
sliceWorker.onerror = reject;
slicerWorker.onerror = reject;
sliceWorker.addEventListener('message', (event) => {
slicerWorker.addEventListener('message', (event) => {
const { message, data } = event.data;
switch (message) {
case 'SLICE': {
sliceWorker.terminate();
slicerWorker.terminate();
resolve(data.gcode);
break;
}
}
});
sliceWorker.postMessage({
slicerWorker.postMessage({
message: 'SLICE',
data: { geometry, config }
});

View File

@ -1,5 +1,5 @@
import Settings from '../Settings.js';
import slice from './slice.js';
import Settings from './Settings.js';
import slice from './sliceActions/slice.js';
import THREE from 'three.js';
const loader = new THREE.JSONLoader();