Guest User

Untitled

a guest
Oct 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. class PreFlightService {
  2. goToGate(flight) {
  3. if (flight instanceof Flight !== true) throw new Error('Must be a flight')
  4.  
  5. if (flight.atGate) throw new Error('Flight is already at the gate');
  6.  
  7. return Object.assign({}, flight, {
  8. atGate: true
  9. });
  10. }
  11. refuel() {
  12.  
  13. }
  14. restockFood() {
  15.  
  16. }
  17. onBoardFlightTeam() {
  18.  
  19. }
  20. onBoardPassengers() {
  21.  
  22. }
  23. }
  24.  
  25. class Flight {
  26. constructor() {
  27. this.passengers = [];
  28. this.team = [];
  29. this.food = [];
  30. this.refueled = false;
  31. this.atGate = false;
  32. }
  33. }
  34.  
  35. let service = new PreFlightService;
  36. let flight = new Flight;
  37.  
  38. flight.atGate = true;
  39.  
  40. service.goToGate(flight)
Add Comment
Please, Sign In to add comment