https://github.com/flocasts/lynx-scoreboard
Connection interface to FinishLynx Scoreboard
https://github.com/flocasts/lynx-scoreboard
Last synced: over 1 year ago
JSON representation
Connection interface to FinishLynx Scoreboard
- Host: GitHub
- URL: https://github.com/flocasts/lynx-scoreboard
- Owner: flocasts
- License: mit
- Created: 2020-07-08T16:14:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-18T22:53:01.000Z (almost 3 years ago)
- Last Synced: 2025-02-07T17:39:11.921Z (over 1 year ago)
- Language: TypeScript
- Size: 664 KB
- Stars: 4
- Watchers: 30
- Forks: 1
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lynx-scoreboard
Create a Scoreboard Interface to listen to updates from FinishLynx
## Publish new version
Edit Cloud Build trigger by updating _FLO_NPM_TOKEN with a valid github personal access token.
Update version in package.json
Merge changes to master branch
## Usage Example
Use "npm run build" to create dist version of example.js
Open terminal and cd to "lynx-scoreboard\dist"
Run command "node example.js"
```javascript
const scoreboard = await LynxScoreboard.listen({
port: 8080,
ip: "127.0.0.1",
});
if (scoreboard.isListening) {
console.log("I am listening!");
}
scoreboard.subscribe("error", (err) => {
console.log(`Uh oh! There was an error: ${err}`);
});
scoreboard.subscribe("results", (data) => {
console.log(
`Received ${data.results.length} results from ${data.event.eventName}`
);
});
scoreboard.subscribe("directive", (data) => {
console.log(`Received directive: ${data.title}`);
});
scoreboard.subscribe("stoppedListening", () => {
console.log(`I stopped listening!`);
});
// Stop listening after 10 seconds
setTimeout(() => scoreboard.stopListening(), 10000);
```