Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for browsers without Symbols #68

Open
manix opened this issue May 6, 2018 · 0 comments
Open

Add support for browsers without Symbols #68

manix opened this issue May 6, 2018 · 0 comments

Comments

@manix
Copy link

manix commented May 6, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant