-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from finos-labs/rob-first-version
Created import() loader
- Loading branch information
Showing
9 changed files
with
71 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { DesktopAgent } from "@finos/fdc3"; | ||
import { APIResponseMessage, FDC3Initialiser } from "../types"; | ||
|
||
/** | ||
* This loads the script using an import | ||
*/ | ||
export function load(resolve: (da: DesktopAgent) => void, data: APIResponseMessage) { | ||
import(data.url).then(ns => { | ||
const init = ns.default as FDC3Initialiser; | ||
const da = init(data.appIdentifier); | ||
resolve(da); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { DesktopAgent } from "@finos/fdc3"; | ||
import { APIResponseMessage } from "../types"; | ||
|
||
/** | ||
* This loads the script using a script tag, which is meh. | ||
*/ | ||
export function load(resolve: (da: DesktopAgent) => void, data: APIResponseMessage) { | ||
const script = document.createElement('script'); | ||
script.onload = function () { | ||
console.log(`FDC3 API Initialised ${JSON.stringify(data)}`); | ||
resolve(window.fdc3); | ||
document.head.removeChild(script); | ||
}; | ||
script.src=data.url; | ||
document.head.appendChild(script); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters