cancel all pending operations on a closing channel
refactor lossy.js in examples