Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@storybook/channel-postmessage
Advanced tools
Storybook PostMessage Channel is a channel for Storybook that can be used when the Storybook Renderer runs inside an iframe or a child window. A channel can be created using the `createChannel` function.
The @storybook/channel-postmessage npm package is used within the Storybook ecosystem to enable communication between the Storybook UI and the preview iframe where the components are rendered. It uses the browser's postMessage API to create a channel for sending and receiving messages across different origins securely.
Creating a channel for communication
This code sample demonstrates how to create a new PostmsgTransport instance and use it to create a communication channel. The 'key' is a unique identifier for the channel.
import { PostmsgTransport } from '@storybook/channel-postmessage';
const transport = new PostmsgTransport({ key: 'postmsg-key' });
const channel = createChannel({ transport });
Sending messages
This code sample shows how to send a message with an event name and associated data through the channel.
channel.emit('eventName', { payload: 'data' });
Receiving messages
This code sample illustrates how to set up a listener for a specific event name and handle the data received through the channel.
channel.on('eventName', (data) => console.log(data));
Socket.IO-client is a real-time bidirectional event-based communication library. Unlike @storybook/channel-postmessage which is specific to Storybook and uses postMessage, socket.io-client can be used for a wide range of applications and relies on WebSockets with fallbacks.
Postmate is a powerful, simple, promise-based postMessage library that enables secure and seamless iframe communication, similar to @storybook/channel-postmessage, but it is not tied to Storybook and can be used for general iframe communication.
Storybook PostMessage Channel is a channel for Storybook that can be used when the Storybook Renderer runs inside an iframe or a child window.
A channel can be created using the createChannel
function.
import { createChannel } from '@storybook/channel-postmessage';
const channel = createChannel({ key: 'postmsg-key' });
For more information visit: storybook.js.org
7.0.0-beta.53 (February 22, 2023)
.stories.mdx
to MDX and CSF #21073.mjs
files for the browser entries #21161main.js
#21168ci:daily
workflow #21169FAQs
Unknown package
The npm package @storybook/channel-postmessage receives a total of 915,983 weekly downloads. As such, @storybook/channel-postmessage popularity was classified as popular.
We found that @storybook/channel-postmessage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.