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

View File

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