# Source: editor/XMLEditorEvent.js

    /**
     * The base class of all {@link XMLEditor} events.
     */
    export class XMLEditorEvent {
        /**
         * Event constructor.
         */
        constructor(xmlEditor, data, type) {
            if (data) {
                for (const key in data) {
                    this["_" + key] = data[key];
                }
            }

            this._xmlEditor = xmlEditor;
            this._type = type;
        }

        /**
         * Get the <code>xmlEditor</code> property of this event:
         * the {@link XMLEditor} at the source of this event.
         *
         * @type {XMLEditor}
         */
        get xmlEditor() {
            return this._xmlEditor;
        }

        /**
         * Get the <code>type</code> property of this event:
         * the name of this event (examples: "connected", "documentSaved",
         * "readOnlyStateChanged", etc).
         *
         * @type {string}
         */
        get type() {
            return this._type;
        }

        toString() {
            return this._type.charAt(0).toUpperCase() + this._type.substring(1) +
                "Event" +
                JSON.stringify(this,
                               (key, value) => (key === "_xmlEditor" ||
                                                key === "_type")? undefined : value,
                               4);
        }
    }