codice:
playerList.html
<script type="text/javascript">
var view = new View();
var proxy = new Proxy();
var controller = new Controller(); proxy.initComponents(controller);
controller.initComponents(view, proxy);
...
codice:
Controller.js
this.initComponents = function(view,controller){
this.view= view;
this.proxy=proxy;
}
this.initPlayerListField = function(credentials){
//con this.view se faccio alert(this) mi da [object HTMLDocument] invece che Controller
view.createHeader('proxy.fillPlayersCacheToInitialBlock', ... );
Se nella funzione this.initPlayerListField scrivo come riportato qui sopra view.createHeader(... funziona, poichè la variabile è vista ovunque, se invece scrivo this.view.createHeader(... mi dice che this.view non è definita, e se vado a fare alert(this) mi da [object HTMLDocument]...