public async onKeyUp()

in streamdeck-plugin/src/actions/default-action.ts [44:107]


    public async onKeyUp({payload}: KeyUpEvent<ActionSettingsInterface>): Promise<void> {
        console.log('onKeyUp() actionId=' + this.actionId())
        let action = payload.settings.action // current button's customized action ID
        let runConfig = payload.settings.runConfig
        console.log('onKeyUp() customAction=' + action)

        if (action == null || action === '') {
            action = this.actionId()
        }

        if (action == null || action === '') {
            if(this.context != null) {
                this.plugin.showAlert(this.context);
            }

            return
        }

        const globalSettings = this.plugin.settingsManager.getGlobalSettings<GlobalSettingsInterface>()
        let host: string = '127.0.0.1'
        let password: string = ''
        let port: string = ''

        if (isGlobalSettingsSet(globalSettings)) {
            host = globalSettings.host
        }

        if(host === undefined || host === '') {
            host = '127.0.0.1'
        }

        if (globalSettings !== undefined) {
            const settings: GlobalSettingsInterface = globalSettings as GlobalSettingsInterface
            password = settings.password
            port = settings.port
        }

        // Override with action-specific port if provided
        if (payload.settings.port) {
            port = payload.settings.port
        }

        // Handle customized run/debug configuration
        let endpoint = `/api/action/${action}`;

        if (runConfig == null || runConfig === undefined) {
            runConfig = ''
        }

        console.log('runConfig=' + runConfig)
        if(runConfig !== '') {
            endpoint += '?name=' + encodeURIComponent(runConfig)
        }

        await fetchJetBrainsIDE({
            endpoint: endpoint,
            port: port,
            password: password,
            accessToken: '',
            host: host,
            method: 'GET',
        })

    }