Dab tsi yog Reactor qauv hauv node JS?
Dab tsi yog Reactor qauv hauv node JS?

Video: Dab tsi yog Reactor qauv hauv node JS?

Video: Dab tsi yog Reactor qauv hauv node JS?
Video: Yim laus yim do hau _phees lauj _fullmusic MV 2023 2024, Tej zaum
Anonim

Reactor Qauv yog ib lub tswv yim ntawm kev tsis thaiv I/Ooperations hauv Node . js . Qhov no qauv muab tus tuav tes (hauv rooj plaub Node . js , callback function) uas cuam tshuam nrog txhua qhov haujlwm I / O. Thaum qhov kev thov I / O raug tsim, nws raug xa mus rau lub demultiplexer.

Xav txog qhov no, dab tsi yog qhov xwm txheej voj hauv Nodejs?

Node . js yog ib daim ntawv thov ib leeg, tab sis nws tuaj yeem txhawb nqa concurrency ntawm lub tswv yim ntawm xwm txheej thiab hu rov qab. Node siv tus qauv soj ntsuam. Node threads ib xov xwm txheej thiab thaum twg ib txoj hauj lwm tau ua tiav, nws ua rau qhov sib thooj xwm txheej uas signals xwm txheej -listener muaj nuj nqi los ua.

Ib yam li ntawd, node kev tshwm sim tau tsav? Kev tshwm sim - Tsav programming yog lub ntsiab lus tseem ceeb tom qab node .js uas yog manifested los ntawm kev siv ntawmthe Cov xwm txheej module. Cov xwm txheej Loop yog qhov nkag pointused los ua ib qho xwm txheej uas invokes ib tug coj xwm txheej handler uas nyob rau hauv lem yuav invoke ntxiv xwm txheej ua rau lub kev tshwm sim tsav programming.

Kev sib raug zoo, Event Loop Java yog dab tsi?

Kev tshwm sim voj yog lub tswv yim yooj yim uas Node JS siv los ua cov cai. Thaum lub asynchronous muaj nuj nqi khiav, nws yuav tsis tos rau qhov tshwm sim. Hloov ib xwm txheej yuav muab tso rau hauv qhov system xwm txheej queue tom qab ua tiav cov haujlwm, ces cov haujlwm hu rov qab yuav saib xyuas qhov xwm txheej nyob rau hauv lub queue andrun.

Node JS zoo rau dab tsi?

Node . js yog server-sab JavaScriptenvironment. Nws siv tus qauv asynchronous tshwm sim-tsav thiab tsim los sau cov ntawv thov hauv internet, tshwj xeeb hauv webservers. Yog li, Node . js tau txais kev ua tau zoo heev raws li kev tsim qauv ntawm ntau daim ntawv thov hauv Internet.

Pom zoo: