npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lastfm-viewer/react

v2.3.0

Published

A React component to view recent scrobbles for a last.fm user

Downloads

74

Readme

@lastfm-viewer/react

[!NOTE] This repository is now part of a monorepo if you want to start developing on it go to the original monorepo here

Homepage: lastfm-viewer.vercel.app

A React component to view recent scrobbles for a provided last.fm user, built with:

Quick start

Install it:

npm i @lastfm-viewer/react
# or
yarn add @lastfm-viewer/react
# or
pnpm add @lastfm-viewer/react
# or
bun i @lastfm-viewer/react

Use it

to start using the component you first need to get a last.fm API key from here, once you've done that just import the component and specify the username of the user you want to get scrobbling information from:

Please note that some users set their profile stats to private, so not every user is applicable, if you're using this component on your personal account just set your "Recent listening" stats to public here

import ReactLastFMViewer from "@lastfm-viewer/react";

function App() {
	return (
		<>
			<ReactLastFMViewer user="[username]" api_key="[API_KEY]" />
		</>
	);
}

Props:

user: string :

last.fm username

api_key: string :

your last.fm public api key

updateInterval?: number :

if you want to frequently fetch the user's listening info just specify the updateInterval prop. (milliseconds) (it takes a number that determines the update interval):

import ReactLastFMViewer from "@lastfm-viewer/react";

function App() {
	return (
		<>
			<ReactLastFMViewer
				user="[username]"
				api_key="[API_KEY]"
				updateInterval={20000} {/* 20 seconds */}
			/>
		</>
	);
}

[!CAUTION] setting the updateInterval prop to a low number might subject your api key for termination, to avoid this just use a higher more reasonable number.

mode?: ("dev" | "prod") = "dev" :

The default value for this prop is: "dev"

when using "dev" mode any error that haapens will be viewed with the following message above it:

Hello developer👋, please consider handling the following error before deployment:

Error during development

when using "prod" mode the error is shown as is:

Error during production