Skip to content

Commit ff5e30d

Browse files
authored
Merge pull request #16 from GlenHughes/mode-option
Add mode option
2 parents 4f125e4 + e57a218 commit ff5e30d

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Is *web-component* library missing something ?
1414

1515
No problem! Simply [fork](https://github.com/vardius/web-component/network#fork-destination-box) this repository, [add middleware](https://github.com/vardius/web-component/wiki/Middleware) and create pull request.
1616

17-
## Instaliation
17+
## Installation
1818

1919
```bash
2020
npm install --save web-component
@@ -37,7 +37,8 @@ import { WebComponent } from 'web-component'
3737
template: require('./hello-world.html'),// provide template
3838
styles: require('./hello-world.css'), //provide styles
3939
extends: 'button', //default does not extends any
40-
shadowDOM: true //default false
40+
shadowDOM: true, //default false
41+
mode: "open" // default open, set to closed to block access to shadowDOM
4142
})
4243
export class HelloWorld extends HTMLElement {}
4344
```

src/connectedCallback/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default options => original => {
1010
let shadowRoot = target.shadowRoot;
1111
if (!shadowRoot) {
1212
shadowRoot = target.attachShadow({
13-
mode: "open"
13+
mode: options.mode ? options.mode : "open"
1414
});
1515
}
1616
target = shadowRoot;

0 commit comments

Comments
 (0)