Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-listen-along

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-listen-along - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

6

dist/use-listen-along.cjs.development.js

@@ -17,3 +17,3 @@ 'use strict';

var parseResponse = function parseResponse(res) {
var _res$error, _res$data, _res$data$spotify;
var _res$error, _res$data, _res$data2, _res$data2$spotify;

@@ -24,4 +24,4 @@ var error = {

};
var np = res.data.listening_to_spotify;
var track = (_res$data = res.data) == null ? void 0 : (_res$data$spotify = _res$data.spotify) == null ? void 0 : _res$data$spotify.track_id;
var np = (_res$data = res.data) == null ? void 0 : _res$data.listening_to_spotify;
var track = (_res$data2 = res.data) == null ? void 0 : (_res$data2$spotify = _res$data2.spotify) == null ? void 0 : _res$data2$spotify.track_id;
return {

@@ -28,0 +28,0 @@ error: error,

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useListenAlong=function(t,e,r){var n,s=!1,o=null,a=function(t){var e,r,n;return{error:{status:!t.success,message:null==t||null==(e=t.error)?void 0:e.message},np:t.data.listening_to_spotify,track:null==(r=t.data)||null==(n=r.spotify)?void 0:n.track_id}},i=function(t){if(t.error.status)throw new Error(JSON.stringify(t.error));t.track!==n&&t.np&&!r&&fetch("https://api.spotify.com/v1/me/player/play",{method:"PUT",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({uris:["spotify:track:"+n]})}).then((function(t){s=204==t.status,o=204!==t.status?403==t.status?"User must have a premium account.":t.statusText:null})).catch((function(t){if(t.status)throw new Error(t)})),n=t.track};return setInterval((function(){r||fetch("https://api.lanyard.rest/v1/users/"+t).then((function(t){return t.json()})).then(a).then(i)}),1e3),{connected:s,error:o}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useListenAlong=function(t,e,r){var n,s=!1,o=null,a=function(t){var e,r,n,s;return{error:{status:!t.success,message:null==t||null==(e=t.error)?void 0:e.message},np:null==(r=t.data)?void 0:r.listening_to_spotify,track:null==(n=t.data)||null==(s=n.spotify)?void 0:s.track_id}},i=function(t){if(t.error.status)throw new Error(JSON.stringify(t.error));t.track!==n&&t.np&&!r&&fetch("https://api.spotify.com/v1/me/player/play",{method:"PUT",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({uris:["spotify:track:"+n]})}).then((function(t){s=204==t.status,o=204!==t.status?403==t.status?"User must have a premium account.":t.statusText:null})).catch((function(t){if(t.status)throw new Error(t)})),n=t.track};return setInterval((function(){r||fetch("https://api.lanyard.rest/v1/users/"+t).then((function(t){return t.json()})).then(a).then(i)}),1e3),{connected:s,error:o}};
//# sourceMappingURL=use-listen-along.cjs.production.min.js.map

@@ -13,3 +13,3 @@ /**

var parseResponse = function parseResponse(res) {
var _res$error, _res$data, _res$data$spotify;
var _res$error, _res$data, _res$data2, _res$data2$spotify;

@@ -20,4 +20,4 @@ var error = {

};
var np = res.data.listening_to_spotify;
var track = (_res$data = res.data) == null ? void 0 : (_res$data$spotify = _res$data.spotify) == null ? void 0 : _res$data$spotify.track_id;
var np = (_res$data = res.data) == null ? void 0 : _res$data.listening_to_spotify;
var track = (_res$data2 = res.data) == null ? void 0 : (_res$data2$spotify = _res$data2.spotify) == null ? void 0 : _res$data2$spotify.track_id;
return {

@@ -24,0 +24,0 @@ error: error,

{
"name": "use-listen-along",
"description": "A react hook to listen alongside others on spotify.",
"version": "1.1.7",
"version": "1.1.8",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

@@ -21,3 +21,3 @@ import { LanyardResponse } from './types';

const error = { status: !res.success, message: res?.error?.message };
const np = res.data.listening_to_spotify;
const np = res.data?.listening_to_spotify;
const track = res.data?.spotify?.track_id;

@@ -34,4 +34,4 @@

error: { status: boolean; message: string };
np: boolean;
track: string;
np: boolean | undefined;
track: string | undefined;
}) => {

@@ -38,0 +38,0 @@ if (r.error.status) throw new Error(JSON.stringify(r.error));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc