use-listen-along
Advanced tools
Comparing version 1.0.0 to 1.1.1
{ | ||
"name": "use-listen-along", | ||
"description": "A react hook to listen alongside others on spotify.", | ||
"version": "1.0.0", | ||
"version": "1.1.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
@@ -1,3 +0,3 @@ | ||
# 🌙 wrap-presence | ||
#### An official wrapper for [presence](https://presence.im). | ||
# 👥🎵 use-listen along | ||
#### Typescript React Hook for listening along on spotify. | ||
@@ -9,6 +9,6 @@ ### 📦 Installation | ||
via NPM | ||
> npm i --save wrap-presence | ||
> npm i --save use-listen-along | ||
via yarn | ||
> yarn add wrap-presence | ||
> yarn add use-listen-along | ||
@@ -20,22 +20,24 @@ ### ⌨️ Usage | ||
```tsx | ||
import { wrapPresence } from 'wrap-presence'; | ||
import { useListenAlong } from 'use-listen-along'; | ||
const Presence = async () => { | ||
const req = { | ||
platform: 'twitter', | ||
type: 'user', | ||
params: 'atmattt', | ||
}; | ||
const {data, error, isLoading} = await wrapPresence(req); | ||
const Spotify = () => { | ||
const [connection, setConnection] = React.useState<boolean>(false); | ||
// The discord ID of the user you wish to listen-along to. | ||
const snowflake = 291050399509774340; | ||
// The spotify authorization code. | ||
let auth_code: string; | ||
function listen(disconnect) { | ||
// Get auth from spotify with scope 'user-modify-playback-state'. | ||
const {connected, error} = useListenAlong(snowflake, auth_code, disconnect); | ||
setConnection(connected); | ||
} | ||
if (isLoading) { | ||
return <p>Loading...</p> | ||
} else if (error) { | ||
return <p>An error has occured!</p> | ||
} | ||
return data; | ||
return ( | ||
<button onClick={() => listen(connection ? true : false)}> {connection ? 'Disconnect' : "Listen Along"} </button> | ||
) | ||
} | ||
``` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25640
42