Skip to content

Commit

Permalink
Examples: Use async/await instead of promises.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Oct 21, 2020
1 parent 5bf2142 commit 80509b1
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,17 @@ <h1><a href="https://threejs.org">three.js</a></h1>

let selected = null;

Promise.all( [
fetch( 'files.json' ).then( response => response.json() ),
fetch( 'tags.json' ).then( response => response.json() )
] ).then( ( json ) => {
init();

init( json[ 0 ], json[ 1 ] );

} );

function init( files, tags ) {
async function init() {

content.appendChild( container );

viewSrcButton.style.display = 'none';

const files = await ( await fetch( 'files.json' ) ).json();
const tags = await ( await fetch( 'tags.json' ) ).json();

for ( const key in files ) {

const section = files[ key ];
Expand Down

0 comments on commit 80509b1

Please sign in to comment.