diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..83c0101 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,9 @@ +test: + script: + - npm install + - npx vitest --reporter=verbose + artifacts: + reports: + coverage_report: + coverage_format: clover + path: coverage/clover.xml diff --git a/README.md b/README.md index 280884d..d7268bd 100644 --- a/README.md +++ b/README.md @@ -236,11 +236,12 @@ interface AudioData = { ### roll options -| Function | Comment | -| ------------------------ | ------------------------------------------------------- | -| roll(value) | rolls the roulette to an index with said value | -| rollByIndex(index) | rolls the roulette to said index | -| rollProbabilities(probs) | rolls the roulette using custom probabilities[] | +| Function | Comment | +| ------------------------- | ------------------------------------------------------------- | +| roll(value) | rolls the roulette to an index with said value | +| rollByIndex(index) | rolls the roulette to said index | +| rollProbabilities(probs) | rolls the roulette using custom probabilities[] | +| asyncRollByIndex(promise) | rolls the roulette while waiting for the value in the promise | @@ -292,7 +293,7 @@ const roulette = new Roulette({ padding: 20, color: '#000', shift: 0, - } + }, sections: [{ value: 'fail', probability: 7, @@ -329,20 +330,20 @@ const roulette = new Roulette({ width: 4, color: 'grey', }, - } + }, colors: [ 'yellow', 'white', 'white', 'white' ], audio: { src: 'https://link_to_some_audio' volume: 1, play: { once: true }, - } + }, }); ``` You can then roll the roulette like so. -``` -roll() // to a random value given equal probabilities -rollIndex(2) // to the grey car -rollProbabilities() // using the probabilities given in the costructor +```typescript +roulette.roll() // to a random value given equal probabilities +roulette.rollIndex(2) // to the grey car +roulette.rollProbabilities() // using the probabilities given in the costructor ``` \ No newline at end of file diff --git a/index.html b/index.html index d4266ae..0efa4c3 100644 --- a/index.html +++ b/index.html @@ -88,6 +88,11 @@