Mautic Community Forums

TypeError: can't access property "on", Mautic.builderContents is undefined

Hi,

I wrote a piece of javascript and it is telling me that error:

TypeError: can't access property "on", Mautic.builderContents is undefined

I guess my script is executing before the Mautic core which is defining builderContents. ANy idea how I can fix this?

My script:

Mautic.customSlotListener = function () {

Mautic.builderContents.on('slot:change', function (event, params) {
// CODE.
});

};

mQuery(function () {
  Mautic.customSlotListener();
});

Thanks to anyone trying to help me.