docs: touchups

* code block langs
* ags faq
* fix broken links
This commit is contained in:
Aylur
2024-09-07 13:00:42 +00:00
parent 758550f320
commit 13b6c88dd0
8 changed files with 167 additions and 68 deletions
+21 -17
View File
@@ -2,7 +2,7 @@
`App` is a singleton **instance** of [Astal.Application](https://aylur.github.io/libastal/class.Application.html).
```tsx
```ts
import { App } from "astal"
```
@@ -29,7 +29,7 @@ You can not instantiate widgets outside of the main function.
You can run multiple instance by defining a unique instance name.
```tsx
```ts
App.start({
instanceName: "my-instance", // defaults to "astal"
main() {},
@@ -52,16 +52,20 @@ App.start({
})
```
```bash
# ags cli
$ ags -m "say hi"
hi cli
:::code-group
# astal cli
$ astal say hi
hi cli
```sh [ags]
ags -m "say hi"
# hi cli
```
```sh [astal]
astal say hi
# hi cli
```
:::
If you want to run arbitrary JavaScript from cli, you can use `App.eval`.
It will evaluate the passed string as the body of an `async` function.
@@ -76,19 +80,19 @@ App.start({
If the string does not contain a semicolon, a single expression is assumed and returned implicity.
```bash
$ ags -m "'hello'"
hello
```sh
ags -m "'hello'"
# hello
```
If the string contains a semicolon, you have to return explicitly
```bash
$ ags -m "'hello';"
undefined
```sh
ags -m "'hello';"
# undefined
$ ags -m "return 'hello';"
hello
ags -m "return 'hello';"
# hello
```
## App without AGS