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

Update Custom Registries example code #2561

Closed
jeanbmar opened this issue Apr 7, 2021 · 3 comments
Closed

Update Custom Registries example code #2561

jeanbmar opened this issue Apr 7, 2021 · 3 comments

Comments

@jeanbmar
Copy link
Contributor

jeanbmar commented Apr 7, 2021

Task functions medata are lost when using fn.bind as in:

ConfigRegistry.prototype.set = function set(name, fn) {
  // The `DefaultRegistry` uses `this._tasks` for storage.
  var task = this._tasks[name] = fn.bind(this.config);
  return task;
};

Updating the example with the following would preserve metadata:

ConfigRegistry.prototype.set = function set(name, fn) {
  // The `DefaultRegistry` uses `this._tasks` for storage.
  var task = this._tasks[name] = Object.assign(fn.bind(this.config), fn);
  return task;
};

It's not a big deal but it would definitely save some times to devs wondering why metadata aren't displaying suddenly :).

@phated
Copy link
Member

phated commented Apr 7, 2021

Good catch! Would you like to send a PR for this, I can get it merged and released on the website.

@jeanbmar
Copy link
Contributor Author

jeanbmar commented Apr 8, 2021

PR #2565 sent!

@phated phated closed this as completed in 9877de0 Apr 9, 2021
@phated
Copy link
Member

phated commented Apr 9, 2021

Thanks again!

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

2 participants