Waiting for the Txt object

In case you need to call a function on the global Txt object, you have to make sure the object is loaded properly. You can do this by using our event txt-loaded.

document.addEventListener('txt-loaded', (e) => {
  console.log('Txt object is now available.');
  // do something like Txt.updateProfile(...);
});