Skip to content

Commit

Permalink
Docs: Guide CustomRegistries to maintain properties on tasks (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanbmar committed Apr 9, 2021
1 parent f91c388 commit 9877de0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/advanced/creating-custom-registries.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ function ConfigRegistry(config){
util.inherits(ConfigRegistry, DefaultRegistry);

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

Expand Down

0 comments on commit 9877de0

Please sign in to comment.