mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2025-01-03 10:03:48 +01:00
updated paths for local imports
This commit is contained in:
parent
2b7cedfcf6
commit
376731722d
23
config.js
23
config.js
@ -1,5 +1,6 @@
|
||||
System.config({
|
||||
"baseURL": "/",
|
||||
"defaultJSExtensions": true,
|
||||
"transpiler": "babel",
|
||||
"babelOptions": {
|
||||
"optional": [
|
||||
@ -7,31 +8,23 @@ System.config({
|
||||
]
|
||||
},
|
||||
"paths": {
|
||||
"*": "*.js",
|
||||
"github:*": "jspm_packages/github/*.js",
|
||||
"npm:*": "jspm_packages/npm/*.js"
|
||||
"github:*": "jspm_packages/github/*",
|
||||
"npm:*": "jspm_packages/npm/*"
|
||||
}
|
||||
});
|
||||
|
||||
System.config({
|
||||
"map": {
|
||||
"config-API": "src/configapi",
|
||||
"doodle3d-API": "src/doodle3dapi",
|
||||
"info-API": "src/infoapi",
|
||||
"network-API": "src/networkapi",
|
||||
"printer-API": "src/printerapi",
|
||||
"rest-API": "src/restapi",
|
||||
"sketch-API": "src/sketchapi",
|
||||
"system-API": "src/systemapi",
|
||||
"update-API": "src/updateapi",
|
||||
"babel": "npm:babel-core@5.6.20",
|
||||
"babel-runtime": "npm:babel-runtime@5.6.20",
|
||||
"babel": "npm:babel-core@5.7.4",
|
||||
"babel-runtime": "npm:babel-runtime@5.7.0",
|
||||
"core-js": "npm:core-js@0.9.18",
|
||||
"jquery": "github:components/jquery@2.1.4",
|
||||
"traceur": "github:jmcriffey/bower-traceur@0.0.90",
|
||||
"traceur-runtime": "github:jmcriffey/bower-traceur-runtime@0.0.90",
|
||||
"github:jspm/nodelibs-process@0.1.1": {
|
||||
"process": "npm:process@0.10.1"
|
||||
},
|
||||
"npm:babel-runtime@5.6.20": {
|
||||
"npm:babel-runtime@5.7.0": {
|
||||
"process": "github:jspm/nodelibs-process@0.1.1"
|
||||
},
|
||||
"npm:core-js@0.9.18": {
|
||||
|
137
example/app.js
137
example/app.js
@ -1,73 +1,83 @@
|
||||
import Doodle3DAPI from 'doodle3d-API';
|
||||
import rest from 'rest-API';
|
||||
import Doodle3DAPI from 'src/doodle3dapi.js';
|
||||
import rest from 'src/restapi.js';
|
||||
|
||||
var api = 'http://connect.doodle3d.com/api/';
|
||||
var known = [];
|
||||
|
||||
function addBox (boxData) {
|
||||
var addBox = (function () {
|
||||
var known = [];
|
||||
|
||||
if (known.indexOf(boxData.localip) === -1) {
|
||||
known.push(boxData.localip);
|
||||
return function (boxData) {
|
||||
if (known.indexOf(boxData.localip) === -1) {
|
||||
known.push(boxData.localip);
|
||||
|
||||
var row = document.createElement('tr');
|
||||
row.style.color = 'gray';
|
||||
|
||||
var id = document.createElement('td');
|
||||
var state = document.createElement('td');
|
||||
var localIP = document.createElement('td');
|
||||
var bed = document.createElement('td');
|
||||
var bedTarget = document.createElement('td');
|
||||
var bufferedLines = document.createElement('td');
|
||||
var currentLine = document.createElement('td');
|
||||
var hasControl = document.createElement('td');
|
||||
var hotend = document.createElement('td');
|
||||
var hotendTarget = document.createElement('td');
|
||||
var totalLines = document.createElement('td');
|
||||
|
||||
row.appendChild(id);
|
||||
row.appendChild(localIP);
|
||||
row.appendChild(state);
|
||||
row.appendChild(currentLine);
|
||||
row.appendChild(bufferedLines);
|
||||
row.appendChild(totalLines);
|
||||
row.appendChild(hotend);
|
||||
row.appendChild(hotendTarget);
|
||||
row.appendChild(bed);
|
||||
row.appendChild(bedTarget);
|
||||
row.appendChild(hasControl);
|
||||
|
||||
id.innerHTML = boxData.wifiboxid;
|
||||
localIP.innerHTML = boxData.localip;
|
||||
|
||||
document.getElementById('table').appendChild(row);
|
||||
|
||||
var doodle3DAPI = new Doodle3DAPI(boxData.localip);
|
||||
doodle3DAPI.onconnect = function () {
|
||||
row.style.color = 'black';
|
||||
};
|
||||
doodle3DAPI.ondisconnect = function () {
|
||||
var row = document.createElement('tr');
|
||||
row.style.color = 'gray';
|
||||
};
|
||||
doodle3DAPI.onupdate = function (data) {
|
||||
console.log(data);
|
||||
state.innerHTML = data.state;
|
||||
if (data.state !== 'disconnected' && data.state !== 'connecting' && data.state !== 'unknown') {
|
||||
bed.innerHTML = data.bed;
|
||||
bedTarget.innerHTML = data.bed_target;
|
||||
bufferedLines.innerHTML = data.buffered_lines;
|
||||
currentLine.innerHTML = data.current_line;
|
||||
hasControl.innerHTML = data.has_control;
|
||||
hotend.innerHTML = data.hotend;
|
||||
hotendTarget.innerHTML = data.hotend_target;
|
||||
|
||||
var id = document.createElement('td');
|
||||
var state = document.createElement('td');
|
||||
var localIP = document.createElement('td');
|
||||
var bed = document.createElement('td');
|
||||
var bedTarget = document.createElement('td');
|
||||
var bufferedLines = document.createElement('td');
|
||||
var currentLine = document.createElement('td');
|
||||
var hasControl = document.createElement('td');
|
||||
var hotend = document.createElement('td');
|
||||
var hotendTarget = document.createElement('td');
|
||||
var totalLines = document.createElement('td');
|
||||
|
||||
row.appendChild(id);
|
||||
row.appendChild(localIP);
|
||||
row.appendChild(state);
|
||||
row.appendChild(currentLine);
|
||||
row.appendChild(bufferedLines);
|
||||
row.appendChild(totalLines);
|
||||
row.appendChild(hotend);
|
||||
row.appendChild(hotendTarget);
|
||||
row.appendChild(bed);
|
||||
row.appendChild(bedTarget);
|
||||
row.appendChild(hasControl);
|
||||
|
||||
id.innerHTML = boxData.wifiboxid;
|
||||
localIP.innerHTML = boxData.localip;
|
||||
|
||||
document.getElementById('table').appendChild(row);
|
||||
|
||||
var doodle3DAPI = new Doodle3DAPI(boxData.localip);
|
||||
doodle3DAPI.onconnect = function () {
|
||||
row.style.color = 'black';
|
||||
};
|
||||
doodle3DAPI.ondisconnect = function () {
|
||||
row.style.color = 'gray';
|
||||
};
|
||||
doodle3DAPI.onupdate = function (data) {
|
||||
state.innerHTML = data.state;
|
||||
totalLines.innerHTML = data.total_lines;
|
||||
}
|
||||
else {
|
||||
}
|
||||
};
|
||||
doodle3DAPI.startUpdateLoop();
|
||||
if (data.state !== 'disconnected' && data.state !== 'connecting' && data.state !== 'unknown') {
|
||||
bed.innerHTML = data.bed;
|
||||
bedTarget.innerHTML = data.bed_target;
|
||||
bufferedLines.innerHTML = data.buffered_lines;
|
||||
currentLine.innerHTML = data.current_line;
|
||||
hasControl.innerHTML = data.has_control;
|
||||
hotend.innerHTML = data.hotend;
|
||||
hotendTarget.innerHTML = data.hotend_target;
|
||||
state.innerHTML = data.state;
|
||||
totalLines.innerHTML = data.total_lines;
|
||||
}
|
||||
else {
|
||||
bed.innerHTML = '';
|
||||
bedTarget.innerHTML = '';
|
||||
bufferedLines.innerHTML = '';
|
||||
currentLine.innerHTML = '';
|
||||
hasControl.innerHTML = '';
|
||||
hotend.innerHTML = '';
|
||||
hotendTarget.innerHTML = '';
|
||||
state.innerHTML = '';
|
||||
totalLines.innerHTML = '';
|
||||
}
|
||||
};
|
||||
doodle3DAPI.startUpdateLoop();
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
function searchBoxes () {
|
||||
rest.get(api + 'list.php', function (error, boxes) {
|
||||
@ -83,12 +93,11 @@ function searchBoxes () {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(searchBoxes, 5000);
|
||||
searchBoxes();
|
||||
|
||||
addBox({
|
||||
localip: window.location.host + ':3000',
|
||||
localip: '127.0.0.1:3000',
|
||||
wifiboxid: 'Node Server'
|
||||
});
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
<script type="text/javascript" src="../config.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
System.import('example/app');
|
||||
System.import('example/app.js');
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
17
package.json
17
package.json
@ -1,7 +1,6 @@
|
||||
{
|
||||
"jspm": {
|
||||
"format": "es6",
|
||||
"main": "doodle3dapi.js",
|
||||
"main": "./doodle3dapi",
|
||||
"directories": {
|
||||
"lib": "src"
|
||||
},
|
||||
@ -11,17 +10,9 @@
|
||||
"devDependencies": {
|
||||
"babel": "npm:babel-core@^5.1.13",
|
||||
"babel-runtime": "npm:babel-runtime@^5.1.13",
|
||||
"core-js": "npm:core-js@^0.9.4"
|
||||
},
|
||||
"map": {
|
||||
"config-API": "src/configapi",
|
||||
"info-API": "src/infoapi",
|
||||
"network-API": "src/networkapi",
|
||||
"printer-API": "src/printerapi",
|
||||
"rest-API": "src/restapi",
|
||||
"sketch-API": "src/sketchapi",
|
||||
"system-API": "src/systemapi",
|
||||
"update-API": "src/updateapi"
|
||||
"core-js": "npm:core-js@^0.9.4",
|
||||
"traceur": "github:jmcriffey/bower-traceur@0.0.90",
|
||||
"traceur-runtime": "github:jmcriffey/bower-traceur-runtime@0.0.90"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import rest from 'rest-API';
|
||||
import rest from './restapi.js';
|
||||
|
||||
export default class {
|
||||
constructor (localIP) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
import rest from 'rest-API';
|
||||
import ConfigAPI from 'config-API';
|
||||
import InfoAPI from 'info-API';
|
||||
import NetworkAPI from 'network-API';
|
||||
import PrinterAPI from 'printer-API';
|
||||
import SketchAPI from 'sketch-API';
|
||||
import SystemAPI from 'system-API';
|
||||
import UpdateAPI from 'update-API';
|
||||
import rest from './restapi.js';
|
||||
import ConfigAPI from './configapi.js';
|
||||
import InfoAPI from './infoapi.js';
|
||||
import NetworkAPI from './networkapi.js';
|
||||
import PrinterAPI from './printerapi.js';
|
||||
import SketchAPI from './sketchapi.js';
|
||||
import SystemAPI from './systemapi.js';
|
||||
import UpdateAPI from './updateapi.js';
|
||||
|
||||
export default class {
|
||||
constructor (localIP) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import rest from 'rest-API';
|
||||
import rest from './restapi.js';
|
||||
|
||||
export default class {
|
||||
constructor (localIP) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import rest from 'rest-API';
|
||||
import rest from './restapi.js';
|
||||
|
||||
export default class {
|
||||
constructor (localIP) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import rest from 'rest-API';
|
||||
import rest from './restapi.js';
|
||||
|
||||
export default class {
|
||||
constructor (localIP) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import rest from 'rest-API';
|
||||
import rest from './restapi.js';
|
||||
|
||||
export default class {
|
||||
constructor (localIP) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import rest from 'rest-API';
|
||||
import rest from './restapi.js';
|
||||
|
||||
export default class {
|
||||
constructor (localIP) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import rest from 'rest-API';
|
||||
import rest from './restapi.js';
|
||||
|
||||
export default class {
|
||||
constructor (localIP) {
|
||||
|
Loading…
Reference in New Issue
Block a user