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

Create interval method #159

Closed
sergeysova opened this issue Jun 30, 2021 · 1 comment
Closed

Create interval method #159

sergeysova opened this issue Jun 30, 2021 · 1 comment
Assignees

Comments

@sergeysova
Copy link
Member

const { tick, opened } = interval({ timeout: 300, start: event, stop: event });

sample({
  clock: tick,
  target: readTimeFx,
})

// or (bad example) but take an idea
$time.on(tick, () => Date.now())

Originally posted by @sergeysova in #152 (comment)

@sergeysova
Copy link
Member Author

sergeysova commented Jun 30, 2021

It is can be useful with time({ clock }) method:

const $now = time({ clock: interval({ timeout: 100, start, stop }).tick })

It reads as:

After start is triggered, each 100 ms update $now with a new Date. When stop is triggered disable updates

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

No branches or pull requests

1 participant