<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Boris Joskic</title>
    <description>The latest articles on DEV Community by Boris Joskic (@brsjsk).</description>
    <link>https://dev.to/brsjsk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F64442%2Fd2023b0f-2abb-4ac0-a691-62ddf2fcbce5.jpeg</url>
      <title>DEV Community: Boris Joskic</title>
      <link>https://dev.to/brsjsk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/brsjsk"/>
    <language>en</language>
    <item>
      <title>Phaser - Why, what, how?</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Thu, 21 Nov 2024 21:48:25 +0000</pubDate>
      <link>https://dev.to/brsjsk/phaser-why-what-how-3i3h</link>
      <guid>https://dev.to/brsjsk/phaser-why-what-how-3i3h</guid>
      <description>&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Games got me into programming. As much as I loved playing them, I loved figuring out how they are even made. To this day, I know the basics.. To challenge myself, I thought it could be a good idea to finally figure out at least some part of it. Could using a language I already know and use on a daily basis make it easier?&lt;/p&gt;

&lt;p&gt;I'll try to document my findings in series of blog posts..&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm not really sure on what I'll try to build. Its most likely gonna be a multiplayer RPG, and yes, I know..thats a lot of work, at least I know what I'm getting myself into..&lt;/p&gt;

&lt;p&gt;To make things as simple as possible, its just gonna be PVE multiplayer, where you can join worlds with other players or create your own private world..there's gonna be different paths you can take and upgrade skills within that path. So basically, as any other RPG game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3rkkth3daghtds2we8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3rkkth3daghtds2we8w.png" width="800" height="554"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The changes that this will be a fully playable game, let's be honest, are low..but at least I'll spend some time figuring out things I'm interested in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A sane person might go with Unreal, Unity or even Godot. But I'm going with Phaser.js as game engine. I'm gonna use a language I'm most familiar with with a framework and concepts I know nothing about. I guess with official docs and community examples I might get something right..&lt;/p&gt;

&lt;p&gt;As it's gonna be a pixelated top down game(no 3d here for now..), I'm going with Tiled as my editor for the world.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.mapeditor.org/" rel="noopener noreferrer"&gt;https://www.mapeditor.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://craftpix.net/freebies/free-pixel-citizens-for-top-down-tower-defense/" rel="noopener noreferrer"&gt;https://craftpix.net/freebies/free-pixel-citizens-for-top-down-tower-defense/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://craftpix.net/freebies/free-fields-tileset-pixel-art-for-tower-defense/" rel="noopener noreferrer"&gt;https://craftpix.net/freebies/free-fields-tileset-pixel-art-for-tower-defense/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzcndg7grf1d0jn08wlo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzcndg7grf1d0jn08wlo.png" width="800" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To skip additional overhead that includes me creating all the art..I'm gonna download a free one.&lt;br&gt;
No point in buying or creating custom tiles, characters, icons and animations when I'm just figuring out what how and where. I've decided to go with &lt;a href="https://craftpix.net/freebies/free-fields-tileset-pixel-art-for-tower-defense/" rel="noopener noreferrer"&gt;https://craftpix.net/freebies/free-fields-tileset-pixel-art-for-tower-defense/&lt;/a&gt; . They have couple of free download, and couple of paid ones..the paid ones will be useful if I'm able to code at least something playable..&lt;/p&gt;

&lt;p&gt;Of course, I'm going with Vite + Typescript.&lt;br&gt;
After some tutorials on Tiled and Phaser, deleting some boilerplate code and writing a veeeery simple scene, I've got my tiles on the screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucyodhfbkbo5jupm842b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucyodhfbkbo5jupm842b.png" width="800" height="509"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmx9uy4ia47soc3iszqi6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmx9uy4ia47soc3iszqi6.png" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next step would be adding a character, movement and some camera improvements..&lt;/p&gt;

&lt;p&gt;Originally posted on &lt;a href="https://joskonic.com/2024/11/21/phaser-why-what-how/" rel="noopener noreferrer"&gt;https://joskonic.com/2024/11/21/phaser-why-what-how/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>#2 - Leetcode - Kids with the greates number of candies solution</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Tue, 07 Nov 2023 00:00:00 +0000</pubDate>
      <link>https://dev.to/brsjsk/2-leetcode-kids-with-the-greates-number-of-candies-solution-baa</link>
      <guid>https://dev.to/brsjsk/2-leetcode-kids-with-the-greates-number-of-candies-solution-baa</guid>
      <description>&lt;p&gt;Original post: &lt;a href="https://brsjsk.github.io/posts/leetcode-greatest-number-of-candies" rel="noopener noreferrer"&gt;brsjsk.github.io&lt;/a&gt;&lt;br&gt;
Github &lt;a href="https://github.com/BrsJsk/2-kids-with-the-greatest-number-of-candies" rel="noopener noreferrer"&gt;url&lt;/a&gt;&lt;br&gt;
Leetcode &lt;a href="https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/" rel="noopener noreferrer"&gt;url&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an integer extraCandies, denoting the number of extra candies that you have.&lt;/p&gt;

&lt;p&gt;Return a boolean array result of length n, where result[i] is true if, after giving the ith kid all the extraCandies, they will have the greatest number of candies among all the kids, or false otherwise.&lt;/p&gt;

&lt;p&gt;Note that multiple kids can have the greatest number of candies.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: candies = [2,3,5,1,3], extraCandies = 3
Output: [true,true,true,false,true]
Explanation: If you give all extraCandies to:
- Kid 1, they will have 2 + 3 = 5 candies, which is the greatest among the kids.
- Kid 2, they will have 3 + 3 = 6 candies, which is the greatest among the kids.
- Kid 3, they will have 5 + 3 = 8 candies, which is the greatest among the kids.
- Kid 4, they will have 1 + 3 = 4 candies, which is not the greatest among the kids.
- Kid 5, they will have 3 + 3 = 6 candies, which is the greatest among the kids.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Solution 1
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @param {number[]} candies
 * @param {number} extraCandies
 * @return {boolean[]}
 */
module.exports.kidsWithCandies = (candies, extraCandies) =&amp;gt; {
    const largestNumber = Math.max(...candies);

    return candies.map(candie =&amp;gt; candie + extraCandies &amp;gt;= largestNumber);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a very simple one-liner solution..but, it's slower to execute then a good old for loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Runtime: 136 ms, faster than 5.86% of JavaScript online submissions for Kids With the Greatest Number of Candies.
Memory Usage: 36.7 MB, less than 10.89% of JavaScript online submissions for Kids With the Greatest Number of Candies.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Solution 2
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @param {number[]} candies
 * @param {number} extraCandies
 * @return {boolean[]}
 */
module.exports.kidsWithCandies = (candies, extraCandies) =&amp;gt; {
    const largestNumber = Math.max(...candies);
    let items = [];

    for (let i = 0; i &amp;lt; candies.length; i++) {
        items.push(candies[i] + extraCandies &amp;gt;= largestNumber)
    }

    return items;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Runtime: 76 ms, faster than 46.11% of JavaScript online submissions for Kids With the Greatest Number of Candies.
Memory Usage: 37.1 MB, less than 7.66% of JavaScript online submissions for Kids With the Greatest Number of Candies.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Difference
&lt;/h1&gt;

&lt;p&gt;Difference in execution speed is quite noticable.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbrsjsk.github.io%2Fstatic%2F4a0ca2e0091c77554423ffa8d47e2d19%2Fe751c%2Fms_speed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbrsjsk.github.io%2Fstatic%2F4a0ca2e0091c77554423ffa8d47e2d19%2Fe751c%2Fms_speed.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But difference in memory usage? Ehh, not so much noticable..&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbrsjsk.github.io%2Fstatic%2F73d9f1c68de3593cd061d28e1f4fd623%2F62a6a%2Fmb_usage.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbrsjsk.github.io%2Fstatic%2F73d9f1c68de3593cd061d28e1f4fd623%2F62a6a%2Fmb_usage.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Leetcode - Kids with the greates number of candies solution</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Tue, 11 Jul 2023 13:27:24 +0000</pubDate>
      <link>https://dev.to/brsjsk/leetcode-kids-with-the-greates-number-of-candies-solution-2pf4</link>
      <guid>https://dev.to/brsjsk/leetcode-kids-with-the-greates-number-of-candies-solution-2pf4</guid>
      <description>&lt;p&gt;Original post: &lt;a href="https://brsjsk.github.io/posts/leetcode-greatest-number-of-candies" rel="noopener noreferrer"&gt;brsjsk.github.io&lt;/a&gt;&lt;br&gt;
Github &lt;a href="https://github.com/BrsJsk/2-kids-with-the-greatest-number-of-candies" rel="noopener noreferrer"&gt;url&lt;/a&gt;&lt;br&gt;
Leetcode &lt;a href="https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/" rel="noopener noreferrer"&gt;url&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an integer extraCandies, denoting the number of extra candies that you have.&lt;/p&gt;

&lt;p&gt;Return a boolean array result of length n, where result[i] is true if, after giving the ith kid all the extraCandies, they will have the greatest number of candies among all the kids, or false otherwise.&lt;/p&gt;

&lt;p&gt;Note that multiple kids can have the greatest number of candies.&lt;/p&gt;

&lt;p&gt;Example 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: candies = [2,3,5,1,3], extraCandies = 3
Output: [true,true,true,false,true]
Explanation: If you give all extraCandies to:
- Kid 1, they will have 2 + 3 = 5 candies, which is the greatest among the kids.
- Kid 2, they will have 3 + 3 = 6 candies, which is the greatest among the kids.
- Kid 3, they will have 5 + 3 = 8 candies, which is the greatest among the kids.
- Kid 4, they will have 1 + 3 = 4 candies, which is not the greatest among the kids.
- Kid 5, they will have 3 + 3 = 6 candies, which is the greatest among the kids.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Solution 1
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @param {number[]} candies
 * @param {number} extraCandies
 * @return {boolean[]}
 */
module.exports.kidsWithCandies = (candies, extraCandies) =&amp;gt; {
    const largestNumber = Math.max(...candies);

    return candies.map(candie =&amp;gt; candie + extraCandies &amp;gt;= largestNumber);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a very simple one-liner solution..but, it's slower to execute then a good old for loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Runtime: 136 ms, faster than 5.86% of JavaScript online submissions for Kids With the Greatest Number of Candies.
Memory Usage: 36.7 MB, less than 10.89% of JavaScript online submissions for Kids With the Greatest Number of Candies.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Solution 2
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @param {number[]} candies
 * @param {number} extraCandies
 * @return {boolean[]}
 */
module.exports.kidsWithCandies = (candies, extraCandies) =&amp;gt; {
    const largestNumber = Math.max(...candies);
    let items = [];

    for (let i = 0; i &amp;lt; candies.length; i++) {
        items.push(candies[i] + extraCandies &amp;gt;= largestNumber)
    }

    return items;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Runtime: 76 ms, faster than 46.11% of JavaScript online submissions for Kids With the Greatest Number of Candies.
Memory Usage: 37.1 MB, less than 7.66% of JavaScript online submissions for Kids With the Greatest Number of Candies.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Difference
&lt;/h1&gt;

&lt;p&gt;Difference in execution speed is quite noticable.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbrsjsk.github.io%2Fstatic%2F4a0ca2e0091c77554423ffa8d47e2d19%2Fe751c%2Fms_speed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbrsjsk.github.io%2Fstatic%2F4a0ca2e0091c77554423ffa8d47e2d19%2Fe751c%2Fms_speed.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But difference in memory usage? Ehh, not so much noticable..&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbrsjsk.github.io%2Fstatic%2F73d9f1c68de3593cd061d28e1f4fd623%2F62a6a%2Fmb_usage.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbrsjsk.github.io%2Fstatic%2F73d9f1c68de3593cd061d28e1f4fd623%2F62a6a%2Fmb_usage.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Started working on a library for building web sites</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Fri, 24 Apr 2020 12:13:20 +0000</pubDate>
      <link>https://dev.to/brsjsk/started-working-on-a-library-for-building-web-sites-43fl</link>
      <guid>https://dev.to/brsjsk/started-working-on-a-library-for-building-web-sites-43fl</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FBrsJsk%2Fsfy%2Fmaster%2Fassets%2Flogo.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FBrsJsk%2Fsfy%2Fmaster%2Fassets%2Flogo.svg" width="280" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While building my personal, very simple, web site I did not really want to use frameworks such as Angular or React as it would be a bit too much for a simple site..and did not really want to set up webpack from scratch..&lt;/p&gt;

&lt;p&gt;So, what does a developer do when he does not want to use premade solutions which make his life easier? Creates his own library, of course!&lt;/p&gt;

&lt;p&gt;I really liked the idea of it, plus it is nice practice for me to work on a library.&lt;/p&gt;

&lt;p&gt;What it does now is that it converts SCSS to CSS, MD to HTML and displays blog posts list in index.html file.&lt;/p&gt;

&lt;p&gt;It's barebones but its fun to work on this, my kind-of-first library..I was really excited when I found out what npm link does!&lt;/p&gt;

&lt;p&gt;Here is a github repo url: &lt;a href="https://github.com/BrsJsk/sfy" rel="noopener noreferrer"&gt;https://github.com/BrsJsk/sfy&lt;/a&gt;&lt;br&gt;
Docs: &lt;a href="https://brsjsk.github.io/sfy/#/" rel="noopener noreferrer"&gt;https://brsjsk.github.io/sfy/#/&lt;/a&gt;&lt;br&gt;
Live example: &lt;a href="https://keen-swanson-66c35f.netlify.app/" rel="noopener noreferrer"&gt;https://keen-swanson-66c35f.netlify.app/&lt;/a&gt;&lt;br&gt;
Comments are welcome!&lt;/p&gt;

&lt;p&gt;Might not be the most original idea(we already have tons of libraries and frameworks), but I personally plan to use it and continue work on it.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>html</category>
      <category>web</category>
    </item>
    <item>
      <title>Angular custom elements - introduction</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Mon, 16 Mar 2020 15:26:51 +0000</pubDate>
      <link>https://dev.to/brsjsk/angular-custom-elements-introduction-2cen</link>
      <guid>https://dev.to/brsjsk/angular-custom-elements-introduction-2cen</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LiYAhBw6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1in1ws6i5rq5a14mjclq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LiYAhBw6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1in1ws6i5rq5a14mjclq.png" alt="logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In a land of framework wars, one thing that could help us are web components. Creating components and being able to use them in any javascript framework would be nice..in this series we will explore creating web components using Angular, publishing them and using them in plan javascript, React etc.&lt;/p&gt;

&lt;p&gt;Lets start by creating a new application&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng new br-date
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Add @angular/elements package&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng add @angular/elements
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Generate new component (I created br-date but you can use whatever you want)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng generate component br-date
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We need to update entryComponents inside app.module.ts to include our newly created component  and also define a custom element.&lt;/p&gt;

&lt;p&gt;App module will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { BrowserModule } from "@angular/platform-browser";
import { NgModule, Injector } from "@angular/core";

import { AppComponent } from "./app.component";
import { BrDateComponent } from "./components/br-date/br-date.component";

import { createCustomElement } from "@angular/elements";
@NgModule({
 declarations: [AppComponent, BrDateComponent],
 imports: [BrowserModule],
 providers: [],
 entryComponents: [BrDateComponent]
})
export class AppModule {
 constructor(private injector: Injector) {}

 ngDoBootstrap() {
   const element = createCustomElement(BrDateComponent, {
     injector: this.injector
   });

   customElements.define('br-date', element);
 }
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Inside ngDoBootstrap function, we are creating a custom element using createCustomElement method from @angular/elements and defining br-date component.&lt;/p&gt;

&lt;p&gt;We also need to update our angular.json. Inside projects-&amp;gt;br-date-&amp;gt;architect-&amp;gt;build-&amp;gt;scripts object we need to add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   "input": "node_modules/document-register-element/build/document-register-element.js"
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;By default, angular will hash outputs inside dist directory, which is not really useful when building a web component we plan to publish.&lt;/p&gt;

&lt;p&gt;Lets create custombuild.sh file with following content:&lt;br&gt;
It will build application without hashing and concat source files inside index.js file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/sh
ng build br-date --prod --output-hashing=none &amp;amp;&amp;amp; cat dist/br-date/runtime-es5.js dist/br-date/polyfills-es5.js dist/br-date/scripts.js dist/br-date/main-es5.js &amp;gt; dist/br-date/index.js
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now we can test this.&lt;br&gt;
Fastest way, in my opinion to test this, is to create a example folder with index.html and index.js.&lt;/p&gt;

&lt;p&gt;index.html will have following content&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
   &amp;lt;meta charset="UTF-8"&amp;gt;
   &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
   &amp;lt;title&amp;gt;Document&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
   &amp;lt;br-date&amp;gt;&amp;lt;/br-date&amp;gt;
   &amp;lt;script src="./index.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and inside index.js we will just import our built component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import '../dist/br-date/index';
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We can run example app using Parcel or whatever you like.&lt;br&gt;
Inside the example directory, run parcel index.html&lt;br&gt;
You can get more info if you are interested at : &lt;a href="https://parceljs.org/"&gt;https://parceljs.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you open your app in browser, you should see something like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ipZjtBfr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3ig3spse7cxbcvlpnmmx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ipZjtBfr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3ig3spse7cxbcvlpnmmx.png" alt="End REsult"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you encounter some problems, you can leave a comment here.&lt;br&gt;
Source code is hosted at: &lt;a href="https://github.com/BrsJsk/br-date"&gt;https://github.com/BrsJsk/br-date&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>webcomponents</category>
      <category>html</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Alternatives to Google Analytics</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Sun, 26 May 2019 11:30:40 +0000</pubDate>
      <link>https://dev.to/brsjsk/alternatives-to-google-analytics-3m81</link>
      <guid>https://dev.to/brsjsk/alternatives-to-google-analytics-3m81</guid>
      <description>&lt;p&gt;Let's say you have an open source app and you would like to use some analytics tool to see how much traffic you have, where do your visitors come from etc.&lt;/p&gt;

&lt;p&gt;But you do not want to use Google Analytics.&lt;br&gt;
You want something that respects user's privacy. You want something that developers wont complain about when they look at your code.&lt;/p&gt;

&lt;p&gt;What tools would you use? What are alternatives to Google Analytics?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>analytics</category>
    </item>
    <item>
      <title>Improve Your Ionic App Performance</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Thu, 07 Feb 2019 14:46:11 +0000</pubDate>
      <link>https://dev.to/jsguru_io/improve-your-ionic-app-performance-2p2j</link>
      <guid>https://dev.to/jsguru_io/improve-your-ionic-app-performance-2p2j</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F0041lc9rkx1igqj7cfst.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F0041lc9rkx1igqj7cfst.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ionic allows developers to build mobile applications using web technologies and allows access to native features such as file storage, camera, flashlight and many more. The first version was released in 2013 and built using Apache Cordova and AngularJS but recent versions, while still using Apache Cordova, are using Angular instead of AngularJS.&lt;/p&gt;

&lt;p&gt;The most recent version of Ionic, version 4, includes performance improvements but in my opinion, it’s still having a tough time competing with the performance of native apps, or even React Native.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Make a production build&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This might be an obvious one. While developing and testing, we usually build debug versions of the app. How many times have you build an apk and after installing you realized it’s a debug apk? I’ve done it... a couple of times.&lt;/p&gt;

&lt;p&gt;The default build command will generate a debug apk which does not have optimized code.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ionic cordova build android --prod --release&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;command will do the trick. It will generate a production-ready apk with minified and optimized code.&lt;/p&gt;

&lt;p&gt;Consider this first tip more like a reminder..&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Add a Service Worker&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Adding a Service Worker to an Ionic app has its benefits. One of them is that it can cache your static assets so your app can load faster. Not only can it cache your app’s static assets, but it can also cache some data from the API? That probably has some use.&lt;/p&gt;

&lt;p&gt;Ionic has built-in support for service workers and adding it is pretty easy.&lt;/p&gt;

&lt;p&gt;If you are interested, you can get more information in their documentation.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdelivery.eusi.cloud%2Fapi%2Fv1%2Ff1a4305c-e431-4668-ae4c-02f78c656a41%2Fmedia%2Fs3%2F1549549262275_190206-18-2-Cache.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdelivery.eusi.cloud%2Fapi%2Fv1%2Ff1a4305c-e431-4668-ae4c-02f78c656a41%2Fmedia%2Fs3%2F1549549262275_190206-18-2-Cache.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Native Page Transitions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;By default, when switching to a different page, Ionic will use CSS animations to switch between views. This works fine mostly, but you may notice lags sometimes on devices with lower specs and also it’s not very customizable.&lt;/p&gt;

&lt;p&gt;To solve this problem, you should switch to Native Page Transitions which uses native hardware device acceleration to animate transitions.&lt;/p&gt;

&lt;p&gt;From my experience, performance is improved and the app feels much more native.&lt;/p&gt;

&lt;p&gt;It’s supported on Android, iOS and Windows Mobile and you can start using it pretty quickly.&lt;/p&gt;

&lt;p&gt;Regarding the customization, you can change the swipe direction, duration, delay in Android and iOS and more.&lt;/p&gt;

&lt;p&gt;You can get more information in their &lt;a href="https://ionicframework.com/docs/native/native-page-transitions/" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Use Virtual Scroll and Infinite Scroll&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you are working with a list, you are probably using the Ionic list component which is completely fine and will offer native UI depending on the platform.&lt;/p&gt;

&lt;p&gt;However, if you have a large list you may notice some sluggishness. To get rid of that, you can start using Virtual Scroll and Infinite Scroll.&lt;/p&gt;

&lt;p&gt;Infinite Scroll is just an Ionic component with the infinite scroll logic. It will call a certain action when user reaches the end of the list. It’s great for pagination as you can load a certain number of items, and when needed load more and append it to the original list. It also offers customization of the loading indicator where you can change the text and spinner.&lt;/p&gt;

&lt;p&gt;Virtual scroll will take full list of the array, but only render items that are currently visible which can greatly improve performance. As the user scrolls, views are reused but are filled with different data depending of the row.&lt;/p&gt;

&lt;p&gt;When should you use Virtual Scroll?&lt;/p&gt;

&lt;p&gt;When you have a somewhat larger amount of data but do not need the Infinite scroll option(eg. all data is loaded in one API call), you can use it and it will greatly benefit you!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Great performance does not come by default in Hybrid apps no matter which starter kit you use. Before trying any performance optimization tricks, do not forget to optimize your own code, remove unused imports and CSS and optimize your images! Even the small stuff can make a difference.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before you go…
&lt;/h3&gt;

&lt;p&gt;If you enjoyed reading this post please &lt;strong&gt;share&lt;/strong&gt; it. You should check out our other publications, you might like them too! We write from time to time about software development, tips and tricks, and how to become a better developer and business person in general. Join us on the journey of constant improvement!&lt;/p&gt;

&lt;p&gt;Follow us on &lt;a href="https://www.facebook.com/jsguruio/" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt;, &lt;a href="https://twitter.com/jsguru_software" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://www.linkedin.com/company/jsguru" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://medium.com/jsguru" rel="noopener noreferrer"&gt;Medium&lt;/a&gt; or &lt;a href="https://dev.to/jsguru_io"&gt;DEV.to&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://jsguru.io/blog/improve-your-ionic-app-performance" rel="noopener noreferrer"&gt;&lt;em&gt;jsguru.io&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ionic</category>
      <category>mobileappdevelopment</category>
      <category>ionicframework</category>
      <category>angular</category>
    </item>
    <item>
      <title>Lazy loading modules with Webpack</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Tue, 08 Jan 2019 14:07:13 +0000</pubDate>
      <link>https://dev.to/brsjsk/lazy-loading-modules-with-webpack-4emg</link>
      <guid>https://dev.to/brsjsk/lazy-loading-modules-with-webpack-4emg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6d6bhzam9xle181ci2l5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6d6bhzam9xle181ci2l5.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Webpack is a great tool and it's really great to know at least basics of it. If we are working with Angular CLI, or Create React App, we already have webpack setup there, but if we are working on a web application that's not using a Javascript Framework, we should probably user a bundler. Sure, we could go with no-setup-needed Parcel but if we want more control, go with Webpack. My personal web site is all Javascript, only one HTML file and no framework. I'me using webpack as a bundler and lazy loading to improve performance and I'm really happy with it!&lt;/p&gt;

&lt;p&gt;To get started, run npm init -y and create the following structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src / 
--- notLazyLoaded.js
--- lazyLoaded.js
index.html
main.js
webpack.config.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the following command to install webpack:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install webpack webpack-cli html-webpack-plugin webpack-dev-server --save-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We've installed webpack, webpack plugin for adding our index.html into the bundle and dev server.&lt;/p&gt;

&lt;p&gt;Let's add some code to our webpack config&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  entry: "./main.js",
  output: {
    filename: "[name].[hash].bundle.js",
    path: path.resolve(__dirname, "dist")
  },
  devtool: "inline-source-map",
  devServer: {
    contentBase: "./dist",
    port: 9000
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: "./index.html"
    })
  ]
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside our package.json, add a script to bundle and run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; "webpack": "webpack-dev-server --open"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pretty basic but it will bundle our application and open our web application on port 9000.&lt;/p&gt;

&lt;p&gt;Inside the HTML file, I've added 2 buttons, one will call notLazyLoaded.js and the other one will lazyLoaded.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;body&amp;gt;
    &amp;lt;button id="alert"&amp;gt;Alert&amp;lt;/button&amp;gt; 
    &amp;lt;button id="lazyAlert"&amp;gt;Lazy Alert&amp;lt;/button&amp;gt;
  &amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;lazyLoaded.js and notLazyLoaded.js have basically same code.&lt;/p&gt;

&lt;h1&gt;
  
  
  lazyLoaded.js
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const showLazyAlert = () =&amp;gt; {
  alert("Hello from lazyLoaded.js");
};

export { showLazyAlert };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  notLazyLoaded.js
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const showAlert = () =&amp;gt; {
  alert("Hello from notLazyLoaded.js");
};

export { showAlert };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In our main.js, we will add code to show an alert depending of the button clicked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { showAlert } from "./src/notLazyLoaded";

window.onload = () =&amp;gt; {
  const alertBtn = document.querySelector("#alert");
  const lazyAlertBtn = document.querySelector("#lazyAlert");

  alertBtn.addEventListener("click", () =&amp;gt; {
      showAlert();
  });
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Currently, if we open the app, we see in the network tab that only main.js is loaded on initial load, we click the 'Alert' button and an alert shows up which is already loaded in the bundle. Now comes the main part, making changes so when user clicks on 'Lazy Alert' button, lazyLoaded.js module loads and executes.&lt;/p&gt;

&lt;p&gt;Inside main.js, add following code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lazyAlertBtn.addEventListener("click", () =&amp;gt; {
    import(/* webpackChunkName: "lazyLoaded" */ './src/lazyLoaded').then(module =&amp;gt; {
        module.showLazyAlert();
    });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save and open the app. On initial load, we only have the main.js bundle loaded, when we click the Lazy Alert button, lazyLoaded.js bundle loads and executes code. That's it. It will load only when it needs to load and will improve initial load time and overall performance of the app.&lt;/p&gt;

&lt;p&gt;Source code is hosted on Github.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/BrsJsk/webpack-lazy-loading
cd webpack-lazy-loading
npm i
npm run webpack
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>lazy</category>
      <category>loading</category>
      <category>webpack</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Published my first NPM package that actually does something</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Sun, 27 May 2018 11:12:32 +0000</pubDate>
      <link>https://dev.to/brsjsk/published-my-first-npm-package-that-actually-does-something-3l9n</link>
      <guid>https://dev.to/brsjsk/published-my-first-npm-package-that-actually-does-something-3l9n</guid>
      <description>

&lt;p&gt;Yesterday morning I was playing a bit with some personal project, and found myself having to add a simple loader. Nothing complicated, but I just wanted to do it a different way. &lt;/p&gt;

&lt;p&gt;Could I create a package that I could reuse after? Sure.&lt;/p&gt;

&lt;p&gt;Got an idea how I could do it, so just opened StackBlitz and started playing with it. It was working fine, and was doing what it's supposed to do.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is it?
&lt;/h1&gt;

&lt;p&gt;Just a simple JavaScript library for displaying and hiding loaders.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why?
&lt;/h1&gt;

&lt;p&gt;Why not? It was fun to make, and I could use it anytime I want to.&lt;/p&gt;

&lt;h1&gt;
  
  
  Usage
&lt;/h1&gt;

&lt;p&gt;It's pretty simple. You initialize a loader, and send id of element where you want it to be displayed and type of loader as parameters.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let loader = new Loader('app', 'standard');

// show loader
loader.show();

// hide loader
loader.hide();
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Currently, there are 4 different loaders, but I will probably add more.&lt;br&gt;
You can check it out at &lt;a href="https://github.com/BrsJsk/brsjs-loader"&gt;github repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Nothing complex or new, but it was fun to make and play with it.&lt;/p&gt;


</description>
      <category>javascript</category>
      <category>npm</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Top 10 reasons to upgrade your Angular Application</title>
      <dc:creator>Boris Joskic</dc:creator>
      <pubDate>Thu, 03 May 2018 12:01:09 +0000</pubDate>
      <link>https://dev.to/jsguru_io/top-10-reasons-to-upgrade-your-angular-application-5dlg</link>
      <guid>https://dev.to/jsguru_io/top-10-reasons-to-upgrade-your-angular-application-5dlg</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1000%2F1%2AbRlKDjxqkQTfgEz40jdftA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1000%2F1%2AbRlKDjxqkQTfgEz40jdftA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Angular is a popular JavaScript framework, used to create web, desktop and mobile applications. It is built and maintained by Google.&lt;/p&gt;

&lt;p&gt;Angular 5 (codename pentagonal-donut) was released on November 1, 2017, a major release containing new features, and focusing on making your Angular application faster, smaller and easier to use.&lt;/p&gt;

&lt;p&gt;So, with all these new features, what are top 10 reasons you should upgrade to Angular 5?&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1) Performance&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Angular 5 will make you application smaller and much faster. Angular CLI v1.5 comes with a build optimizer turned on by default and Angular compiler is improved to enable faster builds and rebuilds. Size of the bundle is reduced by removing AST classes, only changed files are emitted for incremental compilation and much more. Ahead of time compiler is turned on by default and it is much faster than in Angular 4. It’s different from Just In Time compilation because it converts Angular Typescript into JavaScript code before the browser downloads and runs it. The Just In Time compiler was compiling application at runtime. Using AOT gives faster rendering, smaller download sizes and detects template errors earlier. This makes Angular 5 faster in development and production.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2) Progressive Web Apps&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A Progressive Web App (PWA) is a web application that uses modern web capabilities to deliver an app-like experience to users. It is an experience that combines the best of the web and mobile applications.&lt;/p&gt;

&lt;p&gt;A Progressive Web App works for every user, regardless of their browser, it’s responsive, always up-to-date thanks to service workers, and if served via HTTPS, it’s safe as well, and all the while it feels like a real app!&lt;/p&gt;

&lt;p&gt;Right now, the development of progressive web applications a complex process. One needs to take care during both development and deployment that neither caching nor the delivery of older versions is impaired.&lt;/p&gt;

&lt;p&gt;This has changed with Angular 5. The development of progressive web applications should be simplified so they can even be created by default.&lt;/p&gt;

&lt;p&gt;With Angular-CLI, Angular has the ability to create configuration and code on its own. Essentially, this allows the creation of mobile web applications that have features of native mobile applications, like offline capability, push notifications and an application logo in the start menu of a particular platform.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3) Build Optimizer&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The Angular team focused on making Angular 5 faster, smaller and easier to use. In Angular 5, production builds created with the Angular CLI will now apply the build optimizer by default. The build optimizer is included in Angular CLI.&lt;/p&gt;

&lt;p&gt;The build optimizer removes parts of your application that are not needed, and it removes Angular decorators from your application’s runtime code. Decorators are used by the compilers and are not needed at runtime and can be removed.&lt;/p&gt;

&lt;p&gt;This reduces the size of your JavaScript bundles, and increases the boot speed of your application!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4) HttpClient&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Before version 4.3, @angular/http was used for making HTTP requests. HTTP is now deprecated and the HttpClient API from @angular/common/http package that shipped in version 4.3 is now recommended for use in all apps.&lt;/p&gt;

&lt;p&gt;Some of the features include&lt;/p&gt;

&lt;p&gt;● JSON is an assumed default and no longer needs to be explicitly parsed&lt;/p&gt;

&lt;p&gt;● Interceptors allow middleware logic to be inserted into the pipeline&lt;/p&gt;

&lt;p&gt;● Progress events for both request upload and response download.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;5) New router lifecycle events&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Router has new lifecycle events, allowing you to track the cycle of the router from the start of running guards through to completion of activation. These events could be used for things such as showing a spinner on a specific router outlet when a child is updating or to measure performance of guards and/or resolvers.&lt;/p&gt;

&lt;p&gt;This new lifecycle events are GuardsCheckStart, ChildActivationStart, ActivationStart, GuardsCheckEnd, ResolveStart, ResolveEnd, ActivationEnd, ChildActivationEnd.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;6) CLI&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Starting with Angular CLI version 1.5, support for Angular 5 is added and the CLI generates v5 projects by default and build optimizer is also turned on. By default, the build-optimizer plugin will now be applied to your build if you are using Angular 5 and building in AOT.&lt;/p&gt;

&lt;p&gt;Build command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ng&lt;/span&gt; &lt;span class="nx"&gt;build&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;prod&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;build&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;optimizer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is now simplified to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ng&lt;/span&gt; &lt;span class="nx"&gt;build&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;prod&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Angular CLI will also warn you if you are using version of TypeScript which is not the recommended one for your Angular version. You can deactivate the warning (only if you believe in yourself and you know what you are doing) with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ng&lt;/span&gt; &lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="nx"&gt;typescriptMismatch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;7) Forms&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To improve performance, we can now specify when validators should be executed. Every time a value is changed, the validation will most likely be performed with every keystroke!&lt;/p&gt;

&lt;p&gt;In Angular 5, forms have the ability to decide when the validity and value of a field or form are updated via on blur or on submit, instead on every input event. This can drastically improve performance!&lt;/p&gt;

&lt;p&gt;To improve performance, you can now specify when validators should be executed in forms.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;8) Pipes&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In previous versions, Angular has relied on the browser to provide date, number and currency formatting using browser i18n API’s. Users were seeing inconsistent results across browsers.&lt;/p&gt;

&lt;p&gt;Angular 5 comes with new date, number and currency pipes.&lt;/p&gt;

&lt;p&gt;Pipes rely on the &lt;a href="http://cldr.unicode.org/" rel="noopener noreferrer"&gt;CLDR&lt;/a&gt; to provide locale support and configurations for any locales you want to support.&lt;/p&gt;

&lt;p&gt;Here is a &lt;a href="https://docs.google.com/spreadsheets/d/12iygt-_cakNP1VO7MV9g4lq9NsxVWG4tSfc98HpHb0k/edit%23gid=0" rel="noopener noreferrer"&gt;document&lt;/a&gt; that compares pipes between v4 and v5.&lt;/p&gt;

&lt;p&gt;You are not ready for the new pipes? You can import DeprecatedI18NPipesModule after the CommonModule.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;9) Incremental builds&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A lot of improvements have been made to the Angular compiler to make it faster, and it now enables faster builds and rebuilds. Ahead of time and incremental builds are possible when using &lt;em&gt;–aot&lt;/em&gt; with &lt;em&gt;ng serve&lt;/em&gt; command. This will probably be used by default in a future version of the Angular CLI.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;10) Better Typescript and RxJS support&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;RxJS version 5.5 introduces a new way of using RxJS called ‘lettable operators’. Any operator can now be imported from rxjs/operators. These new operators eliminate the side effects and the code splitting / tree shaking problems that existed with the previous method of importing operators. New Angular CLI will pull this version by default and will save considerably on the bundle size!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AwDkdwUhMM555aZ8J.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AwDkdwUhMM555aZ8J.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Would you like to upgrade your application to Angular 5?
&lt;/h3&gt;

&lt;p&gt;The Angular team built a &lt;a href="https://angular-update-guide.firebaseapp.com/" rel="noopener noreferrer"&gt;nice tool&lt;/a&gt; to make upgrading as easy as possible or &lt;strong&gt;send us a message&lt;/strong&gt; at &lt;a href="//mailto:info@jsguru.io"&gt;info@jsguru.io&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before you go…
&lt;/h3&gt;

&lt;p&gt;If you enjoyed reading this post please &lt;strong&gt;share&lt;/strong&gt; it. You should check out our other publications, you might like them too! We write from time to time about software development, tips and tricks, and how to become a better developer and business person in general. Join us on the journey of constant improvement!&lt;/p&gt;

&lt;p&gt;Follow us on &lt;a href="https://www.facebook.com/jsguruio/" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt;, &lt;a href="https://twitter.com/jsguru_software" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://www.linkedin.com/company/jsguru" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://medium.com/jsguru" rel="noopener noreferrer"&gt;Medium&lt;/a&gt; or &lt;a href="https://dev.to/jsguru_io"&gt;DEV.to&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://jsguru.io/blog/Top-10-reasons-to-upgrade-to-Angular-5" rel="noopener noreferrer"&gt;&lt;em&gt;jsguru.io&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>angular5</category>
      <category>angularcli</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
