Skip to the content.
Differences between v2+ and older versions
- Server support - v2+ can also be used with NodeJS. Older versions are client-side only.
- Code - v2+ is written in ES6 and built with Babel and Webpack. Older versions were written in ES3 and built with Grunt and Browserify.
- CommonJS - v2+ can be “required” or “imported” as module.
- Size - The v2 bundle is more than 4 times smaller
- jQuery - v2+ does not include (nor depend on) jQuery. Older versions include jQuery, or expect to find it in the page.
- Promises - v2+ uses ES6 Promises (and includes polyfill for older browsers). The older versions are using promise-like
$.Deferred
objects.
- HTTP Requests - v2+ uses native
fetch
(and includes polyfill for older browsers). The older versions were using $.ajax
from jQuery.
- fhir.js - v2+ does not include (nor depend on) fhir.js. Older versions include fhir.js, or expect to find it in the global scope. In v2, fhir.js can be manually or automatically linked at runtime. Read more.
- Authorization - v2+ Will attempt to use the well-known-json (which is faster) and will fail-back to Conformance statement. Older versions only used the conformance.
- authorize(options) - Some options are changed since v2:
clientId
- This was previously called client_id
(which also works in v2+)
clientSecret
- This is now accepted because it is applicable on the server side
iss
- Since v2, pass iss
option to make a Standalone Launch
redirectUri
- This was previously called redirect_uri
(which also works in v2+)
- Other Options are available. See the full list.
- ready() - Since v2, the ready function returns a promise that you should await for. In older versions we had to pass callback arguments (which is still possible in v2+).
- init() - v2 adds the
init
method that is designed to handle authorization on a single page.
- client.encounter - v2+ adds
client.encounter.id
and client.encounter.read()
API
- client.user - v2+ adds client.user.fhirUser and client.user.resourceType API and changes client.user.id to return the ID of the user resource (instead of the whole “type/id” token).
- client.request() - v2+ adds the
client.request()
method.
- client.refresh() - v2+ adds the
client.refresh()
method.
- client.getPath() - v2+ adds the
client.getPath()
method.
- client.getBinary - v2+ no longer has a
client.getBinary()
method (replaced with client.request(...).blob()
).
- client.fetchBinary - v2+ no longer has a
client.fetchBinary()
method (replaced with client.request(...).blob()
).
- client.byCode() - v2+ fixes
client.byCode()
to also work if the second argument points to an array of CodeableConcepts.
- refresh tokens - v2+ will renew access tokens automatically if you use the
client.request()
method. You can also do that manually via the client.refresh()
method.
- fetching references - In v2+ this can be done using request() and is controlled with options. In older versions this can only be done via
fetchAllWithReferences
from the fhir.js API (note that fetchAllWithReferences is also available in v2+ through fhir.js).
- Testing - v2+ has large test suite and high (> 95%) code coverage. Older versions did not have tests.
- Debugging - v2+ uses debug and comes with source maps and type definitions.
- Documentation - v2+ comes with detailed documentation and live examples.
- Configurable browser support - By default v2 supports IE 10+. However, those who target different environments can change the
broserlist
configuration in package.json and rebuild. This can result in skipping some polyfills and reducing the bundle size.