Who can tell me the meaning of the following code?
blob = new Blob([ blob, appendABViewSupported ? array : array.buffer ], {
type : contentType
});
Who can tell me the meaning of the following code?
blob = new Blob([ blob, appendABViewSupported ? array : array.buffer ], {
type : contentType
});
On
That code can be expanded like this (I think):
var a;
var b;
var c;
var blob;
if (appendABViewSupported) {
a = array;
} else {
a = array.buffer;
}
b = [ blob, a ]; // this bit seems like an issue to me but
// but would need to see the Blob code.
c = { type : contentType };
blob = new Blob(b,c);
All they have done is compress everything to make it more complex to read (some would say). Personally, I would have expanded some and used some of the short hand. For example, I would have used a ternary at the very least like so:
var a = appendABViewSupported ? array : array.buffer;
This code creates a new Blob, with the following input parameters:
I'm guessing it's this part
that you are wondering about here. It means: If "appendABViewSupported" is true, then use the "array" variable. Else, use the "array.buffer" variable.
This code snippet does the same thing:
But it's more elegant this way: