mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-06 08:08:10 +08:00
perf(outbox): Only trigger when send draft tasks are present
This commit is contained in:
parent
bbc4b792c9
commit
835e7fe9c8
4 changed files with 10 additions and 5 deletions
|
@ -24,6 +24,6 @@ class FeedbackButton extends React.Component
|
|||
|
||||
_onSendFeedback: =>
|
||||
return if NylasEnv.inSpecMode()
|
||||
require('electron').shell.openExternal('http://support.nylas.com/')
|
||||
require('electron').shell.openExternal('https://nylas.zendesk.com/hc/en-us/sections/203638587-N1')
|
||||
|
||||
module.exports = FeedbackButton
|
||||
|
|
|
@ -114,8 +114,8 @@ class ActionBridge
|
|||
# Electron won't actually send the message. To work around this, we wait an
|
||||
# arbitrary amount of time before closing the window after the last IPC event
|
||||
# was sent. https://github.com/atom/electron/issues/4366
|
||||
if @ipcLastSendTime and Date.now() - @ipcLastSendTime < 100
|
||||
setTimeout(readyToUnload, 100)
|
||||
if @ipcLastSendTime and Date.now() - @ipcLastSendTime < 50
|
||||
setTimeout(readyToUnload, 50)
|
||||
return false
|
||||
return true
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ module.exports =
|
|||
setupEmitter: ->
|
||||
return if @_emitter
|
||||
@_emitter ?= new EventEmitter()
|
||||
@_emitter.setMaxListeners(20)
|
||||
@_emitter.setMaxListeners(50)
|
||||
|
||||
listen: (callback, bindContext) ->
|
||||
if not callback
|
||||
|
|
|
@ -7,14 +7,19 @@ class OutboxStore extends NylasStore {
|
|||
|
||||
constructor() {
|
||||
super();
|
||||
this._tasks = [];
|
||||
this.listenTo(TaskQueueStatusStore, this._populate);
|
||||
this._populate();
|
||||
}
|
||||
|
||||
_populate() {
|
||||
this._tasks = TaskQueueStatusStore.queue().filter((task)=> {
|
||||
const nextTasks = TaskQueueStatusStore.queue().filter((task)=> {
|
||||
return task instanceof SendDraftTask;
|
||||
});
|
||||
if ((this._tasks.length === 0) && (nextTasks.length === 0)) {
|
||||
return;
|
||||
}
|
||||
this._tasks = nextTasks;
|
||||
this.trigger();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue