๐ Composite Design Pattern
#js #patterns #composite
โ Article link
#js #patterns #composite
Composite: Basic Idea
The first thing we need to look at is the definition offered by the book from the Gang of Four:
โCompose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.โ
โ Article link
This media is not supported in your browser
VIEW IN TELEGRAM
๐ AI writing assistant
#js #react #ui_element
โ Article link
#js #react #ui_element
....Imagine youโve created an amazing AI writing assistant giving helpful suggestions for writing engaging stories....
โ Article link
This media is not supported in your browser
VIEW IN TELEGRAM
๐ When to Use the BroadcastChannel
#js #BroadcastChannel
โ Article link
#js #BroadcastChannel
/** Same Origin */
const channel = new BroadcastChannel("paymentChannel");
channel.postMessage("Payment Completed!");
channel.addEventListener(
"message",
(event) => {
const message = event.data;
console.log(message);
}
);
โ Article link
๐งช ECMAScript 2024 (ES15): JS Features
#js #es #es2024 #es15 #withResolvers #groupBy #temporal #tuples #decorators
โ Article link
#js #es #es2024 #es15 #withResolvers #groupBy #temporal #tuples #decorators
ECMAScript 2024 (ES15) is just around the corner, arriving in June 2024. This new version brings many exciting features that promise to simplify your JavaScript code and boost your productivity โ giving you even more time to relax! Letโs dive into five of the most impactful additions.
โ Article link
Hello team! As promised, here is a custom smiley pack for the channel that will decorate the articles.
๐ ๐ โ๏ธ ๐ญ โ๏ธ ๐ โ๏ธ ๐
พ๏ธ ๐
๐ฉท โค๏ธ ๐ ๐ ๐ฉต ๐ ๐ค ๐ฉถ ๐ค
๐ค โค๏ธโ๐ฅ โค๏ธโ๐ฉน โฃ๏ธ ๐ ๐ ๐ ๐ ๐
๐ฏ ๐ โฆ๏ธ ๐ โ โ๏ธ โ๏ธ โ๏ธ โ๏ธ
โข๏ธ โฃ๏ธ ๐ด ๐ณ ๐ถ ๐๏ธ ๐ธ ๐บ ๐ท๏ธ
๐ซ ๐ข โจ๏ธ ๐ท ๐ฏ ๐ณ ๐ฑ ๐ ๐ต
โ โ โผ๏ธ โ๏ธ ๐
๐ ใฝ๏ธ โ ๏ธ ๐ธ
๐ฑ โ๏ธ ๐ฐ โป๏ธ โ
๐ฏ๏ธ ๐น โ๏ธ โณ๏ธ
You can thank us at the link below:
๐ต PayPal: luckystudydanit@gmail.com
๐ต SWIFT code: UNJSUAUKXXX
You can thank us at the link below:
๐ต PayPal: luckystudydanit@gmail.com
๐ต SWIFT code: UNJSUAUKXXX
Please open Telegram to view this post
VIEW IN TELEGRAM
๐4โค1๐ฅ1
#angular #let
The @let operator allows you to define and assign variables directly within your Angular templates. This can help streamline your code, especially when working with asynchronous data. One of the biggest advantages is that it allows you to use the async pipe without worrying about unsubscribing from observables manually.
โ 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
๐2โค1
#js #patterns
Pub/Sub, which means Publish-Subscribe, uses a more structured approach. Instead of depending on DOM components, it uses a central message bus, similar to an events message board. Here is the summary:
- Publishers: These are the event announcers who broadcast messages (events) via the messaging bus.
- Subscribers: These are the visitors who registered to receive specific announcements (events). When a relevant interaction comes, subscribers get notified and can take action.
โ Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐2
#js #interview #promise
Problem: Implement a simple version of Promise:
The Promise object is an asynchronous programming solution for handling asynchronous events. Promise objects can represent the status of an asynchronous operation, including:
- pending
- fulfilled
- rejected
Analysis:
๐ถThe MyPromise class is a custom Promise class whose constructor accepts an executor function as a parameter.
๐ฝThe executor function in the constructor will be executed immediately and accepts two parameters, resolve and reject, which are used to modify the state of the Promise.
๐The resolve method is used to modify the Promiseโs status from โpendingโ to โfulfilledโ and pass the value to subsequent handlers.
๐ฅThe reject method is used to modify the Promiseโs status from โpendingโ to โrejectedโ and pass the reason to the subsequent handler.
๐ณThe then method is used to register a callback function to be executed when the Promise is completed or rejected. It accepts two parameters: onFulfilled and onRejected, which are called when the Promise is completed or rejected respectively.
๐ฅฉThe then method returns a new MyPromise instance to support chained calls. If onFulfilled or onRejected returns a value, it will be used as the resolved value for the next MyPromise instance.
๐The catch method is the shorthand form of then(null, onRejected).
๐The isFulfilled method is used to check whether the Promise is in the fulfilled state.
๐ฎThe isRejected method is used to check whether the Promise is in the rejected state.
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
๐4