-
Notifications
You must be signed in to change notification settings - Fork 164
(WIP) implement addIntentListenerWithContext #1590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,13 +7,16 @@ import { | |
| IntentEvent, | ||
| IntentResultRequest, | ||
| IntentResultResponse, | ||
| //RaiseIntentResponse, | ||
| } from '@finos/fdc3-schema/dist/generated/api/BrowserTypes'; | ||
|
|
||
| export class DefaultIntentListener extends AbstractListener<IntentHandler, AddIntentListenerRequest> { | ||
| readonly intent: string; | ||
|
|
||
| constructor(messaging: Messaging, intent: string, action: IntentHandler, messageExchangeTimeout: number) { | ||
| constructor( | ||
| messaging: Messaging, | ||
| private readonly intent: string, | ||
| private readonly context: string[] | null, | ||
Roaders marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| action: IntentHandler, | ||
| messageExchangeTimeout: number | ||
| ) { | ||
| super( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Theres more to think about here: how does the Desktop Agent know what contexts are being listened for (and hence how to filter intent resolution)? |
||
| messaging, | ||
| messageExchangeTimeout, | ||
|
|
@@ -24,11 +27,14 @@ export class DefaultIntentListener extends AbstractListener<IntentHandler, AddIn | |
| 'intentListenerUnsubscribeRequest', | ||
| 'intentListenerUnsubscribeResponse' | ||
| ); | ||
| this.intent = intent; | ||
| } | ||
|
|
||
| filter(m: IntentEvent): boolean { | ||
| return m.type == 'intentEvent' && m.payload.intent == this.intent; | ||
| return ( | ||
| m.type == 'intentEvent' && | ||
| m.payload.intent == this.intent && | ||
| (this.context == null || this.context.includes(m.payload.context.type)) | ||
| ); | ||
| } | ||
|
|
||
| action(m: IntentEvent): void { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.