Skip to content

Commit

Permalink
Merge pull request #260 from 0x0a0d/allow_modify_debounce_time
Browse files Browse the repository at this point in the history
allow set debounceTime
  • Loading branch information
icebob authored Jul 21, 2021
2 parents e25616c + a04d50a commit f708503
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ module.exports = {
optimizeOrder: true,

// CallOption for the root action `api.rest`
rootCallOptions: null
rootCallOptions: null,

// Debounce wait time before call to regenerate aliases when received event "$services.changed"
debounceTime: 500
},

// Service's metadata
Expand Down Expand Up @@ -1580,10 +1583,11 @@ module.exports = {
this.settings.routes.forEach(route => this.addRoute(route));

// Regenerate all auto aliases routes
const debounceTime = this.settings.debounceTime > 0 ? parseInt(this.settings.debounceTime) : 500;
this.regenerateAllAutoAliases = _.debounce(() => {
/* istanbul ignore next */
this.routes.forEach(route => route.opts.autoAliases && this.regenerateAutoAliases(route));
}, 500);
}, debounceTime);
},


Expand Down

0 comments on commit f708503

Please sign in to comment.