[jQuery] SOT: Anonymous JS functions / classes? Help me understand

[jQuery] SOT: Anonymous JS functions / classes? Help me understand

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16608" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008>So I'm making my
first foray into clas based JS (or what I think is class based JS). I found a
function group yesterday and really liked the way it grouped functions and
variables together. I'd like to start using this method but I have a few
questions. First, some code (at the bottom). This code is contained in a file
called Login.js. My primary functionality is contained in a file called
core.js.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008>I can now call
Login.submitLogin(user,pass) from core.js and it works just fine. That is until
I changed _loginURL to be included in this. _loginURL expects the variable
domain which is contained inside core.js.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008>Now some
questions...</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008>1) What is this
method traditionally called? Is it a class? A function grouping? I want to
understand but I don't even know what it's really called.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008>2) How would I go
about passing data INTO this class/function group/etc? I've tried
this:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008>var log = new
Login(domain);</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008>and of course I
could pass in domain with every call, but I'd rather create it once and use it
multiple times.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=359335918-14032008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008>// and now the
code</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008>var Login =
{</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008> // private
property<BR> _loginURL: domain + '/mycode.cfm',</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=359335918-14032008> submitLogin:
function (u,p) {<BR>  var user = u;<BR>  var pass =
p;<BR>  /*<BR>   * send the request to the server, wait for
response<BR>   * <BR>   * TODO: Should we trigger a modal
window overlay with<BR>   * an animated GIF while we wait for a
request?<BR>   */ <BR>  // do some ajax stuff
here<BR> }<BR>}</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV align=left><SPAN style="FONT-SIZE: 14px"><B><FONT face="Century Gothic">
<DIV align=left><SPAN class=159130414-05012007><FONT face=Arial size=2><SPAN
class=159130414-05012007><FONT face=Arial
size=2>____________________________________</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=159130414-05012007><FONT face=Arial size=2><SPAN
class=159130414-05012007></SPAN></FONT></SPAN> </DIV>Andy
Matthews<BR></FONT></B></SPAN><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic"><SPAN
style="FONT-SIZE: 8.5pt; FONT-FAMILY: 'Century Gothic'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes">Senior
ColdFusion Developer</SPAN><BR></FONT></SPAN><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic"><FONT color=#808080><SPAN
style="FONT-SIZE: 11px"></SPAN><IMG alt="" hspace=0
src="cid:359335918@14032008-2499" align=baseline border=0></FONT><BR>Office:
 615.627.9747<BR>Fax:  615.467.6249</FONT></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 11px"><FONT face="Century Gothic"><A
href="http://www.dealerskins.com/">www.dealerskins.com</A></FONT></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 11px"></SPAN> </DIV>
<DIV><SPAN style="FONT-SIZE: 11px"><SPAN style="FONT-SIZE: 12px"><FONT
face="Century Gothic">Total customer satisfaction is my number 1 priority! If
you are not completely satisfied with the service I have provided, please let me
know right away so I can correct the problem, or notify my manager <FONT
color=#fe6500>Aaron West</FONT> at <FONT
color=#0000ff><U>awest@dealerskins.com</U></FONT>.</FONT></SPAN></SPAN></DIV>
<DIV> </DIV></BODY></HTML>