You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Furthermore, why don't you cache result of checking? Each time I call isMobile/Tablet/Desktop regexes are checked. In my opinion it should be checked on first method call, then result should be kept in memory. User Agent won't change so checking each time is redundant.
The text was updated successfully, but these errors were encountered:
#187
1:- create a class for device contants because we want to destroy regexes after it checked
2:- apply the condition when user check its device first time it will work but when same useragent and device check another time we return the store data which is stored when user check is first time
Hi,
I found issue with your library. It causes memory leaks. https://github.com/KoderLabs/ngx-device-detector/blob/master/projects/ngx-device-detector/src/lib/device-detector.constants.ts here you create regex objects. Those objects cannot be handled by garbage collector. Regex should be created if needed and destroy after check. Keep them like that make them unavailable for garbage collector.
Furthermore, why don't you cache result of checking? Each time I call isMobile/Tablet/Desktop regexes are checked. In my opinion it should be checked on first method call, then result should be kept in memory. User Agent won't change so checking each time is redundant.
The text was updated successfully, but these errors were encountered: