Add example how to import aqua function

This commit is contained in:
Pavel Murygin 2023-02-15 15:55:38 +04:00
parent 9195d58c08
commit 9c4d6b350f

View File

@ -71,11 +71,11 @@ it might be a good idea to add these scripts to your `package.json` file
For example you project structure could look like this: For example you project structure could look like this:
``` ```
┣ aqua _aqua
┃ ┗ hello-world.aqua ┃ ┗ demo.aqua
┣ src ┣ src
┃ ┣ _aqua ┃ ┣ _aqua
┃ ┃ ┗ hello-world.ts ┃ ┃ ┗ demo.ts
┃ ┗ index.ts ┃ ┗ index.ts
┣ package-lock.json ┣ package-lock.json
┣ package.json ┣ package.json
@ -96,6 +96,17 @@ And your package json:
} }
``` ```
6. Now you can import and use call aqua code from your application. e.g;
```
import { getRelayTime } from "./_aqua/demo";
async function buttonClick() {
const time = await getRelayTime();
alert("relay time: " + time);
}
```
## Developing ## Developing
To hack on the JS Client itself refer to [dev page](./DEVLOPING.md). To hack on the JS Client itself refer to [dev page](./DEVLOPING.md).