examples/viewers_upload/viewers_upload.js
function loadSequence(index, files) {
      return (
        Promise.resolve()
          // load the file
          .then(function() {
            return new Promise(function(resolve, reject) {
              let myReader = new FileReader();
              // should handle errors too...
              myReader.addEventListener('load', function(e) {
                resolve(e.target.result);
              });
              myReader.readAsArrayBuffer(files[index]);
            });
          })
          .then(function(buffer) {
            return loader.parse({ url: files[index].name, buffer });
          })
          .then(function(series) {
            seriesContainer.push(series);
          })
          .catch(function(error) {
            window.console.log('oops... something went wrong...');
            window.console.log(error);
          })
      );
    }
function loadSequence(index, files) {
      return (
        Promise.resolve()
          // load the file
          .then(function() {
            return new Promise(function(resolve, reject) {
              let myReader = new FileReader();
              // should handle errors too...
              myReader.addEventListener('load', function(e) {
                resolve(e.target.result);
              });
              myReader.readAsArrayBuffer(files[index]);
            });
          })
          .then(function(buffer) {
            return loader.parse({ url: files[index].name, buffer });
          })
          .then(function(series) {
            seriesContainer.push(series);
          })
          .catch(function(error) {
            window.console.log('oops... something went wrong...');
            window.console.log(error);
          })
      );
    }
function loadSequence ( index , files ) { return ( Promise . resolve ( ) // load the file . then ( function ( ) { return new Promise ( function ( resolve , reject ) { let myReader = new FileReader ( ) ; // should handle errors too... myReader . addEventListener ( 'load' , function ( e ) { resolve ( e . target . result ) ; } ) ; myReader . readAsArrayBuffer ( files [ index ] ) ; } ) ; } ) . then ( function ( buffer ) { return loader . parse ( { url : files [ index ] . name , buffer } ) ; } ) . then ( function ( series ) { seriesContainer . push ( series ) ; } ) . catch ( function ( error ) { window . console . log ( 'oops... something went wrong...' ) ; window . console . log ( error ) ; } ) ) ; }
Load sequence
Load sequence