Convert ext lib to typescript

This commit is contained in:
hensm
2019-02-27 16:46:09 +00:00
parent 7eaa97a556
commit 8cef999afb
6 changed files with 58 additions and 31 deletions

33
ext/src/lib/utils.ts Normal file
View File

@@ -0,0 +1,33 @@
"use strict";
export function getNextEllipsis (ellipsis: string): string {
/* tslint:disable:curly */
if (ellipsis === "") return ".";
if (ellipsis === ".") return "..";
if (ellipsis === "..") return "...";
if (ellipsis === "...") return "";
/* tslint:enable:curly */
}
interface WindowCenteredProps {
width: number;
height: number;
left: number;
top: number;
}
export function getWindowCenteredProps (
refWin: browser.windows.Window
, width: number
, height: number): WindowCenteredProps {
const centerX = refWin.left + (refWin.width / 2);
const centerY = refWin.top + (refWin.height / 3);
return {
width, height
, left: Math.floor(centerX - width / 2)
, top: Math.floor(centerY - height / 2)
};
}