I am creating an google-chrome-extension which has rich notifications. I need to change timeout to close in this notification and I need some help with that. This is my code. I have already tried window.close(), but it does not seem to work in Chrome.
var options = {
type: "basic",
title: "test",
message: "body here",
iconUrl: "icon.png"
};
var msj = chrome.notifications.create(options);
setTimeout(function () {
chrome.notifications.clear(msj); // how to close?
}, 1500);
Chrome APIs are mostly asynchronous (definitely take a look at that link).
chrome.notifications.create
does not immediately create the notification, and will not return the ID. You need to use the callback for that: