Skip to content

Commit

Permalink
feat(preprocess): add support for error message bubble (spicetify#1963)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrie25 authored Sep 29, 2022
1 parent 28ccdad commit 711c457
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,10 @@ declare namespace Spicetify {
function removeFromQueue(uri: string | string[]): Promise<void>;
/**
* Display a bubble of notification. Useful for a visual feedback.
* @param message Message to display
* @param isError If true, bubble will be red. Defaults to false.
*/
function showNotification(text: string): void;
function showNotification(text: string, isError?: boolean): void;
/**
* Set of APIs method to parse and validate URIs.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/preprocess/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func exposeAPIs_main(input string) string {
utils.Replace(
&input,
`,(\w+)=(\(\w+=\w+\.dispatch)`,
`;globalThis.Spicetify.showNotification=(message)=>${1}({message});const ${1}=${2}`)
`;globalThis.Spicetify.showNotification=(message,isError=false)=>${1}({message,feedbackType:isError?"ERROR":"NOTICE"});const ${1}=${2}`)

// Remove list of exclusive shows
utils.Replace(
Expand Down

0 comments on commit 711c457

Please sign in to comment.