Comments (8)
In addition to this, I would like to see some kind of ED.onPluginsLoaded
event implemented so that plugins that create global variables as some sort of APIs would be easier to work with,
nvm.
from enhanceddiscord.
I'm not sure there are really many plugins that need dependencies. Mine do of course, but they automatically check for the dependency and let you know if it exists. To have a dependency system, really the best way would cause some restructures of how plugins work in ED. Ideally there would be a separate config files that states plugin info including dependencies that way dependencies can be checked and ensured even before the plugin itself is required that way it can ensure no errors occur and that plugins can require their dependency at any time (as opposed to during load()
which would be necessary if sticking with current structure and adding dependencies.)
That being said, either way of moving forwards would require rewriting the current plugin loader. So it would really be up to you guys and Joe how you would want to move forward (if at all).
@jakuski an event like that would be simple enough. But realistically for most dependency cases shouldn't be needed. For instance if I had a plugin that wanted to use ZeresUtils.js
I could simply do require("ZeresUtils")
and anything exported would be available to you, e.g. static functions and such would immediately be available without the plugin having had load()
fired.
from enhanceddiscord.
@rauenzi I was thinking more of something like this
Plugin A
is lets say, a chat command plugin.
Plugin B
is a plugin that shows you all emojis in a guild for example.
Plugin A
creates a global variable called ChatCommands
and any can plugin can utilise it and make their own chat commands.
However due to the way plugins are required/loaded, Plugin B
doesn't know when the global variable ChatCommands
will be ready and instead of a while (!ChatCommands) sleep...
I think that having a event fire off, (Not really a NodeEventEmitter since I see multiple issues with it when it comes to multiple plugins utilisng it.) will be better for speeds sake.
So instead of Plugin B
having to integrate it's own way of UI, it could simply wait for ED's plugins to be loaded and if the chat command global var is not there, throw a error.
If it is there, then it could register a chatcommand to show guild emojis.
Example:
module.exports = new Plugin({
load () {
ED.onPluginsLoaded(() => {
// do something
})
}
})
or maybe
module.exports = new Plugin({
load () {}
onPluginsLoaded () {
// do something
})
})
from enhanceddiscord.
well in ChatCommands
you could do this
const myPlugin = new Plugin({});
myPlugin.commands = [];
module.exports = myPlugin;
and in another plugin called Shrug
you can do this
module.exports = new Plugin({
load () {
const commands = require("ChatCommands").commands;
commands.push("my new command");
}
});
that should work fine since it all refers to the same object.
from enhanceddiscord.
Only issue I see with this is user's renaming the file (which is what the ED.plugins
key's are based off.)
from enhanceddiscord.
You can never fully eliminate pebkac errors, that can happen even with a dependency scheme.
from enhanceddiscord.
I can sort of see a use for this, but have no idea how to implement it at this time. Hence the 'status:delayed'.
from enhanceddiscord.
I could help with implementing this, but like I said above it depends on the structuring you want to go with.
from enhanceddiscord.
Related Issues (20)
- Character count (beta) needs to be rewritten
- Colorblindness accessibility issue in theme_v2.css included from default style.css HOT 1
- Tag All needs to be rewritten
- All channels are shown in the channel list. HOT 1
- TypeError: Cannot read property 'contextMenu' of null HOT 2
- When visiting an nsfw hidden channel, and the user hits confirm. The client will still try to load the channel messages instead of just showing a warning HOT 2
- Client still tries to load hidden channel if it was the last selected channel
- EnhancedDiscord no longer works on latest Discord version HOT 6
- Doesn't work with the latest version of discord, in Linux. HOT 11
- Unable to change ED settings from the settings page
- Can't watch streams on Linux HOT 1
- Please allow us to enable win32 themes HOT 3
- Improper Electron Security Practices HOT 3
- Site is down HOT 3
- BetterDiscord plug-ins not working due to recent changes HOT 8
- Can't go into settings on ED HOT 3
- Hidden Channels aren't working HOT 1
- Discord crashes upon using SHIFT+ENTER shortcut. HOT 12
- Discord 0.0.309 will immediately crashed after pasting url HOT 2
- Archive the repo so no more Issues and PR can be made, and close existing ones HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enhanceddiscord.