mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Typescript stuff.
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
6fb9fc4e6f
commit
6315907585
1
src/@types/global.d.ts
vendored
1
src/@types/global.d.ts
vendored
@ -18,4 +18,5 @@ interface Window {
|
||||
Olm: {
|
||||
init: () => Promise<void>;
|
||||
};
|
||||
mxSendRageshake: (text: string, withLogs?: boolean) => void;
|
||||
}
|
||||
|
@ -18,8 +18,7 @@ import request from 'browser-request';
|
||||
|
||||
// Load the config file. First try to load up a domain-specific config of the
|
||||
// form "config.$domain.json" and if that fails, fall back to config.json.
|
||||
export async function getVectorConfig(relativeLocation) {
|
||||
if (relativeLocation === undefined) relativeLocation = '';
|
||||
export async function getVectorConfig(relativeLocation: string='') {
|
||||
if (relativeLocation !== '' && !relativeLocation.endsWith('/')) relativeLocation += '/';
|
||||
|
||||
const specificConfigPromise = getConfig(`${relativeLocation}config.${document.domain}.json`);
|
||||
@ -37,7 +36,7 @@ export async function getVectorConfig(relativeLocation) {
|
||||
}
|
||||
}
|
||||
|
||||
function getConfig(configJsonFilename) {
|
||||
function getConfig(configJsonFilename: string): Promise<{}> {
|
||||
return new Promise(function(resolve, reject) {
|
||||
request(
|
||||
{ method: "GET", url: configJsonFilename, qs: { cachebuster: Date.now() } },
|
@ -26,7 +26,7 @@ import * as languageHandler from 'matrix-react-sdk/src/languageHandler';
|
||||
import SettingsStore from "matrix-react-sdk/src/settings/SettingsStore";
|
||||
|
||||
|
||||
export function loadOlm() {
|
||||
export function loadOlm(): Promise<void> {
|
||||
/* Load Olm. We try the WebAssembly version first, and then the legacy,
|
||||
* asm.js version if that fails. For this reason we need to wait for this
|
||||
* to finish before continuing to load the rest of the app. In future
|
||||
|
@ -50,7 +50,7 @@ function initRageshake() {
|
||||
|
||||
initRageshake();
|
||||
|
||||
global.mxSendRageshake = function(text, withLogs) {
|
||||
window.mxSendRageshake = function(text: string, withLogs?: boolean) {
|
||||
if (withLogs === undefined) withLogs = true;
|
||||
if (!text || !text.trim()) {
|
||||
console.error("Cannot send a rageshake without a message - please tell us what went wrong");
|
@ -20,7 +20,7 @@ import * as qs from 'querystring';
|
||||
// so we're re-using query string like format
|
||||
//
|
||||
// returns {location, params}
|
||||
export function parseQsFromFragment(location) {
|
||||
export function parseQsFromFragment(location: Location) {
|
||||
// if we have a fragment, it will start with '#', which we need to drop.
|
||||
// (if we don't, this will return '').
|
||||
const fragment = location.hash.substring(1);
|
||||
@ -41,6 +41,6 @@ export function parseQsFromFragment(location) {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function parseQs(location) {
|
||||
export function parseQs(location: Location) {
|
||||
return qs.parse(location.search.substring(1));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user