npm.io
3.1.0 • Published 1 year ago

@lastfm-viewer/solid

Licence
GPL-3.0
Version
3.1.0
Deps
1
Size
959 kB
Vulns
0
Weekly
0

@lastfm-viewer/solid

@lastfm-viewer/solid

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 solidjs component to view recent scrobbles for a last.fm user

Quick start

Install it:

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

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 SolidLastFMViewer from "@lastfm-viewer/solid";

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

Props:

user: string :

last.fm username

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 SolidLastFMViewer from "@lastfm-viewer/solid";

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

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

Keywords