Metamask Event Disconnect

web3.ethereum.on("accountsChanged", accounts => {
  if (accounts.length > 0)
    console.log(`Account connected: ${accounts[0]}`);
  else
    console.log("Account disconnected");
});
Alex Georgousis