(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// ES7, async/await | |
function sleep(ms = 0) { | |
return new Promise(r => setTimeout(r, ms)); | |
} | |
(async () => { | |
console.log('a'); | |
await sleep(1000); | |
console.log('b'); | |
})() |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
public static Task<byte[]> WaitData(this SerialPort serialPort, TimeSpan timeout, byte[] request) | |
{ | |
var tcs = new TaskCompletionSource<byte[]>(); | |
SerialDataReceivedEventHandler handler = null; | |
Timer timer = null; | |
handler = (sender, e) => | |
{ | |
var package = serialPort.ReadPackage(); |