Skip to content

Commit 4b964c5

Browse files
committed
docs(readme): add documentation for global options
1 parent 914d76f commit 4b964c5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

readme.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ Add in your `.babelrc`
2626
"type": "element",
2727
"name": "button",
2828
"priority": 100,
29-
"source": "./myButtonDirective.js"
29+
"source": "./myButtonDirective.js",
30+
"globalOptions": {
31+
"colour": "fuchsia"
32+
}
3033
},
31-
"directive-module",
34+
["directive-module", { "colour": "pink" }],
3235
"path/to/a/directiveConfiguration.js"
3336
]
3437
}]
@@ -51,6 +54,7 @@ _* Not really mandatory, but this plugin wont do nothing without specific config
5154
- `type` ("attribute"|"element"): whether the directive should be applied
5255
on matches against element names or attribute names. Default: "attribute"
5356
- `priority` (Integer): Directives with a higher priority run first, Default: 0
57+
- `globalOptions` (any): Additional options that are provided to directives
5458
- `transformOptions` (Function): Only for attribute directives. Optional transformer
5559
for the options node. See [Transform Options](#transform-options)
5660

@@ -142,6 +146,10 @@ target library, like [context](https://facebook.github.io/react/docs/context.htm
142146
A directive can also decide to not call `next` at all and prevent creation
143147
of all child components.
144148
149+
- `globalOptions`: Globally provided directive options
150+
151+
see [Directive Configuration](#directive-configuration).
152+
145153
- `options`: Value of the directive attribute. _(Only available on attribute directives)_
146154
147155
Given this jsx `<div foo="bar" />`, a `foo` attribute directive would receive

0 commit comments

Comments
 (0)