Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fs.readdir(`./plugins`, (err, plugins) => {
if(err) {
console.log(`Error reading plugins folder: ${err}`);
}
webview.addEventListener('did-navigate', (event) => {
plugins.forEach((plugin) => {
const pluginSettings = require(`../plugins/${plugin}/settings.json`);
fs.readFile(`./plugins/${plugin}/plugin.js`, 'utf8', (err, code) => {
if(err) {
console.log(`Error loading plugin (${plugin}): ${err}`);
}
if(event.url.match(new RegExp(pluginSettings.page))) {
webview.executeJavaScript(code);
}
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.