Skip to content

Using an arrow function into handleClientLoad() method cause to use wrong scope #49

@storrisi

Description

@storrisi

I've noticed that the handleClientLoad method uses an arrow function to init the client.

script.onload = () => {
   window['gapi'].load('client:auth2', this.initClient);
};

This causes that the this scope used here is related to the arrow function, not the whole class, because of the arrow function behavior.

You can fix it switching to ES5 functions:

script.onload = function () {
   window['gapi'].load('client:auth2', this.initClient);
};

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