Extract deferredToPromise

This commit is contained in:
Daniel Gasienica 2018-03-26 15:30:51 -04:00
parent e2f1339ab9
commit c765422fa1
2 changed files with 5 additions and 5 deletions

View file

@ -0,0 +1,3 @@
exports.deferredToPromise = deferred =>
// eslint-disable-next-line more/no-then
new Promise((resolve, reject) => deferred.then(resolve, reject));

View file

@ -7,17 +7,14 @@
const Attachment = require('./js/modules/types/attachment');
const Attachments = require('./app/attachments');
const Message = require('./js/modules/types/message');
const { deferredToPromise } = require('./js/modules/deferred_to_promise');
const { app } = electron.remote;
window.PROTO_ROOT = 'protos';
window.config = require('url').parse(window.location.toString(), true).query;
window.wrapDeferred = function(deferred) {
return new Promise(function(resolve, reject) {
deferred.then(resolve, reject);
});
};
window.wrapDeferred = deferredToPromise;
const ipc = electron.ipcRenderer;
window.config.localeMessages = ipc.sendSync('locale-data');