Skip to content

Commit

Permalink
Check for canvas support
Browse files Browse the repository at this point in the history
  • Loading branch information
makeable committed Oct 1, 2011
1 parent d0624f6 commit 5101b6b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion notificon.js
@@ -1,4 +1,20 @@
(function(){

var unsupported = false;

var checkSupport = function checkSupport() {
if (unsupported) {
return false;
}
if (!document.createElement('canvas').getContext) {
unsupported = true;
if (console) {
console.log('Notificon: requires canvas support');
}
return false;
}
return true;
}

var findFaviconTag = function findFaviconTag(notificon) {
var link_tags = document.getElementsByTagName('link');
Expand Down Expand Up @@ -53,8 +69,11 @@
context.drawImage(img, 0, 0);
return canvas;
};
var createNotificon = function createNotificon(label, favicon) {
if (!checkSupport()) {
return false;
}
if (!favicon) {
favicon = getExistingFavicon();
}
Expand Down

0 comments on commit 5101b6b

Please sign in to comment.