diff --git a/config.js b/config.js deleted file mode 100644 index 5dd6187..0000000 --- a/config.js +++ /dev/null @@ -1,95 +0,0 @@ -System.config({ - baseURL: "/", - defaultJSExtensions: true, - transpiler: "babel", - babelOptions: { - "optional": [ - "runtime" - ] - }, - paths: { - "github:*": "jspm_packages/github/*", - "npm:*": "jspm_packages/npm/*" - }, - bundles: { - "bundle.js": [] - }, - - map: { - "babel": "npm:babel-core@5.8.21", - "babel-runtime": "npm:babel-runtime@5.8.20", - "clipper-lib": "npm:clipper-lib@1.0.0", - "core-js": "npm:core-js@0.9.18", - "json": "github:systemjs/plugin-json@0.1.0", - "nodeca/js-yaml": "github:nodeca/js-yaml@3.3.1", - "read-yaml": "npm:read-yaml@1.0.0", - "systemjs/plugin-json": "github:systemjs/plugin-json@0.1.0", - "three.js": "github:mrdoob/three.js@r72", - "github:jspm/nodelibs-assert@0.1.0": { - "assert": "npm:assert@1.3.0" - }, - "github:jspm/nodelibs-path@0.1.0": { - "path-browserify": "npm:path-browserify@0.0.0" - }, - "github:jspm/nodelibs-process@0.1.1": { - "process": "npm:process@0.10.1" - }, - "github:jspm/nodelibs-util@0.1.0": { - "util": "npm:util@0.10.3" - }, - "npm:argparse@1.0.2": { - "assert": "github:jspm/nodelibs-assert@0.1.0", - "fs": "github:jspm/nodelibs-fs@0.1.2", - "lodash": "npm:lodash@3.10.1", - "path": "github:jspm/nodelibs-path@0.1.0", - "process": "github:jspm/nodelibs-process@0.1.1", - "sprintf-js": "npm:sprintf-js@1.0.3", - "util": "github:jspm/nodelibs-util@0.1.0" - }, - "npm:assert@1.3.0": { - "util": "npm:util@0.10.3" - }, - "npm:babel-runtime@5.8.20": { - "process": "github:jspm/nodelibs-process@0.1.1" - }, - "npm:clipper-lib@1.0.0": { - "process": "github:jspm/nodelibs-process@0.1.1" - }, - "npm:core-js@0.9.18": { - "fs": "github:jspm/nodelibs-fs@0.1.2", - "process": "github:jspm/nodelibs-process@0.1.1", - "systemjs-json": "github:systemjs/plugin-json@0.1.0" - }, - "npm:esprima@2.2.0": { - "fs": "github:jspm/nodelibs-fs@0.1.2", - "process": "github:jspm/nodelibs-process@0.1.1" - }, - "npm:inherits@2.0.1": { - "util": "github:jspm/nodelibs-util@0.1.0" - }, - "npm:js-yaml@3.3.1": { - "argparse": "npm:argparse@1.0.2", - "esprima": "npm:esprima@2.2.0", - "fs": "github:jspm/nodelibs-fs@0.1.2", - "path": "github:jspm/nodelibs-path@0.1.0", - "process": "github:jspm/nodelibs-process@0.1.1", - "systemjs-json": "github:systemjs/plugin-json@0.1.0", - "util": "github:jspm/nodelibs-util@0.1.0" - }, - "npm:lodash@3.10.1": { - "process": "github:jspm/nodelibs-process@0.1.1" - }, - "npm:path-browserify@0.0.0": { - "process": "github:jspm/nodelibs-process@0.1.1" - }, - "npm:read-yaml@1.0.0": { - "fs": "github:jspm/nodelibs-fs@0.1.2", - "js-yaml": "npm:js-yaml@3.3.1", - "xtend": "npm:xtend@4.0.0" - }, - "npm:util@0.10.3": { - "inherits": "npm:inherits@2.0.1", - "process": "github:jspm/nodelibs-process@0.1.1" - } - } -}); diff --git a/example/app.js b/example/app.js index eaa4bfa..4dfebd0 100644 --- a/example/app.js +++ b/example/app.js @@ -1,19 +1,17 @@ import THREE from 'three.js'; -import PRINTER_SETTINGS from 'settings/printer_settings.json!'; -import USER_SETTINGS from 'settings/user_settings.json!'; import * as SLICER from 'src/index'; -var settings = new SLICER.Settings(); -settings.updateConfig(PRINTER_SETTINGS["ultimaker2go"]); -settings.updateConfig(USER_SETTINGS); +const settings = new SLICER.Settings({ + ...SLICER.printerSettings['ultimaker2go'], + ...SLICER.userSettings +}); -var geometry = new THREE.TorusGeometry(20, 10, 30, 30); +const geometry = new THREE.TorusGeometry(20, 10, 30, 30); -var slicer = new SLICER.Slicer(); -//var slicer = new SLICER.SlicerWorker(); +const slicer = new SLICER.Slicer(); -slicer.setGeometry(geometry.clone()); -slicer.onfinish = function (gCode) { - document.getElementById('gcode').innerHTML = gCode.replace(/(?:\r\n|\r|\n)/g, '
'); -}; +slicer.setGeometry(geometry); +slicer.addEventListener('finish', ({ gcode }) => { + document.getElementById('gcode').innerHTML = gcode.replace(/(?:\r\n|\r|\n)/g, '
'); +}); slicer.slice(settings); diff --git a/example/index.html b/example/index.html index 1117bf4..f85f1ec 100644 --- a/example/index.html +++ b/example/index.html @@ -11,7 +11,7 @@ - +