mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-03 13:33:18 +00:00
typescript: Migrate common-util to typescript.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
let instance = null;
|
let instance: null | CommonUtil = null;
|
||||||
|
|
||||||
class CommonUtil {
|
class CommonUtil {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -13,13 +13,13 @@ class CommonUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unescape already encoded/escaped strings
|
// unescape already encoded/escaped strings
|
||||||
decodeString(string) {
|
decodeString(stringInput: string): string {
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const dom = parser.parseFromString(
|
const dom = parser.parseFromString(
|
||||||
'<!doctype html><body>' + string,
|
'<!doctype html><body>' + stringInput,
|
||||||
'text/html');
|
'text/html');
|
||||||
return dom.body.textContent;
|
return dom.body.textContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = new CommonUtil();
|
export = new CommonUtil();
|
||||||
Reference in New Issue
Block a user