Under Inheritance, when a child object extends the parent, the parent needs to be constructed first before the child can be created.
However, one of the properties of parent constructor is async (webSQL database transaction). I want to share the database transaction object to all of it's children.
But then the problem is children can't use the transaction object right away because it gets created some time later asynchronously after the parent creation.
Parent:
if(this.database = common.model.connections.Sync.getConnection()) {
this.database.transaction(function(transaction){
self.transaction = transaction;
});
}
Please advise or ask me for more details. Will appreciate any design patterns.