updateBackend(role) {
      let existing = this[role],
          backend,
          changed;
      const attribute = "mv-" + role;

      if (this.index == 1) {
        // This app is the first one in the page, so we can override its backend
        // via URL params such as ?storage=...
        backend = _.Functions.url(role);
      }

      if (!backend) {
        backend = _.Functions.url("".concat(this.id, "-").concat(role)) || this.element.getAttribute(attribute) || null;
      }

      if (backend) {
        backend = backend.trim();

        if (backend == "none") {
          backend = null;
        }
      }

      if (backend) {
        var _existing$equals;

        // Do we have any other attributes?
        let prefix = attribute + "-";
        let roleAttributes = Mavo.attributeStartsWith(prefix, this.element);
        let options = Object.fromEntries(roleAttributes.map(a => [a.name.replace(prefix, ""), a.value]));

        if (!(existing !== null && existing !== void 0 && (_existing$equals = existing.equals) !== null && _existing$equals !== void 0 && _existing$equals.call(existing, backend))) {
          // We have a string, convert to a backend object if different than existing
          this[role] = backend = _.Backend.create(backend, {
            format: this.element.getAttribute("mv-format"),
            // can be overwritten by options below
            ...options,
            mavo: this
          }, existing);
          changed = true;
        }
      } else {
        // We had a backend and now we will un-have it
        this[role] = null;
      }

      changed = changed || (backend ? !backend.equals(existing) : Boolean(existing));

      if (changed) {
        var _this$source;

        // A change occured
        if (!this.storage && !this.source && this.init) {
          // If init is present with no storage and no source, init is equivalent to source
          this.source = this.init;
          this.init = null;
        }

        var permissions = this.storage ? this.storage.permissions : new Mavo.Permissions({
          edit: true,
          save: false
        });
        permissions.parent = (_this$source = this.source) === null || _this$source === void 0 ? void 0 : _this$source.permissions;
        this.permissions.parent = permissions;
        this.primaryBackend = this.storage || this.source;
      }

      return changed;
    }
Update the backend for a given role
@return {Boolean} true if a change occurred, false otherwise