Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
electron-wendy
Advanced tools
A window manager for your Electron apps !
npm i --save electron-wendy
or git clone https://github.com/nash403/electron-wendy.git
Wendy
is a window manager for Electron that provides convenient methods to create, remove, replace or give names to windows/modals.
With Wendy you can create and show a window at the same time and even pass argument to the new window in a single call:
const { app } = require('electron')
const path = require('path')
const Wendy = require('electron-wendy')
app.on('ready', () => {
const mainWindow = Wendy.create('mainWin', {
showNow: true,
showPath: path.resolve(__dirname, '..', 'some-location', 'index.html'),
showArgs: { data: 'hello' }
}) // this creates a window called 'mainWin' and shows it. window.__args__ will then be populated in the new window
})
/**
* To show the window immediately at creation, the property 'showNow' must be set to true,
* otherwise you need to call showUrl on the returned instance.
*/
This package relies on the simple but powerful package electron-window. You can go and see their repo for more informations.
Object that keeps track of all windows created by Wendy.
Class method that creates a new BrowserWindow with the following default options: { show: false, width:600, height:400 }.
Creates a modal window whose parent window is parent
. Properties name
and and options
are optional and same as for create except that default width is now 400 and height is 250.
Same as above except that you must give an eventName
that is used to transfer the response data from the modal to the parent window.
In the modal window, when you are finished and need to emit the response, send via ipcRenderer a message with your data to the channel provided as argument above. Then in the parent window (with window instance, not with ipcRenderer !!), listen for an event on that channel.
Example:
// in the renderer process of the parent window
const Wendy = require('electron-wendy')
document.getElementById('modalise-btn').onclick = function () {
let thisWindow = require('electron').remote.getCurrentWindow()
let modal = Wendy.createModalWithResponse(thisWindow,'some-channel-name')
thisWindow.once('some-channel-name', (...response) => {
console.log('your response is here !', ...response)
})
}
// in the renderer process of your modal
document.getElementById('close-btn').onclick = function () {
require('electron').ipcRenderer.send('some-channel-name',{data:'some data 1'}, {status:'some data 2'})
window.close() // You should always close the modal after emitting your result
}
Retrieves the name of the given window or null
if not found
Gets the window named by the given parameter.
Note: If you have stored a reference to a window created with Wendy you can check the name at the property winName.
Gets the window whose id is the given parameter or null
if not found
Tests if Wendy is currenty managing a window named by the given parameter. Returns true
or false
.
If you somehow have a window instance created without Wendy, you can add it to Wendy with this method.
Removes the given window from Wendy.
Removes a window whose name is name
and creates a new one with the same name. newWindowOptions
are the same as the create method.
Wendy has a emitter
property that is a Node.js EventEmitter. With these methods you can register and unregister events with Wendy.
Emits events through the emmitter
property of Wendy.
options
is an object you can set with the following properties:
options.emittedBy
: BrowserWindow
instance that initiated the event.options.target
: string
or BrowserWindow
that represents the target window for this event....args
is a set of argument that can be passed through this event.Shows the url. When the url is finished loading, the callback is returned. If the optional argsForRenderer is set then args will be a global object for the page in the renderer process. This is a convenient way to pass arguments from the main process to the renderer process.
Note : All other methods available in electron-window are also available in the instance returned by Wendy.
Wendy also provides links to the Electron native functions for dialogs (showOpenDialog
, showSaveDialog
, showMessageBox
and showErrorBox
). You can read the related doc here.
MIT
FAQs
A window manager for your Electron apps !
The npm package electron-wendy receives a total of 1 weekly downloads. As such, electron-wendy popularity was classified as not popular.
We found that electron-wendy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.