Some changes.
This commit is contained in:
parent
8b212187d1
commit
0072e6d86e
@ -20,7 +20,6 @@ const allEvents = [
|
||||
'dragenter', 'dragleave', 'touchstart', 'touchmove', 'touchend',
|
||||
'touchcancel', 'pointerdown', 'pointerup', 'pointermove', 'pointerover',
|
||||
'pointerout', 'pointerenter', 'pointerleave', 'wheel'/*'scroll',*/
|
||||
// Add more as needed
|
||||
];
|
||||
const props = [
|
||||
'data',
|
||||
@ -104,20 +103,15 @@ const callback = (mutationList, observer) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
// Create an observer instance linked to the callback function
|
||||
const observer = new MutationObserver(callback);
|
||||
|
||||
// Start observing the target node for configured mutations
|
||||
observer.observe(rWebGui, config);
|
||||
|
||||
// Later, you can stop observing
|
||||
//observer.disconnect();
|
||||
|
||||
}
|
||||
|
||||
|
||||
class MyCustomElement extends HTMLElement {
|
||||
static observedAttributes = ["color", "size"];
|
||||
class RWebGuiApp extends HTMLElement {
|
||||
_ready = false
|
||||
_uuid = null
|
||||
ws = null
|
||||
@ -138,7 +132,7 @@ class MyCustomElement extends HTMLElement {
|
||||
// Always call super first in constructor
|
||||
super();
|
||||
if(!this.parent || !this.parent.app){
|
||||
this.ws = new WebSocket(`ws://${window.location.host}/ws/${this.uuid}`)
|
||||
this.ws = new WebSocket(`wss://${window.location.host}/ws/${this.uuid}`)
|
||||
const me = this
|
||||
this.ws.onopen = ()=>{
|
||||
me.connected = true;
|
||||
@ -252,7 +246,6 @@ class MyCustomElement extends HTMLElement {
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
console.log("Custom element added to page.");
|
||||
|
||||
|
||||
this.rWebGui()
|
||||
@ -270,25 +263,15 @@ class MyCustomElement extends HTMLElement {
|
||||
this._ready = true
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
console.log("Custom element removed from page.");
|
||||
}
|
||||
|
||||
adoptedCallback() {
|
||||
console.log("Custom element moved to new page.");
|
||||
}
|
||||
|
||||
attributeChangedCallback(name, oldValue, newValue) {
|
||||
this.emit("attributeChanged", {aa:123})
|
||||
console.log(`Attribute ${name} has changed.`);
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("rwebgui-app", MyCustomElement);
|
||||
customElements.define("rwebgui-app",RWebGuiApp);
|
||||
|
||||
/*
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
console.log("DOM fully loaded and parsed");
|
||||
document.querySelectorAll("*").forEach(child => {
|
||||
child.rWebGui()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user