[flow] fixed flow errors in ModuleBase
This commit is contained in:
parent
1e4968d9c7
commit
3f681ac065
|
@ -2,10 +2,12 @@
|
||||||
* @flow
|
* @flow
|
||||||
*/
|
*/
|
||||||
import { NativeModules } from 'react-native';
|
import { NativeModules } from 'react-native';
|
||||||
|
|
||||||
import Log from '../utils/log';
|
import Log from '../utils/log';
|
||||||
import { nativeWithApp } from './../utils';
|
|
||||||
import INTERNALS from './../internals';
|
import INTERNALS from './../internals';
|
||||||
import FirebaseCore from './../firebase';
|
import FirebaseCore from './../firebase';
|
||||||
|
import FirebaseApp from '../firebase-app';
|
||||||
|
import { nativeWithApp } from './../utils';
|
||||||
|
|
||||||
const logs = {};
|
const logs = {};
|
||||||
|
|
||||||
|
@ -37,14 +39,23 @@ const DEFAULTS = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class ModuleBase {
|
export default class ModuleBase {
|
||||||
|
_native: Object;
|
||||||
|
_module: string;
|
||||||
|
_options: Object;
|
||||||
|
_appName: string;
|
||||||
|
_namespace: string;
|
||||||
|
_firebaseApp: Object;
|
||||||
|
_eventEmitter: Object;
|
||||||
|
static _NAMESPACE: string;
|
||||||
|
static _NATIVE_MODULE: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param firebaseApp
|
* @param firebaseApp
|
||||||
* @param options
|
* @param options
|
||||||
* @param moduleName
|
|
||||||
* @param withEventEmitter
|
* @param withEventEmitter
|
||||||
*/
|
*/
|
||||||
constructor(firebaseApp, options, withEventEmitter = false) {
|
constructor(firebaseApp: Object, options: Object, withEventEmitter: boolean = false) {
|
||||||
this._module = this.constructor._NATIVE_MODULE.replace('RNFirebase', '');
|
this._module = this.constructor._NATIVE_MODULE.replace('RNFirebase', '');
|
||||||
this._firebaseApp = firebaseApp;
|
this._firebaseApp = firebaseApp;
|
||||||
this._appName = firebaseApp._name;
|
this._appName = firebaseApp._name;
|
||||||
|
@ -108,7 +119,7 @@ export default class ModuleBase {
|
||||||
* Returns the FirebaseApp instance for current module
|
* Returns the FirebaseApp instance for current module
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
get app() {
|
get app(): FirebaseApp {
|
||||||
return this._firebaseApp;
|
return this._firebaseApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,27 +134,27 @@ export default class ModuleBase {
|
||||||
* Proxy functions to shared event emitter instance
|
* Proxy functions to shared event emitter instance
|
||||||
* https://github.com/facebook/react-native/blob/master/Libraries/EventEmitter/EventEmitter.js
|
* https://github.com/facebook/react-native/blob/master/Libraries/EventEmitter/EventEmitter.js
|
||||||
*/
|
*/
|
||||||
get sharedEventEmitter() {
|
get sharedEventEmitter(): Object {
|
||||||
return INTERNALS.SharedEventEmitter;
|
return INTERNALS.SharedEventEmitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
get addListener() {
|
get addListener(): Function {
|
||||||
return INTERNALS.SharedEventEmitter.addListener.bind(INTERNALS.SharedEventEmitter);
|
return INTERNALS.SharedEventEmitter.addListener.bind(INTERNALS.SharedEventEmitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
get once() {
|
get once(): Function {
|
||||||
return INTERNALS.SharedEventEmitter.once.bind(INTERNALS.SharedEventEmitter);
|
return INTERNALS.SharedEventEmitter.once.bind(INTERNALS.SharedEventEmitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
get on() {
|
get on(): Function {
|
||||||
return INTERNALS.SharedEventEmitter.addListener.bind(INTERNALS.SharedEventEmitter);
|
return INTERNALS.SharedEventEmitter.addListener.bind(INTERNALS.SharedEventEmitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
get emit() {
|
get emit(): Function {
|
||||||
return INTERNALS.SharedEventEmitter.emit.bind(INTERNALS.SharedEventEmitter);
|
return INTERNALS.SharedEventEmitter.emit.bind(INTERNALS.SharedEventEmitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
get listeners() {
|
get listeners(): Function {
|
||||||
return INTERNALS.SharedEventEmitter.listeners.bind(INTERNALS.SharedEventEmitter);
|
return INTERNALS.SharedEventEmitter.listeners.bind(INTERNALS.SharedEventEmitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,11 +163,11 @@ export default class ModuleBase {
|
||||||
return subscriptions && subscriptions.length;
|
return subscriptions && subscriptions.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
get removeListener() {
|
get removeListener(): Function {
|
||||||
return INTERNALS.SharedEventEmitter.removeListener.bind(INTERNALS.SharedEventEmitter);
|
return INTERNALS.SharedEventEmitter.removeListener.bind(INTERNALS.SharedEventEmitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
get removeAllListeners() {
|
get removeAllListeners(): Function {
|
||||||
return INTERNALS.SharedEventEmitter.removeAllListeners.bind(INTERNALS.SharedEventEmitter);
|
return INTERNALS.SharedEventEmitter.removeAllListeners.bind(INTERNALS.SharedEventEmitter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue