views:

298

answers:

2

I want to write a module on one html site - I will never leave the site

I think about two possible concurrent basic approaches:

  1. We go into the module by use only a specific function (with specific params - everything which will happen, happen there - logic, exception handling etc)

  2. We go in by using one handler-fct, which manages some kind of action & a dataArray (depending on the action also fcts will be called -> but not directly maybe for exception handling)

So what you prefer?!

A: 

I'm not entirely sure what you're asking, why don't you just write the functions to take values when they're called? You're making too much work for yourself.

If the values aren't defined in the function call, you can always have it set so that if a given value is not defined, it will use a default one in it's place.

Sneakyness
A: 

Have you looked at JavaScriptMVC? There's also a great article about Javascript Architecture at http://tysonlloydcadenhead.com/blog/javascript-architecture/

Tyson Cadenhead