Created
August 25, 2011 19:59
-
-
Save taxilian/1171696 to your computer and use it in GitHub Desktop.
Example of using a generic handler with anonymous functions
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
// Don't do this on something real! It'll leak! | |
function myHandler(obj, param1, param2) | |
{ | |
alert("Some object " + obj + " fired an event with " + param1 + " and " + param2; | |
} | |
function pluginOnLoad(plugin) | |
{ | |
plugin.addEventListener("coolevent", function(p1, p2) { myHandler(plugin, p1, p2); }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment