Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update undocumented.md #276

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions content/docs/undocumented.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,35 @@ personal notes. Contributions are highly appreciated, especially:
If you have questions about any of these, don't hesitate to reach
out on [Discord](https://discord.gg/mkcbkRw).

## Awaits

You can await desired changes to observable properties with `imba.awaits`,
which takes a callback that will be called every time the property is changed until the callback returns a truthy value.

```imba
# [preview=console]
let user = new class User
@observable first_name = 'first'

setTimeout(&,100ms) do
user.first_name = 'updated'

setTimeout(&,200ms) do
user.first_name = 'again'

imba.awaits do
L user.first_name
user.first_name is 'updated'
```

Notice how it stops logging after the name is `updated`.

You can also await the call to `imba.awaits`:

```imba
await imba.awaits do user.first_name is 'updated'
```

## No Hashing

If you want to bundle with no hashing, for now you need to use Vite as a bundler and specify the output filename:
Expand Down