| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Send a cross process message if message channel is connected. Avoid channel closed error throw out.
npm install sendmessage --saveimport { fork } from 'node:child_process';
import { sendmessage } from 'sendmessage';
const worker = fork('./worker.js');
sendmessage(worker, { hi: 'this is a message to worker' });import { sendmessage } from 'sendmessage';
sendmessage(process, { hello: 'this is a message to master' });Send a cross process message. If a process is not child process, this will just call process.emit('message', message) instead.
sendmessage(process, { hello: 'this is a message to master' });You can switch to process.emit('message', message) using process.env.SENDMESSAGE_ONE_PROCESS
Made with contributors-img.
| Back | FazBrowse Home | New Git URL |