code: function getExistingWidget(id, type) {
      var existingEl = document.getElementById(id);
      var existingWidget;
  
      if (existingEl && (existingWidget = existingEl.__widget) && existingWidget.__type === type) {
          return existingWidget;
      }
  
      return null;
  }
docs: Look in in the DOM to see if a widget with the same ID and type already exists.