Skip to content

Commit

Permalink
Fix up code examples in README
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceau committed Nov 16, 2020
1 parent 31363c7 commit 62debf0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@ Want to make your own HUD?
5. Profit!!

```javascript
realtime.stock.percentChange$.subscribe(payload => {
realtime.stock.percentChange$.subscribe((payload) => {
const player = payload.playerIndex + 1;
console.log(`player ${player} percent: ${payload.percent}`);
fs.writeFileSync(`./player${player}Percent.txt`), payload.percent);
fs.writeFileSync(`./player${player}Percent.txt`, payload.percent.toFixed(0));
});

realtime.stock.countChange$.subscribe((payload) => {
const player = payload.playerIndex + 1;
console.log(`player ${player} stocks: ${payload.stocksRemaining}`);
fs.writeFileSync(`./player${player}Stocks.txt`), payload.stocksRemaining);
fs.writeFileSync(`./player${player}Stocks.txt`, payload.stocksRemaining.toString());
});
```

Expand Down
2 changes: 1 addition & 1 deletion examples/custom-hud/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ realtime.game.start$.subscribe(() => {
realtime.stock.percentChange$.subscribe((payload) => {
const player = payload.playerIndex + 1;
console.log(`player ${player} percent: ${payload.percent}`);
setPlayerPercent(player, `${Math.floor(payload.percent)}%`);
setPlayerPercent(player, `${payload.percent.toFixed(0)}%`);
});

realtime.stock.countChange$.subscribe((payload) => {
Expand Down

0 comments on commit 62debf0

Please sign in to comment.