https://github.com/sunneydev/lcu-events
https://github.com/sunneydev/lcu-events
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/sunneydev/lcu-events
- Owner: sunneydev
- Created: 2021-06-16T08:51:40.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-24T20:17:28.000Z (over 3 years ago)
- Last Synced: 2024-08-01T23:30:45.473Z (9 months ago)
- Language: TypeScript
- Size: 17.6 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-league - lcu-events - Cross-platform NPM Module to handle WebSocket events and make API calls to LCU. (Developer Tools)
README
# lcu-events
A lightweight cross-platform TS project for receiving events from LCU.
# Installation
```
npm install lcu-events
```# Usage
### Subscribe to a specific event
```ts
import LCU from 'lcu-events';const lcu = new LCU();
lcu.events.on('/lol-champ-select/v1/session', (data) => {
// handle
})
```### Make a request to an endpoint
```ts
import LCU from "./lcu";const lcu = new LCU();
lcu.wsEvents.on('connect', () => {
lcu.fetch('/lol-login/v1/session')
.then((resp) => resp.json())
.then((data) => {
// process data...
})
})
```