or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Push Based Architecture With Rxjs!
Source Code: https://codesandbox.io/embed/rt-rxjs-state-management-js941?fontsize=14
👮
What is Pull Based Architecture
In order to get some data we call some service and service call server and return the data. Till that time the main UI thread is hung or blocked.
See below Online Shopping eCommerce Example
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →😞
Disadvantages of Pull Based Architecture
If you are using
React
,Angular
orVue
orKnockout
then these framework will continue check is there any changes in theView Model
. Whenever there is change on view model because of certain state change. These frameworks will re-render the view. This is how Angular works auto update UI on Model change.However, this makes framework slow. Because, framework has to watch the changes continuously.
In Angular 2-8 there is
ChangeDetectionStrategy
which by default always create a list models which are bound to UI & keep running a timer to check if the model changed then show the changes in UI or Re-render the UI.ChangeDetectionStrategy
hasOnPush
Strategy which I will discuss later. However in detail I will explainChangeDetectionStrategy
in my some other article.📌
What is Push Based Architecture
Promise
orObservables
are the model to achieve push based architecture in javascript apps.You can also do this by using regular messaging by
amplify
library or some other messaging framework.I personally like
RxJS
now a days for doing push based event driven architecture.🛒
Shopping eCommerce Example to Understand Push Based Design
🎉
Advantages of PUSH Based Architecture
🍴
How to Achieve Push Based Architecture
Below are 4 simple steps we will follow:
Behavior Subject
Pure Functions
to change the stateModeling Shopping Cart Using Push Based Architecture
👉Defining The State | Shopping Cart State | Step 1
Cart State
Cart Initial State
👉 Creating BehaviorSubject | Cart Store | Step 2
👉 Writing Pure Functions For State Change | Cart Store | Step 3
Add Cart Item Method
👉 Creating Selectors to subscribe change of state | Cart Store | Step 4
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Download or Play with Complete source code
Thank you! 🐑
You can find me on