{"id":2573,"date":"2019-05-23T14:42:54","date_gmt":"2019-05-23T12:42:54","guid":{"rendered":"http:\/\/www.openmediavault.org\/?p=2573"},"modified":"2021-01-08T11:11:29","modified_gmt":"2021-01-08T09:11:29","slug":"concatjoin-rxjs-operator","status":"publish","type":"post","link":"https:\/\/www.openmediavault.org\/?p=2573","title":{"rendered":"concatJoin RxJS operator"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Are you searching for a RxJS concat operator that works like forkJoin? Then have a look at the following simple code that will do that for you.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import { concat, EMPTY, Observable } from 'rxjs';\n\n\/**\n * Joins last values emitted by passed Observables.\n *\n * `concatJoin` is an operator that takes any number of Observables which\n * can be passed either as an array or directly as arguments. If no input\n * Observables are provided, resulting stream will complete immediately.\n *\n * `concatJoin` will wait for all passed Observables to complete one by\n * one and then it will emit an array with last values from corresponding\n * Observables. So if you pass `n` Observables to the operator, resulting\n * array will have `n` values, where first value is the last thing emitted\n * by the first Observable, second value is the last thing emitted by the\n * second Observable and so on. That means `concatJoin` will not emit more\n * than once and it will complete after that.\n *\n * @param {...Observable} sources Any number of Observables provided either\n * as an array or as an arguments passed directly to the operator.\n * @return {Observable} Observable emitting either an array of last values\n * emitted by passed Observables.\n *\/\nexport function concatJoin&lt;T>(...sources: Array&lt;Observable&lt;T> | Observable&lt;T>&#91;]>): Observable&lt;T&#91;]> {\n  \/\/ If the first and only other argument is an array assume it's been\n  \/\/ called with `concatJoin(&#91;obs1, obs2, obs3])`\n  if (sources.length === 1 &amp;&amp; Array.isArray(sources&#91;0])) {\n    sources = sources&#91;0] as Array&lt;Observable&lt;T>>;\n  }\n\n  if (sources.length === 0) {\n    return EMPTY;\n  }\n\n  return new Observable((subscriber) => {\n    const values: Array&lt;T> = &#91;];\n    concat(...sources).subscribe(\n      (value: T) => {\n        values.push(value);\n      },\n      (err) => {\n        subscriber.error(err);\n      },\n      () => {\n        subscriber.next(values);\n        subscriber.complete();\n      }\n    );\n  });\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you searching for a RxJS concat operator that works like forkJoin? Then have a look at the following simple code that will do that for you.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-2573","post","type-post","status-publish","format-standard","hentry","category-coding"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"volker\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.openmediavault.org\/?p=2573\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573#article\",\"name\":\"concatJoin RxJS operator | openmediavault\",\"headline\":\"concatJoin RxJS operator\",\"author\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?author=2#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.openmediavault.org\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/header_logo.svg\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/#articleImage\",\"width\":330,\"height\":42},\"datePublished\":\"2019-05-23T14:42:54+02:00\",\"dateModified\":\"2021-01-08T11:11:29+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573#webpage\"},\"articleSection\":\"Coding\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.openmediavault.org#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.openmediavault.org\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?cat=32#listItem\",\"name\":\"Coding\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?cat=32#listItem\",\"position\":2,\"name\":\"Coding\",\"item\":\"https:\\\/\\\/www.openmediavault.org\\\/?cat=32\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573#listItem\",\"name\":\"concatJoin RxJS operator\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.openmediavault.org#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573#listItem\",\"position\":3,\"name\":\"concatJoin RxJS operator\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?cat=32#listItem\",\"name\":\"Coding\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/#organization\",\"name\":\"openmediavault\",\"description\":\"DATA SOVEREIGNTY MADE EASY\",\"url\":\"https:\\\/\\\/www.openmediavault.org\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.openmediavault.org\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/header_logo.svg\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573\\\/#organizationLogo\",\"width\":330,\"height\":42},\"image\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573\\\/#organizationLogo\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?author=2#author\",\"url\":\"https:\\\/\\\/www.openmediavault.org\\\/?author=2\",\"name\":\"volker\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573#webpage\",\"url\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573\",\"name\":\"concatJoin RxJS operator | openmediavault\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?p=2573#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?author=2#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/?author=2#author\"},\"datePublished\":\"2019-05-23T14:42:54+02:00\",\"dateModified\":\"2021-01-08T11:11:29+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/#website\",\"url\":\"https:\\\/\\\/www.openmediavault.org\\\/\",\"name\":\"openmediavault\",\"description\":\"DATA SOVEREIGNTY MADE EASY\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.openmediavault.org\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"concatJoin RxJS operator | openmediavault","description":"","canonical_url":"https:\/\/www.openmediavault.org\/?p=2573","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.openmediavault.org\/?p=2573#article","name":"concatJoin RxJS operator | openmediavault","headline":"concatJoin RxJS operator","author":{"@id":"https:\/\/www.openmediavault.org\/?author=2#author"},"publisher":{"@id":"https:\/\/www.openmediavault.org\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.openmediavault.org\/wp-content\/uploads\/2025\/10\/header_logo.svg","@id":"https:\/\/www.openmediavault.org\/#articleImage","width":330,"height":42},"datePublished":"2019-05-23T14:42:54+02:00","dateModified":"2021-01-08T11:11:29+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.openmediavault.org\/?p=2573#webpage"},"isPartOf":{"@id":"https:\/\/www.openmediavault.org\/?p=2573#webpage"},"articleSection":"Coding"},{"@type":"BreadcrumbList","@id":"https:\/\/www.openmediavault.org\/?p=2573#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.openmediavault.org#listItem","position":1,"name":"Home","item":"https:\/\/www.openmediavault.org","nextItem":{"@type":"ListItem","@id":"https:\/\/www.openmediavault.org\/?cat=32#listItem","name":"Coding"}},{"@type":"ListItem","@id":"https:\/\/www.openmediavault.org\/?cat=32#listItem","position":2,"name":"Coding","item":"https:\/\/www.openmediavault.org\/?cat=32","nextItem":{"@type":"ListItem","@id":"https:\/\/www.openmediavault.org\/?p=2573#listItem","name":"concatJoin RxJS operator"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.openmediavault.org#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.openmediavault.org\/?p=2573#listItem","position":3,"name":"concatJoin RxJS operator","previousItem":{"@type":"ListItem","@id":"https:\/\/www.openmediavault.org\/?cat=32#listItem","name":"Coding"}}]},{"@type":"Organization","@id":"https:\/\/www.openmediavault.org\/#organization","name":"openmediavault","description":"DATA SOVEREIGNTY MADE EASY","url":"https:\/\/www.openmediavault.org\/","logo":{"@type":"ImageObject","url":"https:\/\/www.openmediavault.org\/wp-content\/uploads\/2025\/10\/header_logo.svg","@id":"https:\/\/www.openmediavault.org\/?p=2573\/#organizationLogo","width":330,"height":42},"image":{"@id":"https:\/\/www.openmediavault.org\/?p=2573\/#organizationLogo"}},{"@type":"Person","@id":"https:\/\/www.openmediavault.org\/?author=2#author","url":"https:\/\/www.openmediavault.org\/?author=2","name":"volker"},{"@type":"WebPage","@id":"https:\/\/www.openmediavault.org\/?p=2573#webpage","url":"https:\/\/www.openmediavault.org\/?p=2573","name":"concatJoin RxJS operator | openmediavault","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.openmediavault.org\/#website"},"breadcrumb":{"@id":"https:\/\/www.openmediavault.org\/?p=2573#breadcrumblist"},"author":{"@id":"https:\/\/www.openmediavault.org\/?author=2#author"},"creator":{"@id":"https:\/\/www.openmediavault.org\/?author=2#author"},"datePublished":"2019-05-23T14:42:54+02:00","dateModified":"2021-01-08T11:11:29+02:00"},{"@type":"WebSite","@id":"https:\/\/www.openmediavault.org\/#website","url":"https:\/\/www.openmediavault.org\/","name":"openmediavault","description":"DATA SOVEREIGNTY MADE EASY","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.openmediavault.org\/#organization"}}]}},"aioseo_meta_data":{"post_id":"2573","title":null,"description":null,"keywords":[],"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":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"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":"none","schema_type_options":"{\"webPage\":{\"webPageType\":\"WebPage\"},\"article\":{\"articleType\":\"BlogPosting\"},\"book\":[],\"course\":[],\"event\":[],\"jobPosting\":[],\"music\":[],\"person\":[],\"product\":[],\"recipe\":[],\"restaurant\":[],\"service\":[],\"software\":[],\"video\":[]}","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":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":{"businessInfo":{"name":"","urls":{"website":"","aboutPage":"","contactPage":""},"address":{"line1":"","line2":"","zip":"","city":"","state":"","country":""},"contact":{"email":"","phone":"","fax":""},"ids":{"vatID":"","taxID":"","chamberID":""},"payment":{"priceIndication":"","currenciesAccepted":"","methodsAccepted":""},"areaServed":""},"openingHours":{"show":false,"closedLabel":"","open24h":false,"open24hLabel":"","open247":false,"use24hFormat":false,"twoSets":false,"timezone":"","hours":[]}},"limit_modified_date":false,"ai":null,"created":"2020-12-24 17:43:50","updated":"2022-09-17 13:49:49","breadcrumb_settings":null,"seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.openmediavault.org\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.openmediavault.org\/?cat=32\" title=\"Coding\">Coding<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tconcatJoin RxJS operator\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.openmediavault.org"},{"label":"Coding","link":"https:\/\/www.openmediavault.org\/?cat=32"},{"label":"concatJoin RxJS operator","link":"https:\/\/www.openmediavault.org\/?p=2573"}],"_links":{"self":[{"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=\/wp\/v2\/posts\/2573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2573"}],"version-history":[{"count":3,"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=\/wp\/v2\/posts\/2573\/revisions"}],"predecessor-version":[{"id":2876,"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=\/wp\/v2\/posts\/2573\/revisions\/2876"}],"wp:attachment":[{"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.openmediavault.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}