From e4880106f1f4232380cce45c0183cd1f056cc2b7 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Wed, 19 Jul 2017 20:54:21 +0200 Subject: [PATCH] remove progress promise @mith @peteruithoven --- README.md | 9 ++++----- jspm.config.js | 1 - package.json | 1 - src/Slicer.js | 7 +++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6a2a04a..5f45975 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,8 @@ const geometry = new THREE.TorusGeometry(20, 10, 30, 30); const slicer = new SLICER.Slicer(); slicer.setGeometry(geometry); -const gcode = await slicer.slice(settings) - .progress(({ progress: { done, total, action } }) => { - const percentage = `${(done / total * 100).toFixed()}%` - console.log(action, percentage); - }); +const gcode = await slicer.slice(settings, ({ progress: { done, total, action } }) => { + const percentage = `${(done / total * 100).toFixed()}%` + console.log(action, percentage); +})); ``` diff --git a/jspm.config.js b/jspm.config.js index 39be6b7..fccd3c9 100644 --- a/jspm.config.js +++ b/jspm.config.js @@ -151,7 +151,6 @@ SystemJS.config({ ], map: { "three": "npm:three@0.83.0", - "progress-promise": "npm:progress-promise@0.0.6", "text": "github:systemjs/plugin-text@0.0.11", "js-yaml": "npm:js-yaml@3.9.0", "clipper-js": "github:Doodle3D/clipper-js@1.0.2", diff --git a/package.json b/package.json index 45167f8..c46dbe3 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "clipper-js": "github:Doodle3D/clipper-js@1.0.2", "js-yaml": "npm:js-yaml@^3.9.0", "json": "github:systemjs/plugin-json@^0.1.2", - "progress-promise": "npm:progress-promise@^0.0.6", "text": "github:systemjs/plugin-text@^0.0.11", "three": "npm:three@0.83.0", "worker": "github:casperlamboo/plugin-worker@master" diff --git a/src/Slicer.js b/src/Slicer.js index f3f802d..fe5b951 100644 --- a/src/Slicer.js +++ b/src/Slicer.js @@ -1,7 +1,6 @@ import * as THREE from 'three'; import slice from './sliceActions/slice.js'; import SlicerWorker from './slicerWorker.js!worker'; -import ProgressPromise from 'progress-promise'; export default class { setMesh(mesh) { @@ -29,12 +28,12 @@ export default class { sliceSync(settings, onprogress) { return slice(this.geometry, settings, onprogress); } - slice(settings) { + slice(settings, onprogress) { if (!this.geometry) { throw new Error('Geometry is not set, use Slicer.setGeometry or Slicer.setMesh first'); } - return new ProgressPromise((resolve, reject, progress) => { + return new Promise((resolve, reject) => { // create the slicer worker const slicerWorker = new SlicerWorker(); slicerWorker.onerror = reject; @@ -49,7 +48,7 @@ export default class { break; } case 'PROGRESS': { - progress(data); + onprogress(data); break; } }