Core utilities
Framework-neutral functions from react-7tv/core. Also exported from the main entry.
Functions
| Function | Returns |
|---|---|
fetchEmoteSet(id, options?) | Promise of normalized emotes |
parseEmoteSetResponse(payload) | Normalized emotes from a v3 response |
createEmoteMap(collection) | A new alias-keyed map |
tokenizeText(text, map, syntax?) | Text and emote tokens |
delimitedSyntax(prefix, suffix?, options?) | A syntax configuration |
resolveEmoteImage(emote, options?) | src, srcSet, dimensions, and animation state |
Fetching & errors
Options accept signal, fetch, and apiBaseUrl. There is no built-in retry or polling. Network, JSON, and parsing errors propagate.
import { fetchEmoteSet, ApiError7tv } from "react-7tv/core";
try {
const emotes = await fetchEmoteSet("global", {
signal: AbortSignal.timeout(10_000),
});
} catch (error) {
if (error instanceof ApiError7tv) {
console.error(error.status, error.url);
}
}Collections & types
Collections accept arrays, iterables, and maps. Treat them as immutable; pass a new collection when aliases change. EmoteModel7tv is the data type, while Emote7tv from the main entry is the component.