{"id":36774,"date":"2019-10-31T22:13:44","date_gmt":"2019-10-31T19:13:44","guid":{"rendered":"https:\/\/prohoster.info\/blog\/asinhronnoe-programmirovanie-v-javascript-callback-promise-rxjs\/"},"modified":"2019-10-31T22:13:44","modified_gmt":"2019-10-31T19:13:44","slug":"asinhronnoe-programmirovanie-v-javascript-callback-promise-rxjs","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/news\/asinhronnoe-programmirovanie-v-javascript-callback-promise-rxjs","title":{"rendered":"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>P\u00ebrsh\u00ebndetje t\u00eb gjith\u00ebve. K\u00ebtu \u00ebsht\u00eb Sergey Omel'nytskyi. Koh\u00ebt e fundit kam mbajtur nj\u00eb transmision n\u00eb lidhje me programimin reaktiv, ku tregova p\u00ebr asinkronicitetin n\u00eb JavaScript. Sot do t\u00eb doja t\u00eb p\u00ebrmbledh k\u00ebt\u00eb materiale. <\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/11acf6af8328d3deb6f0ce48e813efb7.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>Por para se t\u00eb fillojm\u00eb me materialin kryesor, na nevojitet nj\u00eb hyrje. Pra, le t\u00eb fillojm\u00eb me p\u00ebrkufizimet: \u00e7far\u00eb \u00ebsht\u00eb steku dhe queues?<br \/>\n<strong>Steku <\/strong>\u00ebsht\u00eb nj\u00eb koleksion, element\u00ebt e t\u00eb cilit merren sipas parimit \"i fundit i ardhur, i pari i dal\u00eb\" LIFO<br \/>\n<strong>Queue <\/strong>\u00ebsht\u00eb nj\u00eb koleksion, element\u00ebt e t\u00eb cilit merren sipas parimit \"i pari i ardhur, i pari i dal\u00eb\" FIFO<\/p>\n<p><\/p>\n<p>Mir\u00eb, vazhdojm\u00eb. <\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/a7d64d1c74f37b463869dd57b96c9d0e.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>JavaScript \u00ebsht\u00eb nj\u00eb gjuh\u00eb programimi me nj\u00eb thread. Kjo do t\u00eb thot\u00eb se ka vet\u00ebm nj\u00eb thread ekzekutimi dhe nj\u00eb stek, n\u00eb t\u00eb cilin vendosen funksionet p\u00ebr ekzekutim. Prandaj, n\u00eb nj\u00eb moment t\u00eb vet\u00ebm, JavaScript mund t\u00eb ekzekutoj\u00eb vet\u00ebm nj\u00eb operacion, nd\u00ebrsa operacionet e tjera do t\u00eb presin n\u00eb radh\u00eb n\u00eb stek derisa t\u00eb thirren. <\/p>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<p><strong>Steku i thirrjeve<\/strong> \u00ebsht\u00eb nj\u00eb struktur\u00eb t\u00eb dh\u00ebnash q\u00eb, n\u00eb m\u00ebnyr\u00eb t\u00eb thjesht\u00eb, regjistron informacionin mbi vendin n\u00eb program ku ndodhemi. Kur kalojm\u00eb n\u00eb nj\u00eb funksion, vendosim nj\u00eb regjistrim t\u00eb tij n\u00eb krye t\u00eb stekut. Kur kthehemi nga funksioni, heqim elementin m\u00eb t\u00eb sip\u00ebrm nga steku dhe kthehemi aty ku e kemi thirrur k\u00ebt\u00eb funksion. K\u00ebto jan\u00eb t\u00eb gjitha aft\u00ebsit\u00eb e stekut. Tani, pyetja shum\u00eb interesante. Si funksionon asinkroniciteti n\u00eb JavaScript?<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/a29fd1dd3de06fb203c7dd14bda30548.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>N\u00eb t\u00eb v\u00ebrtet\u00eb, p\u00ebrve\u00e7 stekut, n\u00eb shfletues ekziston nj\u00eb radh\u00eb e ve\u00e7ant\u00eb p\u00ebr t\u00eb punuar me at\u00eb q\u00eb quhet WebAPI. Funksionet n\u00eb k\u00ebt\u00eb radh\u00eb do t\u00eb ekzekutohen me rend vet\u00ebm pasi steku t\u00eb pastruar plot\u00ebsisht. Vet\u00ebm pas k\u00ebsaj ato vendosen nga radh\u00eb n\u00eb stek p\u00ebr ekzekutim. N\u00ebse n\u00eb stek n\u00eb k\u00ebt\u00eb moment ndodhet t\u00eb pakt\u00ebn nj\u00eb element, ato nuk mund t\u00eb hyjn\u00eb n\u00eb stek. Pik\u00ebrisht p\u00ebr k\u00ebt\u00eb arsye thirrja e funksioneve me vones\u00eb shpesh \u00ebsht\u00eb e pasakt\u00eb n\u00eb koh\u00eb, pasi funksioni nuk mund t\u00eb hyj\u00eb nga radh\u00eb n\u00eb stek derisa ai t\u00eb jet\u00eb plot. <\/p>\n<p><\/p>\n<p>Le t\u00eb shqyrtojm\u00eb shembullin e m\u00ebposht\u00ebm dhe t\u00eb merremi me \"ekzekutimin\" e tij hap pas hapi. Po ashtu, le t\u00eb shohim se \u00e7far\u00eb ndodh me k\u00ebt\u00eb n\u00eb sistem.<\/p>\n<p><\/p>\n<pre><code class=\"javascript\">console.log('Hi);\nsetTimeout(function cb1() {\n    console.log('cb1');\n}, 5000);\nconsole.log('Bye');<\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/379423fca95fb28b2124be03dfd15739.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>1) Deri tani nuk ndodh asgj\u00eb. Konsola e shfletuesit \u00ebsht\u00eb e past\u00ebr, steku i thirrjeve \u00ebsht\u00eb bosh.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/4a16bbc23bade54ae0b02d81d5f6a581.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>2) M\u00eb pas, komand\u00ebn console.log(\u2018Hi\u2019) e shtojm\u00eb n\u00eb grumbullin e thirrjeve.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/a1845af23fd7dedebf94afc168f1f13f.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>3) Dhe ajo ekzekutohet<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/57397b53386018b662f3a79a6d4d60fb.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>4) Pastaj, console.log(\u2018Hi\u2019) hiqet nga grumbulli i thirrjeve.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/7cb2b32be8807ecf39d2f38683ccd435.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>5) Tani kalojm\u00eb te komanda setTimeout(function cb1() {\u2026 }). Ajo shtohet n\u00eb stoku i thirrjeve.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/99c0724994e3390d009577852b451beb.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>6) Komanda setTimeout(function cb1() {\u2026 }) ekzekutohet. Shfletuesi krijon nj\u00eb timer, q\u00eb \u00ebsht\u00eb pjes\u00eb e Web API. Ai do t\u00eb realizoj\u00eb nj\u00eb num\u00ebrim mbrapsht.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/99086cdeafd83c5fe72e92c4a9f9b738.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>7) Komanda setTimeout(function cb1() {\u2026 }) p\u00ebrfundon pun\u00ebn dhe hiqet nga stoku i thirrjeve.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/24ac12b1b6cfbff780ece9e9a7acd7c7.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>8) Komanda console.log(\u2018Bye\u2019) i shtohet grumbullit t\u00eb thirrjeve.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/6ccad0ad8eebf05e870a409766d38766.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>9) Komanda console.log(\u2018Bye\u2019) ekzekutohet.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/09e4e380eb873fb23bea550f3ffb21f7.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>10) Komanda console.log(\u2018Bye\u2019) hiqet nga grumbulli i thirrjeve.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/357bfb372361310681ba7bb1860d90d7.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>11) Pasi t\u00eb kalojn\u00eb t\u00eb pakt\u00ebn 5000 ms., timer-i p\u00ebrfundon pun\u00ebn dhe vendos callback-un cb1 n\u00eb radh\u00ebn e callbacks.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/8170e8ff5d3d0c56c0091658370c25cc.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>12) Cikli i ngjarjeve merr funksionin cb1 nga radhja e callbacks dhe e vendos at\u00eb n\u00eb stoku i thirrjeve.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/d858a54e82bc32d84f854610db462bc1.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>13) Funksioni cb1 ekzekutohet dhe shton console.log(\u2018cb1\u2019) n\u00eb grumbullin e thirrjeve.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/6ca8e016389904eec57035e64d57a157.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>14) Komanda console.log(\u2018cb1\u2019) ekzekutohet.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/0caa645a90ac1fca5fb8a76569494d48.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>15) Komanda console.log(\u2018cb1\u2019) hiqet nga grumbulli i thirrjeve.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/aeb838fe8df3f6e3f8603a4207a6e193.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>16) Funksioni cb1 hiqet nga stoku i thirrjeve.<\/p>\n<p><\/p>\n<p>Shikojm\u00eb nj\u00eb shembull n\u00eb dinamik\u00eb:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/3836d9df513afee374f498720990e39f.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>Ja se si e kemi shqyrtuar se si asinkronizimi \u00ebsht\u00eb realizuar n\u00eb JavaScript. Tani le t\u00eb flasim shkurt p\u00ebr evolucionin e kodit asinkron.<\/p>\n<p><\/p>\n<h2 id=\"evolyuciya-asinhronnogo-koda\">Evolucioni i kodit asinkron.<\/h2>\n<p><\/p>\n<pre><code class=\"javascript\">a(function (resultsFromA) {\n    b(resultsFromA, function (resultsFromB) {\n        c(resultsFromB, function (resultsFromC) {\n            d(resultsFromC, function (resultsFromD) {\n                e(resultsFromD, function (resultsFromE) {\n                    f(resultsFromE, function (resultsFromF) {\n                        console.log(resultsFromF);\n                    })\n                })\n            })\n        })\n    })\n});<\/code><\/pre>\n<p><\/p>\n<p>Programimi asinkron, si\u00e7 e njohim ne JavaScript, mund t\u00eb realizohet vet\u00ebm me funksione. Ato mund t\u00eb kalohen si \u00e7do variab\u00ebl tjet\u00ebr te funksione t\u00eb tjera. K\u00ebshtu lindi callback-u. Dhe \u00ebsht\u00eb arg\u00ebtues derisa t\u00eb kthehet n\u00eb trishtim dhe m\u00ebrzi. Pse? Sepse \u00ebsht\u00eb e thjesht\u00eb:<\/p>\n<p><\/p>\n<ul>\n<li>Me rritjen e kompleksitetit t\u00eb kodit, projekti shpejt kthehet n\u00eb blloqe shum\u00eb t\u00eb thelluara, nj\u00eb situat\u00eb q\u00eb quhet \"helli i callbacks\".<\/li>\n<li>Menaxhimi i gabimeve mund t\u00eb humbas\u00eb leht\u00ebsisht.<\/li>\n<li>Nuk mund t\u00eb kthehen shprehje me return.<\/li>\n<\/ul>\n<p><\/p>\n<p>Me shfaqjen e Promise, situata u b\u00eb pak m\u00eb e mir\u00eb.<\/p>\n<p><\/p>\n<pre><code class=\"javascript\">new Promise(function(resolve, reject) {\n    setTimeout(() =&gt; resolve(1), 2000);\n\n}).then((result) =&gt; {\n    alert(result);\n    return result + 2;\n\n}).then((result) =&gt; {\n    throw new Error('FAILED HERE');\n    alert(result);\n    return result + 2;\n\n}).then((result) =&gt; {\n    alert(result);\n    return result + 2;\n\n}).catch((e) =&gt; {\n    console.log('error: ', e);\n});<\/code><\/pre>\n<p><\/p>\n<ul>\n<li>Lindi zinxhir\u00ebt e promesave, q\u00eb p\u00ebrmir\u00ebsuan lexueshm\u00ebrin\u00eb e kodit.<\/li>\n<li>Lindi nj\u00eb metod\u00eb e ve\u00e7ant\u00eb p\u00ebr kapjen e gabimeve.<\/li>\n<li>Ka ardhur mund\u00ebsia e ekzekutimit paralel me ndihm\u00ebn e Promise.all<\/li>\n<li>Ne mund ta zgjidhim asinkronin\u00eb e thell\u00eb me ndihm\u00ebn e async\/await<\/li>\n<\/ul>\n<p><\/p>\n<p>Por premtimi ka kufizimet e veta. P\u00ebr shembull, nj\u00eb premtim nuk mund t\u00eb Anulohet pa ndihm\u00ebn e ndonj\u00eb triku, dhe ajo q\u00eb ka r\u00ebnd\u00ebsi - punon me nj\u00eb vler\u00eb.<\/p>\n<p><\/p>\n<p>Ja, tani jemi afruar me programimin reaktiv. T\u00eb lodhur? Fatmir\u00ebsisht, mund t\u00eb shkoni t\u00eb b\u00ebni nj\u00eb \u00e7aj, t\u00eb reflektoni dhe t\u00eb ktheheni p\u00ebr t\u00eb lexuar m\u00eb tej. Un\u00eb do t\u00eb vazhdoj.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/48409ec625d57fec171214c1de332c85.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>Programimi reaktiv<\/strong>\u2014 \u00ebsht\u00eb nj\u00eb paradigm\u00eb programimi q\u00eb fokusohet n\u00eb rrjedhat e t\u00eb dh\u00ebnave dhe p\u00ebrhapjen e ndryshimeve. Le t\u00eb shqyrtojm\u00eb m\u00eb n\u00eb detaje se \u00e7far\u00eb \u00ebsht\u00eb nj\u00eb rrjedh\u00eb t\u00eb dh\u00ebnash.<\/p>\n<p><\/p>\n<pre><code class=\"javascript\">\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\nconst input = ducument.querySelector('input');\n\nconst eventsArray = [];\n\n\/\/ \u041f\u0443\u0448\u0438\u043c \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 eventsArray\ninput.addEventListener('keyup',\n    event =&gt; eventsArray.push(event)\n);<\/code><\/pre>\n<p><\/p>\n<p>Imagjinoni se kemi nj\u00eb fush\u00eb hyrjeje. Ne krijojm\u00eb nj\u00eb array, dhe p\u00ebr \u00e7do ngjarje keyup t\u00eb inputit, do t\u00eb ruajm\u00eb ngjarjen n\u00eb array-in ton\u00eb. N\u00eb k\u00ebt\u00eb rast, duhet t\u00eb theksojm\u00eb se array-i yn\u00eb \u00ebsht\u00eb i renditur sipas koh\u00ebs, pra indeksi i ngjarjeve m\u00eb t\u00eb vonshme \u00ebsht\u00eb m\u00eb i madh se indeksi i ngjarjeve m\u00eb t\u00eb hershme. Ky array paraqet nj\u00eb model t\u00eb thjeshtuar t\u00eb rrjedh\u00ebs s\u00eb t\u00eb dh\u00ebnave, por akoma nuk \u00ebsht\u00eb nj\u00eb rrjedh\u00eb. P\u00ebr ta quajtur k\u00ebt\u00eb array me t\u00eb drejt\u00eb nj\u00eb rrjedh\u00eb, ai duhet t\u00eb jet\u00eb n\u00eb gjendje t\u00eb komunikoj\u00eb ndonj\u00eb m\u00ebnyr\u00eb me abonent\u00ebt se jan\u00eb pranuar t\u00eb dh\u00ebna t\u00eb reja. K\u00ebshtu kemi arritur n\u00eb definimin e rrjedh\u00ebs.<\/p>\n<p><\/p>\n<h3 id=\"potok-dannyh\">Rrjedha e t\u00eb dh\u00ebnave<\/h3>\n<p><\/p>\n<pre><code class=\"javascript\">const { interval1 } = Rx;\nconst { take } = RxOperators;\n\ninterval(1000).pipe(\n    take(4)\n)<\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/68ec447abafb6b8a323b429ed94f8252.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>Rrjedha<\/strong>\u2014 \u00ebsht\u00eb nj\u00eb array i t\u00eb dh\u00ebnave t\u00eb renditura sipas koh\u00ebs, i cili mund t\u00eb komunikoj\u00eb se t\u00eb dh\u00ebnat jan\u00eb ndryshuar. Tani imagjinoni se sa e leht\u00eb b\u00ebhet t\u00eb shkruani kod, n\u00eb t\u00eb cilin p\u00ebr nj\u00eb veprim k\u00ebrkohen t\u00eb thirren disa ngjarje n\u00eb pjes\u00eb t\u00eb ndryshme t\u00eb kodit. Ne thjesht abonohemi n\u00eb rrjedh\u00eb dhe ajo na informon kur ndodhin ndryshimet. Kjo \u00ebsht\u00eb ajo q\u00eb b\u00ebn biblioteka RxJs.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/dcb1cfca8b4d8a887b63c302a7d6c06a.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>RxJS <\/strong> \u2014 \u00ebsht\u00eb nj\u00eb bibliotek\u00eb p\u00ebr t\u00eb punuar me programe asinkrone dhe t\u00eb bazuara n\u00eb ngjarje duke p\u00ebrdorur sekuenca t\u00eb v\u00ebzhguara. Biblioteka ofron tipin kryesor <em>Observable<\/em>, disa tipe ndihm\u00ebse (<em>Observer, Schedulers, Subjects<\/em>) dhe operator\u00eb p\u00ebr t\u00eb punuar me ngjarje si me koleksione (<em>map, filter, reduce, every<\/em> dhe t\u00eb ngjashme nga JavaScript Array).<\/p>\n<p><\/p>\n<p>Le t\u00eb shqyrtojm\u00eb konceptet themelore t\u00eb k\u00ebsaj biblioteke.<\/p>\n<p><\/p>\n<h3 id=\"observable-observer-producer\">Observable, Observer, Producer<\/h3>\n<p><\/p>\n<p>Observable \u2014 tipi i par\u00eb bazik q\u00eb do t\u00eb shqyrtojm\u00eb. Ky klas p\u00ebrmban shumic\u00ebn e implementimit t\u00eb RxJs. Ai \u00ebsht\u00eb i lidhur me nj\u00eb rrjedh\u00eb t\u00eb v\u00ebzhguar, n\u00eb t\u00eb cil\u00ebn mund t\u00eb abonohemi duke p\u00ebrdorur metod\u00ebn subscribe.<\/p>\n<p><\/p>\n<p>N\u00eb Observable realizohet nj\u00eb mekaniz\u00ebm ndihm\u00ebs p\u00ebr krijimin e azhurnimeve, t\u00eb ashtuquajturin <em>Observer<\/em>. Burimi i vlerave p\u00ebr Observer quhet <em>Producer<\/em>. Kjo mund t\u00eb jet\u00eb nj\u00eb array, nj\u00eb iterator, nj\u00eb web socket, nj\u00eb ndodhi etj. Pra, mund t\u00eb themi se observable \u00ebsht\u00eb nj\u00eb nd\u00ebrmjet\u00ebs midis Producer dhe Observer. <\/p>\n<p><\/p>\n<p>Observable trajton tre lloje t\u00eb ngjarjeve t\u00eb Observer:<\/p>\n<p><\/p>\n<ul>\n<li>next \u2013 t\u00eb dh\u00ebna t\u00eb reja<\/li>\n<li>error \u2013 nj\u00eb gabim, n\u00ebse sekuenca p\u00ebrfundoi p\u00ebr shkak t\u00eb nj\u00eb situate t\u00eb jashtme. Ky ngjarje gjithashtu supozon p\u00ebrfundimin e sekuenc\u00ebs.<\/li>\n<li>complete \u2014 nj\u00eb sinjal p\u00ebr p\u00ebrfundimin e sekuenc\u00ebs. Kjo do t\u00eb thot\u00eb se nuk do t\u00eb ket\u00eb m\u00eb t\u00eb dh\u00ebna t\u00eb reja.<\/li>\n<\/ul>\n<p><\/p>\n<p>Le t\u00eb shohim nj\u00eb demo:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/c5bcd2af0f18b6de3ab0dbc20db595d1.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>N\u00eb fillim do t\u00eb trajtojm\u00eb vlerat 1, 2, 3, dhe pas 1 sekonde, do t\u00eb marrim 4 dhe do t\u00eb p\u00ebrfundojm\u00eb rrjedh\u00ebn ton\u00eb.<\/p>\n<p>\n<b class=\"spoiler_title\">Mendime n\u00eb z\u00eb<\/b><\/p>\n<p>Dhe k\u00ebtu e kuptova, q\u00eb t\u00eb flas\u00ebsh ishte m\u00eb interesante se sa t\u00eb shkruash p\u00ebr k\u00ebt\u00eb. \ud83d\ude00 <\/p>\n<p><\/p>\n<h3 id=\"subscription\">Subscription<\/h3>\n<p><\/p>\n<p>Kur abonohesh n\u00eb nj\u00eb rrjedh\u00eb, krijojm\u00eb nj\u00eb klas\u00eb t\u00eb re <strong>subscription<\/strong>, e cila na jep mund\u00ebsin\u00eb p\u00ebr t\u00eb anuluar abonimin duke p\u00ebrdorur metod\u00ebn <em>unsubscribe<\/em>. Po ashtu, mund t\u00eb grumbullojm\u00eb abonimet duke p\u00ebrdorur metod\u00ebn <em>add<\/em>. Dhe logjikisht, mund t\u00eb ndajm\u00eb rrjedhat duke p\u00ebrdorur <em>remove<\/em>. Metodat add dhe remove pranojn\u00eb nj\u00eb abonim tjet\u00ebr si hyrje. D\u00ebshiroj t\u00eb theksoj se kur b\u00ebjm\u00eb anullimin, ne anulojm\u00eb t\u00eb gjitha abonimet f\u00ebmij\u00eb si\u00e7 do t\u00eb kishim thirrur metod\u00ebn unsubscribe p\u00ebr to. Le t\u00eb vazhdojm\u00eb.<\/p>\n<p><\/p>\n<h3 id=\"vidy-potokov\">Llojet e rrjedhave<\/h3>\n<p><\/p>\n<table>\n<thead>\n<tr>\n<th>HOT<\/th>\n<th>COLD<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Producer krijohet jasht\u00eb observable<\/td>\n<td>Producer krijohet brenda observable<\/td>\n<\/tr>\n<tr>\n<td>T\u00eb dh\u00ebnat transmetohen n\u00eb momentin e krijimit t\u00eb observable<\/td>\n<td>T\u00eb dh\u00ebnat komunikohen n\u00eb momentin e abonimit<\/td>\n<\/tr>\n<tr>\n<td>K\u00ebrkohet logjik\u00eb shtes\u00eb p\u00ebr anulimin<\/td>\n<td>Rrjedha p\u00ebrfundon vet\u00eb<\/td>\n<\/tr>\n<tr>\n<td>P\u00ebrdor lidhje nj\u00eb-n\u00eb-marr\u00eb<\/td>\n<td>P\u00ebrdor lidhje nj\u00eb-n\u00eb-nj\u00eb<\/td>\n<\/tr>\n<tr>\n<td>T\u00eb gjitha abonimet kan\u00eb nj\u00eb vler\u00eb t\u00eb vetme<\/td>\n<td>Abonimet jan\u00eb t\u00eb pavarura<\/td>\n<\/tr>\n<tr>\n<td>T\u00eb dh\u00ebnat mund t\u00eb humben n\u00ebse nuk ka abonim<\/td>\n<td>Rikthe gjith\u00eb vlerat e rrjedh\u00ebs p\u00ebr nj\u00eb abonim t\u00eb ri<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/p>\n<p>N\u00ebse duhet t\u00eb b\u00ebj nj\u00eb analogji, do ta paraqisja rrjedh\u00ebn e ngroht\u00eb si nj\u00eb film n\u00eb kinemat\u00eb. N\u00eb cilin moment ke ardhur, q\u00eb nga ai moment e ke filluar shikimin. Rrjedha e ftoht\u00eb do ta krahasoja me nj\u00eb telefonat\u00eb n\u00eb mb\u00ebshtetje teknike. \u00c7do person q\u00eb telefonon d\u00ebgjon regjistrimin e automatik\u00ebve nga fillimi n\u00eb fund, por ti mund t\u00eb heq\u00ebsh telefonin duke p\u00ebrdorur unsubscribe.<\/p>\n<p><\/p>\n<p>Do t\u00eb doja t\u00eb theksoja se ekzistojn\u00eb edhe ato q\u00eb quhen rrjedha t\u00eb ngrohta (kjo p\u00ebrkufizim e kam takuar shum\u00eb rrall\u00eb dhe vet\u00ebm n\u00eb komunitetet e huaja) \u2014 kjo \u00ebsht\u00eb nj\u00eb rrjedh\u00eb q\u00eb transformohet nga nj\u00eb rrjedh\u00eb e ftoht\u00eb n\u00eb nj\u00eb t\u00eb ngroht\u00eb. Lind pyetja \u2014 ku t\u00eb p\u00ebrdorim? )) Do t\u00eb jap nj\u00eb shembull nga praktika.<\/p>\n<p><\/p>\n<p>Un\u00eb punoj me Angular. Ai aktivisht p\u00ebrdor RxJS. P\u00ebr t\u00eb marr\u00eb t\u00eb dh\u00ebnat n\u00eb server, un\u00eb pres nj\u00eb rrjedh\u00eb t\u00eb ftoht\u00eb dhe e p\u00ebrdor k\u00ebt\u00eb rrjedh\u00eb n\u00eb shabllon me ndihm\u00ebn e asyncPipe. N\u00ebse e p\u00ebrdor k\u00ebt\u00eb pipe disa her\u00eb, duke u rikthyer te p\u00ebrkufizimi i rrjedh\u00ebs s\u00eb ftoht\u00eb, \u00e7do pipe do t\u00eb k\u00ebrkoj\u00eb t\u00eb dh\u00ebna nga serveri, q\u00eb \u00ebsht\u00eb paksa e \u00e7uditshme. N\u00ebse e transformoj rrjedh\u00ebn e ftoht\u00eb n\u00eb t\u00eb ngroht\u00eb, at\u00ebher\u00eb k\u00ebrkesa do t\u00eb ndodhi nj\u00eb her\u00eb.<\/p>\n<p><\/p>\n<p>N\u00eb fakt, kuptimi i llojeve t\u00eb rrjedhave \u00ebsht\u00eb mjaft i komplikuar p\u00ebr fillestar\u00ebt, por \u00ebsht\u00eb i r\u00ebnd\u00ebsish\u00ebm. <\/p>\n<p><\/p>\n<h3 id=\"operators\">Operators<\/h3>\n<p><\/p>\n<pre><code class=\"javascript\">return this.http.get(`${environment.apiUrl}\/${this.apiUrl}\/trade_companies`)\n    .pipe(\n        tap(({ data }: TradeCompanyList) =&gt; this.companies$$.next(cloneDeep(data))),\n        map(({ data }: TradeCompanyList) =&gt; data)\n    );<\/code><\/pre>\n<p><\/p>\n<p>Ofruesit e operator\u00ebve zgjeruan mund\u00ebsin\u00eb e pun\u00ebs me rrjedhat. Ata ndihmojn\u00eb n\u00eb kontrollimin e ngjarjeve q\u00eb ndodhin n\u00eb Observable. Ne do t\u00eb shqyrtojm\u00eb disa nga m\u00eb t\u00eb njohurit, nd\u00ebrsa p\u00ebr m\u00eb shum\u00eb informacion mbi operator\u00ebt mund t\u00eb konsultoheni me lidhjet n\u00eb informacionin e dobish\u00ebm.<\/p>\n<p><\/p>\n<p><strong>Operators \u2014 of<\/strong><\/p>\n<p><\/p>\n<p>T\u00eb fillojm\u00eb me operatorin ndihm\u00ebs \u2018of\u2019. Ai krijon nj\u00eb Observable mbi nj\u00eb vler\u00eb t\u00eb thjesht\u00eb.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/68f382447e306392b025867a9a1e88e7.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>Operators \u2014 filter<\/strong><\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/24ac65fdb5ccc7f6301b3dfe49f1e804.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>Operatori i filtrimit \u2018filter\u2019, si\u00e7 mund ta kuptoni nga emri, filtroh sinjalin e rrjedh\u00ebs. N\u00ebse operatori kthen t\u00eb v\u00ebrtet\u00ebn, at\u00ebher\u00eb e kalon m\u00eb tej.<\/p>\n<p><\/p>\n<p><strong>Operators \u2014 take<\/strong><\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/b3e7a2a2e03038d6fc250247ff4496a2.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>\u2018take\u2019 \u2014 Merr vler\u00ebn e numrit t\u00eb emitimeve, pas t\u00eb cilit p\u00ebrfundon rrjedh\u00ebn.<\/p>\n<p><\/p>\n<p><strong>Operators \u2014 debounceTime<\/strong><\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/add686e546a0b6169c38fb3b457da928.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>\u2018debounceTime\u2019 \u2014 hedh vlerat e emituara q\u00eb bien brenda nj\u00eb intervali t\u00eb caktuar kohor midis daljeve \u2014 pas kalimit t\u00eb intervalit t\u00eb caktuar emiton vler\u00ebn e fundit.<\/p>\n<p><\/p>\n<pre><code class=\"javascript\">const { Observable } = Rx;\nconst { debounceTime, take } = RxOperators;\n\nObservable.create((observer) =&gt; {\n  let i = 1;\n  observer.next(i++);\n  \/\/ Emiton vler\u00ebn \u00e7do 1000ms\n  setInterval(() =&gt; {\n    observer.next(i++)\n  }, 1000);\n\n  \/\/ Emiton vler\u00ebn \u00e7do 1500ms\n  setInterval(() =&gt; {\n    observer.next(i++)\n  }, 1500);\n}).pipe(\n  debounceTime(700),  \/\/ Pritni 700ms p\u00ebr vlerat para se t\u2019i p\u00ebrpunoni\n  take(3)\n);  <\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/dbb690d6fea6c43c1f0a2bdabea57934.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>Operators \u2014 takeWhile<\/strong><\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/120d9fe6ddf5a60ddffc8742989b27ff.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>Emiton vlera derisa \u2018takeWhile\u2019 t\u00eb mos kthej\u00eb false, pas s\u00eb cil\u00ebs do t\u00eb anullohet nga rrjedha.<\/p>\n<p><\/p>\n<pre><code class=\"javascript\">const { Observable } = Rx;\nconst { debounceTime, takeWhile } = RxOperators;\n\nObservable.create((observer) =&gt; {\n  let i = 1;\n  observer.next(i++);\n  \/\/ Emit value every 1000ms\n  setInterval(() =&gt; {\n    observer.next(i++)\n  }, 1000);\n}).pipe(\n  takeWhile(producer =&gt; producer &lt; 5)\n);  <\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/d2910d1bf9fab228acc9241fdbad3d4a.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>Operators \u2014 combineLatest<\/strong><\/p>\n<p><\/p>\n<p>Operatori kombinuese combineLatest \u00ebsht\u00eb disi si promise.all. Ai bashkon disa rrjedha n\u00eb nj\u00eb t\u00eb vetme. Pas k\u00ebsaj, kur \u00e7do rrjedh\u00eb t\u00eb emitoj\u00eb t\u00eb pakt\u00ebn nj\u00eb her\u00eb, marrim vlerat m\u00eb t\u00eb fundit nga secila si nj\u00eb array. M\u00eb pas, pas \u00e7do emitoj t\u00eb ndonj\u00eb prej rrjedhave t\u00eb bashkuara, ai do t\u00eb kthej\u00eb vlera t\u00eb reja.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/c39bc0a8a736ed30ad147055110bbf55.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<pre><code class=\"javascript\">const { combineLatest, Observable } = Rx;\nconst { take } = RxOperators;\n\nconst observer_1 = Observable.create((observer) =&gt; {\n  let i = 1;\n  \/\/ Emit value every 1000ms\n  setInterval(() =&gt; {\n    observer.next('a: ' + i++);\n  }, 1000);\n});\n\nconst observer_2 = Observable.create((observer) =&gt; {\n  let i = 1;\n  \/\/ Emit value every 750ms\n  setInterval(() =&gt; {\n    observer.next('b: ' + i++);\n  }, 750);\n});\n\ncombineLatest(observer_1, observer_2).pipe(take(5));<\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/7fc35461f446987ef81302ff7c2ed5a8.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>Operators \u2014 zip<\/strong><\/p>\n<p><\/p>\n<p>Zip pret nj\u00eb vler\u00eb nga \u00e7do rrjedh\u00eb dhe formon nj\u00eb array mbi k\u00ebto vlera. N\u00ebse nuk merr nj\u00eb vler\u00eb nga ndonj\u00eb rrjedh\u00eb, grupi nuk do t\u00eb formohet.<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/0be5ee0d2ec56bd2bc245b15d43d4cc1.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<pre><code class=\"javascript\">const { zip, Observable } = Rx;\nconst { take } = RxOperators;\n\nconst observer_1 = Observable.create((observer) =&gt; {\n  let i = 1;\n  \/\/ Emit value every 1000ms\n  setInterval(() =&gt; {\n    observer.next('a: ' + i++);\n  }, 1000);\n});\n\nconst observer_2 = Observable.create((observer) =&gt; {\n  let i = 1;\n  \/\/ Emit value every 750ms\n  setInterval(() =&gt; {\n    observer.next('b: ' + i++);\n  }, 750);\n});\n\nconst observer_3 = Observable.create((observer) =&gt; {\n  let i = 1;\n  \/\/ Emit value every 500ms\n  setInterval(() =&gt; {\n    observer.next('c: ' + i++);\n  }, 500);\n});\n\nzip(observer_1, observer_2, observer_3).pipe(take(5));<\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/e2606bf8ea5f8a660699ebe896a27d80.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>Operators \u2014 forkJoin<\/strong><\/p>\n<p><\/p>\n<p>forkJoin gjithashtu bashkon rrjedhat, por emiton nj\u00eb vler\u00eb vet\u00ebm kur t\u00eb gjitha rrjedhat t\u00eb ken\u00eb p\u00ebrfunduar (complete).<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/6c430d7eeafbc8a7c1c228ddfe0e44b5.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<pre><code class=\"javascript\">const { forkJoin, Observable } = Rx;\nconst { take } = RxOperators;\n\nconst observer_1 = Observable.create((observer) =&gt; {\n  let i = 1;\n  \/\/ Emit value every 1000ms\n  setInterval(() =&gt; {\n    observer.next('a: ' + i++);\n  }, 1000);\n}).pipe(take(3));\n\nconst observer_2 = Observable.create((observer) =&gt; {\n  let i = 1;\n  \/\/ Emit value every 750\n  setInterval(() =&gt; {\n    observer.next('b: ' + i++);\n  }, 750);\n}).pipe(take(5));\n\nconst observer_3 = Observable.create((observer) =&gt; {\n  let i = 1;\n  \/\/ Emit value every 500\n  setInterval(() =&gt; {\n    observer.next('c: ' + i++);\n  }, 500);\n}).pipe(take(4));\n\nforkJoin(observer_1, observer_2, observer_3);<\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/df110efc7ece46fc1d8da2d7693f75bb.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>Operators \u2014 map<\/strong><\/p>\n<p><\/p>\n<p>Operatori transformues map ndryshon vler\u00ebn e emisionit n\u00eb nj\u00eb t\u00eb re. <\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/2196ff9f82dd7aaeb00ab76475176d32.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<pre><code class=\"javascript\">const { Observable } = Rx;\nconst { take, map } = RxOperators;\n\nObservable.create((observer) =&gt; {\n  let i = 1;\n  \/\/ Emit value every 1000ms\n  setInterval(() =&gt; {\n    observer.next(i++);\n  }, 1000);\n}).pipe(\n  map(x =&gt; x * 10),\n  take(3)\n);\n<\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/4e4ff3e2eb4acf69f16559c711a2e666.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p><strong>Operators \u2013 share, tap<\/strong><\/p>\n<p><\/p>\n<p>Operatori tap \u2014 lejon t\u00eb b\u00ebsh efekte an\u00ebsore, dmth veprime t\u00eb cilat nuk ndikojn\u00eb n\u00eb renditjen.<\/p>\n<p><\/p>\n<p>Operatori utilitar share \u00ebsht\u00eb n\u00eb gjendje t\u00eb b\u00ebj\u00eb nj\u00eb rrjedh\u00eb t\u00eb ftoht\u00eb t\u00eb nxeht\u00eb. <\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Programimi asinkron n\u00eb JavaScript. ( Callback, Promise, RxJs )\" src=\"\/wp-content\/uploads\/2019\/08\/c46e96420ed78d197ceef829ff74c82d.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>Kemi p\u00ebrfunduar me operator\u00ebt. Tani do t\u00eb kalojm\u00eb te Subject.<\/p>\n<p>\n<b class=\"spoiler_title\">Mendime n\u00eb z\u00eb<\/b><\/p>\n<p>Dhe k\u00ebtu shkova t\u00eb pi \u00e7aj. M\u00eb lodh\u00ebn k\u00ebto shembuj \ud83d\ude00<\/p>\n<p><\/p>\n<h2 id=\"semeystvo-subject-ov\">Familja e subject-\u00ebve<\/h2>\n<p><\/p>\n<p>Familja e subject-\u00ebve \u00ebsht\u00eb nj\u00eb shembull e qart\u00eb e rrjedhave t\u00eb nxehta. K\u00ebto klasa jan\u00eb nj\u00eb hibrid, q\u00eb veprojn\u00eb si observable dhe observer nj\u00ebkoh\u00ebsisht. Duke qen\u00eb se subject \u00ebsht\u00eb nj\u00eb rrjedh\u00eb e nxeht\u00eb, \u00ebsht\u00eb e nevojshme t\u00eb hiqet dor\u00eb nga t\u00eb. N\u00eb lidhje me metodat kryesore, k\u00ebto jan\u00eb:<\/p>\n<p><\/p>\n<ul>\n<li>next \u2013 transmetimi i t\u00eb dh\u00ebnave t\u00eb reja n\u00eb rrjedh\u00eb<\/li>\n<li>error \u2013 gabim dhe p\u00ebrfundimi i rrjedh\u00ebs<\/li>\n<li>complete \u2013 p\u00ebrfundimi i rrjedh\u00ebs<\/li>\n<li>subscribe \u2013 regjistrohu n\u00eb rrjedh\u00eb<\/li>\n<li>unsubscribe \u2013 hiq dor\u00eb nga rrjedha<\/li>\n<li>asObservable \u2013 transformohet n\u00eb nj\u00eb v\u00ebzhgues<\/li>\n<li>toPromise \u2013 transformon n\u00eb nj\u00eb premtim<\/li>\n<\/ul>\n<p><\/p>\n<p>Dallohen 4-5 lloje subject-\u00ebsh. <\/p>\n<p>\n<b class=\"spoiler_title\">Mendime n\u00eb z\u00eb<\/b><\/p>\n<p>N\u00eb stream thash\u00eb 4, por duket se ata kan\u00eb shtuar nj\u00eb tjet\u00ebr. Si\u00e7 thon\u00eb, jetoni dhe m\u00ebsoni.<\/p>\n<p><\/p>\n<p>Subject e thjesht\u00eb <code>new Subject()<\/code>\u2013 lloji m\u00eb i thjesht\u00eb i subject-\u00ebve. Krijohet pa parameter. Transmeton vlerat q\u00eb kan\u00eb ardhur vet\u00ebm pas regjistrimit.<\/p>\n<p><\/p>\n<p>BehaviorSubject <code>new BehaviorSubject(defaultData)<\/code> \u2013 sipas mendimit tim, lloji m\u00eb i zakonsh\u00ebm i subject-\u00ebve. Merr nj\u00eb vler\u00eb t\u00eb paracaktuar. Ruajti gjithmon\u00eb t\u00eb dh\u00ebnat e emitit t\u00eb fundit, t\u00eb cilat i transmeton gjat\u00eb regjistrimit. Kjo klas\u00eb gjithashtu ka nj\u00eb metod\u00eb t\u00eb dobishme value, e cila kthen vler\u00ebn aktuale t\u00eb rrjedh\u00ebs.<\/p>\n<p><\/p>\n<p>ReplaySubject <code>new ReplaySubject(bufferSize?: number, windowTime?: number)<\/code> \u2014 Mund t\u00eb pranoj\u00eb opcionalisht si argument t\u00eb par\u00eb madh\u00ebsin\u00eb e buffers q\u00eb do t\u00eb mbaj\u00eb, dhe si t\u00eb dyt\u00eb koh\u00ebn gjat\u00eb s\u00eb cil\u00ebs na duhet ndryshimi.<\/p>\n<p><\/p>\n<p>AsyncSubject <code>new AsyncSubject()<\/code> \u2014 gjat\u00eb regjistrimit nuk ndodh asgj\u00eb, dhe vlera do t\u00eb kthehet vet\u00ebm kur t\u00eb p\u00ebrfundoj\u00eb. Do t\u00eb kthehet vet\u00ebm vlera e fundit e rrjedh\u00ebs.<\/p>\n<p><\/p>\n<p>WebSocketSubject <code>new WebSocketSubject(urlConfigOrSource: string | WebSocketSubjectConfig | Observable, destination?: Observer)<\/code> \u2014 Dokumentacioni p\u00ebr t\u00eb hesht dhe un\u00eb e shoh p\u00ebr her\u00eb t\u00eb par\u00eb. Kush di se \u00e7far\u00eb b\u00ebn, na shkruani p\u00ebr ta plot\u00ebsuar.<\/p>\n<p><\/p>\n<p>Uff. K\u00ebshtu ne kemi shqyrtuar gjith\u00e7ka q\u00eb doja t\u00eb flisja sot. Shpresoj q\u00eb kjo informacion t\u00eb ishte e dobishme. Mund ta shqyrtoni list\u00ebn e literatur\u00ebs n\u00eb seksionin e informacionit t\u00eb dobish\u00ebm.<\/p>\n<p><\/p>\n<h2 id=\"poleznaya-informaciya\">Informacion i dobish\u00ebm<\/h2>\n<p><\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/vk.com\/frontend_practice?w=wall-182297870_931\">https:\/\/vk.com\/frontend_practice?w=wall-182297870_931<\/a><\/noindex> \u2014 linku p\u00ebr stream<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/337042\/\">https:\/\/habr.com\/ru\/company\/ruvds\/blog\/337042\/<\/a><\/noindex> \u2014 Si funksionon JS: nj\u00eb p\u00ebrmbledhje e motorit, mekanizmave t\u00eb ekzekutimit, dhe stack t\u00eb thirrjeve.<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/340508\/\">https:\/\/habr.com\/ru\/company\/ruvds\/blog\/340508<\/a><\/noindex> \u2014 Si si punon JS: cikli i ngjarjeve, asinkronia dhe pes\u00eb m\u00ebnyra p\u00ebr t\u00eb p\u00ebrmir\u00ebsuar kodin me async \/ await<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"http:\/\/vanilla-js.blogspot.com\/2014\/09\/event-loop-javasript.html\">http:\/\/vanilla-js.blogspot.com\/2014\/09\/event-loop-javasript.html<\/a><\/noindex> \u2014 Si punon Event Loop n\u00eb JavaScript<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/tproger.ru\/translations\/asynchronous-javascript\/\">https:\/\/tproger.ru\/translations\/asynchronous-javascript\/<\/a><\/noindex> \u2014 Evolucioni i JavaScript asinkron<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/341880\/\">https:\/\/habr.com\/ru\/company\/ruvds\/blog\/341880\/<\/a><\/noindex> \u2014 \u00c7far\u00eb \u00ebsht\u00eb RxJS dhe pse \u00ebsht\u00eb e dobishme ta dish<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/medium.com\/ngx\/practical-use-rxjs-81aaab57045c\">https:\/\/medium.com\/ngx\/practical-use-rxjs-81aaab57045c<\/a><\/noindex> \u2014 P\u00ebrdorimi praktik i RxJS<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/coursetro.com\/posts\/code\/148\/RxJS-Observables-Tutorial---Creating-&amp;-Subscribing-to-Observables\">https:\/\/coursetro.com\/posts\/code\/148\/RxJS-Observables-Tutorial&#8212;Creating-&amp;-Subscribing-to-Observables<\/a><\/noindex> \u2014 Tutoriali i RxJS Observables \u2014 Krijimi &amp; Abonimi n\u00eb Observables<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/slides.com\/zenabsaleem\/rxjs-hot-cold-observables#\/\">https:\/\/slides.com\/zenabsaleem\/rxjs-hot-cold-observables#\/<\/a><\/noindex> \u2014 RXJS: Observables t\u00eb Ngrohta dhe t\u00eb Ftohta<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/clck.ru\/FiPgB\">https:\/\/clck.ru\/FiPgB<\/a><\/noindex> \u2014 Klasa, funksione p\u00ebr krijimin e Observable. Operator\u00ebt.<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/www.learnrxjs.io\/operators\/\">https:\/\/www.learnrxjs.io\/operators\/<\/a><\/noindex> \u2014 Operator\u00ebt e RxJS me shembuj<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/rxjs.dev\/api\">https:\/\/rxjs.dev\/api<\/a><\/noindex> \u2014 Lista e API-ve<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/clck.ru\/FkS8Y\">https:\/\/clck.ru\/FkS8Y<\/a><\/noindex> \u2014 Llojet e Subject dhe Planifikimi n\u00eb RxJS<\/li>\n<\/ul>\n<p>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/462355\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u041e\u043c\u0435\u043b\u044c\u043d\u0438\u0446\u043a\u0438\u0439 \u0421\u0435\u0440\u0433\u0435\u0439. \u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u044f \u0432\u0435\u043b \u0441\u0442\u0440\u0438\u043c \u043f\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e, \u0433\u0434\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043f\u0440\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0432 JavaScript. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0437\u0430\u043a\u043e\u043d\u0441\u043f\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0432\u043e\u0434\u043d\u0443\u044e. \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0441\u0442\u0435\u043a \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u044c? \u0421\u0442\u0435\u043a \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f, \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0439 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":27545,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[702],"tags":[],"class_list":["post-36774","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u041e\u043c\u0435\u043b\u044c\u043d\u0438\u0446\u043a\u0438\u0439 \u0421\u0435\u0440\u0433\u0435\u0439. \u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u044f \u0432\u0435\u043b \u0441\u0442\u0440\u0438\u043c \u043f\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e, \u0433\u0434\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043f\u0440\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0432 JavaScript. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0437\u0430\u043a\u043e\u043d\u0441\u043f\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/news\/asinhronnoe-programmirovanie-v-javascript-callback-promise-rxjs\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 JavaScript. ( Callback, Promise, RxJs ) | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u041e\u043c\u0435\u043b\u044c\u043d\u0438\u0446\u043a\u0438\u0439 \u0421\u0435\u0440\u0433\u0435\u0439. \u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u044f \u0432\u0435\u043b \u0441\u0442\u0440\u0438\u043c \u043f\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e, \u0433\u0434\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043f\u0440\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0432 JavaScript. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0437\u0430\u043a\u043e\u043d\u0441\u043f\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/news\/asinhronnoe-programmirovanie-v-javascript-callback-promise-rxjs\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T19:13:44+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T19:13:44+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47 Programimi asinkron n\u00eb JavaScript. (Callback, Promise, RxJs) | ProHoster","description":"P\u00ebrsh\u00ebndetje t\u00eb gjith\u00ebve. K\u00ebtu \u00ebsht\u00eb Sergey Omel'nytskyi. Koh\u00ebt e fundit kam mbajtur nj\u00eb transmision n\u00eb lidhje me programimin reaktiv, ku tregova p\u00ebr asinkronicitetin n\u00eb JavaScript. Sot do t\u00eb doja t\u00eb p\u00ebrmbledh k\u00ebt\u00eb materiale.","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/news\/asinhronnoe-programmirovanie-v-javascript-callback-promise-rxjs","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 JavaScript. ( Callback, Promise, RxJs ) | ProHoster","og:description":"\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u041e\u043c\u0435\u043b\u044c\u043d\u0438\u0446\u043a\u0438\u0439 \u0421\u0435\u0440\u0433\u0435\u0439. \u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u044f \u0432\u0435\u043b \u0441\u0442\u0440\u0438\u043c \u043f\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e, \u0433\u0434\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043f\u0440\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0432 JavaScript. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0437\u0430\u043a\u043e\u043d\u0441\u043f\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b.","og:url":"https:\/\/prohoster.info\/sq\/blog\/news\/asinhronnoe-programmirovanie-v-javascript-callback-promise-rxjs","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T19:13:44+00:00","article:modified_time":"2019-10-31T19:13:44+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"36774","title":null,"description":null,"keywords":null,"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-22 04:48:19","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 01:39:22","updated":"2026-08-11 12:50:32","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/36774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=36774"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/36774\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/27545"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=36774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=36774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=36774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}