From 92fc33e2de7e627084176a5c40aad7c704eff80d Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Thu, 21 Apr 2016 15:09:49 +0200 Subject: [PATCH] added spaces --- src/configapi.js | 6 +++--- src/doodle3dapi.js | 10 +++++----- src/doodle3dmanager.js | 4 ++-- src/index.js | 2 +- src/infoapi.js | 8 ++++---- src/networkapi.js | 18 +++++++++--------- src/printerapi.js | 14 +++++++------- src/sketchapi.js | 10 ++++------ src/systemapi.js | 2 +- src/updateapi.js | 8 ++++---- 10 files changed, 40 insertions(+), 42 deletions(-) diff --git a/src/configapi.js b/src/configapi.js index 25fa330..2bdc567 100644 --- a/src/configapi.js +++ b/src/configapi.js @@ -6,14 +6,14 @@ export default class { } get (...keys) { - return rest.get(`${this.api}config/?${keys.join('=&')}=`); + return rest.get(`${ this.api }config/?${ keys.join('=&') }=`); } getAll () { - return rest.get(`${this.api}config/all`); + return rest.get(`${ this.api }config/all`); } set (data) { - return rest.post(`${this.api}config`, data); + return rest.post(`${ this.api }config`, data); } } diff --git a/src/doodle3dapi.js b/src/doodle3dapi.js index 76f0284..374f741 100644 --- a/src/doodle3dapi.js +++ b/src/doodle3dapi.js @@ -6,7 +6,7 @@ import PrinterAPI from './printerapi.js'; import SketchAPI from './sketchapi.js'; import SystemAPI from './systemapi.js'; import UpdateAPI from './updateapi.js'; -import {sleep} from './utils.js'; +import { sleep } from './utils.js'; export default class extends EventDispatcher { constructor (boxData) { @@ -14,13 +14,13 @@ export default class extends EventDispatcher { this.boxData = boxData; - this.api = `http://${boxData.localip}/d3dapi/`; + this.api = `http://${ boxData.localip }/d3dapi/`; this.alive = false; this.autoUpdate = false; this.state = {}; - this.maxBatchSize = 10*1024; + this.maxBatchSize = 10 * 1024; this.fullBufferTimeout = 10000; this.config = new ConfigAPI(this.api); @@ -57,7 +57,7 @@ export default class extends EventDispatcher { async sendGCode (gcode) { const printerState = await this.printer.state(); if (printerState.state !== 'idle') { - throw `Cannot print, print state is ${printerState.state}`; + throw `Cannot print, print state is ${ printerState.state }`; } if (!gcode.endsWith('\n')) { @@ -98,7 +98,7 @@ export default class extends EventDispatcher { const response = await this.printer.print(gcode, start, start); // maybe do something with failing response - console.log(`batch sent: ${index}`, printRequest); + console.log(`batch sent: ${ index }`, printRequest); } catch(error) { await sleep(1000); diff --git a/src/doodle3dmanager.js b/src/doodle3dmanager.js index 4af5b74..28dc58f 100644 --- a/src/doodle3dmanager.js +++ b/src/doodle3dmanager.js @@ -1,7 +1,7 @@ import * as rest from './restapi.js'; import Doodle3DAPI from './doodle3dapi.js'; import EventDispatcher from 'casperlamboo/EventDispatcher'; -import {sleep} from './utils.js'; +import { sleep } from './utils.js'; export default class Doodle3DManager extends EventDispatcher { constructor () { @@ -44,7 +44,7 @@ export default class Doodle3DManager extends EventDispatcher { async _checkNew () { let boxes; try { - boxes = await rest.get(`${this.api}list.php`); + boxes = await rest.get(`${ this.api }list.php`); } catch(error) { console.warn('fail connecting to Doodle3D server'); return; diff --git a/src/index.js b/src/index.js index 0bbbb16..2a5b9b9 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ import Doodle3DManager from './doodle3dmanager.js'; import Doodle3DAPI from './doodle3dapi.js'; -export {Doodle3DManager, Doodle3DAPI}; +export { Doodle3DManager, Doodle3DAPI }; diff --git a/src/infoapi.js b/src/infoapi.js index 8193845..97b49b2 100644 --- a/src/infoapi.js +++ b/src/infoapi.js @@ -6,18 +6,18 @@ export default class { } get () { - return rest.get(`${this.api}info`); + return rest.get(`${ this.api }info`); } status () { - return rest.get(`${this.api}info/status`); + return rest.get(`${ this.api }info/status`); } downloadLogFiles () { - window.location = `${this.api}info/logfiles`; + window.location = `${ this.api }info/logfiles`; } acces () { - return rest.get(`${this.api}info/access`); + return rest.get(`${ this.api }info/access`); } } diff --git a/src/networkapi.js b/src/networkapi.js index f391e14..bff2815 100644 --- a/src/networkapi.js +++ b/src/networkapi.js @@ -6,48 +6,48 @@ export default class { } scan () { - return rest.get(`${this.api}network/scan`); + return rest.get(`${ this.api }network/scan`); } known () { - return rest.get(`${this.api}network/known`); + return rest.get(`${ this.api }network/known`); } status () { - return rest.get(`${this.api}network/status`); + return rest.get(`${ this.api }network/status`); } assosiate (ssid, phrase, recreate = false) { const data = { ssid, recreate, phrase }; - return rest.post(`${this.api}network/associate`, data); + return rest.post(`${ this.api }network/associate`, data); } disassociate () { //not tested - return rest.post(`${this.api}network/disassociate`, {}); + return rest.post(`${ this.api }network/disassociate`, {}); } openAccesPoint () { //not tested - return rest.post(`${this.api}network/openap`, {}); + return rest.post(`${ this.api }network/openap`, {}); } remove (ssid) { - return rest.post(`${this.api}network/remove`, { + return rest.post(`${ this.api }network/remove`, { 'ssid': ssid }); } signin () { - return rest.get(`${this.api}network/signin`); + return rest.get(`${ this.api }network/signin`); } async alive () { try { - await rest.get(`${this.api}network/alive`); + await rest.get(`${ this.api }network/alive`); return true; } catch(error) { diff --git a/src/printerapi.js b/src/printerapi.js index 6736fc4..85fa2d6 100644 --- a/src/printerapi.js +++ b/src/printerapi.js @@ -6,34 +6,34 @@ export default class { } temperature () { - return rest.get(`${this.api}printer/temperature`); + return rest.get(`${ this.api }printer/temperature`); } progress () { - return rest.get(`${this.api}printer/progress`); + return rest.get(`${ this.api }printer/progress`); } state () { - return rest.get(`${this.api}printer/state`); + return rest.get(`${ this.api }printer/state`); } listAll () { - return rest.get(`${this.api}printer/listall`); + return rest.get(`${ this.api }printer/listall`); } heatup () { - return rest.post(`${this.api}printer/heatup`, {}); + return rest.post(`${ this.api }printer/heatup`, {}); } print (gcode = '', first = false, start = false, last) { const data = { gcode, first, start, last }; - return rest.post(`${this.api}printer/print`, data); + return rest.post(`${ this.api }printer/print`, data); } stop (gcode = '') { const data = { gcode }; - return rest.post(`${this.api}printer/stop`, data); + return rest.post(`${ this.api }printer/stop`, data); } } diff --git a/src/sketchapi.js b/src/sketchapi.js index c22d46c..44ab542 100644 --- a/src/sketchapi.js +++ b/src/sketchapi.js @@ -6,20 +6,18 @@ export default class { } getSketch (id) { - return rest.get(`${this.api}sketch/?id=${id}`); + return rest.get(`${ this.api }sketch/?id=${ id }`); } set (data = '') { - return rest.post(`${this.api}sketch`, { - data - }); + return rest.post(`${ this.api }sketch`, { data }); } status () { - return rest.get(`${this.api}sketch/status`); + return rest.get(`${ this.api }sketch/status`); } clear () { - return rest.post(`${this.api}sketch/clear`); + return rest.post(`${ this.api }sketch/clear`); } } diff --git a/src/systemapi.js b/src/systemapi.js index b2b4e37..ae62b01 100644 --- a/src/systemapi.js +++ b/src/systemapi.js @@ -6,6 +6,6 @@ export default class { } versions () { - return rest.get(`${this.api}system/fwversions`); + return rest.get(`${ this.api }system/fwversions`); } } diff --git a/src/updateapi.js b/src/updateapi.js index 88f980c..de3224d 100644 --- a/src/updateapi.js +++ b/src/updateapi.js @@ -6,24 +6,24 @@ export default class { } status () { - return rest.get(`${this.api}update/status`); + return rest.get(`${ this.api }update/status`); } download () { //not tested - return rest.post(`${this.api}update/download`, {}); + return rest.post(`${ this.api }update/download`, {}); } install () { //not tested - return rest.post(`${this.api}update/install`, {}); + return rest.post(`${ this.api }update/install`, {}); } clear () { //not tested - return rest.post(`${this.api}update/clear`, {}); + return rest.post(`${ this.api }update/clear`, {}); } }