typescript: Migrate index.js to typescript.

This commit is contained in:
Priyank Patel
2019-06-22 09:25:38 -04:00
committed by Akash Nimare
parent 1182af23e4
commit 2b19cdecf2
2 changed files with 11 additions and 11 deletions

View File

@@ -1,12 +1,12 @@
'use strict';
const {
remote: { app }
} = require('electron');
import { remote } from 'electron';
const params = require('../utils/params-util.js');
const DefaultNotification = require('./default-notification');
const { appId, loadBots } = require('./helpers');
import * as params from '../utils/params-util';
import DefaultNotification from './default-notification';
import { appId, loadBots } from './helpers';
const { app } = remote;
// From https://github.com/felixrieseberg/electron-windows-notifications#appusermodelid
// On windows 8 we have to explicitly set the appUserModelId otherwise notification won't work.
@@ -15,12 +15,11 @@ app.setAppUserModelId(appId);
window.Notification = DefaultNotification;
if (process.platform === 'darwin') {
const DarwinNotification = require('./darwin-notifications');
window.Notification = DarwinNotification;
window.Notification = require('./darwin-notifications');
}
window.addEventListener('load', () => {
// eslint-disable-next-line no-undef, camelcase
// eslint-disable-next-line no-undef, @typescript-eslint/camelcase
if (params.isPageParams() && page_params.realm_uri) {
loadBots();
}

5
typings.d.ts vendored
View File

@@ -4,7 +4,7 @@
// are not supported
declare module '*';
declare var page_params: object;
declare var page_params: any;
// since requestIdleCallback didn't make it into lib.dom.d.ts yet
declare function requestIdleCallback(callback: Function, options?: object): void;
@@ -12,5 +12,6 @@ declare function requestIdleCallback(callback: Function, options?: object): void
// This is mostly zulip side of code we access from window
interface Window {
$: any;
narrow: any;
narrow: any
Notification: typeof Notification;
}