Navigation
Open pages in Nuclear, navigate back and forward, and read the current location from a plugin.
Navigation API for plugins
The Navigation API is designed to work like the browser history API. You can open navigate to specified views in Nuclear, go back and forward in the navigation history, and read the location of the current page.
Usage
import type { NuclearPluginAPI } from '@nuclearplayer/plugin-sdk';
const showArtist = async (api: NuclearPluginAPI, providerId: string, artistId: string) => {
await api.Navigation.navigate(`/artist/${providerId}/${artistId}`);
};
const showSearchResults = async (api: NuclearPluginAPI, query: string) => {
await api.Navigation.navigate(`/search?q=${encodeURIComponent(query)}`);
};Reference
Opens the page at path. The path is a route of Nuclear, with a search string if the page needs one. Some examples:
Path
Page
/dashboard
Dashboard
/search?q=<query>
Search results
/artist/<providerId>/<artistId>
Artist
/album/<providerId>/<albumId>
Album
/playlists/<playlistId>
Playlist
/favorites/tracks
Favorite tracks
Go back or forward one page in the navigation history.
Returns the location of the current page. At /search?q=radiohead, it returns:
Types
Last updated
