-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs to run liveview examples in 30 seconds
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 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 |
---|---|---|
|
@@ -61,6 +61,29 @@ export const counterLiveView = createLiveView< | |
}); | ||
``` | ||
|
||
### Run LiveViewJS Examples in 30 seconds | ||
```bash | ||
# clone the LiveViewJS repo | ||
git clone [email protected]:floodfx/liveviewjs.git | ||
``` | ||
If you want to run examples for NodeJS (on Express), you can do it like this: | ||
```bash | ||
cd packages/express | ||
npm install | ||
npm run start | ||
# open your browser to http://localhost:4001/ | ||
``` | ||
If you want to run examples for Deno, you can do it like this: | ||
```bash | ||
cd packages/deno | ||
deno run --allow-net --allow-read --allow-write --allow-env --import-map=import_map.json src/example/index.ts | ||
# open your browser to http://localhost:9001/ | ||
``` | ||
To see the examples you just ran navigate to the examples folder: | ||
```bash | ||
cd ../examples | ||
``` | ||
|
||
### Anatomy of a LiveView | ||
The LiveViewJS API is extremely simple but very flexible. There are 5 methods that make up the LiveView lifecycle: `mount`, `handleParams`, `handleEvent`, `handleInfo`, and `render`. The `render` method is the only "required" method. The other methods are optional but typically `mount` and `handleEvent` are also defined in order to setup the context (i.e. state) of the LiveView and handle user input. | ||
|
||
|