[react-native-mixpanel] Added typings

This commit is contained in:
Andrew Makarov
2017-11-17 01:12:18 +03:00
parent 17f759f936
commit 628b7ee0eb
4 changed files with 71 additions and 0 deletions

25
types/react-native-mixpanel/index.d.ts vendored Normal file
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: My Self <https://github.com/me>
// 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;

View File

@@ -0,0 +1,22 @@
import Mixpanel = require('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));

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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }