Betslip documentation

To instaciate new BetslipCalculator, write the next code:

const betslipCalc = new BetslipCalculator();
const bets = [{
  banker: false,
  oddValue: 1.85
},
{
  banker: false,
  oddValue: 2.00
},
{
  banker: true,
  oddValue: 1.40
},
{
  banker: false,
  oddValue: 2.10
},
{
  banker: true,
  oddValue: 1.65
}];

In the code example above, we specified banker property on each bet. Property banker is only used when calculating system tickets. So if you need to calculate single or combo ticket you can omit banker property.

To add these bets to betslip, write next code:

betslipCalc.setBets(bets);

System ticket

In code above, we have 5 bets, 2 of them are bankers. That means we have only 3 system available. Before we can calculate system, we need to select one of them or more. To select system, we can use toggleSystem method on BetslipCalculator class.

betslipCalc.toggleSystem(1);

Now, we have selected system 1/3, you can also select other systems if you want

betslipCalc.toggleSystem(2);
betslipCalc.toggleSystem(3);

...and finally calculate method

betslipCalc.calculateSystemWinnings();

Single ticket

betslipCalc.calculateSingleWinnings();

Combo ticket

betslipCalc.calculateComboWinnings();