109 lines
2.1 KiB
JavaScript
109 lines
2.1 KiB
JavaScript
var Coffee, Coffee0, JCoffee, MaxgoodHouse, SelectFlights, boring, french, j;
|
|
|
|
Coffee0 = class Coffee0 {
|
|
constructor(name, strength = 1) {
|
|
this.name = name;
|
|
this.strength = strength;
|
|
}
|
|
|
|
};
|
|
|
|
Coffee = class Coffee {
|
|
constructor(name1, strength1 = 1) {
|
|
this.name = name1;
|
|
this.strength = strength1;
|
|
}
|
|
|
|
brew() {
|
|
return alert(`brewing ${this.name}`);
|
|
}
|
|
|
|
pour(amount = 1) {
|
|
if (amount === 1) {
|
|
return "Poured a single cup";
|
|
} else {
|
|
return `Poured ${amount} cups`;
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
french = new Coffee("French", 2);
|
|
|
|
french.brew();
|
|
|
|
alert(french.pour());
|
|
|
|
alert(french.pour(2));
|
|
|
|
MaxgoodHouse = class MaxgoodHouse extends Coffee {
|
|
// Cannot use @param format, because of the required call to super in Coffee 2.x.
|
|
constructor(name, strength = 0) {
|
|
super(name, strength);
|
|
this.name = name;
|
|
this.strength = strength;
|
|
this.brand = "Maxgood House";
|
|
}
|
|
|
|
pour(amount = 1) {
|
|
return `${super.pour(amount)}, but it sucks`;
|
|
}
|
|
|
|
};
|
|
|
|
boring = new MaxgoodHouse("Boring");
|
|
|
|
boring.brew();
|
|
|
|
alert(boring.pour());
|
|
|
|
JCoffee = class JCoffee {
|
|
constructor(name1, strength1 = 1, inventory = 0) {
|
|
this.name = name1;
|
|
this.strength = strength1;
|
|
this.inventory = inventory;
|
|
}
|
|
|
|
pourClick() {
|
|
return $(`#pour-${this.name}`).click((event) => {
|
|
if (this.inventory !== 0) {
|
|
this.inventory--;
|
|
return alert(`Poured a cup of ${this.name}`);
|
|
} else {
|
|
return alert(`Out of ${this.name}`);
|
|
}
|
|
});
|
|
}
|
|
|
|
};
|
|
|
|
j = new JCoffee("French", 2, 1);
|
|
|
|
j.pourClick();
|
|
|
|
SelectFlights = (function() {
|
|
class SelectFlights {};
|
|
|
|
constructor(SelectFlights.fetchingFlights = null)(function() {
|
|
$("#tabs ul li a").bind({
|
|
click: this.changeTab
|
|
});
|
|
$("#tabs #error a").click((event) => {
|
|
event.preventDefault();
|
|
return this.showFlights($("#tabs li a.active").attr("href"));
|
|
});
|
|
return {
|
|
showFlights: function(activeDiv) {
|
|
return {};
|
|
},
|
|
changeTab: (event) => {
|
|
return {};
|
|
}
|
|
};
|
|
});
|
|
|
|
return SelectFlights;
|
|
|
|
}).call(this);
|
|
|
|
//# sourceMappingURL=6-1-class.js.map
|