Skip to content

Add support for browsers without Symbols #68

Open
@manix

Description

@manix

First off, thanks for the good work, this is an awesome library.

I'd like to ask if it is possible to add support for older browsers that do not support Symbol? When I try to run my app in such browser I get an error on this line that Symbol is undefined. I added a polyfill and yet again I'm getting an error:

Unhandled rejection TypeError: Property '[object Object]' of object Ivan is not a function

My data (suggestion) object is the following

{ value: "test", text: "Ivan", email: "test" } 

so obviously it's trying to get something off of the text key, which is a string, which made me think I was doing something wrong but then again on newer browsers everything is running fine. I also tried disabling the highlighter as I thought that would help but the error remains, as well as the highlighter..

Here is some code:

  activateHorsey(e: any) {
    e.disabled = true;
    e.placeholder = t("loading", true);
    console.log('a');
    return import("horsey").then(({ default: horsey }) => {
      console.log('b');
      horsey(e, {
        highlighter: false,
        source: (data: any, done: any) => {
          console.log('c');
          e.controlComponent.loading(true);
          console.log('d');
          web.request("/findUser", {
            data: {
              user: e.value
            }
          }).then((resp: any) => {
            console.log('e');
            done(null, [{
              list: resp.users.map((emailRecord: any) => ({
                value: emailRecord.email,
                text: emailRecord.user.name,
                email: FindUserControl.transformEmail(emailRecord.email)
              }))
            }]);
          }, function (error) {
            console.log("HORSEY ERROR", error);
          }).then(() => {
            console.log('f');
            e.controlComponent.loading(false);
          });
        },
        getText: "text",
        getValue: "value",
        set: function (text: string, data: any) {
          console.log('g');
          e.controlComponent.selectUser.call(e.controlComponent, data);
        },
        renderItem: function (li: HTMLLIElement, suggestion: any) {
          console.log('h', suggestion, li);
          li.appendChild(...);
          console.log("LILOG", li);
        }
      });

      e.disabled = false;
      e.placeholder = "";
    });
  }

And the output

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions