How to extract updated XML string from modeler

I am trying to console.log an XML string from modeler ā€“ after changes have been made to the model.

I delete some icons, and attempt to get an updated XML string (with deleted icons removed) by calling the following function:

      { format: true },
      (err, updatedXML) => {
        console.log("updateXML", updatedXML);

updatedXML is undefined

Iā€™m now doing:

  getUpdatedXML = () => {
    return new Promise((accept, reject) => {
          format: true
        (err, response) => {
          if (err) return reject(err);
          return accept(response);

but getting new error:

Cannot read property 'isGeneric' of undefined

Please do not open multiple threads for the same question, cf. Cannot read property isGeneric of undefined