{"id":19014294,"url":"https://github.com/elemental-mind/awaitium-js","last_synced_at":"2025-07-28T12:42:32.728Z","repository":{"id":57187974,"uuid":"396153123","full_name":"elemental-mind/awaitium-js","owner":"elemental-mind","description":"Put your await on fire and chain together async functions, promises and syncronous code in one line.","archived":false,"fork":false,"pushed_at":"2021-08-15T02:27:16.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-05T01:18:44.536Z","etag":null,"topics":["async","async-await","chainable-interface","chaining","promises"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elemental-mind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-14T22:59:58.000Z","updated_at":"2023-04-07T20:01:06.000Z","dependencies_parsed_at":"2022-08-28T10:51:40.406Z","dependency_job_id":null,"html_url":"https://github.com/elemental-mind/awaitium-js","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/elemental-mind/awaitium-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fawaitium-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fawaitium-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fawaitium-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fawaitium-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elemental-mind","download_url":"https://codeload.github.com/elemental-mind/awaitium-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fawaitium-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267519534,"owners_count":24100813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","async-await","chainable-interface","chaining","promises"],"created_at":"2024-11-08T19:28:45.982Z","updated_at":"2025-07-28T12:42:32.680Z","avatar_url":"https://github.com/elemental-mind.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Awaitium - chain multiple awaits into one\nPut your await on fire and make your code flow without intermediate awaits! Chain asynchrounous (and synchronous) functions together easily.\n\nThe best thing: Get full type support along the way. No fighting with the Typescript compiler. It's tamed!\n\n# Example\nWrite...\n````\nasync function testChainedAwait()\n{\n    ....\n    chainResult = await ing(asyncGetObject()).asyncGetAnotherObject().objectProperty.asyncInstanceGetter().synchronousFunction();\n    ....\n}\n````\n...instead of...\n````\nasync function helpIAmRunningOutOfVariableNames()\n{\n    ....\n    const initialObject = await asyncGetObject();\n    const intermediateObject = await initialObject.asyncGetAnotherObject();\n    const wantedInstance = await intermediateObject.objectProperty.asyncInstanceGetter();\n\n    chainResult=wantedInstance.synchronousFunction();\n    ....\n}\n````\n# Installation\n## Deno\nIn deno...\n````\ninclude { ing } from https://deno.land/x/awaitium@VERSION/source/awaitium.ts\n````\n## Browser \u0026 Node\n\u003e Both these environments are untested. Raise an issue if you come across any problems. \n\nIf you use npm do...\n````\nnpm i awaitium\n````\nthen in your sources...\n````\ninclude { ing } from \"awaitium\"\n````\n\n# Usage\nTo use Awaitium, simply wrap the entry point of your chain with the `ing(\u003cyourEntryPoint\u003e)` function. An entry point can be one of the following:\n- a function call to a synchronous function: \n````\nawait ing(syncFunction()).followedByAnyOf.asyncFunc().syncFunc().orPropOrMember\n````\n- a function call to an asynchronous function: \n````\nawait ing(asyncFunction()).followedByAnyOf.asyncFunc().syncFunc().orPropOrMember\n````\n- any object: \n````\nawait ing(object).followedByAnyOf.asyncFunc().syncFunc().orPropOrMember\n````\n\nThe chain following the `ing` call may comprise any combination of the following:\n- async function calls\n- synchronous function calls\n- property reads\n- member reads\n\n# Good to know\nYou must start your call chain (the start of the chain is the closing bracket of the `ing` function call) after the first call to an async function - but you can start your chain already at the very beginning:\n````\nawait ing(object.member.asyncFunction()).syncFunction().doSomethingElseAsync()\n````\n... is the same as ...\n````\nawait ing(object).member.asyncFunction().syncFunction().doSomethingElseAsync()\n````\nI like it clean: Personally I prefer wrapping objects (or function calls) the earliest possible. \n\n# Caveats\nBehind the scenes every function call is awaited. As you can also chain synchronous function calls, that means these synchronous calls may also be waiting for their turn of the event loop (depending on the JS engine/environment, I guess?!).\nThis is uninvestigated, however - if you'd like to add more insight into this, feel free to raise an issue. In most applications this should have negligable impact, though.\n\n# License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felemental-mind%2Fawaitium-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felemental-mind%2Fawaitium-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felemental-mind%2Fawaitium-js/lists"}