Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
1.2 kB
2
Indexable
Never
const mcDonalds = new McDonalds({
  onOrderFinish: (bayer) => console.log(`Buyer ${bayer.name} got his ${bayer.product}. His order was ready in ${bayer.waitingTime}s`),
});

// mcDonalds.serve(Client({ name: 'Friend 1', product: 'Cheeseburger' }));
// mcDonalds.serve(Client({ name: 'Friend 2', product: 'DoubleCheese Menu + Fanta'}));
// mcDonalds.serve(Client({ name: 'Friend 3', product: 'Latte + McPie'}));
// mcDonalds.serve(Client({ name: 'Friend 4', product: '2x Cheeseburgers'}));
// mcDonalds.serve(Client({ name: 'Friend 5', product: '4 piece Chicken McNuggets'}));

Client({ name: 'Friend 1', product: 'Cheeseburger' }).then((bayer) => {
  console.log(`Buyer ${bayer.name} got his ${bayer.product}. His order was ready in ${bayer.waitingTime}s`)
  Client({ name: 'Friend 2', product: 'DoubleCheese Menu + Fanta'}).then((bayer) => {
    console.log(`Buyer ${bayer.name} got his ${bayer.product}. His order was ready in ${bayer.waitingTime}s`)
    Client({ name: 'Friend 3', product: 'Latte + McPie'}).then((bayer) => {
      console.log(`Buyer ${bayer.name} got his ${bayer.product}. His order was ready in ${bayer.waitingTime}s`)
      ....
    })
  })
})