Skip to content

Commit

Permalink
formattign
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlindHawk committed Apr 11, 2024
1 parent bce86ed commit 2cfade7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"markdown": {
},
"excludes": [
"**/coverage",
"**/dist",
"**/node_modules",
"**/*-lock.json",
"**/.expo",
Expand Down
22 changes: 16 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ export default class Roulette {

// getters

get isRolling() { return this._isRolling }
get isRolling() {
return this._isRolling
}

get degrees() { return this._degrees }
get degrees() {
return this._degrees
}

get history() { return this._history }
get history() {
return this._history
}

get sections() { return this._sections.get() }
get sections() {
return this._sections.get()
}

// setters

Expand Down Expand Up @@ -108,7 +116,8 @@ export default class Roulette {
const sections = this._sections.length
const point = (360 * index) / this._sections.length + 360 / this._sections.length / 2 - this.arrow.shift
const loosen = this.settings.roll.landing === 'random'
? Math.round((Math.random() * 320) / sections - 320 / sections / 2) : 0
? Math.round((Math.random() * 320) / sections - 320 / sections / 2)
: 0
const sprint = Math.floor(this.settings.roll.duration / 360 / 3) * 360 + point + loosen

const audio_distance = 360 / this._sections.length
Expand Down Expand Up @@ -161,7 +170,8 @@ export default class Roulette {
const defaultIncrease = 12
const sections = this._sections.length
const loosen = this.settings.roll.landing === 'random'
? Math.round((Math.random() * 320) / sections - 320 / sections / 2) : 0
? Math.round((Math.random() * 320) / sections - 320 / sections / 2)
: 0
let sprint = Math.floor(this.settings.roll.duration / 360 / 3) * 360 + loosen

const audio_distance = 360 / this._sections.length
Expand Down
4 changes: 3 additions & 1 deletion tests/async-roll.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ vi.spyOn(window.HTMLMediaElement.prototype, 'play').mockImplementation(() => {})
document.body.innerHTML = `<div id="roulette"></div>`
Promise.withResolvers = () => {
let resolve, reject
const promise = new Promise((res, rej) => { resolve = res, reject = rej })
const promise = new Promise((res, rej) => {
resolve = res, reject = rej
})
return { promise, resolve, reject }
}

Expand Down
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export default defineConfig({
coverage: {
include: ['src/index.ts', 'src/builders'],
},
reporters: ['verbose']
reporters: ['verbose'],
},
})

0 comments on commit 2cfade7

Please sign in to comment.