I have a singleton class based on Joose and I would like to add initialization arguments to it like this:
var programs = Programs.getInstance({
tabContainer: '#tab'
});
tabContainer is also declared as an attribute to the singleton.
In my after method modifier initialization method, I track to see if the arguments passed in was read like this:
after: {
initialize: function(){
alert(this.getTabContainer());
}
}
But the alert produces the default value given, not the initialization value I passed to it.
Any idea how to pass arguments to the singleton in Joose?
I tested the same thing using regular class definitions in Joose and the above code alerts the proper argument.
From the documentation for Joose about Singletons and Classes, the Class documentation specifically mentions this syntax as something that is supported. The Singleton documentation does not mention it. Most likely this is something that is not supported by Joose.
The problem with adding support for that to the Singleton is that the 2nd caller to the class may not have their initialization parameters applied since there can be only one instance of the class. Whoever invokes it first would have their parameters applied to it.