Skip to content

Instantly share code, notes, and snippets.

@eru
Created December 6, 2011 06:55
Show Gist options
  • Save eru/1437117 to your computer and use it in GitHub Desktop.
Save eru/1437117 to your computer and use it in GitHub Desktop.
// -- GrowlMonkey stuff below here - do not edit
GrowlMonkey = function(){
function fireGrowlEvent(type, data){
var element = document.createElement("GrowlEventElement");
element.setAttribute("data", JSON.stringify(data));
document.documentElement.appendChild(element);
var evt = document.createEvent("Events");
evt.initEvent(type, true, false);
element.dispatchEvent(evt);
}
return {
register : function(appName, icon, notificationTypes){
var r = {};
r.appName = appName;
r.icon = icon;
r.notificationTypes = notificationTypes;
fireGrowlEvent("GrowlRegister", r);
},
notify : function(appName, notificationType, title, text, icon){
var n = {};
n.appName = appName;
n.type = notificationType;
n.title = title;
n.text = text;
n.icon = icon;
fireGrowlEvent("GrowlNotify", n);
}
}
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment