Skip to content

EvolveLabs/electron-plugins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d2cfb87 · May 6, 2016

History

18 Commits
May 14, 2015
May 11, 2015
May 13, 2015
May 14, 2015
May 10, 2015
Sep 10, 2015
May 6, 2016
May 6, 2016

Repository files navigation

electron-plugins

Plugin loader for electron applications.

Installation

npm install electron-plugins --save

Usage

In your electron render process you can load your plugins like so:

var plugins = require('electron-plugins');

document.addEventListener('DOMContentLoaded', function () {
  var context = { document: document };
  plugins.load(context, function (err, loaded) {
    if(err) return console.error(err);
    console.log('Plugins loaded successfully.');
  });
});

Your plugin should export a constructor function, which is passed the context object upon instantiation. You can put whatever you want onto the context object.

function Plugin(context) {
	var d = context.document
	var ul = d.getElementById('plugins')
	var li = d.createElement('li')
	li.innerHTML = 'electron-updater-sample-plugin'
	ul.appendChild(li)
}

module.exports = Plugin

Examples

Related

About

Plugin loader for electron applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published