node-spotilocal
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "node-spotilocal", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Simple wrapper for Spotify local webserver.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -43,4 +43,4 @@ # node-spotilocal | ||
// get current status | ||
spotify.status().then(console.log).catch(console.error); | ||
// get app status on particular events (default: ["login", "logout", "play", "pause", "error", "ap"]) or after X seconds (default: 0; 0 = disabled) | ||
spotify.status(["login", "logout", "play", "pause", "error", "ap"], 0).then(console.log).catch(console.error); | ||
@@ -47,0 +47,0 @@ // [optional] revoke auth tokens |
/** | ||
* node-spotilocal v1.0.2 (2018-05-17) | ||
* node-spotilocal v1.0.3 (2018-05-19) | ||
* Copyright 2018 Oliver Findl | ||
@@ -139,6 +139,8 @@ * @license MIT | ||
_revoke() { | ||
return this.csrf = this.oauth = ""; | ||
this.csrf = ""; | ||
this.oauth = ""; | ||
return; | ||
} | ||
async status() { | ||
async status(returnOn = ["login", "logout", "play", "pause", "error", "ap"], returnAfter = 0) { | ||
try { | ||
@@ -148,4 +150,4 @@ return await this._auth() && await this._json(this._url("/remote/status.json"), { | ||
oauth: this.oauth, | ||
returnafter: 0, | ||
returnon: ["login", "logout", "play", "pause", "error", "ap"].join(",") | ||
returnon: (!Array.isArray(returnOn) ? [].push(returnOn) : returnOn).join(","), | ||
returnafter: !isNaN(returnAfter) ? parseInt(returnAfter) : 0 | ||
}); | ||
@@ -160,3 +162,3 @@ } catch(err) { | ||
try { | ||
return await this._auth() && await this._json(this._url("/remote/play.json?action=queue"), { | ||
return await this._auth() && await this._json(this._url("/remote/play.json"), { | ||
csrf: this.csrf, | ||
@@ -163,0 +165,0 @@ oauth: this.oauth, |
7653
164