mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-05-04 20:11:33 +08:00
[internals] Start refactoring some of the internals to simplify, tidy up and also reduce flow type pollution
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
* @flow
|
||||
* Database Transaction representation wrapper
|
||||
*/
|
||||
import { getAppEventName, SharedEventEmitter } from '../../utils/events';
|
||||
import { getLogger } from '../../utils/log';
|
||||
import type Database from './';
|
||||
|
||||
let transactionId = 0;
|
||||
@@ -18,8 +20,8 @@ export default class TransactionHandler {
|
||||
this._transactions = {};
|
||||
this._database = database;
|
||||
|
||||
this._transactionListener = this._database.addListener(
|
||||
this._database._getAppEventName('database_transaction_event'),
|
||||
this._transactionListener = SharedEventEmitter.addListener(
|
||||
getAppEventName(this._database, 'database_transaction_event'),
|
||||
this._handleTransactionEvent.bind(this),
|
||||
);
|
||||
}
|
||||
@@ -75,7 +77,7 @@ export default class TransactionHandler {
|
||||
case 'complete':
|
||||
return this._handleComplete(event);
|
||||
default:
|
||||
this.log.warn(`Unknown transaction event type: '${event.type}'`, event);
|
||||
getLogger(this._database).warn(`Unknown transaction event type: '${event.type}'`, event);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user