Socket
Book a DemoInstallSign in
Socket

delegate-electron-events

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delegate-electron-events

Delegate electron's boot events until there's a window that can handle them

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

delegate-electron-events

Delegate electron's boot events until there's a window that can handle them.

Usage

var delegate = require('delegate-electron-events')
var electron = require('electron')
var path = require('path')

var BrowserWindow = electron.BrowserWindow
var app = electron.app

var emitter = delegate()

app.on('ready', function () {
  var win = new BrowserWindow()
  win.loadURL('file://' + path.join( __dirname, 'index.html'))
  win.webContents.on('did-finish-load', function () {
    win.show()
  })

  emitter.on('open-file', function (file) {
    win.webContents.send('open-file', file)
  })

  emitter.on('open-url', function (url) {
    win.webContents.send('open-url', url)
  })
})

API

emitter = delegate()

Create a new instance.

emitter.on('open-file', function(file))

Listen for a file event.

emitter.on('open-url', function(url))

Listen for a url event.

License

MIT

Keywords

electron

FAQs

Package last updated on 31 May 2017

Did you know?

Socket

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.

Install

Related posts