import { h } from '../edel-elements.core.js';

class ContextComponent {
    constructor() {
        this.endpoint = '';
    }
    componentDidLoad() {
        this.checkForJwt();
        const context = {
            jwt: this.jwt,
            endpoint: this.endpoint
        };
        this.contextUpdated.emit(context);
    }
    checkForJwt() {
        if (localStorage.getItem('jwt'))
            this.jwt = localStorage.getItem('jwt');
    }
    static get is() { return "edel-context"; }
    static get properties() { return {
        "endpoint": {
            "type": String,
            "attr": "endpoint",
            "watchCallbacks": ["componentDidLoad"]
        },
        "jwt": {
            "type": String,
            "attr": "jwt",
            "watchCallbacks": ["componentDidLoad"]
        }
    }; }
    static get events() { return [{
            "name": "contextUpdated",
            "method": "contextUpdated",
            "bubbles": true,
            "cancelable": true,
            "composed": true
        }]; }
}

export { ContextComponent as EdelContext };
