examples/viewers_upload/viewers_upload.js
function loadSequenceGroup(files) {
      const fetchSequence = [];

      for (let i = 0; i < files.length; i++) {
        fetchSequence.push(
          new Promise((resolve, reject) => {
            const myReader = new FileReader();
            // should handle errors too...
            myReader.addEventListener('load', function(e) {
              resolve(e.target.result);
            });
            myReader.readAsArrayBuffer(files[i].file);
          }).then(function(buffer) {
            return { url: files[i].file.name, buffer };
          })
        );
      }

      return Promise.all(fetchSequence)
        .then(rawdata => {
          return loader.parse(rawdata);
        })
        .then(function(series) {
          seriesContainer.push(series);
        })
        .catch(function(error) {
          window.console.log('oops... something went wrong...');
          window.console.log(error);
        });
    }
function loadSequenceGroup(files) {
      const fetchSequence = [];

      for (let i = 0; i < files.length; i++) {
        fetchSequence.push(
          new Promise((resolve, reject) => {
            const myReader = new FileReader();
            // should handle errors too...
            myReader.addEventListener('load', function(e) {
              resolve(e.target.result);
            });
            myReader.readAsArrayBuffer(files[i].file);
          }).then(function(buffer) {
            return { url: files[i].file.name, buffer };
          })
        );
      }

      return Promise.all(fetchSequence)
        .then(rawdata => {
          return loader.parse(rawdata);
        })
        .then(function(series) {
          seriesContainer.push(series);
        })
        .catch(function(error) {
          window.console.log('oops... something went wrong...');
          window.console.log(error);
        });
    }
function loadSequenceGroup ( files ) { const fetchSequence = [ ] ; for ( let i = 0 ; i < files . length ; i ++ ) { fetchSequence . push ( new Promise ( ( resolve , reject ) => { const myReader = new FileReader ( ) ; // should handle errors too... myReader . addEventListener ( 'load' , function ( e ) { resolve ( e . target . result ) ; } ) ; myReader . readAsArrayBuffer ( files [ i ] . file ) ; } ) . then ( function ( buffer ) { return { url : files [ i ] . file . name , buffer } ; } ) ) ; } return Promise . all ( fetchSequence ) . then ( rawdata => { return loader . parse ( rawdata ) ; } ) . then ( function ( series ) { seriesContainer . push ( series ) ; } ) . catch ( function ( error ) { window . console . log ( 'oops... something went wrong...' ) ; window . console . log ( error ) ; } ) ; }
Load group sequence
Load group sequence