Check current view type

Dear ERPnext team,

I’m writing some custom script which need to detect the type of current view, such as “Form”, “ListView”, “Grid”, which variable I can access to get this information?

Best Regards,