Created
December 30, 2024 09:32
-
-
Save doubleedesign/250f05d3014e36da372771e185d996b0 to your computer and use it in GitHub Desktop.
Log all Storybook events to the browser console for debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { addons } from '@storybook/manager-api'; | |
import events from '@storybook/core-events'; | |
addons.register('my-manager-addon', () => { | |
const channel = addons.getChannel(); | |
Object.values(events).forEach((event) => { | |
channel.on(event, (data) => { | |
console.log(event, data); | |
}); | |
}); | |
//...addon code as applicable | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { addons } from '@storybook/preview-api'; | |
import events from '@storybook/core-events'; | |
const channel = addons.getChannel(); | |
Object.values(events).forEach((event) => { | |
channel.on(event, (data) => { | |
console.log(event, data); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: You don't need both of these at the same time, they are two separate options.