Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-ignatov committed Jan 8, 2020
1 parent 786c76f commit c558973
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
21 changes: 1 addition & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ The documentation for the upcoming release is available at [http://docs.smarthea

Check out [what's new in v2](http://docs.smarthealthit.org/client-js/v2.html)!

<br/>

## Documentation (old)
The documentation for the older (current) version is at [http://docs.smarthealthit.org/clients/javascript/](http://docs.smarthealthit.org/clients/javascript/).

<br/>

Expand All @@ -38,24 +34,9 @@ npm test
# Build everything
npm run build

# Build all bundles
# Build all bundles (browser packages in dist/build)
npm run pack

# Only build the minified bundle for production
npm run pack:prod

# Only build the pure (no polyfills included) minified bundle for production
npm run pack:prod:pure

# Only build non-minified bundle for development
npm run pack:dev

# Only build the pure (no polyfills included) bundle for development
npm run pack:dev:pure

# Only build non-minified bundle for development and rebuild on change
npm run build:dev

# Build the CommonJS modules (for Node and bundlers)
npm run build:module
```
Expand Down
7 changes: 7 additions & 0 deletions dist/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v2.2.0
- Rewritten in TypeScript to improve readability and maintainability
- Fixed some build errors (#68)
- HapiJs users have new entry point `const smart = require("fhirclient/lib/entry/hapi")`
- Better code coverage
- Improved performance (#67) - work in progress

## v2.1.1
- Switched to ES modules (thanks to @kherock)
- Updated type definitions to fix some issues with Angular projects
Expand Down
11 changes: 11 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ FHIR.oauth2.ready()
.catch(console.error);
```

> NOTE: When the library is used as module it will not polyfill the global namespace and will not create a global `FHIR` object as it does when included as script. If you want to be able to use it globally, you can expert it yourself like so:
```ts
import FHIR from "fhirclient";

// in JavaScript:
window.FHIR = FHIR;

// In TypeScript:
(window as any).FHIR = FHIR;
```

## Server Usage
The server is fundamentally different environment than the browser but the
API is very similar. Here is a simple Express example:
Expand Down
10 changes: 8 additions & 2 deletions docs/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,15 @@ An adapter is a class that has a few methods for doing environment-specific thin

The adapters are located [here](https://github.com/smart-on-fhir/client-js/tree/master/src/adapters). They all extend one abstract base class (`BaseAdapter`).

In Node `require("fhirclient")` is the same as `require("fhirclient/lib/adapters/NodeAdapter")` which loads the default adapter for Node and/or Express. To use another adapter load it like so:
In Node `require("fhirclient")` loads the default adapter for Node and/or Express.
To use another adapter load it like so:
```js
const smart = require("fhirclient/lib/adapters/HapiAdapter");

// NOTE
// require("fhirclient/lib/entry/hapi") is the same as require("fhirclient/lib/adapters/HapiAdapter").default.smart;
// but it is cleaner and comes with proper type definitions
const smart = require("fhirclient/lib/entry/hapi");


// inside your redirect_uri route handler
smart(request, h).ready(client => client.request("Patient"));
Expand Down

0 comments on commit c558973

Please sign in to comment.