Skip to content

Commit

Permalink
Merge branch 'master' into 1588-fix-leftpanel-init-proptype-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-dv authored Aug 16, 2017
2 parents 9a7f328 + d486e17 commit 6b3cd3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions addons/knobs/src/KnobManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import KnobStore from './KnobStore';
const PANEL_UPDATE_INTERVAL = 400;

export default class KnobManager {
constructor(channel) {
this.channel = channel;
constructor() {
this.knobStore = new KnobStore();
}

setChannel(channel) {
this.channel = channel;
}

knob(name, options) {
this._mayCallChannel();

Expand Down
6 changes: 4 additions & 2 deletions addons/knobs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import KnobManager from './KnobManager';
import { vueHandler } from './vue';
import { reactHandler } from './react';

const channel = addons.getChannel();
const manager = new KnobManager(channel);
const manager = new KnobManager();

export function knob(name, options) {
return manager.knob(name, options);
Expand Down Expand Up @@ -63,6 +62,9 @@ export function date(name, value = new Date()) {
// In 3.3, this will become `withKnobs`, once our decorator API supports it.
// See https://github.com/storybooks/storybook/pull/1527
function wrapperKnobs(options) {
const channel = addons.getChannel();
manager.setChannel(channel);

if (options) channel.emit('addon:knobs:setOptions', options);

switch (window.STORYBOOK_ENV) {
Expand Down

0 comments on commit 6b3cd3e

Please sign in to comment.