4.0.1 • Published 6 months ago

@lastfm-viewer/svelte v4.0.1

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
6 months ago

@lastfm-viewer/svelte

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

Quick start

Install it:

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

Install peer dependencies:

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

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

<script>
	import SvelteLastFmViewer from '@lastfm-viewer/svelte/SvelteLastFMViewer.svelte';
	import '@lastfm-viewer/ui/styles';
	import '@lastfm-viewer/ui/styles/LastFMViewer.css';
	import '@lastfm-viewer/ui/styles/PastTracks.css';
	import '@lastfm-viewer/ui/styles/TrackProgressBar.css';
	import '@lastfm-viewer/ui/styles/CardFooter.css';
	import '@lastfm-viewer/ui/styles/ErrorView.css';
</script>

<SvelteLastFmViewer 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):

<script>
	import SvelteLastFmViewer from "@lastfm-viewer/svelte/SvelteLastFMViewer.svelte";
</script>

<SvelteLastFmViewer
	user="[username]"
	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

2.0.5

7 months ago

3.0.3

7 months ago

3.0.2

7 months ago

3.0.1

7 months ago

3.0.0

7 months ago

4.0.1

6 months ago

4.0.0

6 months ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.8

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.2.8

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.7

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.0

2 years ago

1.2.1

2 years ago

1.1.5

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago