Created
September 24, 2019 19:31
-
-
Save jbis9051/f34bb56a32e84b246916a2ee0297427c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqlite.open(path.join('/', 'Users', 'joshuabrown3', 'Desktop', 'chat.db')).then(db => db.all('SELECT * FROM `chat`').then(chats => { | |
const promises = []; | |
const convos = chats.map(chat => { | |
const convo = new Conversation(chat, db); | |
promises.push(new Promise(resolve => { | |
convo.on("ready", resolve); | |
})); | |
convos.push(convo); | |
}); | |
Promise.all(promises).then(_ => { | |
mainWindow.chats = convos.filter(convo => convo.messages.length > 0).sort((a, b) => { | |
return b.messages[0].date - a.messages[0].date; | |
}); | |
mainWindow.loadFile(path.join(__dirname, 'src', 'render', 'index.html')).then(() => console.log("loaded")); | |
console.log("Done"); | |
}); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment