-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Guillaume Hivert <[email protected]>
- Loading branch information
Showing
4 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
*.ez | ||
/build | ||
erl_crash.dump | ||
.DS_Store | ||
Thumbs.db | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,58 @@ | ||
# Tardis | ||
|
||
[![Package Version](https://img.shields.io/hexpm/v/tardis)](https://hex.pm/packages/tardis) | ||
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/tardis/) | ||
<!-- [![Package Version](https://img.shields.io/hexpm/v/tardis)](https://hex.pm/packages/tardis) | ||
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/tardis/) --> | ||
|
||
Every good frontend framework should have a good debugger. Tardis tries to fill | ||
this gap with [Lustre](https://hexdocs.pm/lustre). Because of the immutable nature and the management of side-effects of lustre, it's possible to implement a debugger able to register everything that happened in the app and that can rewind the time in order to display the state of your app, at any point in time! Tardis is a time-traveller debugger, made to interact with multiple lustre applications and components on one page, with the simplest setup possible yet! | ||
|
||
## Demo | ||
|
||
![Demo video](assets/demo.mp4) | ||
|
||
## Quickstart Guide | ||
|
||
First, add tardis to your gleam project. | ||
|
||
```sh | ||
gleam add tardis | ||
``` | ||
|
||
Then, setup the package. | ||
|
||
```gleam | ||
import gleam/int | ||
import lustre | ||
import lustre/element/html | ||
import lustre/event | ||
import tardis | ||
pub fn main() { | ||
// TODO: An example of the project in use | ||
let main = tardis.single("main") | ||
lustre.application(init, update, view) | ||
|> tardis.wrap(main) | ||
|> lustre.start("#app", Nil) | ||
|> tardis.activate(main) | ||
} | ||
``` | ||
Further documentation can be found at <https://hexdocs.pm/tardis>. | ||
fn init(_) { | ||
0 | ||
} | ||
## Development | ||
fn update(model, msg) { | ||
case msg { | ||
Incr -> model + 1 | ||
Decr -> model - 1 | ||
} | ||
} | ||
```sh | ||
gleam run # Run the project | ||
gleam test # Run the tests | ||
gleam shell # Run an Erlang shell | ||
fn view(model) { | ||
let count = int.to_string(model) | ||
html.div([], [ | ||
html.button([event.on_click(Incr)], [html.text(" + ")]), | ||
html.p([], [html.text(count)]), | ||
html.button([event.on_click(Decr)], [html.text(" - ")]) | ||
]) | ||
} | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters