I am using
sources.DOM.select('document').events('keydown')
.map(ev => Object.assign({}, ev, {type: 'keydown'}))
but the resulting stream gives objects with just the "isTrusted" property (and not "key", "code", etc.). Instead, with 'mousemove' I get events as expected (with "isTrusted" but also "movementX", "movementY", etc.). What is wrong?
You're right, not a Cycle.js problem but rather a limitation of
Object.assign
.Simply put—
Object.assign
does not copy inherited properties.This answer on a similar problem provided a working alternative:
See updated codepen.io example.
These SO questions and answers also helped clarify the situation:
Poor Use Case of Object.assign() - Simple Example
Javascript hasOwnProperty always false on Event objects?