Created
December 6, 2011 06:55
-
-
Save eru/1437117 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -- 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