how to check if user has installed pwa

JavaScript
if (window.matchMedia('(display-mode: standalone)').matches) {  
    // do things here
}  
Source

Also in JavaScript: