Can't attach callback events to Tawk_API

Hey guys,

I’ve been trying to attach events to the Tawk_API variable after the widget is loaded, but to no avail.
I’ve added a very simple snippet of code to test events - “onChatMaximized” and “onChatMinimized” but to no avail.

I’ve added logs to the console to see the flow. Function calls work, however the call back events don’t seem to be getting attached.

Here’s the snippet which I’m using.

var Tawk_API = Tawk_API || {},
      Tawk_LoadStart = new Date();
    (function() {
      var s1 = document.createElement("script"),
        s0 = document.getElementsByTagName("script")[0];
      s1.async = true;
      s1.src = '';
      s1.charset = 'UTF-8';
      s1.setAttribute('crossorigin', '*');
      s0.parentNode.insertBefore(s1, s0);

      Tawk_API.onLoad = function() {

        Tawk_API.onChatMaximized = function() {

        Tawk_API.onChatMinimized = function() {

Any help would be much much appreciated as I just can’t to see where the issue lies, and suspect it might something extremely silly.