{"id":22731326,"url":"https://github.com/sno2/async_function","last_synced_at":"2026-04-27T11:31:02.209Z","repository":{"id":62421757,"uuid":"307024039","full_name":"sno2/async_function","owner":"sno2","description":"A simple Deno module for accessing the `AsyncFunction` class and type.","archived":false,"fork":false,"pushed_at":"2020-10-25T04:32:11.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T10:43:42.238Z","etag":null,"topics":["async","asyncfunction","asynchronous","deno","deno-module","deno-modules"],"latest_commit_sha":null,"homepage":"https://deno.land/x/async_function","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/sno2.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":"2020-10-25T04:30:09.000Z","updated_at":"2020-10-25T04:41:31.000Z","dependencies_parsed_at":"2022-11-01T17:32:45.288Z","dependency_job_id":null,"html_url":"https://github.com/sno2/async_function","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sno2/async_function","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sno2%2Fasync_function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sno2%2Fasync_function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sno2%2Fasync_function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sno2%2Fasync_function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sno2","download_url":"https://codeload.github.com/sno2/async_function/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sno2%2Fasync_function/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32335295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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","asyncfunction","asynchronous","deno","deno-module","deno-modules"],"created_at":"2024-12-10T19:21:29.400Z","updated_at":"2026-04-27T11:31:02.193Z","avatar_url":"https://github.com/sno2.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async_function\n\n\u003e A simple Deno module for accessing the `AsyncFunction` class and type.\n\n## Why?\n\nDespite the `Function` class being in the default global scope, the `AsyncFunction` class is not. A workaround to get this type can be achieved by just using the following code:\n\n```ts\nconst AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;\n// credits: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction\n```\n\nObviously, this is a little bit of nasty code that everyone may not want to have to include every time you need the `AsyncFunction` class. Therefore, I have created this Deno module to give you the `AsyncFunction` class just by importing it from the Deno third-party modules registry.\n\n## Usage\n\nHere is how you can import the `AsyncFunction` class:\n\n```ts\nimport { AsyncFunction } from \"http://deno.land/x/async_function/mod.ts\";\n```\n\nThere you go! You can now freely use the `AsyncFunction` class and all of it's glory! Of course, if we did want to add a type for `AsyncFunction` if we have an undeclared variable or just want to be explicit, we can just do `typeof AsyncFunction` to get its type. However, if you really want to have the `AsyncFunction` type imported into your code from yours truly, you can use this import statement:\n\n```ts\nimport type { AsyncFunctionType } from \"http://deno.land/x/async_function/mod.ts\";\n```\n\nNow, we have the `AsyncFunction` class and its type for us to use. Please refer to [the MDN docs page on `AsyncFunction`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction) for more info.\n\n## License\n\nBy contributing your code, you agree to license your contribution under the [MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsno2%2Fasync_function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsno2%2Fasync_function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsno2%2Fasync_function/lists"}