License is set to that of the other files in the directory Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9922feb2a520a549ab9cc1d82a85417202ad83c3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
32 lines
927 B
JavaScript
32 lines
927 B
JavaScript
// Copyright (C) 2022 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
export function parseQuery() {
|
|
const trimmed = window.location.search.substring(1);
|
|
return new Map(
|
|
trimmed.length === 0 ?
|
|
[] :
|
|
trimmed.split('&').map(paramNameAndValue => {
|
|
const [name, value] = paramNameAndValue.split('=');
|
|
return [decodeURIComponent(name), value ? decodeURIComponent(value) : ''];
|
|
}));
|
|
}
|
|
|
|
export class EventSource {
|
|
#listeners = [];
|
|
|
|
constructor(receivePrivateInterface) {
|
|
receivePrivateInterface({
|
|
fireEvent: (arg0, arg1) => this.#fireEvent(arg0, arg1)
|
|
});
|
|
}
|
|
|
|
addEventListener(listener) {
|
|
this.#listeners.push(listener);
|
|
}
|
|
|
|
#fireEvent(arg0, arg1) {
|
|
this.#listeners.forEach(listener => listener(arg0, arg1));
|
|
}
|
|
}
|