function checkFrames(frames) {
            if (!frames[0]) {
                postMessage({
                    error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'
                });
                return;
            }

            var width = frames[0].width,
                height = frames[0].height,
                duration = frames[0].duration;

            for (var i = 1; i < frames.length; i++) {
                duration += frames[i].duration;
            }
            return {
                duration: duration,
                width: width,
                height: height
            };
        }
function checkFrames(frames) {
            if (!frames[0]) {
                postMessage({
                    error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'
                });
                return;
            }

            var width = frames[0].width,
                height = frames[0].height,
                duration = frames[0].duration;

            for (var i = 1; i < frames.length; i++) {
                duration += frames[i].duration;
            }
            return {
                duration: duration,
                width: width,
                height: height
            };
        }
function checkFrames ( frames ) { if ( ! frames [ 0 ] ) { postMessage ( { error : 'Something went wrong. Maybe WebP format is not supported in the current browser.' } ) ; return ; } var width = frames [ 0 ] . width , height = frames [ 0 ] . height , duration = frames [ 0 ] . duration ; for ( var i = 1 ; i < frames . length ; i ++ ) { duration += frames [ i ] . duration ; } return { duration : duration , width : width , height : height } ; }
sums the lengths of all the frames and gets the duration
sums the lengths of all the frames and gets the duration
Check frames for an error