Created
February 13, 2010 12:29
-
-
Save hojberg/303425 to your computer and use it in GitHub Desktop.
how to make testing possible of sandboxed api #2
This file contains hidden or 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 () { | |
var PublicAPI = window.PublicAPI = {}; | |
PublicAPI.publicFunction = function (foo) { | |
PrivateAPI.privateFunction(foo); | |
return 'bar'; | |
}; | |
var PrivateAPI = {}; | |
PrivateAPI.privateFunction = function (foo) { | |
// Make secret stuff that never gets returned to the public | |
// Could be an XHR call. | |
}; | |
// Assign PrivateAPI to window in order to perform unit testing of PrivateAPI. | |
// Remove this in production | |
window.PrivateAPI = PrivateAPI; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment