I have a single global object I use. I know the cons of using global objects but in this case I want to use it.
I call this global object the object pipe b.c. it branches my models to my controller and vice versa...maybe should have called it object branch...anyways...
The mistake I made is that I thought I only had one model running at any given time...but I don't, there are multiple.
Hence I can't use a single static implementation, I need and instance based one, one global object pipe per each model running.
Here is the static versions. MC stands for Model/Controller.
/********************************************************************************************
*
* MC - Model/Controller Types
*
*******************************************************************************************/
var MC = {};
/**
** Object Pipe
*/
MC.o_p = {
model : 'default',
result : 'continue',
page : {},
args : {},
server : {},
hash : localStorage.hash
};
I thought about doing something like this:
MC.o_p1 = function() {
return {
model : 'default',
result : 'continue',
page : {},
args : {},
server : {},
hash : localStorage.hash
}
}
but now the return object is in local scope to whatever called it.
I need global instance based objects.
I'm not sure if I'm over thinking this or what I'm asking is possible?