Last active
December 11, 2015 22:28
-
-
Save d48/4669276 to your computer and use it in GitHub Desktop.
rewrite addEvent function signature to work with removeEvent using variable that points to function
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
function openHandler(widgetTypeId, userWidgetId, displayOrder, savePrefUrl) { | |
// some stuff | |
Utils.addEvent(btnSave, 'click', function () { | |
btnSaveClick(widgetTypeId, userWidgetId, displayOrder, savePrefUrl); | |
}); | |
} | |
function btnSaveClick(typeId, widgetId, order, url) { | |
// definition | |
} | |
/* Can be rewritten to below? */ | |
var saveClickHandle = function() { | |
btnSaveClick(widgetTypeId, userWidgetId, displayOrder, savePrefUrl); | |
} | |
Utils.addEvent(btnSave, 'click', saveClickHandle); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment