Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alii/use-last-fm
🎸 React Hook to use realtime last.fm data and display your currently played song in your application.
https://github.com/alii/use-last-fm
last-fm lastfm music react react-dom react-hook react-music react-music-hook spotify use-hook
Last synced: 5 days ago
JSON representation
🎸 React Hook to use realtime last.fm data and display your currently played song in your application.
- Host: GitHub
- URL: https://github.com/alii/use-last-fm
- Owner: alii
- License: mit
- Created: 2020-09-07T08:45:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-20T20:56:13.000Z (8 months ago)
- Last Synced: 2024-07-31T07:15:48.462Z (5 months ago)
- Topics: last-fm, lastfm, music, react, react-dom, react-hook, react-music, react-music-hook, spotify, use-hook
- Language: TypeScript
- Homepage: https://npmjs.com/package/use-last-fm
- Size: 309 KB
- Stars: 123
- Watchers: 2
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![use-last-fm](docs/use-last-fm.jpg)
![CI Status](https://github.com/webmail/use-last-fm/workflows/CI/badge.svg)
Stream your currently playing song through last.fm as a React hook.
# Features
- 📦 **Tiny**: `use-last-fm` weighs in at **less than** 700 bytes minified and gzipped.
- 🌳 **Universal**: we dist esm and cjs modules.
- 👨💻 **Developer friendly**: Helpful development messages that are stripped away in production
- ⌨️ **Strongly typed**: `use-last-fm` is written in TypeScript and encourages good practices this way## Installation
##### With NPM
> `npm i --save use-last-fm`
##### Or, with yarn:
> `yarn add use-last-fm`
## Usage
```tsx
import { useLastFM } from 'use-last-fm';const CurrentlyPlaying = () => {
const lastFM = useLastFM('aabbccsmith', '[add api token here]');if (lastFM.status !== 'playing') {
returnNot listening to anything
;
}return (
Listening to {lastFM.song.name} by {lastFM.song.artist}
);
};
```A full example can be seen in the [examples](https://github.com/webmail/use-last-fm/tree/master/example) folder