I have to write a global method in angular 2+(i am using angular 6).The reason behind using global method is If the system is idle for X minutes then I have to show dialog box.I am planning to call global method on every click and store current time in SessionStorage and If different between last accessed time is more than X minutes then show dialog.Where to write function that is accessible from all everywhere?
If you think this approach having flaws,could you please help in pointing out those.