We should be able to use https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers to thread the level generation. This means we could generate the levels and not hang the main application.