π Real Examples of Promise Patterns
#js #promise
β Article link
#js #promise
β Promise.all() is ideal when you have multiple asynchronous operations that are independent of each other and need to be performed concurrently.
β Promise.race() Use Promise.race() when you need to respond to whichever promise resolves or rejects first. It's useful in scenarios like timeout implementations.
β Promise.allSettled() is useful when you need to wait for all promises to settle, regardless of whether they resolve or reject.
β Promise.any() returns the first promise that resolves and ignores rejections unless all promises reject.
β Article link
β€1π1π₯1
π Angular Named Router Outlets
#angular #router #outlets
β Article link
#angular #router #outlets
<!-- wrapper-layout.component.html -->
<div class="container">
<div class="row">
<div>
<left-side></left-side>
</div>
<div>
<router-outlet
name="showright"
></router-outlet>
</div>
</div>
</div>
/** routing.module.ts */
{
path: 'connect',
component: WrapperLayoutComponent,
children: [
{
path: '',
component: RightSideComponent,
outlet: 'showright'
},
]
},
// component navigation action
this.router.navigate([
'/connect',
{ outlets: { showright: ['user-info'] } }
]);
β Article link
π3β€1π₯1
π Angular with Electron: Building Cross-Platform Desktop Applications
#angular #electron #guide
β Article link
#angular #electron #guide
Combining Angular with Electron offers a powerful framework for building cross-platform desktop applications. Electron, known for its ability to create desktop applications using web technologies, seamlessly integrates with Angular, a popular front-end framework. This fusion provides developers with a robust platform to build feature-rich desktop applications leveraging their web development skills. In this article, weβll delve into the integration of Angular with Electron, covering various scenarios and providing detailed code examples.
β Article link
π4β€1π₯1
π€ Angular for Server-Side Rendering (SSR)
#angular #universal #ssr #guide
β Article link
#angular #universal #ssr #guide
...Hereβs a step-by-step guide to get you started with Server-Side Rendering (SSR) using Angular Universal...
β Article link
β€1π₯1π₯°1
π 1/8 JS Reactive Patterns: PubSub or Publish-Subscribe
#js #patterns #pubsub
#js #patterns #pubsub
PubSub is one of the most commonly used and fundamental reactivity patterns. The Publisher is responsible for notifying Subscribers about the updates and the Subscriber receives those updates and can react in response.
One popular example of its usage is Redux. This popular state management library is based on this pattern (or more specifically, the Flux architecture). Things work pretty simple in the context of Redux:
β Publisher: The store acts as the publisher. When an action is dispatched, the store notifies all the subscribed components about the state change.
β Subscriber: UI Components in the application are the subscribers. They subscribe to the Redux store and receive updates whenever the state changes.
π3β€1π₯1
π 2/8 JS Reactive Patterns: Custom Event Targets
#js #patterns #customEvent
#js #patterns #customEvent
If you prefer not to dispatch events globally on the window object, you can create your own event target.
By extending the native EventTarget class, you can dispatch events to a new instance of it. This ensures that your events are triggered only on the new class itself, avoiding global propagation. Moreover, you have the flexibility to attach handlers directly to this specific instance.
π4
π 3/8 JS Reactive Patterns: Observer
#js #patterns #observer
#js #patterns #observer
The Observer pattern is really similar to PubSub. You subscribe to the Subject and then it notifies its subscribers (Observers) about changes, allowing them to react accordingly. This pattern plays a significant role in building decoupled and flexible architecture.
π1
π 5/8 JS Reactive Patterns: Individual Object Properties and Reactivity
#js #patterns #defineProperty
#js #patterns #defineProperty
If you donβt need to track all the fields in the objects, you can choose the specific one using Object.defineProperty or group of them with Object.defineProperties.
π 6/8 JS Reactive Patterns: Reactive HTML Attributes With MutationObserver
#js #patterns #MutationObserver
#js #patterns #MutationObserver
One way to achieve reactivity in the DOM is by using MutationObserver. Its API allows us to observe changes in attributes and also in the text content of the target element and its children.
π 7/8 JS Reactive Patterns: Custom Events as a Browser Version Of PubSub
#js #patterns #CustomEvent
#js #patterns #CustomEvent
The browser offers an API for triggering and subscribing to custom events through the CustomEvent class and the dispatchEvent method. The latter provides us with the ability not only to trigger an event but also to attach any desired data to it.
I would like to get to know my subscribers a little, who is from what country? (Or your option in comments)
Final Results
52%
Ukraine
33%
India
2%
Pakistan
0%
Argentina
0%
France
3%
USA
6%
Other European countries
0%
Other Asian countries
3%
Other African countries
0%
Other countries of America
π1
π 8/8 JS Reactive Patterns: Reactive Scrolling With IntersectionObserver
#js #patterns #IntersectionObserver
#js #patterns #IntersectionObserver
The IntersectionObserver API enables reacting to the intersection of a target element with another element or the viewport area.
π4