mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
[react-native-mixpanel] Added typings
This commit is contained in:
25
types/react-native-mixpanel/index.d.ts
vendored
Normal file
25
types/react-native-mixpanel/index.d.ts
vendored
Normal 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;
|
||||
22
types/react-native-mixpanel/react-native-mixpanel-tests.ts
Normal file
22
types/react-native-mixpanel/react-native-mixpanel-tests.ts
Normal 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));
|
||||
23
types/react-native-mixpanel/tsconfig.json
Normal file
23
types/react-native-mixpanel/tsconfig.json
Normal 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
types/react-native-mixpanel/tslint.json
Normal file
1
types/react-native-mixpanel/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user