Skip to content

Commit 40767ee

Browse files
committed
Add sections
1 parent d936a0a commit 40767ee

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# async_function
22

3-
> A simple module for accessing the `AsyncFunction` class and type.
3+
> A simple Deno module for accessing the `AsyncFunction` class and type.
4+
5+
## Why?
46

57
Despite 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:
68

@@ -9,7 +11,11 @@ const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
911
// credits: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction
1012
```
1113

12-
Obviously, 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. Here is how you can get it working:
14+
Obviously, 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.
15+
16+
## Usage
17+
18+
Here is how you can import the `AsyncFunction` class:
1319

1420
```ts
1521
import { AsyncFunction } from "http://deno.land/x/async_function/mod.ts";

0 commit comments

Comments
 (0)