startEmbedChat launching new frames in container

Each time a user clicks the 'Start Chat' Button, the webchat.renderFrame({}) writes a new chat frame in the containerEl.
This has the effect of launching multiple frames when the user clicks Start Chat multiple times.
Is there configuration option in the renderFrame method to replace an existing frame?

LAUNCH CODE

function startEmbeddedChat() {
    createChatConfig();
    ININ.webchat.create(chatConfig, function(err, webchat) {
        if (err) {
            throw err;
        }

        // Render to frame
        webchat.renderFrame({
            containerEl: 'chatContainer'
        });
    });
}

$('#webchat_submit').on("click", function (e) {
    e.preventDefault();
    startEmbeddedChat()
});

HTML OUTOUT

<div id="chatContainer" style="height:500px">
<iframe class="webchat-frame" src="https://apps.mypurecloud.com.au/webchat/frame/#? style="width: 100%; height: 100%;">
<iframe class="webchat-frame" src="https://apps.mypurecloud.com.au/webchat/frame/#? style="width: 100%; height: 100%;">
</div>

Hi Jeremy,

So yeah embedded does not have a replace option at this time and so I have a couple of ways you can work around it.

  1. Disable the start chat button, but problem is we do not have an event you can key off of to enable it again at this time.
  2. When the start chat button is clicked make the button disappear for a little while or move somewhere else so the customer is not temped to click it again.
  3. If the button is click multiple times just blow away the iframe on button click and make a new one. You should be able to do that in the button click.

I hope the options listed give you a way to move past this. I think the best end solution would be to provide an event when the chat ends that you can key off of to enabled the button again. If you would like the replace options or the event or both please just throw up a enhancement request so we can track it.

Thanks,
Josh