Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ntsd/overwolf-nanostores
Nano Stores implement for Overwolf
https://github.com/ntsd/overwolf-nanostores
game-overlay hearthstone league-of-legends nanostores overlay overwolf
Last synced: about 1 month ago
JSON representation
Nano Stores implement for Overwolf
- Host: GitHub
- URL: https://github.com/ntsd/overwolf-nanostores
- Owner: ntsd
- License: mit
- Created: 2023-10-13T16:52:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-25T15:41:01.000Z (about 1 year ago)
- Last Synced: 2024-05-02T05:51:26.764Z (8 months ago)
- Topics: game-overlay, hearthstone, league-of-legends, nanostores, overlay, overwolf
- Language: TypeScript
- Homepage: https://ntsd.github.io/overwolf-nanostores/
- Size: 52.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Overwolf Nano Stores
[![npm version](https://badge.fury.io/js/overwolf-nanostores.svg)](https://www.npmjs.com/package/overwolf-nanostores)
[Nano Stores](https://github.com/nanostores/nanostores) implementation for Overwolf Plugin
## Prerequisite
Nano Stores is a powerful state manager library designed to support multiple frontend frameworks and tiny bundle sizes.
To have [Overwolf API](https://overwolf.github.io/api) such as [Window](https://overwolf.github.io/api/windows), [Game Event](https://overwolf.github.io/api/games/events) stored in Nano Stores is an easy way to use the API and handle the state.
Supported frameworks: React, React Native, Preact, Vue, Svelte, Solid, Lit, Angular, and vanilla JS.
See how to use Nano Stores in a different framework at [The Nano Store Guide](https://github.com/nanostores/nanostores#react--preact).
## Installation
`npm i overwolf-nanostores`
## Documentation
Link: https://ntsd.github.io/overwolf-nanostores
Documentation is generated by [TypeDoc](https://github.com/TypeStrong/typedoc).
## Examples
Example for `League of Legends` game
```ts
import {
setGameEventRequiredFeatures,
gameInfoAtom,
gameEventAtom,
} from "overwolf-nanostores";// Set required event features
// check different game features from the Overwolf Docs
// https://overwolf.github.io/api/live-game-data/supported-games/league-of-legends#available-features
setGameEventRequiredFeatures(["gep_internal", "match_info", "chat"]);// The subscribe will trigger every time when the Game Info is updated
gameInfoAtom.subscribe((newInfo) => {
if (!newInfo) return;
// use condition to check the feature name
if (newInfo.feature === "gep_internal") {
console.log("Local + Public version number:", JSON.stringify(newInfo.info));
}
if (newInfo.feature === "match_info") {
console.log("match info:", JSON.stringify(newInfo.info));
}
});// The subscribe will trigger every time when a new Game Event occurs
gameEventAtom.subscribe((newEvent) => {
if (!newEvent) return;
newEvent.events.forEach((event) => {
// use condition to check the event name
if (event.name === "chat") {
console.log("new chat:", event.data);
}
});
});
```In the example,
`gep_internal` and `match_info` are features for Game Info so they will trigger the `gameInfoAtom`
`chat` is a feature for Game Event so it will trigger the `gameEventAtom`