Enabling Guest Access to Host Exposed Scripting Objects
For your integration user-interface (Guest) to interact with its Host, it must load and initialize the Ellie Mae JavaScript Guest Library. This library will allow your application to access the JavaScript objects published and exposed by the host Encompass application.
Approach #1: Include as a Script Tag
The most straight-forward approach to including the Ellie Mae JavaScript Guest Library into your web page/application is to include a <script>
tag in the pages that reference and utilize the functionality it exposes:
<script src="https://cdn.elliemae.io/elliemae/core/ssf/1.0/elli.ssf.guest-with-polyfill.js"></script>
This script defines a single, global object, elli.script
, which provides all the entry-point functions into the guest library. The script tag should be included in your page prior to other scripts that invoke the elli.script
object (preferably in the <head>
portion of the page).
<html>
<head>
<script src="https://cdn.elliemae.io/elliemae/core/ssf/1.0/elli.ssf.guest.js"></script>
<!-- Any other script tags required by the page -->
</head>
<body>
<!-- HTML content -->
</body>
</html>
Support for Promises
The JavaScript Guest Library uses the Promise object extensively in its public interface. It is strongly advised to include the polyfill(s) necessary to support the ES6 Promise implementation across browsers used by the Encompass user base, which you can find here
Ellie Mae provides two versions of the JavaScript Guest Library to choose from when adding your script tag:
- The
elli.ssf.guest-with-polyfill.js
file includes an Internet Explorer-compatible polyfill library that allows use of modern JavaScript features (e.g.Promises
) that are not available in legacy web browsers. This should be your default choice unless you are already including a polyfill library (e.g. the Babel Polyfill library) in your page as a separate script tag. This version of the library is available at:
https://cdn.elliemae.io/elliemae/core/ssf/1.0/elli.ssf.guest-with-polyfill.js
- The
elli.ssf.guest.js
file excludes the polyfill library. Use this version of the script only if you are already including a polyfill library in your page. Note that the script tag for your polyfill library must precede the script tag for the SSF Guest Library. This version of the library is available at:
https://cdn.elliemae.io/elliemae/core/ssf/1.0/elli.ssf.guest.js
Approach #2: Include as NPM package
If you are building your web application using a JavaScript dependency management/bundling tool, such as npm
or yarn
, you can include the JavaScript Guest Library package in your project as a dependency. The package is published as a public NPM package under the name @elliemae/em-ssf-guest
. This example shows how to install this to your project using npm
:
$ npm install @elliemae/em-ssf-guest
Note that the em-ssf-guest package does not include a polyfill as a dependency to prevent lock-in with a specific polyfill implementation. If you do not already have a polyfill included in your package.json file's dependencies section, then you need to add a dependency on the Babel Polyfill library and include the library in your bundle file.
Once installed - you can import the guest libraries default export (the global elli.script
object described above) into your application as needed, which provides all the entry-point functions into the guest library:
// Import the guest libraries default export
import host from '@elliemae/em-ssf-guest';
...