mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-23 03:31:56 +00:00
typescript: Do final cleanup of issues.
Using `import * as` import syntax causes some problem if the module exports a class or function. Because the whole point of star import is to import every property the module exports. It turns out we have been using it incorrectly in many places which this commit fixes. Then we fix a linting error by adding a eslint disable rule to solve it along with a TODO because the way we currently do it is wrong. Finally, to conclude this cleanup, we merge all the .gitignore paths into once now that we can.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import path from 'path';
|
||||
import { ipcRenderer, remote, WebviewTag, NativeImage } from 'electron';
|
||||
|
||||
import path = require('path');
|
||||
import ConfigUtil = require('./utils/config-util.js');
|
||||
const { Tray, Menu, nativeImage, BrowserWindow } = remote;
|
||||
|
||||
@@ -97,6 +97,11 @@ const renderNativeImage = function (arg: number): Promise<NativeImage> {
|
||||
.then(() => renderCanvas(arg))
|
||||
.then(canvas => {
|
||||
const pngData = nativeImage.createFromDataURL(canvas.toDataURL('image/png')).toPNG();
|
||||
|
||||
// TODO: Fix the function to correctly use Promise correctly.
|
||||
// the Promise.resolve().then(...) above is useless we should
|
||||
// start with renderCanvas(arg).then
|
||||
// eslint-disable-next-line promise/no-return-wrap
|
||||
return Promise.resolve(nativeImage.createFromBuffer(pngData, {
|
||||
scaleFactor: config.pixelRatio
|
||||
}));
|
||||
|
Reference in New Issue
Block a user