Calling a private function of one object from the other in Javascript
<pre><code>var STICKIES = (function () {
/* some code here*/
createSticky = function createSticky(data) {        
    $('#color-picker'+data.id).ColorPicker({
        color: '#0000ff',
        onShow: function (colpkr) {
            $(colpkr).fadeIn(500);
            return false;
        },
        onHide: function (colpkr) {
            $(colpkr).fadeOut(500);
</code></pre>

<blockquote>
<pre><code>          // TODO: Call saveSticky from here
</code></pre>
</blockquote>

<pre><code>            return false;
        },
        onChange: function (hsb, hex, rgb) {
            $('#'+data.id).css('background-color', '#' + hex);
                colorInHex = hex;                   
        }
    }); 
},

saveSticky = function saveSticky() {        
    var that = $(this),
        sticky = (that.hasClass("color-pick") || that.hasClass("sticky-status") || that.hasClass("sticky-content") || that.hasClass("sticky-status-time")) ? that.parents('div.sticky'): that,
            obj = {
                id  : sticky.attr("id"),
                top : sticky.css("top"),
                left: sticky.css("left"),
                text: sticky.children(".sticky-content").text(),                    
                createdDate: sticky.find(".sticky-status-time").text(),                 
                colorOfNote: rgb2hex(sticky.css("background-color")) }          
    localStorage.setItem("sticky-" + obj.id, JSON.stringify(obj));  
    sticky.find(".sticky-status").css('color','grey').text("saved");
    chkForNoNote();
},

/* some code here*/
return {
    open   : openStickies,
    init   : initStickies,
    "new"  : createSticky,
    remove : deleteSticky 
};
}());
</code></pre>

<p>// I am trying to save color while creating a sticky note. For this, in function onHide() i need to call <code>saveSticky().</code> <code>saveSticky()</code> happens to be the function of STICKIES and <code>ColorPicker()</code> to be the function of colorPicker. How shall I call saveSticky?</p>
