Replace calls to sync.cleanup with sync.removealllisteners (#1066)

This commit is contained in:
Kristian Dupont 2017-06-14 12:54:47 +02:00 committed by GitHub
parent 523c1ec772
commit af72770094
1 changed files with 4 additions and 5 deletions

View File

@ -78,15 +78,14 @@ module.exports = function(realmConstructor) {
realmConstructor.Sync.AuthError = require('./errors').AuthError; realmConstructor.Sync.AuthError = require('./errors').AuthError;
if (realmConstructor.Sync.cleanup) { if (realmConstructor.Sync.removeAllListeners) {
// FIXME: DOES THIS WORK ON BOTH NODE AND REACT NATIVE? process.on('exit', realmConstructor.Sync.removeAllListeners);
process.on('exit', realmConstructor.Sync.cleanup);
process.on('SIGINT', function () { process.on('SIGINT', function () {
realmConstructor.Sync.cleanup(); realmConstructor.Sync.removeAllListeners();
process.exit(2); process.exit(2);
}); });
process.on('uncaughtException', function(e) { process.on('uncaughtException', function(e) {
realmConstructor.Sync.cleanup(); realmConstructor.Sync.removeAllListeners();
/* eslint-disable no-console */ /* eslint-disable no-console */
console.log(e.stack); console.log(e.stack);
process.exit(99); process.exit(99);