Imagine you have to create a reusable element that will be widely used across your project (or even multiple projects). Before I know about Web Components the natural way of achieving this would be creating a component in some framework (like Vue or React). Then you could easily reuse it.
Have you ever wondered how Facebook displays this cool custom message in the browser’s console? Well, I did.
In the previous post, we learned how we can define and react to change in object properties. Let’s use that knowledge to create reactive form helper. Let’s reuse observe()
function.
To understand what’s happening under the hood of modern JS frameworks (like Vue.js) let’s focus on how to make an object property observable.
A short comparison between those two patterns in JS, and why factory functions might be easier to use.
The binary search algorithm allows you to efficiently check if the value exists and get there index from an array. It does not need to iterate over the whole array which complexity is O(n)
. But thanks to its design it can find the solution in O(log n)
time. But the important precondition is fact, that array must be sorted.
Recently I have a task to prepare a modal that will be displayed on top of a page. Nothing really fancy. So by default I will use below css to position a modal:
.modal {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
}
If you check on desktop everything looks good
I have attended Meet.js KRK November where one of the talks was about Node.js performance. Krzysztof Słonka from Allegro presented his story about performance analysis
The app that was examined basically has one job to do. Convert JSON files to HTML. He described them as a worker-renders. The node profiler together with a flamegraph was used to determined what to optimize. Below you can see an example output from flamegraph. You can manipulate with this graph to better determine ‘hot’ places of your application.
JAM - it’s an acronym form JavaScript, APis and Markup. It’s a modern architecture for fast, client-side oriented web development. It is a static website - no running servers are needed to show the content. For example, the site might be hosted directly from the CDN.