wavesurfer.js
Version:
Interactive navigable audio visualization using Web Audio and Canvas
17 lines (16 loc) • 444 B
JavaScript
/**
* Apply a map of styles to an element
*
* @param {HTMLElement} el The element that the styles will be applied to
* @param {Object} styles The map of propName: attribute, both are used as-is
*
* @return {HTMLElement} el
*/
export default function style(el, styles) {
Object.keys(styles).forEach(prop => {
if (el.style[prop] !== styles[prop]) {
el.style[prop] = styles[prop];
}
});
return el;
}