thunks/thunk-loop

Name: thunk-loop

Owner: thunks

Description: Asynchronous tasks loop (while (true) { ... }).

Created: 2016-02-26 11:14:15.0

Updated: 2018-03-15 11:21:08.0

Pushed: 2017-06-04 13:39:48.0

Homepage:

Size: 9

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

thunk-loop

Asynchronous tasks loop (while (true) { … }).

NPM version Build Status Downloads

thunks
Demo

Infinite Clock:

t thunk = require('thunks')()
t thunkLoop = require('..')

i = 0
kLoop(function *() {
eld thunk.delay(1000)
= ++i % 60
nsole.log(i)
turn true
unction (_) {
 will never reach here.

API
t thunkLoop = require('thunk-loop')
thunkLoop(iter[, errorHandle])

return thunk function. You should run the thunk function because of thunk's lazy evaluation. If iter is infinite, you will not get the last result except error occured.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.