Merge pull request #21587 from r3nya/react-native-mixpanel

[react-native-mixpanel] Added typings
This commit is contained in:
Nathan Shively-Sanders
2017-11-17 15:09:47 -08:00
committed by GitHub
4 changed files with 71 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for react-native-mixpanel 0.1
// Project: https://github.com/davodesign84/react-native-mixpanel#readme
// Definitions by: Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export function sharedInstanceWithToken(token: string): void;
export function track(event: string): void;
export function trackWithProperties(event: string, property: object): void;
export function createAlias(id: string): void;
export function identify(id: string): void;
export function set(property: object): void;
export function setOnce(property: object): void;
export function timeEvent(event: string): void;
export function registerSuperProperties(property: object): void;
export function registerSuperPropertiesOnce(property: object): void;
export function trackCharge(id: number): void;
export function trackChargeWithProperties(id: number, property: object): void;
export function increment(property: string, value: number): void;
export function setPushRegistrationId(token: string): void;
export function initPushHandling(token: string): void;
export function clearPushRegistrationId(): void;
export function addPushDeviceToken(token: string): void;
export function reset(): void;
export function getDistinctId(handler: (id: string) => void): void;
@@ -0,0 +1,22 @@
import * as Mixpanel from 'react-native-mixpanel';
Mixpanel.sharedInstanceWithToken('1234567890');
Mixpanel.track('Event name');
Mixpanel.trackWithProperties('Click Button', { button_type: 'yellow button', button_text: 'magic button' });
Mixpanel.createAlias('123456');
Mixpanel.identify('123456');
Mixpanel.set({ $email: 'elvis@email.com' });
Mixpanel.setOnce({ $email: 'elvis@email.com', Created: new Date().toISOString() });
Mixpanel.timeEvent('Image Upload');
Mixpanel.track('Image Upload');
Mixpanel.registerSuperProperties({ 'Account type': 'Free', 'User Type': 'Vendor' });
Mixpanel.registerSuperPropertiesOnce({ Gender: 'Female' });
Mixpanel.trackCharge(399);
Mixpanel.trackChargeWithProperties(399, { product: 'ACME Wearable tech' });
Mixpanel.increment("Login Count", 1);
Mixpanel.setPushRegistrationId('1234567890abc');
Mixpanel.initPushHandling('123456666');
Mixpanel.clearPushRegistrationId();
Mixpanel.addPushDeviceToken('1234567890abc');
Mixpanel.reset();
Mixpanel.getDistinctId((id) => (id));
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"react-native-mixpanel-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }