mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 15:56:10 +08:00
[client-app] Convert nylas-env.coffee to ES6 😓
Test Plan: unit tests + run the app Reviewers: juan, halla, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3979
This commit is contained in:
parent
15bcf974d2
commit
776cf26d7a
File diff suppressed because it is too large
Load diff
1225
packages/client-app/src/nylas-env.es6
Normal file
1225
packages/client-app/src/nylas-env.es6
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,19 +0,0 @@
|
|||
# Swap out Node's native Promise for Bluebird, which allows us to
|
||||
# do fancy things like handle exceptions inside promise blocks
|
||||
global.Promise = require 'bluebird'
|
||||
Promise.setScheduler(global.setImmediate)
|
||||
|
||||
# Like sands through the hourglass, so are the days of our lives.
|
||||
require './window'
|
||||
|
||||
NylasEnvConstructor = require './nylas-env'
|
||||
window.NylasEnv = window.atom = NylasEnvConstructor.loadOrCreate()
|
||||
NylasEnv.initialize()
|
||||
NylasEnv.startRootWindow()
|
||||
|
||||
|
||||
# Workaround for focus getting cleared upon window creation
|
||||
windowFocused = ->
|
||||
window.removeEventListener('focus', windowFocused)
|
||||
setTimeout (-> document.getElementById('sheet-container')?.focus()), 0
|
||||
window.addEventListener('focus', windowFocused)
|
25
packages/client-app/src/window-bootstrap.es6
Normal file
25
packages/client-app/src/window-bootstrap.es6
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* eslint import/first: 0 */
|
||||
|
||||
// Swap out Node's native Promise for Bluebird, which allows us to
|
||||
// do fancy things like handle exceptions inside promise blocks
|
||||
global.Promise = require('bluebird');
|
||||
Promise.setScheduler(global.setImmediate);
|
||||
|
||||
// Like sands through the hourglass, so are the days of our lives.
|
||||
import './window';
|
||||
|
||||
import NylasEnvConstructor from './nylas-env';
|
||||
window.NylasEnv = NylasEnvConstructor.loadOrCreate();
|
||||
NylasEnv.initialize();
|
||||
NylasEnv.startRootWindow();
|
||||
|
||||
|
||||
// Workaround for focus getting cleared upon window creation
|
||||
const windowFocused = () => {
|
||||
window.removeEventListener('focus', windowFocused);
|
||||
return setTimeout((() => {
|
||||
const elt = document.getElementById('sheet-container');
|
||||
if (elt) elt.focus();
|
||||
}), 0);
|
||||
}
|
||||
window.addEventListener('focus', windowFocused);
|
Loading…
Reference in a new issue