Created
December 25, 2010 11:18
-
-
Save ignacy/754832 to your computer and use it in GitHub Desktop.
module pattern
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
var drawEvents = function() { | |
var popupExists = function (target) { | |
return !!jQuery(target).find("#sender").length; | |
}; | |
var getLocationId = function(slots) { | |
if (!slots) { | |
return jQuery("#location_id").text(); | |
} else { | |
return slots.attr("id").split("_")[1]; | |
} | |
}; | |
return { | |
thisContextIsPublic : function () { | |
// I can use getLocationId() and popupExists() functions here | |
} | |
} | |
}(); | |
// Now I can use this object like this: | |
drawEvents.thisContextIsPublic(); | |
// but I can't do that: | |
drawEvents.popupExists(jQuery("Slot")); | |
// popupExists() is private method of drawEvents! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment