{"id":18338764,"url":"https://github.com/tableflip/score-board","last_synced_at":"2025-04-09T20:35:48.846Z","repository":{"id":33639273,"uuid":"37291650","full_name":"tableflip/score-board","owner":"tableflip","description":"Browser score board","archived":false,"fork":false,"pushed_at":"2017-05-31T09:29:13.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-15T12:46:45.235Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tableflip.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-11T23:33:45.000Z","updated_at":"2017-05-31T09:28:50.000Z","dependencies_parsed_at":"2022-09-13T05:22:06.825Z","dependency_job_id":null,"html_url":"https://github.com/tableflip/score-board","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Fscore-board","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Fscore-board/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Fscore-board/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Fscore-board/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tableflip","download_url":"https://codeload.github.com/tableflip/score-board/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248108353,"owners_count":21049117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T20:15:08.478Z","updated_at":"2025-04-09T20:35:48.821Z","avatar_url":"https://github.com/tableflip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Score Board\nThis module is a generic score board for your browser.\n\nUse this module by cloning the repo\n\n```sh\ngit clone git@github.com:tableflip/score-board.git\n```\n\nor\n\n```sh\nnpm install git://github.com/tableflip/score-board.git\n```\n\nDon't forget to\n\n```sh\nnpm install\n```\n\n## Usage\n\nInitiate with team names in an array:\n\n```js\nvar ScoreBoard = require('score-board')\nvar scoreBoard = new ScoreBoard(['sharks', 'jets'], localforage, cb)\n```\n\nThe ScoreBoard requires a [localforage](https://github.com/mozilla/localForage) or localforage like object for persisting scores.\n\nTeams are created with a score of 0 you can increment and deduct values asynchronously which looks like this:\n\n```js\nscoreBoard.sharks.addScore(9, cb)\n```\n\nThis will add 9 points to the shark's score. When it's done your callback function will be executed. Callback functions follow the node callback signiture below. You don't have to pass a callback in if you don't want to.\n\n```js\nfunction (err, result) {\n  if (err) throw err\n  doStuffWithResult(result)\n}\n```\n\n### Restoring teams and scores\n\nIf you create a `ScoreBoard` passing `null` for team names, it'll attempt to reinstate existing teams from storage:\n\n```js\nvar ScoreBoard = require('score-board')\n\nnew ScoreBoard(null, localforage, function (err, scoreBoard) {\n  if (err) return console.error('No teams in storage')\n  scoreBoard.getTeams(function (err, teams) {\n    console.log(teams)\n  })\n})\n```\n\n## API\n\n```js\nscoreBoard.getTeams(cb) // callback with ['sharks', 'jets']\n\n// Main score\nscoreBoard.sharks.addScore(9, cb) // callback with 9\nscoreBoard.sharks.getScore(cb) // callback with 9\nscoreBoard.sharks.setScore(10, cb) // callback with 10\nscoreBoard.sharks.deductScore(3, cb) // callback with 7\n\n// Bonus points\nscoreBoard.sharks.addBonus(9, cb) // callback with 9\nscoreBoard.sharks.getBonus(cb) // callback with 9\nscoreBoard.sharks.setBonus(10, cb) // callback with 10\nscoreBoard.sharks.deductBonus(3, cb) // callback with 7\n\n// Total (score + bonus)\nscoreBoard.sharks.getTotal(cb) // callback with 14\n```\n\n## Events\n\n### Team\n\nTeam objects emit the following events:\n\n* score:add\n* score:deduct\n* score:set\n* bonus:add\n* bonus:deduct\n* bonus:set\n\nUses tape in the browser for tests. To run the tests type `npm test` in the root of the project.\n\n---\n\nA [(╯°□°）╯︵TABLEFLIP](https://tableflip.io) side project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftableflip%2Fscore-board","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftableflip%2Fscore-board","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftableflip%2Fscore-board/lists"}