INNER CODE UNIT · JavaScript

observedAttributes

ChatFAQ/ChatFAQ · widget/components/index.js:35

    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
        window.testApp = this.app;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…