mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-15 04:11:47 +00:00
Initial commit - app + 4 plugins
This commit is contained in:
26
preload.js
Normal file
26
preload.js
Normal file
@ -0,0 +1,26 @@
|
||||
const path = require("path");
|
||||
|
||||
const { getEnabledPlugins } = require("./store");
|
||||
const { fileExists } = require("./plugins/utils");
|
||||
|
||||
const plugins = getEnabledPlugins();
|
||||
|
||||
plugins.forEach(plugin => {
|
||||
const pluginPath = path.join(__dirname, "plugins", plugin, "actions.js");
|
||||
fileExists(pluginPath, () => {
|
||||
const actions = require(pluginPath).global || {};
|
||||
Object.keys(actions).forEach(actionName => {
|
||||
global[actionName] = actions[actionName];
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
plugins.forEach(plugin => {
|
||||
const pluginPath = path.join(__dirname, "plugins", plugin, "front.js");
|
||||
fileExists(pluginPath, () => {
|
||||
const run = require(pluginPath);
|
||||
run();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user