ia have a problem. How can i get access to my vars in TeslaModelS from the prototype extension ?
Or is my Plugin-Pattern wrong ?
I would like to separate the different areas of my app and not have it all in one big file
var TeslaModelS = function () {
this.numWheels = 4;
this.manufacturer = 'Tesla';
this.make = 'Model S';
this.Drive.pressGasPedal();
}
TeslaModelS.prototype = function () {
var _this = this;
var Drive = {
go: function () {
// HOW CAN I GET RED AND WRITE ACCESS TO MY VARS IN TeslaModelS ??
console.log(_this.numWheels)
},
stop: function () {
}
}
return {
Drive: {
pressBrakePedal: Drive.stop,
pressGasPedal: Drive.go
}
}
}();
var i = new TeslaModelS();