Using variables in multiple functions, throughout an Object
<p><strong>Base</strong></p>

<ul>
<li>I would like to use some variables that are set from another function within an object</li>
<li>One function, <code>onUpdate:</code> waits for a call to be made from somewhere else in the application</li>
<li>Second function, <code>onRelease:</code> triggers after a mouse click</li>
</ul>

<p><strong>What I am trying to achieve</strong></p>

<p>There are some <code>DOM</code> elements I need to use for both functions. However, a <code>document.onload</code> won't work here, so I am thinking that I'll need to store them in some sort of <code>JavaScript object</code>.</p>

<p><strong>Restrictions</strong></p>

<p>(Elements are only used in this <code>Object</code> and must be declared inside the <code>Object</code>)</p>

<hr>

<p><strong>note</strong>: This is a custom built <code>app</code> so it may seem a bit confusing, but I only need to know if this can be done in the current situation</p>

<hr>

<p><strong>QUESTION</strong></p>

<p>Is there any way to use <code>Javascript Objects</code> or some sort of function that stores/gets the <code>DOM</code> elements so they are usable throughout an <code>Object</code>?</p>

<p><strong>Code</strong></p>

<pre><code>var ObjB = exports.ObjB = ObjA.extend({

    /* Something to contain the DOM Elements E.g.
     UI = {
         domElement: document.querySelector('#dom')
     }, 
    */ 

    onUpdate: function() {
        if(domElement.hasClass('class')) { 
            // logic using other elements
        }
    },

    onRelease: function() {
        if(domElement.hasClass('class')) { 
            // logic using other elements  
        }
    }

});
</code></pre>
