Non Productive Monday

    electron-messages
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    electron-messages Travis CI Build Status

    Evaluate some code in an Electron context with inter-process messaging.

    NPM Badge

    Install

    npm install electron-messages

    Usage

    const electronMessages = require("electron-messages")
    
    const electronInstance = await electronMessages(async ipc => {
    	// You can use Electron APIs here
    	ipc.emit("unicorn", {
    		hello: "world"
    	})
    })
    
    // Logs `{ hello: "world" }`
    electronInstance.on("unicorn", data => {
    	console.log(data)
    })

    API

    electronMessages(function_, arguments_, options?)

    function_

    Type: (ipc, ...arguments_) => any | Promise<any>

    The function to evaluate in the Electron context. The first argument will be an ipc controller that allows you to .emit events and listen for them with .on. The other arguments are set to the value of arguments_.

    arguments_

    An array of arguments to include as arguments when calling function_.

    options

    Type: object

    Options to pass to new BrowserWindow().

    Install

    npm i electron-messages

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    6.09 kB

    Total Files

    5

    Last publish

    Collaborators

    • richienb