Skip to content

Commit

Permalink
feat: Call listener as function (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
taorepoara authored Jan 25, 2024
1 parent ffcc821 commit 274bb82
Show file tree
Hide file tree
Showing 34 changed files with 4,200 additions and 1,307 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@ const route = app.route(`/${counter.id}`, (data) => {
You can also call a listener given by the route:

```javascript
button.onclick = () => {
route.callListener(data.increment).then(() => {
// calling directly the listener
button1.onclick = () => {
data.increment().then(() => {
// When the listener is finished
});
};
// or from the route
button2.onclick = () => {
route.callListener(data.decrement).then(() => {
// When the listener is finished
});
};
Expand Down
4 changes: 3 additions & 1 deletion example/app-lenra/.github/workflows/lenra-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
uses: ndeloof/[email protected]
- run: docker-compose --version
- name: Install Lenra CLI
run: wget -c https://github.com/lenra-io/lenra_cli/releases/latest/download/lenra-linux-x86_64.tar.gz -O - | tar -xz
run: wget -c https://github.com/lenra-io/lenra_cli/releases/latest/download/lenra-linux-x86_64 -O lenra
- name: Make Lenra CLI executable
run: chmod +x lenra
- name: Build app
run: ./lenra build
4 changes: 2 additions & 2 deletions example/app-lenra/.template
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
https://github.com/lenra-io/template-javascript.git
aa877374123282219c6dae4b2aa04724b4bc6ae5
https://github.com/lenra-io/template-bun-ts.git
6957345e52aad5660d0cfff9216a63b99ce1f657
52 changes: 16 additions & 36 deletions example/app-lenra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<br />
<div align="center">

<h3 align="center">Template Javascript</h3>
<h3 align="center">Template TypeScript based on Bun.sh</h3>

<p align="center">
This template provides just enough to get started with your Javascript application.
This template provides just enough to get started with your TypeScript application.
<br />
<br />
<a href="https://github.com/lenra-io/template-javascript/issues">Report Bug</a>
<a href="https://github.com/lenra-io/template-bun-ts/issues">Report Bug</a>
·
<a href="https://github.com/lenra-io/template-javascript/issues">Request Feature</a>
<a href="https://github.com/lenra-io/template-bun-ts/issues">Request Feature</a>
</p>
</div>

Expand All @@ -46,31 +46,11 @@ Installation instructions can be found here https://github.com/lenra-io/lenra_cl
<!-- USAGE EXAMPLES -->
## Usage

To have IDE auto-completion, you will have to install the dependencies of the project. To do so, run the following command:

```console
npm install
```

This will also index the views and listeners of your application. You can re-index them by running:
```console
npm run index
```


To start the JavaScript template just run:

To run the Javascript template just run:
```console
lenra dev
```

### Classique client

You can use one of the client libs to create a custom client for your application.
You can find the client libs here: https://github.com/search?q=topic%3Alenra+topic%3Aclient+topic%3Alib&sort=stargazers&type=repositories

### Lenra client (beta)

You can then access the application by opening [`localhost:4000`](http://localhost:4000) on your web browser.

This template is a basic implementation of a Lenra application using the Javascript language. You can get your application started by using this template.
Expand Down Expand Up @@ -104,20 +84,20 @@ Distributed under the **MIT** License. See [LICENSE](./LICENSE) for more informa

Lenra - [@lenra_dev](https://twitter.com/lenra_dev) - [email protected]

Project Link: [https://github.com/lenra-io/template-javascript](https://github.com/lenra-io/template-javascript)
Project Link: [https://github.com/lenra-io/template-bun-ts](https://github.com/lenra-io/template-bun-ts)

<p align="right">(<a href="#top">back to top</a>)</p>


<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[contributors-shield]: https://img.shields.io/github/contributors/lenra-io/template-javascript.svg?style=for-the-badge
[contributors-url]: https://github.com/lenra-io/template-javascript/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/lenra-io/template-javascript.svg?style=for-the-badge
[forks-url]: https://github.com/lenra-io/template-javascript/network/members
[stars-shield]: https://img.shields.io/github/stars/lenra-io/template-javascript.svg?style=for-the-badge
[stars-url]: https://github.com/lenra-io/template-javascript/stargazers
[issues-shield]: https://img.shields.io/github/issues/lenra-io/template-javascript.svg?style=for-the-badge
[issues-url]: https://github.com/lenra-io/template-javascript/issues
[license-shield]: https://img.shields.io/github/license/lenra-io/template-javascript.svg?style=for-the-badge
[license-url]: https://github.com/lenra-io/template-javascript/blob/master/LICENSE
[contributors-shield]: https://img.shields.io/github/contributors/lenra-io/template-bun-ts.svg?style=for-the-badge
[contributors-url]: https://github.com/lenra-io/template-bun-ts/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/lenra-io/template-bun-ts.svg?style=for-the-badge
[forks-url]: https://github.com/lenra-io/template-bun-ts/network/members
[stars-shield]: https://img.shields.io/github/stars/lenra-io/template-bun-ts.svg?style=for-the-badge
[stars-url]: https://github.com/lenra-io/template-bun-ts/stargazers
[issues-shield]: https://img.shields.io/github/issues/lenra-io/template-bun-ts.svg?style=for-the-badge
[issues-url]: https://github.com/lenra-io/template-bun-ts/issues
[license-shield]: https://img.shields.io/github/license/lenra-io/template-bun-ts.svg?style=for-the-badge
[license-url]: https://github.com/lenra-io/template-bun-ts/blob/master/LICENSE
Binary file added example/app-lenra/bun.lockb
Binary file not shown.
Loading

0 comments on commit 274bb82

Please sign in to comment.