Angular ๐Ÿ‡บ๐Ÿ‡ฆ - practical notes
1.63K subscribers
1.6K photos
1 file
532 links
Angular - practical notes

This group is for posting practical notes for Angular developers. Mostly all posts are for quick implementation https://t.me/angular_practical_notes (Commenting on posts only in ENG and UA langs here). Welcome!
Download Telegram
๐Ÿšฑ Interview Questions: Implement a debounce anti-shake function

#js #interview #debounce
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ“ต Exploring the New JavaScript Feature: Records and Tuples

#js #records #tuples

โš ๏ธ ECMAScriptยฎ 2024 (ES15)

โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
1๐Ÿ”ฅ1
๐Ÿ“ต Create a Cancellable Promise

#js #promise

Create a cancellable promise P with a method cancel such that after we call the method P.cancel(), the promise cannot be resolved now. There should be a way to know that the promise was cancelled and not rejected.


โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
โค1
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ“ต Understanding The Secret Power of Generators

#js #generators #guide

When to Choose Which?

Use generators when:

โ€” You need to manage complex control flows with precision.
โ€” Memory efficiency is critical, and you want to generate values on demand.
โ€” Youโ€™re implementing patterns like state machines or lazy iteration.

Use promises when:

โ€” Youโ€™re handling simple asynchronous operations.
โ€” You need to work with concurrent tasks.
โ€” You prefer simpler, more straightforward error handling.

Best Practices for Using Generators:

1. Keep It Simple
Generators can add complexity to your code, so use them judiciously. If a task can be easily handled with promises or async/await, thereโ€™s no need to reach for generators.

2. Combine with Promises for Maximum Effect
Generators and promises are not mutually exclusive. In fact, they can complement each other beautifully. For instance, you can use a generator to structure your async flow and promises to handle the actual asynchronous operations.

3. Mind the Iteration
When using generators for iteration, always be mindful of when to stop. An infinite loop in a generator can be a real headache if not properly managed. Ensure you have clear exit conditions if your generator has the potential to run indefinitely.

4. Test Thoroughly
Given the unique execution flow of generators, thorough testing is crucial. Ensure that all possible execution paths are covered, including edge cases where the generator might yield unexpectedly or be terminated early.

5. Leverage TypeScript for Type Safety
Since youโ€™re writing in TypeScript, make sure to define the types for your generator functions. This adds an extra layer of safety, helping you catch potential issues at compile time.


โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ“ต Advanced JavaScript Techniques

#js #closure #debounce #throttle #currying #proxy #memoize

โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ“ต JavaScript Design Pattern โ€” Facade

#js #patterns

โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘4
๐Ÿ“ต How To Cancel A Promise In Vanilla JavaScript?๐Ÿค”

#js #promise

โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ“ต Most desired JS features in the following ES XX specifications

#js #esnext

โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘4
๐Ÿ“ต JavaScript Promises: 8 Practical Use Cases

#js #promise

โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
โค2๐Ÿ‘1
๐Ÿšณ JavaScript Design Pattern: Builder

#js #patterns #ui_element

โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘1
๐Ÿšฏ Magic of Generators

#js #generators

Generators: Advantages

โ€” Fine-Grained Control: Generators give you the ability to pause and resume function execution at will. This can be a game-changer in scenarios like lazy evaluation, custom iteration logic, or complex control flows.

โ€” Memory Efficiency: Since generators produce values on demand, they are highly memory-efficient, making them perfect for handling large datasets or streams.

โ€” Readable Asynchronous Code: While async/await has largely supplanted many asynchronous handling methods, generators still offer a unique combination of readability and control, making complex asynchronous flows easier to manage.


โœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘1
๐Ÿšฑ No more try-catch

#js #trycatch

An amazing new JavaScript operator has arrived and things are not looking too good for try-catch!

While we wait for ?= to become natively integrated into JavaScript, we can start it now with this polyfill


โœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘1
๐Ÿค“ How to Load file from local in JavaScript

#js #FileReader #guide

โœ… Article Link
๐Ÿ‘3๐Ÿ‘Ž1
๐Ÿ“ต JS Performance Optimization Tips for Faster Websites

#js #performance #throttle #debounce #requestAnimationFrame #workers

โœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
โค5
๐Ÿ“ต Promise.try()

#js #promises

What is Promise.try()?
In essence, Promise.try() is a static method that wraps any function โ€” be it synchronous, asynchronous, value-returning, or exception-throwing โ€” into a Promise. It effortlessly handles both sync and async functions while automatically catching synchronous exceptions, preventing error leaks. ๐ŸŽญ

Advantages of Promise.try()
1 โ€” Unified Handling: Seamlessly manages both synchronous and asynchronous functions, resulting in cleaner code. ๐Ÿงผ
2 โ€” Exception Handling: Automatically captures synchronous exceptions, making error handling more intuitive and preventing oversights. ๐Ÿ•ต๏ธโ€โ™‚๏ธ
3 โ€” Code Simplicity: Compared to traditional methods, Promise.try() enhances code readability and maintainability. ๐Ÿ“š


โœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘2
๐Ÿ“ต Mastering Touch Interactions with Hammer.js: A Complete Guide

#js #hammerjs

What is Hammer.js? ๐Ÿค”
Hammer.js is a lightweight JavaScript library (only 4KB) that brings multi-touch gesture support to web applications. Itโ€™s designed to work seamlessly across both mobile and desktop platforms, with excellent browser compatibility.


โœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
1๐Ÿ”ฅ2
๐Ÿค“๐Ÿ“ต JS Shortcuts

#js

โœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
2๐Ÿ‘2
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘5