I have the following code:
(function(){
var DS = (function(){
DS.prototype.queryDB = function() {
alert('query database');
};
DS.prototype.openDB = function() {
alert('open the database');
};
});
window.DS = new DS;
})(window);
I can then call DS.queryDB() and DS.openDB() from my page which works fine.
What I want is to have a database class within DS to seperate the functions further.
I tried changing DS.prototype.queryDB to DS.prototype.Database.queryDB but that didn’t seem to work. How can I best structure my code to allow for this?
This can be done .
Consider doing it something like this .