|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
703 bytes
|
| Line | |
|---|
| 1 | function createPlugin(plugin, config) {
|
|---|
| 2 | return {
|
|---|
| 3 | handler: plugin,
|
|---|
| 4 | config,
|
|---|
| 5 | }
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | createPlugin.withOptions = function (pluginFunction, configFunction = () => ({})) {
|
|---|
| 9 | const optionsFunction = function (options) {
|
|---|
| 10 | return {
|
|---|
| 11 | __options: options,
|
|---|
| 12 | handler: pluginFunction(options),
|
|---|
| 13 | config: configFunction(options),
|
|---|
| 14 | }
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | optionsFunction.__isOptionsFunction = true
|
|---|
| 18 |
|
|---|
| 19 | // Expose plugin dependencies so that `object-hash` returns a different
|
|---|
| 20 | // value if anything here changes, to ensure a rebuild is triggered.
|
|---|
| 21 | optionsFunction.__pluginFunction = pluginFunction
|
|---|
| 22 | optionsFunction.__configFunction = configFunction
|
|---|
| 23 |
|
|---|
| 24 | return optionsFunction
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | export default createPlugin
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.