Add support for multi windows.
Add props: window and document. With them, this library will work with multi windows environment. For example, with https://github.com/ryanseddon/react-frame-component:
<Frame>
<Helmet window={this.context.window} document={this.context.document}>
<Script>...</Script>
</Helmet>
</Frame>
The script will be add to the head of the iframe instead of the parent window.
update: add a feature.
<Helmet>
<body sytle={{color: 'red'}}/>
</Helmet>
this works now.
Codecov Report
Merging #278 into master will decrease coverage by
1.29%. The diff coverage is92.55%.
@@ Coverage Diff @@
## master #278 +/- ##
=========================================
- Coverage 98.92% 97.62% -1.3%
=========================================
Files 3 3
Lines 278 337 +59
=========================================
+ Hits 275 329 +54
- Misses 3 8 +5
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/Helmet.js | 100% <ø> (ø) |
:arrow_up: |
| src/HelmetUtils.js | 97.03% <92.55%> (-1.55%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update aad5457...22cc083. Read the comment docs.
I have merge master, no conflicts now. And I replace full version lodash with module version lodash. All test passed.
Any chance we could get an update on this PR @vipcxj @jamsea?
Any updates on this one? We are currently having problems because Helmet doesn't support multiple windows.
@smddzcy I can resolve conflicts when I am not busy. But I don't know how to pass codecov check.
@vipcxj You can see the untested lines of code here: https://codecov.io/gh/nfl/react-helmet/pull/278/diff
Wouldn't a kebob-case function be as simple as looking at charCodes for any character falling in the range 65 - 90 and replace it with "-" and that same charCode plus 32 ?
`/** *
-
@param camelCaseString - A camelCased String that needs to be converted to kabob-case
-
@description As camelCase never begins with a capital this function naively assumes camelCaseString will not either
-
@returns {string} - A String formatted in kabob-case */ function camelToKabobConverter(camelCaseString){ let result = ''; for(let i = 0 ; i < camelCaseString.length ; i++){ let charCode = camelCaseString.charCodeAt(i); result += (charCode <= 90 && charCode >= 65) ?
-${String.fromCharCode(charCode+32)}: String.fromCharCode(charCode);} return result } console.log(camelToKabobConverter('helloWorld')); // hello-world`