Private functions in namespaced javascript
<p>I'm trying to define a way in which I can control the access to methods for the javascript we use at work (Part of a coding standards improvement drive).</p>

<p>The pattern I was planning to use was fine until I thought about what we do with 3rd party script methods.</p>

<p>How can I tweak my code to allow access to the private function from inside the jQuery method?</p>

<pre><code>var NameSpace = new function () {

    // My private function I want to access.
    var privateFunction = function () {

    };

    this.publicFunction = function () {

        // I can access my private function here.
        privateFunction();

        jQuery(window).resize(function () {

            // But not here :(
            privateFunction();

        });
    };
};
</code></pre>
