Skip to content

Commit

Permalink
fix(event emission): Only listen once to changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuenzenmeyer committed Feb 9, 2018
1 parent 9f5c143 commit ea6b7d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,14 @@ const patternlab_module = function(config) {
copier()
.copyAndWatch(patternlab.config.paths, patternlab, options)
.then(() => {
this.events.on('patternlab-pattern-change', () => {
this.events.once(events.PATTERNLAB_PATTERN_CHANGE, f => {
if (!patternlab.isBusy) {
return this.build(options);
}
return Promise.resolve();
});

this.events.on('patternlab-global-change', () => {
this.events.once(events.PATTERNLAB_GLOBAL_CHANGE, () => {
if (!patternlab.isBusy) {
return this.build(
Object.assign({}, options, { cleanPublic: true }) // rebuild everything
Expand Down

0 comments on commit ea6b7d3

Please sign in to comment.