-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(js-lib): bump version to rename exported object
- Loading branch information
Showing
6 changed files
with
63 additions
and
105 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Plain JS client | ||
|
||
This example use CDN on the Js side to illustrate how to use the trame client in plain JavaScript. | ||
|
||
## Trame setup | ||
|
||
```bash | ||
python3 -m venv .venv | ||
source .venv/bin/activate | ||
pip install trame | ||
``` | ||
|
||
## Running example | ||
|
||
```bash | ||
python ./server.py --content ./www | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from trame.app import get_server | ||
|
||
server = get_server() | ||
state, ctrl = server.state, server.controller | ||
|
||
state.list = [ | ||
"a", | ||
"b", | ||
"c", | ||
] | ||
|
||
state.count = 1 | ||
|
||
|
||
@ctrl.trigger("add") | ||
def add_to_count(): | ||
state.count += 1 | ||
|
||
|
||
@ctrl.trigger("subtract") | ||
def subtract_to_count(): | ||
state.count += 1 | ||
|
||
|
||
server.start() |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html><html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>My Trame Client</title> | ||
</head> | ||
<body> | ||
<main> | ||
<h1>Welcome to My Trame Client</h1> | ||
<button class="add">Add</button> | ||
<button class="subtract">Subtract</button> | ||
<div class="count">from HTML</div> | ||
</main> | ||
<script crossorigin="anonymous" src="https://www.unpkg.com/@kitware/[email protected]/dist/trame.umd.js"></script> | ||
<script> | ||
</script> | ||
</body> | ||
</html> |
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
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