How do I properly set a close timeout on desktop notifications created by the browser How do I properly set a close timeout on desktop notifications created by the browser google-chrome google-chrome

How do I properly set a close timeout on desktop notifications created by the browser


When I wrap that into a function() {} it works:

setTimeout(function() { notification.close() }, 2000);

See this fiddle: https://jsfiddle.net/drnz12n8/2/