-
Notifications
You must be signed in to change notification settings - Fork 32
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
Import XFC as ES6 module #27
Changes from 5 commits
e3a18a6
42ea965
784d8df
af24dd2
8fa32e0
cc66e7e
c2bd6ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,38 @@ In order to run any SMART app in Cerner's MPage view (iframe), the following pro | |
|
||
This library uses [xfc](https://github.com/cerner/xfc) to solve [Clickjacking](https://www.owasp.org/index.php/Clickjacking) problem for all browsers. | ||
|
||
## Availability | ||
## Installation | ||
|
||
This is an npm project and can be installed with the following: | ||
```shell | ||
npm install cerner-smart-embeddable-lib | ||
``` | ||
|
||
Include it to your project with the following: | ||
```js | ||
import 'cerner-smart-embeddable-lib'; | ||
``` | ||
|
||
The minified & transpiled files are also available in the `dist/` directory and can be used with a `<script>` tag. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be under a new heading Script Include (NOT recommended) since you can't turn off XFC logging and it would conflict with MPages integration. |
||
|
||
It is suggested to import the module (as opposed to including the pre-minified file from `dist/`) as it will allow Webpack to define `process.env.NODE_ENV` which will enable or disable XFC logging. Per the [XFC Readme](https://github.com/cerner/xfc#usage), logging is only enabled in non-production environments. The environment can be set in webpack using the DefinePlugin: | ||
|
||
```js | ||
// webpack.config.js | ||
const webpack = require('webpack'); | ||
|
||
module.exports = { | ||
/*...*/ | ||
plugins:[ | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify('production') | ||
}) | ||
] | ||
}; | ||
``` | ||
|
||
Warning: Disable XFC logging if using [F-Twelve](https://github.com/cerner/f-twelve/). F-Twelve writes to the DOM every time `console.log` is called and (when logging is enabled) XFC calls `console.log` every time the DOM is written to. This causes the browser to endlessly loop and freeze. It is safe to use both concurrently if XFC logging is disabled. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps bold the Warning: part |
||
|
||
This project is an npm project. The minified & transpiled files are also available in the `dist/` directory. | ||
|
||
## Dependency | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a heading for NPM Module(Recommended)