Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Update Default Settings #128

Open
jstnbr opened this issue May 5, 2018 · 1 comment
Open

How to Update Default Settings #128

jstnbr opened this issue May 5, 2018 · 1 comment

Comments

@jstnbr
Copy link

jstnbr commented May 5, 2018

The boilerplate uses a defaults object, but what does the code look like to update a setting of the plugin globally?

For example, if my plugin has a default setting message: 'Hello, world!' how can I update that default setting, so that anytime the plugin is called it would already be changed to message: 'New message.'

I have tried something like this

myPlugin.defaults = {
    message: 'New message.'
};
@Man7398
Copy link

Man7398 commented Aug 18, 2023

Here's how you might achieve this:

// Assuming your plugin is defined like this in your boilerplate
var myPlugin = {
defaults: {
message: 'Hello, world!'
},
// Other plugin methods and functionality
};

// Update the default setting globally
myPlugin.defaults.message = 'New message.';

// Now, anytime the plugin is used, it will use the updated default setting

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

No branches or pull requests

2 participants