Create a channel that gets a single message after the specified duration, and then closes.
Create a channel that gets a single message after the specified duration, and then closes.
Example:
val after = TimeChannels.after(Duration(10, TimeUnit.MILLISECONDS)) after.recv() // 10 ms has passed. // You don't need to close the channel
Create a ticker channel, see https://gobyexample.com/tickers
Create a ticker channel, see https://gobyexample.com/tickers
val ticker = TimeChannels.ticker(Duration(10, TimeUnit.MILLISECONDS)) val instant = ticker.recv() ticker.close()
The object contains channel generators similar to GoLang: https://gobyexample.com/tickers