Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: migrate platform.js to typescript (#2163)

Abdulrehman-Jafer966bedbb49f3
diff --git a/apps/web/src/global.d.ts b/apps/web/src/global.d.ts
index 15fb1e490..fb14fddbd 100644
--- a/apps/web/src/global.d.ts
+++ b/apps/web/src/global.d.ts
@@ -32,6 +32,7 @@ type DesktopIntegrationSettings = {
};
declare interface Window {
+ os: typeof process.platform & "mas";
config: {
static spellChecker(): Promise<SpellCheckerOptions>;
static desktopIntegration(): Promise<DesktopIntegrationSettings>;
diff --git a/apps/web/src/utils/platform.js b/apps/web/src/utils/platform.ts
similarity index 97%
rename from apps/web/src/utils/platform.js
rename to apps/web/src/utils/platform.ts
index 670acc920..0007acc15 100644
--- a/apps/web/src/utils/platform.js
+++ b/apps/web/src/utils/platform.ts
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
export function getPlatform() {
if (window.os) return window.os;
- var userAgent = window.navigator.userAgent,
+ const userAgent = window.navigator.userAgent,
platform = window.navigator.platform,
macosPlatforms = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"],
windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"],
@@ -42,7 +42,7 @@ export function getPlatform() {
return os;
}
-export function getDownloadLink(platform) {
+export function getDownloadLink(platform: string) {
const baseurl = `https://notesnook.com/releases/${platform.toLowerCase()}`;
switch (platform) {
case "iOS":