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

Client should list all the methods available #834

Closed
mdubus opened this issue Mar 18, 2021 · 3 comments
Closed

Client should list all the methods available #834

mdubus opened this issue Mar 18, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@mdubus
Copy link
Member

mdubus commented Mar 18, 2021

By logging my client, I only see the config and httpRequest.
This is really confusing as we might think that there are no methods available :

Capture d’écran 2021-03-18 à 13 59 42

If possible, it would be nice to have an exhaustive object with all the methods available inside

@curquiza
Copy link
Member

This is not the object you expect, but meanwhile

@bidoubiwa
Copy link
Contributor

bidoubiwa commented Mar 20, 2021

Hey @mdubus, after some digging the problem comes from here:

Class behavior on log

class Rectangle {

  constructor(height, width) {
    this.height = height;
    this.width = width;
  }

  square () {
    return this.height + this.width
  }
}

console.log(classRec)

output

Rectangle { height: 1, width: 2 }

Factory Function behavior on log

const rec = (height, width) => ({
  height,
  width,
  square: function() { return this.height * 2 }, // function and not => not keep context
  square2: () => { return this.height * 2 } // function and not => not keep context
})

const classRec = new Rectangle(1, 2)
const functRec = rec (1, 2)

console.log(functRec)

output

{
  height: 1,
  width: 2,
  square: [Function: square],
  square2: [Function: square2]
}

I'm trying to find out why, I would think per intuition that it is linked to private and public functions as we might not want the user to know them?

In either case, we will have to change our classes to functions if we want your output (which I think is way better for users trying to find methods name without having to go to the documentation)

see #835

@bidoubiwa
Copy link
Contributor

Until we go for a factory function this is not possible. Because factory function is not planned as a refactor I close this issue

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

No branches or pull requests

3 participants