1.0.5 • Published 6 years ago

callbag-date-timer v1.0.5

Weekly downloads
4
License
ISC
Repository
-
Last release
6 years ago

callbag-date-timer

Callbag source that after given Date emits numbers in sequence to a specified period.

npm version Build Status

Examples

Emitting Sometime in the Future

import forEach from 'callbag-for-each'
import pipe from 'callbag-pipe'
import timer from 'callbag-date-timer'

const date = new Date(Date.now() + 10000)

pipe(
  timer(date),
  forEach(value => {
    // will log 0
    console.log(value)
  }),
)

Starting a Period Sometime in the Future

import forEach from 'callbag-for-each'
import pipe from 'callbag-pipe'
import timer from 'callbag-date-timer'

const date = new Date(Date.now() + 10000)

pipe(
  timer(date, 2000),
  forEach(value => {
    // will log 0 1 2 3 4 ...
    console.log(value)
  }),
)

Starting in the Past

import forEach from 'callbag-for-each'
import pipe from 'callbag-pipe'
import timer from 'callbag-date-timer'

const date = new Date(Date.now() - 10000)

pipe(
  timer(date, 2000),
  forEach(value => {
    // will log 5 6 7 8 9 ...
    console.log(value)
  }),
)
1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago