mirror of
https://gitlab.com/wirelos/sprocket-ui.git
synced 2025-12-14 22:02:24 +01:00
use global websocket
This commit is contained in:
@@ -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"];
|
||||
|
||||
Reference in New Issue
Block a user