react-native-appmetrica/index.js

42 lines
990 B
JavaScript
Raw Normal View History

2017-09-30 15:41:58 +03:00
// @flow
2017-09-18 10:04:19 +03:00
import { NativeModules } from 'react-native';
const { AppMetrica } = NativeModules;
export default {
/**
* Starts the statistics collection process.
* @param {string} apiKey
*/
2017-09-30 15:41:58 +03:00
activateWithApiKey(apiKey: string) {
2017-09-18 10:04:19 +03:00
AppMetrica.activateWithApiKey(apiKey);
},
/**
* Sends a custom event message and additional parameters (optional).
* @param {string} message
* @param {object} [params=null]
*/
2017-09-30 15:41:58 +03:00
reportEvent(message: string, params: ?Object = null) {
2017-09-18 10:04:19 +03:00
AppMetrica.reportEvent(message, params);
},
2017-09-28 15:06:30 +03:00
/**
* Sends error with reason.
* @param {string} error
* @param {object} reason
*/
2017-09-30 15:41:58 +03:00
reportError(error: string, reason: Object) {
2017-09-28 15:06:30 +03:00
AppMetrica.reportError(error, reason);
},
2018-06-01 18:38:01 +03:00
/**
* Sets the ID of the user profile.
* @param {string} userProfileId
*/
setUserProfileID(userProfileId: string) {
AppMetrica.setUserProfileID(userProfileId);
},
2017-09-18 10:04:19 +03:00
};