INNER CODE UNIT · JavaScript
ChatfaqWidgetCustomElement
ChatFAQ/ChatFAQ · widget/components/index.js:34
class ChatfaqWidgetCustomElement extends HTMLElement {
static get observedAttributes() {
return ['data-split-screen-iframe']; // Add any other attributes you want to observe
}
connectedCallback() {
this.app = _buildApp(this.dataset);
this.app.mount(this)
}
attributeChangedCallback(name, oldValue, newValue) {
if (!this.app) return; // Guard if app isn't mounted yet
// Convert the attribute name to a prop name (remove 'data-' prefix and convert to camelCase)
const propName = name.replace('data-', '')
.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
// Update the prop in the Vue app