Imrpove the following code without if/else
I would separate them out into functions to make the code more readable. So the first if/else would become:

if (decode)
  doDecode()
else
  doEncodeSingle();


I would also break the doDocdeSingle up:

Quagga.decodeSingle({...},
  handleDecodeResult );


The last if/else is currently structured as:

if (result) {
  if (result.codeResult) {
    // Handle Code
  } else {
    // Handle no-code
  }
} else {
  // No result
}


I often find it cleaner to reverse the condition and structure it as:

if (!result) {
  // No result
} else if (result.codeResult) {
  // Handle Code
} else {
  // Handle no-code
}


Which removes a level of nesting. Again I would try and make each if section a single function call.