BS4 - Toasts - Uncaught RangeError: Maximum call stack size exceeded

I’ve been playing with the sample project for BS 4 Toasts. I’d like to show a Toast onshow of a form. However, I get the Uncaught Range Error. So works fine on click (as done in the sample project) but if I do the following then it triggers the error as it gets into a loop of repeatedly trying to trigger the toast - just cant figure out why this.

Function Form1_onshow()
  Toast3_title.innerText = "Custom title"
  Toast3_subtitle.innerText = "Custom Subtitle"
  Toast3_text.innerHTML = "Text <b>can</b> include HTML styling and be <br> more than one line."
End Function

Have done plenty of google searches but no clues yet:

Sounds like the form is taking time to “show”. Especially if it has fadein - maybe. I would think onshow() would be after the fade was done, but apparently not. Sometimes I find you just have to use a setTimeout to give the original control (Form1) time to finish painting before showing the new control (Toast3). 50 to 100 ms seems to do the trick.

Yep. That must be it. I put the code into a function called from window.onload and it then works