Lit's reactive properties system allows you to define properties on your custom element that automatically update the element when their values change.
// ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it | |
// ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge` | |
// Merge a `source` object to a `target` recursively | |
const merge = (target, source) => { | |
// Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties | |
for (const key of Object.keys(source)) { | |
if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key])) | |
} |
let clickStream = Rx.Observable.fromEvent(document.getElementById('link'), 'click'); | |
clickStream | |
.buffer(clickStream.debounce(250)) | |
.map(list => list.length) | |
.filter(x => x === 2) | |
.subscribe(() => { | |
console.log('doubleclick'); | |
}) |
I am in the process of introducing single page applications to where I work. For development, using node based build tools is much easier for the single page applications. However, the build process for our organization is based upon maven. Our solution started with the maven plugin frontend-maven-plugin. It worked great at first, but then we ran into a situation that I couldn't make work with it.
As stated before, at our organization, we have the older ecosystem which is maven and the newer ecosystem which is node. Our goal was to keep the hacking to a minimum. We did this by putting all of the hacks into a single super node based build file. This is what maven calls and the reason frontend-maven-plugin
wasn't sufficient. The super node based build script calls all of the other build scripts by spawning npm run
. Try as I might, I could not figure out how to make the spawn work. front-end-maven-plugin
downloads npm