Skip to content

Commit 6315907

Browse files
committed
Typescript stuff.
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 6fb9fc4 commit 6315907

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎src/@types/global.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ interface Window {
1818
Olm: {
1919
init: () => Promise<void>;
2020
};
21+
mxSendRageshake: (text: string, withLogs?: boolean) => void;
2122
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import request from 'browser-request';
1818

1919
// Load the config file. First try to load up a domain-specific config of the
2020
// form "config.$domain.json" and if that fails, fall back to config.json.
21-
export async function getVectorConfig(relativeLocation) {
22-
if (relativeLocation === undefined) relativeLocation = '';
21+
export async function getVectorConfig(relativeLocation: string='') {
2322
if (relativeLocation !== '' && !relativeLocation.endsWith('/')) relativeLocation += '/';
2423

2524
const specificConfigPromise = getConfig(`${relativeLocation}config.${document.domain}.json`);
@@ -37,7 +36,7 @@ export async function getVectorConfig(relativeLocation) {
3736
}
3837
}
3938

40-
function getConfig(configJsonFilename) {
39+
function getConfig(configJsonFilename: string): Promise<{}> {
4140
return new Promise(function(resolve, reject) {
4241
request(
4342
{ method: "GET", url: configJsonFilename, qs: { cachebuster: Date.now() } },

‎src/vector/init.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import * as languageHandler from 'matrix-react-sdk/src/languageHandler';
2626
import SettingsStore from "matrix-react-sdk/src/settings/SettingsStore";
2727

2828

29-
export function loadOlm() {
29+
export function loadOlm(): Promise<void> {
3030
/* Load Olm. We try the WebAssembly version first, and then the legacy,
3131
* asm.js version if that fails. For this reason we need to wait for this
3232
* to finish before continuing to load the rest of the app. In future
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function initRageshake() {
5050

5151
initRageshake();
5252

53-
global.mxSendRageshake = function(text, withLogs) {
53+
window.mxSendRageshake = function(text: string, withLogs?: boolean) {
5454
if (withLogs === undefined) withLogs = true;
5555
if (!text || !text.trim()) {
5656
console.error("Cannot send a rageshake without a message - please tell us what went wrong");

‎src/vector/url_utils.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import * as qs from 'querystring';
2020
// so we're re-using query string like format
2121
//
2222
// returns {location, params}
23-
export function parseQsFromFragment(location) {
23+
export function parseQsFromFragment(location: Location) {
2424
// if we have a fragment, it will start with '#', which we need to drop.
2525
// (if we don't, this will return '').
2626
const fragment = location.hash.substring(1);
@@ -41,6 +41,6 @@ export function parseQsFromFragment(location) {
4141
return result;
4242
}
4343

44-
export function parseQs(location) {
44+
export function parseQs(location: Location) {
4545
return qs.parse(location.search.substring(1));
4646
}

0 commit comments

Comments
 (0)