January 2018
Intermediate to advanced
332 pages
7h 36m
English
Some of the features that we have within our applications are conditional. For example, logging or analytics fall into this category. Some of the applications may have logging turned off for some time and then turned back on. The most obvious way of achieving this is to wrap the method for logging within an if condition. However, since the method could be triggered a lot of times, there is another way in which we can make the optimization in this case:
function someUserAction() { // logic if (analyticsEnabled) { trackUserAnalytics(); } }// in some other classfunction trackUserAnalytics() { // save analytics}
Instead of the preceding approach, we can instead try to do something, which is only slightly different ...
Read now
Unlock full access