Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: state getter #5

Merged
merged 2 commits into from
Dec 15, 2022
Merged

feat: state getter #5

merged 2 commits into from
Dec 15, 2022

Conversation

sethvincent
Copy link
Contributor

closes #4

This adds an indexer.state getter that returns the same object as the index-state event for accessing the current state of the indexer. I like a getter for this as doing something like indexer.state.current === 'idle' feels more appropriate than calling a method.

clearTimeout(timeoutId)
timeoutId = setTimeout(() => {
emitter.off('idle', onIdle)
emitter.off('indexing', onIndexing)
resolve()
}, 200)
})
}, 10)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduced this to make tests faster. i've found that i can get it as low as 1ms and never have issues.

Copy link
Member

@gmaclennan gmaclennan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@sethvincent sethvincent merged commit a4d7aa5 into main Dec 15, 2022
@sethvincent sethvincent deleted the state-getter branch December 15, 2022 16:46
gmaclennan added a commit that referenced this pull request Jul 6, 2023
* main:
  chore(release): 1.0.0-alpha.1
  fix: stricter types and publish typescript declarations (#7)
  feat: state getter (#5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

expose state method or getter
2 participants