function handle(event, arg) {
    if (arg.state === undefined) {
        var state = arg;
    }
    else {
        var state = arg.state;
    }
    switch (state) {
        case "loginOK":
            console.log("OK");
            if (arg.login != undefined) {
                lastfm.login(arg.login, arg.password).then(result => {
                    console.log("Logged in: "+result);
                    event.reply('btn-event', "loginTrue");
                    
                }).catch(err => {
                    dialog.showMessageBox(err);
                    event.reply('btn-event', "loginFalse");
                });

            }
            break;
        case "loginCancel":
            console.log("cancel");
            process.exit();
            break;
    }
}
/*
Handles button's actions.
*/
Handles button's actions.
Handles button ' s actions .
function handle(event, arg) {
    if (arg.state === undefined) {
        var state = arg;
    }
    else {
        var state = arg.state;
    }
    switch (state) {
        case "loginOK":
            console.log("OK");
            if (arg.login != undefined) {
                lastfm.login(arg.login, arg.password).then(result => {
                    console.log("Logged in: "+result);
                    event.reply('btn-event', "loginTrue");
                }).catch(err => {
                    dialog.showMessageBox(err);
                    event.reply('btn-event', "loginFalse");
                });
            }
            break;
        case "loginCancel":
            console.log("cancel");
            process.exit();
            break;
    }
}
function handle ( event , arg ) { if ( arg . state === undefined ) { var state = arg ; } else { var state = arg . state ; } switch ( state ) { case "loginOK" : console . log ( "OK" ) ; if ( arg . login != undefined ) { lastfm . login ( arg . login , arg . password ) . then ( result => { console . log ( "Logged in: " + result ) ; event . reply ( 'btn-event' , "loginTrue" ) ; } ) . catch ( err => { dialog . showMessageBox ( err ) ; event . reply ( 'btn-event' , "loginFalse" ) ; } ) ; } break ; case "loginCancel" : console . log ( "cancel" ) ; process . exit ( ) ; break ; } }
Handles button's actions.
Handles button ' s actions .