Hi,
Rune Audio is a client server application and nearly all is done
asynchronous.
An example to explain synchronous versus asynchronous:
You are calling your local dealer to ask him if a special product is available.
synchronous:
- you: "Hello, do you have that green round shiny thing available?"
- he: "Sorry i have to check this, please wait"
- you: waiting, waiting ............... hmm .... waiting
- he: "Sorry we only have a blue round dull thing."
asynchronous:
- you: "Hello, do you have that green round shiny thing available?"
- he: "Sorry i have to check this, please wait. Will call you back soon!"
- you: doing something else until he calls back
- he: "Sorry we only have a blue round dull thing."
Saving a playlist is done by passing "mpc save playlistname" to
function sendCmd(inputcmd) {
$.ajax({
type: 'GET',
url: '/command/?cmd=' + inputcmd + '&clientUUID=' + GUI.clientUUID,
cache: false
});
}
You have to use the callback mechanism to get a response.
This may look like this
function notify_user(result) {
if (!result.match("^OK")) {
new PNotify({
title: 'Error',
text: result,
icon: 'fa fa-exclamation-circle',
delay: 3000
});
}
}
// send a MPD playback control command
function sendCmd(inputcmd) {
$.ajax({
type: 'GET',
url: '/command/?cmd=' + inputcmd + '&clientUUID=' + GUI.clientUUID,
cache: false,
success: notify_user
});
}
Frank