Skip to content

Plugin loading - #325

Open
samuelthomas2774 wants to merge 7 commits into
JsSucks:masterfrom
samuelthomas2774:plugin-loading-2
Open

samuelthomas2774 wants to merge 7 commits into
JsSucks:masterfrom
samuelthomas2774:plugin-loading-2

Conversation

@samuelthomas2774

Copy link
Copy Markdown
  • Patch Module._load to allow plugins to require the plugin API when they load instead of having to wrap every module in a function:
    // index.js
    const Plugin = require('betterdiscord/plugin');
    const SomeComponent = require('./component');
    
    module.exports = class extends Plugin {
        // ...
    }
    // component.js
    const { Vuewrap } = require('betterdiscord/plugin-api');
    
    module.exports = props => {
        return Vuewrap('somecomponent', {
            // ...
        });
    }
  • Add a function to the plugin API to unload everything it keeps track of
  • Check external module versions
  • Allow plugins and external modules to expose multiple versioned APIs

@zerebos

zerebos commented Mar 27, 2019

Copy link
Copy Markdown
Member

I like this change, something I wanted to do for awhile. I am at work now so I've only skimmed through it, but I don't see any huge issues. I'll take a closer look tonight when I get home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants