Skip to content

Commit

Permalink
perf: upgrade setValue method in same value setting
Browse files Browse the repository at this point in the history
  • Loading branch information
wenqing committed Sep 15, 2023
1 parent 7450509 commit 9e25eb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/index.d.ts
Expand Up @@ -44,9 +44,9 @@ interface StarscoreInstance {

hoverValue: number | null

get renderValue(): number
readonly renderValue: number

get scoreItems(): ScoreItemsRecord[]
readonly scoreItems: ScoreItemsRecord[]

setOptions(opts: StarscoreOptions, reRender?: boolean): StarscoreInstance

Expand Down
2 changes: 2 additions & 0 deletions src/lib/Starscore.ts
Expand Up @@ -58,6 +58,8 @@ class Starscore implements StarscoreInstance {
hoverValue: number | null = null

setValue(value: number) {
if (this.value === value) return this

if (value < 0) {
this.value = 0
} else if (value > this.options.count) {
Expand Down

0 comments on commit 9e25eb6

Please sign in to comment.