Extract deferredToPromise
This commit is contained in:
parent
e2f1339ab9
commit
c765422fa1
2 changed files with 5 additions and 5 deletions
3
js/modules/deferred_to_promise.js
Normal file
3
js/modules/deferred_to_promise.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
exports.deferredToPromise = deferred =>
|
||||
// eslint-disable-next-line more/no-then
|
||||
new Promise((resolve, reject) => deferred.then(resolve, reject));
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue