|
@@ -10,6 +10,13 @@ import _ from 'lodash';
|
10
|
10
|
|
11
|
11
|
const _allNavigatorEventHandlers = {};
|
12
|
12
|
|
|
13
|
+const throttledPlatformSpecificFunctions = {
|
|
14
|
+ push: _.throttle(platformSpecific.navigatorPush, 500, {leading: true, trailing: false}),
|
|
15
|
+ pop: _.throttle(platformSpecific.navigatorPop, 500, {leading: true, trailing: false}),
|
|
16
|
+ popToRoot: _.throttle(platformSpecific.navigatorPopToRoot, 500, {leading: true, trailing: false}),
|
|
17
|
+ resetTo: _.throttle(platformSpecific.navigatorResetTo, 500, {leading: true, trailing: false})
|
|
18
|
+};
|
|
19
|
+
|
13
|
20
|
class Navigator {
|
14
|
21
|
constructor(navigatorID, navigatorEventID, screenInstanceID) {
|
15
|
22
|
this.navigatorID = navigatorID;
|
|
@@ -20,19 +27,19 @@ class Navigator {
|
20
|
27
|
}
|
21
|
28
|
|
22
|
29
|
push(params = {}) {
|
23
|
|
- return platformSpecific.navigatorPush(this, params);
|
|
30
|
+ return throttledPlatformSpecificFunctions.push(this, params);
|
24
|
31
|
}
|
25
|
32
|
|
26
|
33
|
pop(params = {}) {
|
27
|
|
- return platformSpecific.navigatorPop(this, params);
|
|
34
|
+ return throttledPlatformSpecificFunctions.pop(this, params);
|
28
|
35
|
}
|
29
|
36
|
|
30
|
37
|
popToRoot(params = {}) {
|
31
|
|
- return platformSpecific.navigatorPopToRoot(this, params);
|
|
38
|
+ return throttledPlatformSpecificFunctions.popToRoot(this, params);
|
32
|
39
|
}
|
33
|
40
|
|
34
|
41
|
resetTo(params = {}) {
|
35
|
|
- return platformSpecific.navigatorResetTo(this, params);
|
|
42
|
+ return throttledPlatformSpecificFunctions.resetTo(this, params);
|
36
|
43
|
}
|
37
|
44
|
|
38
|
45
|
showModal(params = {}) {
|
|
@@ -95,10 +102,6 @@ class Navigator {
|
95
|
102
|
return platformSpecific.navigatorSwitchToTab(this, params);
|
96
|
103
|
}
|
97
|
104
|
|
98
|
|
- showFAB(params = {}) {
|
99
|
|
- return platformSpecific.showFAB(params);
|
100
|
|
- }
|
101
|
|
-
|
102
|
105
|
setOnNavigatorEvent(callback) {
|
103
|
106
|
this.navigatorEventHandler = callback;
|
104
|
107
|
if (!this.navigatorEventSubscription) {
|