diff --git a/src/btn.ts b/src/btn.ts index 1b42c0c..e55f5a7 100644 --- a/src/btn.ts +++ b/src/btn.ts @@ -87,6 +87,10 @@ export namespace BtnAction { export const PROCESSING_TEXT = 'Processing…' export const ERROR_TEXT = '❌Download Failed!' + const deprecationNotice = (btnName: string): string => { + return `DEPRECATED! (may still work)\n\nUse \`${btnName}\` inside \`Individual Parts\` instead.` + } + type Promisable = T | Promise type UrlInput = Promisable | (() => Promisable) @@ -160,4 +164,12 @@ export namespace BtnAction { } } + export const deprecate = (action: BtnAction): BtnAction => { + return (name, btn, setText) => { + alert(deprecationNotice(name)) + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return action(name, btn, setText) + } + } + } diff --git a/src/main.ts b/src/main.ts index 60e09cc..cf991d5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -27,7 +27,9 @@ const main = (): void => { btnList.add({ name: 'Download PDF', - action: BtnAction.process(downloadPDF), + action: BtnAction.deprecate( + BtnAction.process(downloadPDF), + ), }) btnList.add({ @@ -42,7 +44,9 @@ const main = (): void => { btnList.add({ name: 'Download MIDI', - action: BtnAction.download(() => getFileUrl('midi'), `${filename}.mid`), + action: BtnAction.deprecate( + BtnAction.download(() => getFileUrl('midi'), `${filename}.mid`), + ), }) btnList.add({