Async loading assets in javascript