提交 80509b14 编写于 作者: M Mr.doob

Examples: Use async/await instead of promises.

上级 5bf21428
......@@ -61,21 +61,17 @@
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 ];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册