module-pattern

Javascript Assistance

The issue I am having is when the function is called multiple times for different elements. I believe I need to localize all of the variables such that this function can be used against multiple elements. In case it matters I also call in jquery 1.3. If I only call pageSlide once, everything is fine, but once I call it multiple times i...

What is the intention of nInject modules?

I'm a complete newbie to nInject I've been pulling apart someone else's code and found several instances of nInject modules - classes that derive from Ninject.Modules.Module, and have a load method that contains most of their code. These classes are called by invoking the LoadModule method of an instance of StandardKernel and passing i...

JavaScript Module Pattern - What about using "return this"?

After doing some reading about the Module Pattern, I've seen a few ways of returning the properties which you want to be public. One of the most common ways is to declare your public properties and methods right inside of the "return" statement, apart from your private properties and methods. A similar way (the "Revealing" pattern) is ...

Using the Module Pattern for larger projects

I'm interested in using the Module Pattern to better organize my future projects. Unfortunately, there are only a few brief tutorials and proof-of-concept examples of the Module Pattern. Using the module pattern, I would like to organize projects into this sort of structure: project.arm.object.method(); Where "project" is my global p...

When returning an object from a JavaScript constructor function (avoiding 'new') how do I implement public members?

I have begun writing my 'class' type JavaScript functions like the Module Pattern or Revealing Module patten. This avoids the use of 'new' and allows me to define which functions are public in a single place. However, I have been unable to see how to use and access public data members in this pattern. e.g. the member 'id' below is ac...

Can the Javascript Module Pattern be used for singletons and also for objects that are instantiated mutliple times?

I have one page with two types of forms. I have a single form of type A at the top, and then I have 1 or more forms of type B below it. I use the Module pattern + jQuery to wire up all the events on my forms, handle validation, ajax calls, etc. Is this the preferred/valid way to define a singleton, as in Form A, and a reusable object ...

How can I safely access other sibling functions and variables in a Javascript Module Pattern without accessing something in the containing scope?

I have a Javascript Object structured after the Module Pattern. I have several private function in it which are called from other sibling "private" functions. How can I access another variable/function without the potential to accidentally access a global/external variable/object/function? function doSomething() { alert("Something I...

Limiting Access to "Functional Modules" in ASP.NET MVC

I am building a site in ASP.NET 4 and MVC2 that will have premium features, such as SMS notifications that will only be available to paid subscribers. I also have additional modules for things like Inventory, and Transactions etc I am already leveraging the standard MembershipProvider, and am leaning towards using Roles tp provide this ...

Javascript: Module Pattern vs Constructor/Prototype pattern?

Hi there, I have been reading a little bit about the Module pattern and i wonder if applicable for what i need to do or should i use the Constructor/protoType pattern. Basically I am using unobstrusive javascript so i have a reference to my .JS file in my HTML document. If i understand it correctly then I can call a INIT method (which...