diff --git a/data/index.html b/data/index.html index 1e63752..959dfce 100644 --- a/data/index.html +++ b/data/index.html @@ -33,38 +33,33 @@
  • + data-label="Color">
  • + data-label="Color 2">
  • + data-label="Rainbow">
  • + data-mode="3">
  • + data-mode="3">
  • diff --git a/data/script.js b/data/script.js index f39162a..e5c2fdc 100644 --- a/data/script.js +++ b/data/script.js @@ -10752,10 +10752,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); __WEBPACK_IMPORTED_MODULE_0_jquery___default()(() => { new __WEBPACK_IMPORTED_MODULE_1__core_App__["a" /* default */](__WEBPACK_IMPORTED_MODULE_0_jquery___default()('body')) - .components(__WEBPACK_IMPORTED_MODULE_2__components_exports__); - /* .websocket({ - led: new WebSocket('ws://ledstrip/') - }); */ + .components(__WEBPACK_IMPORTED_MODULE_2__components_exports__) + .websocket(new WebSocket('ws://192.168.1.246/pixel')); }); @@ -11925,13 +11923,13 @@ class ParamColor extends __WEBPACK_IMPORTED_MODULE_1__base_ColorPicker_ColorPick constructor(ctx, node) { super(ctx, node); //this.store = new Store(this.config.endpoint); - this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); + /* this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); this.ws.onopen = (event) => { console.log('open ' + this.config.endpoint); }; this.ws.onmessage = (event) => { console.log(event.data); - }; + }; */ } onChange(evt) { @@ -11940,7 +11938,7 @@ class ParamColor extends __WEBPACK_IMPORTED_MODULE_1__base_ColorPicker_ColorPick });*/ //let cmd = this.config.id + parseInt(this.value.replace('#', '0x')); console.log(parseInt(this.value.replace('#', '0x'))); - this.ws.send(JSON.stringify({ + this.ctx.ws.send(JSON.stringify({ mode: this.config.mode, value: parseInt(this.value.replace('#', '0x')) })); @@ -11969,14 +11967,14 @@ class ParamWs extends __WEBPACK_IMPORTED_MODULE_1__base_TextInput_TextInput__["a super(ctx, node); //this.store = new Store(this.config.endpoint); - this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); + /* this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); this.ws.onopen = (event) => { console.log('open ' + this.config.endpoint); }; this.ws.onmessage = (event) => { //console.log(event.data); this.node.find('input').val(event.data); - }; + }; */ this.ctx.mediator.on(this.config.endpoint, this.onMessage.bind(this)); } @@ -12016,9 +12014,9 @@ class LedStripPatternSwitch extends __WEBPACK_IMPORTED_MODULE_1__base_Switch_Swi constructor(ctx, node) { super(ctx, node); - this.store = new __WEBPACK_IMPORTED_MODULE_2__core_store_RestStore__["a" /* default */](this.config.endpoint); + //this.store = new RestStore(this.config.endpoint); - this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); + this.ws = this.ctx.ws; this.modes = ["init", "Color", "Pattern", "octoPrint"]; this.patterns = [ "none", "Rainbow", "Scanner", "ColorWipe", "TheaterChase"]; diff --git a/src/app/components/LedStripPatternSwitch.js b/src/app/components/LedStripPatternSwitch.js index a8429a4..519d9bc 100644 --- a/src/app/components/LedStripPatternSwitch.js +++ b/src/app/components/LedStripPatternSwitch.js @@ -6,9 +6,9 @@ export default class LedStripPatternSwitch extends Switch { constructor(ctx, node) { super(ctx, node); - this.store = new RestStore(this.config.endpoint); + //this.store = new RestStore(this.config.endpoint); - this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); + this.ws = this.ctx.ws; this.modes = ["init", "Color", "Pattern", "octoPrint"]; this.patterns = [ "none", "Rainbow", "Scanner", "ColorWipe", "TheaterChase"]; diff --git a/src/app/components/ParamColor.js b/src/app/components/ParamColor.js index bebf80f..7dc4d57 100644 --- a/src/app/components/ParamColor.js +++ b/src/app/components/ParamColor.js @@ -7,13 +7,13 @@ export default class ParamColor extends ColorPicker { constructor(ctx, node) { super(ctx, node); //this.store = new Store(this.config.endpoint); - this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); + /* this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); this.ws.onopen = (event) => { console.log('open ' + this.config.endpoint); }; this.ws.onmessage = (event) => { console.log(event.data); - }; + }; */ } onChange(evt) { @@ -22,7 +22,7 @@ export default class ParamColor extends ColorPicker { });*/ //let cmd = this.config.id + parseInt(this.value.replace('#', '0x')); console.log(parseInt(this.value.replace('#', '0x'))); - this.ws.send(JSON.stringify({ + this.ctx.ws.send(JSON.stringify({ mode: this.config.mode, value: parseInt(this.value.replace('#', '0x')) })); diff --git a/src/app/components/ParamWs.js b/src/app/components/ParamWs.js index e1078e6..9139208 100644 --- a/src/app/components/ParamWs.js +++ b/src/app/components/ParamWs.js @@ -8,14 +8,14 @@ export default class ParamWs extends TextInput { super(ctx, node); //this.store = new Store(this.config.endpoint); - this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); + /* this.ws = new WebSocket(this.config.endpoint.indexOf('/') === 0 ? "ws://" + window.location.host + this.config.endpoint : this.config.endpoint ); this.ws.onopen = (event) => { console.log('open ' + this.config.endpoint); }; this.ws.onmessage = (event) => { //console.log(event.data); this.node.find('input').val(event.data); - }; + }; */ this.ctx.mediator.on(this.config.endpoint, this.onMessage.bind(this)); } diff --git a/src/app/main.js b/src/app/main.js index 3f88263..3e0200a 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -6,10 +6,8 @@ import * as components from './components/exports'; $(() => { new App($('body')) - .components(components); - /* .websocket({ - led: new WebSocket('ws://ledstrip/') - }); */ + .components(components) + .websocket(new WebSocket('ws://192.168.1.246/pixel')); }); diff --git a/src/pages/index.html b/src/pages/index.html index 1e63752..959dfce 100644 --- a/src/pages/index.html +++ b/src/pages/index.html @@ -33,38 +33,33 @@
  • + data-label="Color">
  • + data-label="Color 2">
  • + data-label="Rainbow">
  • + data-mode="3">
  • + data-mode="3">