SMART Messaging implementation for the browser.
// Some setup
const urlParams = new URLSearchParams(window.location.search);
const targetOrigin = urlParams.get('smart_messaging_origin') || '*';
const targetWindow = window.opener || window.parent;
const payload = { resourceType: "Basic" };
// Create a messenger object and call send with a callback
const messenger = new SmartMessenger(targetWindow, targetOrigin);
messenger.send('scratchpad.create', payload, (event) => {
console.log(event);
// ...
});
Add a <script>
tag with this src
:
https://cdn.jsdelivr.net/gh/Vermonster/fhir-kit-smart-messenger@latest/dist/index.min.js
https://github.com/smart-on-fhir/smart-web-messaging
Works in IE10+, modern Chrome, Safari, Firefox.
Clone the repo and then
% yarn install
% yarn build --watch
% yarn start
Then open http://localhost:3000
in your browser.