mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 12:28:50 +03:00
Remove the other listener when one fires
This commit is contained in:
parent
835d7bfb9d
commit
6464bfe850
1 changed files with 14 additions and 4 deletions
|
@ -33,7 +33,11 @@ async function migrateFromOldOrigin() {
|
||||||
webgl: false,
|
webgl: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
ipcMain.once('origin_migration_complete', (e, success, sentSummary, storedSummary) => {
|
const onOriginMigrationComplete = (e, success, sentSummary, storedSummary) => {
|
||||||
|
// we use once but we'll only get once of these events,
|
||||||
|
// so remove the listener for the other one
|
||||||
|
ipcMain.removeListener('origin_migration_nodata', onOriginMigrationNoData);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
console.log("Origin migration completed successfully!");
|
console.log("Origin migration completed successfully!");
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,12 +47,18 @@ async function migrateFromOldOrigin() {
|
||||||
console.error("Data stored", storedSummary);
|
console.error("Data stored", storedSummary);
|
||||||
migrateWindow.close();
|
migrateWindow.close();
|
||||||
resolve();
|
resolve();
|
||||||
});
|
};
|
||||||
ipcMain.once('origin_migration_nodata', (e) => {
|
const onOriginMigrationNoData = (e, success, sentSummary, storedSummary) => {
|
||||||
|
ipcMain.removeListener('origin_migration_complete', onOriginMigrationComplete);
|
||||||
|
|
||||||
console.log("No session to migrate from old origin");
|
console.log("No session to migrate from old origin");
|
||||||
migrateWindow.close();
|
migrateWindow.close();
|
||||||
resolve();
|
resolve();
|
||||||
});
|
};
|
||||||
|
|
||||||
|
ipcMain.once('origin_migration_complete', onOriginMigrationComplete);
|
||||||
|
ipcMain.once('origin_migration_nodata', onOriginMigrationNoData);
|
||||||
|
|
||||||
// Normalise the path because in the distribution, __dirname will be inside the
|
// Normalise the path because in the distribution, __dirname will be inside the
|
||||||
// electron asar.
|
// electron asar.
|
||||||
const sourcePagePath = path.normalize(__dirname + '/../../origin_migrator/source.html');
|
const sourcePagePath = path.normalize(__dirname + '/../../origin_migrator/source.html');
|
||||||
|
|
Loading…
Reference in a new issue