Skip to content

Instantly share code, notes, and snippets.

@mager
Created February 11, 2012 20:38
Show Gist options
  • Save mager/1804049 to your computer and use it in GitHub Desktop.
Save mager/1804049 to your computer and use it in GitHub Desktop.
Spotify Apps API - Handling arguments and creating navigational tabs
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() {
var args = models.application.arguments;
$('.section').hide(); // Hide all sections
$('#'+args[0]).show(); // Show the current section
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment