{"id":21451164,"url":"https://github.com/lenra-io/client-lib-js","last_synced_at":"2026-04-20T03:03:14.838Z","repository":{"id":194527758,"uuid":"679697521","full_name":"lenra-io/client-lib-js","owner":"lenra-io","description":"A lib to Let you create your JavaScript/TypeScript application with Lenra backend","archived":false,"fork":false,"pushed_at":"2024-02-08T17:25:43.000Z","size":237,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-05T04:41:22.271Z","etag":null,"topics":["client","javascript","js","lenra","lib","ts","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lenra-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["lenra-io"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-08-17T12:19:44.000Z","updated_at":"2025-08-27T12:34:58.000Z","dependencies_parsed_at":"2024-02-07T22:43:42.868Z","dependency_job_id":"0c97d3f8-0d1d-4828-9a58-65425e06629b","html_url":"https://github.com/lenra-io/client-lib-js","commit_stats":{"total_commits":22,"total_committers":3,"mean_commits":7.333333333333333,"dds":0.4545454545454546,"last_synced_commit":"1ed8db3e55e5d3adf9173ccae65d3fb01955547b"},"previous_names":["lenra-io/client-lib-js"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/lenra-io/client-lib-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Fclient-lib-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Fclient-lib-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Fclient-lib-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Fclient-lib-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lenra-io","download_url":"https://codeload.github.com/lenra-io/client-lib-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenra-io%2Fclient-lib-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32031070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","javascript","js","lenra","lib","ts","typescript"],"created_at":"2024-11-23T04:18:28.097Z","updated_at":"2026-04-20T03:03:14.821Z","avatar_url":"https://github.com/lenra-io.png","language":"TypeScript","funding_links":["https://github.com/sponsors/lenra-io"],"categories":[],"sub_categories":[],"readme":"\u003cdiv id=\"top\"\u003e\u003c/div\u003e\n\u003c!--\n*** This README was created with https://github.com/othneildrew/Best-README-Template\n--\u003e\n\n\n\n\u003c!-- PROJECT SHIELDS --\u003e\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![MIT License][license-shield]][license-url]\n\n\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n\n\u003ch3 align=\"center\"\u003eLenra's JavaScript client lib\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    Let you create your JavaScript application with Lenra backend.\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/lenra-io/client-lib-js/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/lenra-io/client-lib-js/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\n\n\n\u003c!-- GETTING STARTED --\u003e\n\n## Prerequisites\n\nAdd the dependency to your project:\n\n```console\nnpm i @lenra/client\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- USAGE EXAMPLES --\u003e\n## Usage\n\nCreate a `LenraApp` in your :\n\n```javascript\nimport { LenraApp } from '@lenra/client';\n\nconst app = new LenraApp({\n    appName: \"Example Client\",\n    clientId: \"XXX-XXX-XXX\",\n});\n```\n\nAuthenticate the user and open the websocket connection:\n\n```javascript\napp.connect();\n```\n\nYou also can manage them separatly:\n  \n```javascript\nconst token = app.authenticate();\napp.openSocket(token);\n```\n\nOr just open the websocket connection without authentication:\n\n```javascript\napp.openSocket();\n```\n\nThis while automatically start the authentication flow.\n\nYou can then connect to a Lenra route to use it data:\n\n```javascript\nconst route = app.route(`/${counter.id}`, (data) =\u003e {\n    // Handle data\n});\n```\n\nYou can also call a listener given by the route:\n\n```javascript\n// calling directly the listener\nbutton1.onclick = () =\u003e {\n  data.increment().then(() =\u003e {\n      // When the listener is finished\n  });\n};\n// or from the route\nbutton2.onclick = () =\u003e {\n  route.callListener(data.decrement).then(() =\u003e {\n      // When the listener is finished\n  });\n};\n```\n\nThis [the full example](./example/src/index.js) for more informations.\n\n\nFor the web target, you also have to add the following JavaScript to a redirect file (default to `redirect.html`) to handle OAuth2 redirection (see the [example](./example/redirect.html)):\n\n```javascript\nwindow.onload = function() {\n  window.opener.postMessage(window.location.href, `${window.location.protocol}//${window.location.host}`);\n}\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nIf you have a suggestion that would make this better, please open an issue with the tag \"enhancement\".\nDon't forget to give the project a star if you liked it! Thanks again!\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the **MIT** License. See [LICENSE](./LICENSE) for more information.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- CONTACT --\u003e\n## Contact\n\nLenra - [@lenra_dev](https://twitter.com/lenra_dev) - contact@lenra.io\n\nProject Link: [https://github.com/lenra-io/client-lib-js](https://github.com/lenra-io/client-lib-js)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n[contributors-shield]: https://img.shields.io/github/contributors/lenra-io/client-lib-js.svg?style=for-the-badge\n[contributors-url]: https://github.com/lenra-io/client-lib-js/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/lenra-io/client-lib-js.svg?style=for-the-badge\n[forks-url]: https://github.com/lenra-io/client-lib-js/network/members\n[stars-shield]: https://img.shields.io/github/stars/lenra-io/client-lib-js.svg?style=for-the-badge\n[stars-url]: https://github.com/lenra-io/client-lib-js/stargazers\n[issues-shield]: https://img.shields.io/github/issues/lenra-io/client-lib-js.svg?style=for-the-badge\n[issues-url]: https://github.com/lenra-io/client-lib-js/issues\n[license-shield]: https://img.shields.io/github/license/lenra-io/client-lib-js.svg?style=for-the-badge\n[license-url]: https://github.com/lenra-io/client-lib-js/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenra-io%2Fclient-lib-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flenra-io%2Fclient-lib-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenra-io%2Fclient-lib-js/lists"}