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

add brief example of configuriung a plugin #8

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions plugin-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Configuring Plugins

When adding a plugin or feature a configuration parameter (shown here as `pluginConfiguration`) can also be passed which can can be used to set up application-wide defaults for the plugin.

```
import {Aurelia} from 'aurelia-framework';

export function configure(aurelia: Aurelia): void {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('my-plugin', pluginConfiguration);

aurelia.start().then(() => aurelia.setRoot());
}
```

While all plugins work in a similar manner, a real world example would be configuring the Dialog Plugin. The configuration parameter in this case is a type of `DialogConfiguration` and the above code would become:

```
import {Aurelia} from 'aurelia-framework';

export function configure(aurelia: Aurelia): void {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-dialog', config => {
config.useDefaults();
config.settings.lock = true;
config.settings.centerHorizontalOnly = false;
config.settings.startingZIndex = 5;
config.settings.keyboard = true;
});

aurelia.start().then(() => aurelia.setRoot());
}
```