CoffeeMachine.brewCoffee()

Asks for ingredients to brew a coffee

Usage

Hover over inputs/exits for more info.

var CoffeeMachine = require('machinepack-coffeemachine');


// Asks for ingredients to brew a coffee

CoffeeMachine.brewCoffee({

name: 'Espresso',

cafeinated: false,

sugarCubes: 3,

cream: true,

milk: false,

essence: 'hazelnut',

temperature: 'warm',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// The given ingredient is missing

outOfMilk: function (result) {

 

},

// The given ingredient is missing

outOfEssence: function (result) {

 

},

// The coffee's temperature is not right :(

wrongTemperature: function (result) {

 

},

// OK.

success: function (coffee) {

 

},

});

Inputs

name required

Name the coffe after something

'Espresso'
cafeinated required

Do you want your coffee with cafeine?

false
sugarCubes required

How many sugar cubes do you want?

3
cream required

Do you want cream in your coffee

true
milk

Do you want your coffee with milk?

false
essence

Do you want any flaver to your coffee?

'hazelnut'
temperature

Do you want your coffee Hot or Cold?

'warm'

Exits

error

An unexpected error occurred.

outOfMilk

The given ingredient is missing

{ type: 'milk', message: 'We\'re out of milk :(' }
outOfEssence

The given ingredient is missing

{ type: 'essence', message: 'We\'re out of essence :(' }
wrongTemperature

The coffee's temperature is not right :(

{ type: 'temperature',
  message: 'The coffee went either warm or cold :(' }
success

OK.

{ type: 'coffee',
  coffee: 
   { name: 'Latte',
     cafeinated: true,
     sugarCubes: 3,
     cream: true,
     milk: false,
     essence: 'hazelnut',
     temperature: 'hot' } }