Skip to content

Commit

Permalink
Raise intent working
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed Mar 20, 2024
1 parent 1e9c3d5 commit 48e55de
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
12 changes: 11 additions & 1 deletion packages/demo/src/client/apps/app4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@ import { getClientAPI } from 'client'
getClientAPI().then(async fdc3 => {
console.log("in promise")

fdc3.addIntentListener("ViewNews", context => {
fdc3.addIntentListener("ViewNews", async context => {
const msg = document.createElement("p");
msg.textContent = "Received News!: " + JSON.stringify(context);
const log = document.getElementById("log");
log?.appendChild(msg);

return {
type: "fdc3.test",
id: {
from: "app4",
intent: "ViewNews"
}
}
})
});
22 changes: 20 additions & 2 deletions packages/demo/src/client/apps/app5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,31 @@ import { getClientAPI } from 'client'
getClientAPI().then(async fdc3 => {
console.log("in promise")

fdc3.addIntentListener("ViewNews", context => {
fdc3.addIntentListener("ViewNews", async context => {
const msg = document.createElement("p");
msg.textContent = "Received News!: " + JSON.stringify(context);
const log = document.getElementById("log");
log?.appendChild(msg);
return {
type: "fdc3.test",
id: {
from: "app5",
intent: "ViewNews"
}
}
})

fdc3.addIntentListener("ViewQuote", context => {
fdc3.addIntentListener("ViewQuote", async context => {
const msg = document.createElement("p");
msg.textContent = "Received Quote!: " + JSON.stringify(context);
const log = document.getElementById("log");
log?.appendChild(msg);
return {
type: "fdc3.test",
id: {
from: "app5",
intent: "ViewQuote"
}
}
})
});

0 comments on commit 48e55de

Please sign in to comment.