1.1.6 • Published 7 years ago

ko-timeout v1.1.6

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

ko-timeout

deprecated please use https://github.com/sindresorhus/delay

Build Status

usage

timeout(gen, ms)

gen - a genarator function

ms - millisecond. can use '3s' or '200ms', which https://www.npmjs.com/package/ms support

if timeout, err.name will be CoTimeoutError

example

should timeout

try {
  yield timeout(function * () {
    yield sleep(50)
  }, 20)
} catch (e) {
  e.message.should.eql('timeout: exceed 20ms')
}

should get return value

var value = yield timeout(function * () {
  yield sleep(10)
  return 30;
}, 20)

value.should.eql(30)

license

MIT

1.1.6

7 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago