This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="index"> | |
<!-- This content will show up in the "Home" tab --> | |
</div> | |
<div id="tabs"> | |
<!-- This content will show up in the "How to use tabs" tab --> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"DefaultTabs": [ | |
{ | |
"arguments": "index", | |
"title": { | |
"en": "Home" | |
} | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sp = getSpotifyApi(1); | |
var models = sp.require('sp://import/scripts/api/models'); | |
tabs(); // See function definition below | |
/* When a user clicks a tab, the "arguments" property on the | |
* Application object changes, and the tabs() function fires */ | |
models.application.observe(models.EVENT.ARGUMENTSCHANGED, tabs); | |
function tabs() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Instantiate the global sp object; include models & views */ | |
var sp = getSpotifyApi(1); | |
var models = sp.require("sp://import/scripts/api/models"); | |
var views = sp.require("sp://import/scripts/api/views"); | |
/* Create an array of tracks from the user's library */ | |
var tracks = models.library.tracks; | |
/* Create a temporary playlist and fill it with tracks | |
* from the previous query */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AppDescription": { | |
"en": "A tutorial app for Spotify Apps API" | |
}, | |
"AppIcon": { | |
"36x18": "tutorial.png" | |
}, | |
"AppName": { | |
"en": "Spotify Sandbox" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul id="listens"></ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Instantiate the global sp object; include models & views */ | |
var sp = getSpotifyApi(1); | |
var auth = sp.require('sp://import/scripts/api/auth'); | |
var permissions = ['user_actions.music']; | |
var app_id = '126891607432106'; | |
var request_url = 'https://graph.facebook.com/me/music.listens'; | |
auth.authenticateWithFacebook(app_id, permissions, { | |
onSuccess : function(accessToken, ttl) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="status"> | |
<p>If you've successfully authenticated with Facebook, this should be your access token:</p> | |
</div> |