Now you can receive window push notification when someone from your chat start typing. however it will only work when your status is visiable to others.
it will work when you are on other tabs of browser, but it will keep your status online on whatsapp
Right now it appears that you will also get notifications when the windows is in focus and while you are talking to someone, so this will be annoying
When the tab is not on focus, your status will quickly become unavailable, so where are you keeping the status online in this case? Also people might not want to appear online all the time or are aware of this fact
You are not checking the global enforcing variable you created, so push notifications will always show up regardless of whether or not the checkbox is ticked
In the notification, you show the contact as a JID (phone number) and not a contact name, it'll be better to get the name (I probably did it in other places in the code)
Please try to keep in line with my code style conventions
Now you can receive window push notification when someone from your chat start typing. however it will only work when your status is visiable to others.
it will work when you are on other tabs of browser, but it will keep your status online on whatsapp