-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
78 lines (63 loc) · 1.44 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { NativeModules, Platform } from 'react-native';
const LINKING_ERROR =
`The package 'dashx-react-native' doesn't seem to be linked. Make sure: \n\n` +
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
'- You rebuilt the app after installing the package\n' +
'- You are not using Expo Go\n';
const DashX = NativeModules.DashXReactNative
? NativeModules.DashXReactNative
: new Proxy(
{},
{
get() {
throw new Error(LINKING_ERROR);
},
}
);
const {
configure,
identify,
setIdentity,
reset,
track,
screen,
fetchStoredPreferences,
saveStoredPreferences,
subscribe,
unsubscribe,
setLogLevel,
} = DashX;
DashX.configure = (options) => {
return configure(options);
}
DashX.identify = (options) => {
return identify(options);
};
DashX.setIdentity = (uid, token) => {
return setIdentity(uid, token);
};
DashX.reset = () => {
return reset();
}
DashX.track = (event, data) => {
return track(event, data || null);
}
DashX.screen = (screenName, data) => {
return screen(screenName, data || null)
}
DashX.fetchStoredPreferences = () => {
return fetchStoredPreferences();
};
DashX.saveStoredPreferences = (preferenceData) => {
return saveStoredPreferences(preferenceData);
};
DashX.subscribe = () => {
return subscribe();
}
DashX.unsubscribe = () => {
return unsubscribe();
}
DashX.setLogLevel = (level) => {
return setLogLevel(level);
}
export default DashX;