L
Luke Matuszewski
I am designing the library, which will hidden all its functions within
singleton object ... So for clients
they will use it like [functional_prefix].[function_name] eg.
system.getElementWithId('ruler');
At library side, i will use constructs like follows (at global scope)
eg.
function System() {
function _getElementWithId(id) {
/*
GENERIC CODE (using first DOM getElementById(id) and if not
successful
using document.all with some checks...)
*/
}
/*
MORE UTIL FUNCS
*/
this.getElementWithId = _getElementWithId;
/*
MORE ASSIGMENTS like
this.[util_method] = _[util_method];
*/
}
var system = new System();
System = null; /* since System constructor is desinged to produce
singletons, and it
should not be visible after singleton
instantiation... */
My question is simple, can i use construct like:
System = null;
, to redefine constructor System reference to null ? If not, then how i
should do it ?
Also remember that i can't use function expressions like
function(...) { }
I will appreciate somebody knowlegable to lighten my problem...
Best regards
Luke Matuszewski
singleton object ... So for clients
they will use it like [functional_prefix].[function_name] eg.
system.getElementWithId('ruler');
At library side, i will use constructs like follows (at global scope)
eg.
function System() {
function _getElementWithId(id) {
/*
GENERIC CODE (using first DOM getElementById(id) and if not
successful
using document.all with some checks...)
*/
}
/*
MORE UTIL FUNCS
*/
this.getElementWithId = _getElementWithId;
/*
MORE ASSIGMENTS like
this.[util_method] = _[util_method];
*/
}
var system = new System();
System = null; /* since System constructor is desinged to produce
singletons, and it
should not be visible after singleton
instantiation... */
My question is simple, can i use construct like:
System = null;
, to redefine constructor System reference to null ? If not, then how i
should do it ?
Also remember that i can't use function expressions like
function(...) { }
I will appreciate somebody knowlegable to lighten my problem...
Best regards
Luke Matuszewski