constructor(elementOrForm, formOrOptions, options = {}) {
    let element, form, formOptions;
    if (elementOrForm instanceof HTMLElement) {
      element = elementOrForm;
      form = formOrOptions;
      formOptions = options;
    }
    else {
      element = null;
      form = elementOrForm;
      formOptions = formOrOptions || {};
    }
    if (Formio.options && Formio.options.form) {
      formOptions = Object.assign(formOptions, Formio.options.form);
    }

    super(formOptions);

    if (this.options.useSessionToken) {
      Formio.useSessionToken(this.options);
    }

    this.ready = new Promise((resolve, reject) => {
      this.readyResolve = resolve;
      this.readyReject = reject;
    });

    this.instance = null;
    if (element) {
      if (this.element) {
        delete this.element.component;
      }
      this.element = element;
    }
    else {
      this.element = null;
    }
    this.options = formOptions;
    this.options.events = this.events;
    if (form) {
      this.setForm(form)
        .then(() => this.readyResolve(this.instance))
        .catch(this.readyReject);
    }
    this.display = '';
  }
@type {FormOptions} - the options for this Form.