electron#webContents JavaScript Examples

The following examples show how to use electron#webContents. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: api-invoker.js    From Memocast with MIT License 6 votes vote down vote up
async function triggerRendererContextMenu (eventName, eventData, event) {
  if (!wcs) {
    wcs = BrowserWindow.fromWebContents(event.sender).webContents
  }
  console.log('triggerRendererContextMenu', eventName, eventData)
  return wcs.send('pop-context-menu-event', {
    eventName,
    eventData
  })
}
Example #2
Source File: api-invoker.js    From Memocast with MIT License 5 votes vote down vote up
async function sendNotification (notificationPayload, event) {
  if (!wcs) {
    wcs = BrowserWindow.fromWebContents(event.sender).webContents
  }
  return wcs.send('show-notification', notificationPayload)
}
Example #3
Source File: api-invoker.js    From Memocast with MIT License 5 votes vote down vote up
wcs = webContents.getFocusedWebContents()