-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathView1.tsx
57 lines (51 loc) · 1.27 KB
/
View1.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React from "react";
import logo from "../logo.svg";
function View1() {
async function broadcastFDC3Context() {
if (window.fdc3) {
await fdc3.broadcast({
type: "fdc3.instrument",
name: "Microsoft Corporation",
id: {
ticker: "MSFT",
},
});
} else {
console.error("FDC3 is not available");
}
}
async function broadcastFDC3ContextAppChannel() {
if (window.fdc3) {
const appChannel = await fdc3.getOrCreateChannel("CUSTOM-APP-CHANNEL");
await appChannel.broadcast({
type: "fdc3.instrument",
name: "Apple Inc.",
id: {
ticker: "AAPL",
},
});
} else {
console.error("FDC3 is not available");
}
}
return (
<div className="col fill gap20">
<header className="row spread middle">
<div className="col">
<h1>OpenFin React View 1</h1>
<h1 className="tag">React app view in an OpenFin container</h1>
</div>
<div className="row middle gap10">
<img src={logo} alt="OpenFin" height="40px" />
</div>
</header>
<main className="col gap10 left">
<button onClick={() => broadcastFDC3Context()}>Broadcast FDC3 User Context</button>
<button onClick={() => broadcastFDC3ContextAppChannel()}>
Broadcast FDC3 App Context
</button>
</main>
</div>
);
}
export default View1;