Show modal on load

How would I go about showing a modal on loading the first screen of the app such as in for a log in? I have modals in other parts of the app showing on button clicks but when I try to run an init method when the app starts and try to show a modal within that method it breaks the app from loading anything.

I forked this from @Calendee’s codepen, so all the credit goes to him.

Thanks this really helped a lot.