@genesislcap/foundation-fdc3 14.192.2-axes.2 → 14.192.2-fdc3-enhancements.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"fdc3-channel-event.d.ts","sourceRoot":"","sources":["../../src/fdc3-channel-event.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,iBAAiB,EAAc,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9B;;;GAGG;AACH,qBAGa,gBAAiB,SAAQ,qBAAiC;IAC/D,IAAI,EAAE,IAAI,CAAC;IACkB,SAAS,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IAE7C,eAAe,EAAE,CAAC,GAAG,KAAA,KAAK,GAAG,CAAC;IAE1C,iBAAiB;IAIjB,oBAAoB;IAIX,SAAS,IAAI,IAAI;IAU1B,OAAO,CAAC,kBAAkB,CAMxB;CACH"}
1
+ {"version":3,"file":"fdc3-channel-event.d.ts","sourceRoot":"","sources":["../../src/fdc3-channel-event.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,iBAAiB,EAAc,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9B;;;GAGG;AACH,qBAGa,gBAAiB,SAAQ,qBAAiC;IAC/D,IAAI,EAAE,IAAI,CAAC;IACkB,SAAS,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IAE7C,eAAe,EAAE,CAAC,GAAG,KAAA,KAAK,GAAG,CAAC;IAE1C,iBAAiB;IAIjB,oBAAoB;IAIX,SAAS,IAAI,IAAI;IAU1B,OAAO,CAAC,kBAAkB,CAWxB;CACH"}
@@ -2,6 +2,7 @@
2
2
  * See https://fdc3.finos.org/docs/fdc3-intro, and https://github.com/finos/FDC3/tree/master/src/api
3
3
  */
4
4
  import { AppIntent, Channel, Context, ContextHandler, Intents, IntentResolution } from '@finos/fdc3';
5
+ import { Observable } from 'rxjs';
5
6
  /**
6
7
  * @public
7
8
  */
@@ -40,6 +41,11 @@ export interface FDC3 {
40
41
  * @public
41
42
  */
42
43
  isReady: boolean;
44
+ /**
45
+ * Observable which emits the current channel
46
+ * When a new channel is joined a new value is emitted
47
+ */
48
+ currentChannel$: Observable<FDC3Channel>;
43
49
  /**
44
50
  * Adds intent listeners for the specified intents.
45
51
  * @public
@@ -90,6 +96,12 @@ export interface FDC3 {
90
96
  * @param payload - payload sent to the channel
91
97
  */
92
98
  broadcastOnChannel(channelName: string, type: string, payload: any): Promise<void>;
99
+ /**
100
+ * Broadcasts a message on the current app channel
101
+ * @param type - type of the channel
102
+ * @param payload - payload sent to the channel
103
+ */
104
+ broadcastOnCurrentChannel(payload: any, type?: string): Promise<void>;
93
105
  /**
94
106
  * Helper function to broadcast message on channel in response to dispatched event
95
107
  * @param channelName - name of the channel
@@ -114,6 +126,8 @@ export interface FDC3 {
114
126
  */
115
127
  export declare class DefaultFDC3 implements FDC3 {
116
128
  isReady: boolean;
129
+ private _currentChannel$;
130
+ currentChannel$: Observable<Channel>;
117
131
  constructor();
118
132
  private connect;
119
133
  addIntentListeners(listeners: Map<FDC3Intents, FDC3ContextHandler>): void;
@@ -123,9 +137,11 @@ export declare class DefaultFDC3 implements FDC3 {
123
137
  joinChannel(channelId: string): Promise<void>;
124
138
  getOrCreateChannel(channelId: string): Promise<FDC3Channel>;
125
139
  broadcastOnChannel(channelName: string, type: string, payload: any): Promise<void>;
140
+ broadcastOnCurrentChannel(payload: any, type?: string): Promise<void>;
126
141
  broadcastOnChannelEventHandler(channelName: string, type: string): Promise<(e: any) => Promise<void>>;
127
142
  addChannelListener(channelName: string, channelType: string, callback: (any: any) => void): Promise<Channel>;
128
143
  getCurrentChannel(): Promise<Channel>;
144
+ private broadcastMessageOnChannel;
129
145
  }
130
146
  /**
131
147
  * The DI token for the FDC3 interface.
@@ -1 +1 @@
1
- {"version":3,"file":"fdc3.d.ts","sourceRoot":"","sources":["../../src/fdc3.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEL,SAAS,EACT,OAAO,EACP,OAAO,EACP,cAAc,EAOd,OAAO,EACP,gBAAgB,EAKjB,MAAM,aAAa,CAAC;AAMrB;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,SAAS;CAAG;AAEnD;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,OAAO;CAAG;AAE/C;;GAEG;AACH,MAAM,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C,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAKrD,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlF,yBAAyB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE,8BAA8B,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAC1D,GAAG;IAOT,kBAAkB,CAC7B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,CAAC,GAAG,KAAA,KAAK,IAAI;IAOZ,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlD,OAAO,CAAC,yBAAyB;CAUlC;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,4DAA4D,CAAC"}
@@ -350,8 +350,10 @@ export declare class Fdc3Listener extends Fdc3Listener_base {
350
350
  fdc3: FDC3;
351
351
  intentConfig: IntentConfig[];
352
352
  channelConfig: ChannelConfig[];
353
+ private channelSubscription;
353
354
  deepClone(): Node;
354
355
  connectedCallback(): void;
356
+ disconnectedCallback(): void;
355
357
  }
356
358
  export {};
357
359
  //# sourceMappingURL=fdc3-listener.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fdc3-listener.d.ts","sourceRoot":"","sources":["../../../src/util/fdc3-listener.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,GAAG,KAAA,KAAK,IAAI,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED;;;GAGG;AACH,qBAGa,YAAa,SAAQ,iBAAiC;IAC3D,IAAI,EAAE,IAAI,CAAC;IAEjB,YAAY,EAAE,YAAY,EAAE,CAAM;IAElC,aAAa,EAAE,aAAa,EAAE,CAAM;IAEpC,OAAO,CAAC,mBAAmB,CAAsB;IAExC,SAAS,IAAI,IAAI;IA0B1B,iBAAiB;IAqBjB,oBAAoB;CAIrB"}
@@ -14,7 +14,12 @@ let Fdc3ChannelEvent = class Fdc3ChannelEvent extends LifecycleMixin(FoundationE
14
14
  if (this.mappingFunction && typeof this.mappingFunction === 'function') {
15
15
  payload = this.mappingFunction(payload);
16
16
  }
17
- yield this.fdc3.broadcastOnChannel(this.channelName, this.channelType, payload);
17
+ if (this.channelName) {
18
+ yield this.fdc3.broadcastOnChannel(this.channelName, this.channelType, payload);
19
+ }
20
+ else {
21
+ yield this.fdc3.broadcastOnCurrentChannel(payload, this.channelType);
22
+ }
18
23
  });
19
24
  }
20
25
  connectedCallback() {
package/dist/esm/fdc3.js CHANGED
@@ -5,6 +5,7 @@ import { __awaiter, __decorate } from "tslib";
5
5
  import { addIntentListener, fdc3Ready, findIntent, findIntentsByContext, getCurrentChannel, getOrCreateChannel, getInfo, joinChannel, raiseIntent, raiseIntentForContext, versionIsAtLeast, } from '@finos/fdc3';
6
6
  import { observable } from '@microsoft/fast-element';
7
7
  import { DI } from '@microsoft/fast-foundation';
8
+ import { Subject } from 'rxjs';
8
9
  import { stripOutBigInt } from './util/fdc3-util';
9
10
  import { logger } from './utils';
10
11
  /**
@@ -14,6 +15,8 @@ import { logger } from './utils';
14
15
  export class DefaultFDC3 {
15
16
  constructor() {
16
17
  this.isReady = false;
18
+ this._currentChannel$ = new Subject();
19
+ this.currentChannel$ = this._currentChannel$.asObservable();
17
20
  this.connect();
18
21
  }
19
22
  connect() {
@@ -55,8 +58,13 @@ export class DefaultFDC3 {
55
58
  logger.error(`fdc3 unable to raiseIntent using context '${context}' and intent '${intent}'.`);
56
59
  }
57
60
  joinChannel(channelId) {
58
- logger.debug(`fdc3 joinChannel '${channelId}'`);
59
- return joinChannel(channelId);
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ logger.debug(`fdc3 joinChannel '${channelId}'`);
63
+ yield joinChannel(channelId);
64
+ const channel = yield this.getCurrentChannel();
65
+ this._currentChannel$.next(channel);
66
+ return;
67
+ });
60
68
  }
61
69
  getOrCreateChannel(channelId) {
62
70
  logger.debug(`fdc3 getOrCreateChannel '${channelId}'`);
@@ -65,12 +73,13 @@ export class DefaultFDC3 {
65
73
  broadcastOnChannel(channelName, type, payload) {
66
74
  return __awaiter(this, void 0, void 0, function* () {
67
75
  const channel = yield getOrCreateChannel(channelName);
68
- payload = stripOutBigInt(payload);
69
- const m = {
70
- type,
71
- id: payload,
72
- };
73
- channel.broadcast(m);
76
+ this.broadcastMessageOnChannel(channel, payload, type);
77
+ });
78
+ }
79
+ broadcastOnCurrentChannel(payload, type) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const channel = yield getCurrentChannel();
82
+ this.broadcastMessageOnChannel(channel, payload, type);
74
83
  });
75
84
  }
76
85
  broadcastOnChannelEventHandler(channelName, type) {
@@ -95,6 +104,14 @@ export class DefaultFDC3 {
95
104
  return getCurrentChannel();
96
105
  });
97
106
  }
107
+ broadcastMessageOnChannel(channel, payload, type) {
108
+ payload = stripOutBigInt(payload);
109
+ const m = {
110
+ type,
111
+ id: payload,
112
+ };
113
+ channel.broadcast(m);
114
+ }
98
115
  }
99
116
  __decorate([
100
117
  observable
@@ -1,6 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { LifecycleMixin } from '@genesislcap/foundation-utils';
3
3
  import { customElement, FoundationElement } from '@genesislcap/web-core';
4
+ import { Subscription } from 'rxjs';
4
5
  import { FDC3 } from '../fdc3';
5
6
  /**
6
7
  * fdc3-listener
@@ -11,6 +12,7 @@ let Fdc3Listener = class Fdc3Listener extends LifecycleMixin(FoundationElement)
11
12
  super(...arguments);
12
13
  this.intentConfig = [];
13
14
  this.channelConfig = [];
15
+ this.channelSubscription = new Subscription();
14
16
  }
15
17
  deepClone() {
16
18
  const copy = super.deepClone();
@@ -40,9 +42,22 @@ let Fdc3Listener = class Fdc3Listener extends LifecycleMixin(FoundationElement)
40
42
  const listeners = new Map();
41
43
  this.intentConfig.forEach((intent) => listeners.set(intent.intent, intent.callback));
42
44
  this.fdc3.addIntentListeners(listeners);
43
- this.channelConfig.forEach((c) => this.fdc3.addChannelListener(c.channelName, c.channelType, c.callback));
45
+ this.channelConfig.forEach((c) => {
46
+ if (c.channelName) {
47
+ this.fdc3.addChannelListener(c.channelName, c.channelType, c.callback);
48
+ }
49
+ else {
50
+ this.channelSubscription.add(this.fdc3.currentChannel$.subscribe((channel) => {
51
+ this.fdc3.addChannelListener(channel.id, c.channelType, c.callback);
52
+ }));
53
+ }
54
+ });
44
55
  }
45
56
  }
57
+ disconnectedCallback() {
58
+ this.channelSubscription.unsubscribe();
59
+ super.disconnectedCallback();
60
+ }
46
61
  };
47
62
  __decorate([
48
63
  FDC3
@@ -515,6 +515,113 @@
515
515
  ],
516
516
  "name": "broadcastOnChannelEventHandler"
517
517
  },
518
+ {
519
+ "kind": "MethodSignature",
520
+ "canonicalReference": "@genesislcap/foundation-fdc3!FDC3#broadcastOnCurrentChannel:member(1)",
521
+ "docComment": "/**\n * Broadcasts a message on the current app channel\n *\n * @param type - type of the channel\n *\n * @param payload - payload sent to the channel\n */\n",
522
+ "excerptTokens": [
523
+ {
524
+ "kind": "Content",
525
+ "text": "broadcastOnCurrentChannel(payload: "
526
+ },
527
+ {
528
+ "kind": "Content",
529
+ "text": "any"
530
+ },
531
+ {
532
+ "kind": "Content",
533
+ "text": ", type?: "
534
+ },
535
+ {
536
+ "kind": "Content",
537
+ "text": "string"
538
+ },
539
+ {
540
+ "kind": "Content",
541
+ "text": "): "
542
+ },
543
+ {
544
+ "kind": "Reference",
545
+ "text": "Promise",
546
+ "canonicalReference": "!Promise:interface"
547
+ },
548
+ {
549
+ "kind": "Content",
550
+ "text": "<void>"
551
+ },
552
+ {
553
+ "kind": "Content",
554
+ "text": ";"
555
+ }
556
+ ],
557
+ "isOptional": false,
558
+ "returnTypeTokenRange": {
559
+ "startIndex": 5,
560
+ "endIndex": 7
561
+ },
562
+ "releaseTag": "Public",
563
+ "overloadIndex": 1,
564
+ "parameters": [
565
+ {
566
+ "parameterName": "payload",
567
+ "parameterTypeTokenRange": {
568
+ "startIndex": 1,
569
+ "endIndex": 2
570
+ },
571
+ "isOptional": false
572
+ },
573
+ {
574
+ "parameterName": "type",
575
+ "parameterTypeTokenRange": {
576
+ "startIndex": 3,
577
+ "endIndex": 4
578
+ },
579
+ "isOptional": true
580
+ }
581
+ ],
582
+ "name": "broadcastOnCurrentChannel"
583
+ },
584
+ {
585
+ "kind": "PropertySignature",
586
+ "canonicalReference": "@genesislcap/foundation-fdc3!FDC3#currentChannel$:member",
587
+ "docComment": "/**\n * Observable which emits the current channel When a new channel is joined a new value is emitted\n */\n",
588
+ "excerptTokens": [
589
+ {
590
+ "kind": "Content",
591
+ "text": "currentChannel$: "
592
+ },
593
+ {
594
+ "kind": "Reference",
595
+ "text": "Observable",
596
+ "canonicalReference": "rxjs!Observable:class"
597
+ },
598
+ {
599
+ "kind": "Content",
600
+ "text": "<"
601
+ },
602
+ {
603
+ "kind": "Reference",
604
+ "text": "FDC3Channel",
605
+ "canonicalReference": "@genesislcap/foundation-fdc3!FDC3Channel:interface"
606
+ },
607
+ {
608
+ "kind": "Content",
609
+ "text": ">"
610
+ },
611
+ {
612
+ "kind": "Content",
613
+ "text": ";"
614
+ }
615
+ ],
616
+ "isReadonly": false,
617
+ "isOptional": false,
618
+ "releaseTag": "Public",
619
+ "name": "currentChannel$",
620
+ "propertyTypeTokenRange": {
621
+ "startIndex": 1,
622
+ "endIndex": 5
623
+ }
624
+ },
518
625
  {
519
626
  "kind": "MethodSignature",
520
627
  "canonicalReference": "@genesislcap/foundation-fdc3!FDC3#findIntent:member(1)",
@@ -14,6 +14,7 @@ import { IOConnectDesktop } from '@interopio/desktop';
14
14
  import { LayoutCacheContainer } from '@genesislcap/foundation-utils';
15
15
  import { NotificationDataRow } from '@genesislcap/foundation-notifications';
16
16
  import { NotificationListener } from '@genesislcap/foundation-ui';
17
+ import { Observable } from 'rxjs';
17
18
  import { OverrideFoundationElementDefinition } from '@microsoft/fast-foundation';
18
19
  import { ViewTemplate } from '@microsoft/fast-element';
19
20
 
@@ -33,6 +34,8 @@ export declare interface ChannelConfig {
33
34
  */
34
35
  export declare class DefaultFDC3 implements FDC3 {
35
36
  isReady: boolean;
37
+ private _currentChannel$;
38
+ currentChannel$: Observable<Channel>;
36
39
  constructor();
37
40
  private connect;
38
41
  addIntentListeners(listeners: Map<FDC3Intents, FDC3ContextHandler>): void;
@@ -42,9 +45,11 @@ export declare class DefaultFDC3 implements FDC3 {
42
45
  joinChannel(channelId: string): Promise<void>;
43
46
  getOrCreateChannel(channelId: string): Promise<FDC3Channel>;
44
47
  broadcastOnChannel(channelName: string, type: string, payload: any): Promise<void>;
48
+ broadcastOnCurrentChannel(payload: any, type?: string): Promise<void>;
45
49
  broadcastOnChannelEventHandler(channelName: string, type: string): Promise<(e: any) => Promise<void>>;
46
50
  addChannelListener(channelName: string, channelType: string, callback: (any: any) => void): Promise<Channel>;
47
51
  getCurrentChannel(): Promise<Channel>;
52
+ private broadcastMessageOnChannel;
48
53
  }
49
54
 
50
55
  /**
@@ -57,6 +62,11 @@ export declare interface FDC3 {
57
62
  * @public
58
63
  */
59
64
  isReady: boolean;
65
+ /**
66
+ * Observable which emits the current channel
67
+ * When a new channel is joined a new value is emitted
68
+ */
69
+ currentChannel$: Observable<FDC3Channel>;
60
70
  /**
61
71
  * Adds intent listeners for the specified intents.
62
72
  * @public
@@ -107,6 +117,12 @@ export declare interface FDC3 {
107
117
  * @param payload - payload sent to the channel
108
118
  */
109
119
  broadcastOnChannel(channelName: string, type: string, payload: any): Promise<void>;
120
+ /**
121
+ * Broadcasts a message on the current app channel
122
+ * @param type - type of the channel
123
+ * @param payload - payload sent to the channel
124
+ */
125
+ broadcastOnCurrentChannel(payload: any, type?: string): Promise<void>;
110
126
  /**
111
127
  * Helper function to broadcast message on channel in response to dispatched event
112
128
  * @param channelName - name of the channel
@@ -516,8 +532,10 @@ export declare class Fdc3Listener extends Fdc3Listener_base {
516
532
  fdc3: FDC3;
517
533
  intentConfig: IntentConfig[];
518
534
  channelConfig: ChannelConfig[];
535
+ private channelSubscription;
519
536
  deepClone(): Node;
520
537
  connectedCallback(): void;
538
+ disconnectedCallback(): void;
521
539
  }
522
540
 
523
541
  declare const Fdc3Listener_base: (new (...args: any[]) => {
@@ -0,0 +1,25 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-fdc3](./foundation-fdc3.md) &gt; [FDC3](./foundation-fdc3.fdc3.md) &gt; [broadcastOnCurrentChannel](./foundation-fdc3.fdc3.broadcastoncurrentchannel.md)
4
+
5
+ ## FDC3.broadcastOnCurrentChannel() method
6
+
7
+ Broadcasts a message on the current app channel
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ broadcastOnCurrentChannel(payload: any, type?: string): Promise<void>;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | payload | any | payload sent to the channel |
20
+ | type | string | _(Optional)_ type of the channel |
21
+
22
+ **Returns:**
23
+
24
+ Promise&lt;void&gt;
25
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-fdc3](./foundation-fdc3.md) &gt; [FDC3](./foundation-fdc3.fdc3.md) &gt; [currentChannel$](./foundation-fdc3.fdc3.currentchannel_.md)
4
+
5
+ ## FDC3.currentChannel$ property
6
+
7
+ Observable which emits the current channel When a new channel is joined a new value is emitted
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ currentChannel$: Observable<FDC3Channel>;
13
+ ```
@@ -16,6 +16,7 @@ export interface FDC3
16
16
 
17
17
  | Property | Modifiers | Type | Description |
18
18
  | --- | --- | --- | --- |
19
+ | [currentChannel$](./foundation-fdc3.fdc3.currentchannel_.md) | | Observable&lt;[FDC3Channel](./foundation-fdc3.fdc3channel.md)<!-- -->&gt; | Observable which emits the current channel When a new channel is joined a new value is emitted |
19
20
  | [isReady](./foundation-fdc3.fdc3.isready.md) | | boolean | Whether the FDC3 API is ready. |
20
21
 
21
22
  ## Methods
@@ -26,6 +27,7 @@ export interface FDC3
26
27
  | [addIntentListeners(listeners)](./foundation-fdc3.fdc3.addintentlisteners.md) | Adds intent listeners for the specified intents. |
27
28
  | [broadcastOnChannel(channelName, type, payload)](./foundation-fdc3.fdc3.broadcastonchannel.md) | Broadcasts a message on a given channel with a given type |
28
29
  | [broadcastOnChannelEventHandler(channelName, type)](./foundation-fdc3.fdc3.broadcastonchanneleventhandler.md) | Helper function to broadcast message on channel in response to dispatched event |
30
+ | [broadcastOnCurrentChannel(payload, type)](./foundation-fdc3.fdc3.broadcastoncurrentchannel.md) | Broadcasts a message on the current app channel |
29
31
  | [findIntent(intent, context)](./foundation-fdc3.fdc3.findintent.md) | Finds an app that supports the specified intent. |
30
32
  | [findIntentsByContext(context)](./foundation-fdc3.fdc3.findintentsbycontext.md) | Finds all the intents supported by the specified context. |
31
33
  | [getCurrentChannel()](./foundation-fdc3.fdc3.getcurrentchannel.md) | Helper function to get the current channel of the application |
@@ -20,6 +20,7 @@ import { IOConnectDesktop } from '@interopio/desktop';
20
20
  import { LayoutCacheContainer } from '@genesislcap/foundation-utils';
21
21
  import { NotificationDataRow } from '@genesislcap/foundation-notifications';
22
22
  import { NotificationListener } from '@genesislcap/foundation-ui';
23
+ import { Observable } from 'rxjs';
23
24
  import { OverrideFoundationElementDefinition } from '@microsoft/fast-foundation';
24
25
  import { ViewTemplate } from '@microsoft/fast-element';
25
26
 
@@ -47,6 +48,10 @@ export class DefaultFDC3 implements FDC3 {
47
48
  // (undocumented)
48
49
  broadcastOnChannelEventHandler(channelName: string, type: string): Promise<(e: any) => Promise<void>>;
49
50
  // (undocumented)
51
+ broadcastOnCurrentChannel(payload: any, type?: string): Promise<void>;
52
+ // (undocumented)
53
+ currentChannel$: Observable<Channel>;
54
+ // (undocumented)
50
55
  findIntent(intent: FDC3Intents, context?: FDC3Context): Promise<FDC3AppIntent>;
51
56
  // (undocumented)
52
57
  findIntentsByContext(context: FDC3Context): Promise<FDC3AppIntent[]>;
@@ -70,6 +75,8 @@ export interface FDC3 {
70
75
  addIntentListeners(listeners: Map<FDC3Intents, FDC3ContextHandler>): void;
71
76
  broadcastOnChannel(channelName: string, type: string, payload: any): Promise<void>;
72
77
  broadcastOnChannelEventHandler(channelName: string, type: string): Promise<(e: any) => Promise<void>>;
78
+ broadcastOnCurrentChannel(payload: any, type?: string): Promise<void>;
79
+ currentChannel$: Observable<FDC3Channel>;
73
80
  findIntent(intent: FDC3Intents, context?: FDC3Context): Promise<FDC3AppIntent>;
74
81
  findIntentsByContext(context: FDC3Context): Promise<FDC3AppIntent[]>;
75
82
  getCurrentChannel(): Promise<Channel>;
@@ -138,6 +145,8 @@ export class Fdc3Listener extends Fdc3Listener_base {
138
145
  // (undocumented)
139
146
  deepClone(): Node;
140
147
  // (undocumented)
148
+ disconnectedCallback(): void;
149
+ // (undocumented)
141
150
  fdc3: FDC3;
142
151
  // (undocumented)
143
152
  intentConfig: IntentConfig[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-fdc3",
3
3
  "description": "Genesis Foundation FDC3",
4
- "version": "14.192.2-axes.2",
4
+ "version": "14.192.2-fdc3-enhancements.2",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -59,25 +59,26 @@
59
59
  }
60
60
  },
61
61
  "devDependencies": {
62
- "@genesislcap/foundation-testing": "14.192.2-axes.2",
63
- "@genesislcap/genx": "14.192.2-axes.2",
64
- "@genesislcap/rollup-builder": "14.192.2-axes.2",
65
- "@genesislcap/ts-builder": "14.192.2-axes.2",
66
- "@genesislcap/uvu-playwright-builder": "14.192.2-axes.2",
67
- "@genesislcap/vite-builder": "14.192.2-axes.2",
68
- "@genesislcap/webpack-builder": "14.192.2-axes.2",
62
+ "@genesislcap/foundation-testing": "14.192.2-fdc3-enhancements.2",
63
+ "@genesislcap/genx": "14.192.2-fdc3-enhancements.2",
64
+ "@genesislcap/rollup-builder": "14.192.2-fdc3-enhancements.2",
65
+ "@genesislcap/ts-builder": "14.192.2-fdc3-enhancements.2",
66
+ "@genesislcap/uvu-playwright-builder": "14.192.2-fdc3-enhancements.2",
67
+ "@genesislcap/vite-builder": "14.192.2-fdc3-enhancements.2",
68
+ "@genesislcap/webpack-builder": "14.192.2-fdc3-enhancements.2",
69
69
  "rimraf": "^5.0.0"
70
70
  },
71
71
  "dependencies": {
72
72
  "@finos/fdc3": "^1.2.0",
73
- "@genesislcap/foundation-logger": "14.192.2-axes.2",
74
- "@genesislcap/foundation-notifications": "14.192.2-axes.2",
75
- "@genesislcap/foundation-ui": "14.192.2-axes.2",
76
- "@genesislcap/foundation-utils": "14.192.2-axes.2",
77
- "@genesislcap/web-core": "14.192.2-axes.2",
73
+ "@genesislcap/foundation-logger": "14.192.2-fdc3-enhancements.2",
74
+ "@genesislcap/foundation-notifications": "14.192.2-fdc3-enhancements.2",
75
+ "@genesislcap/foundation-ui": "14.192.2-fdc3-enhancements.2",
76
+ "@genesislcap/foundation-utils": "14.192.2-fdc3-enhancements.2",
77
+ "@genesislcap/web-core": "14.192.2-fdc3-enhancements.2",
78
78
  "@interopio/desktop": "^6.3.1",
79
79
  "@microsoft/fast-element": "^1.12.0",
80
80
  "@microsoft/fast-foundation": "^2.49.4",
81
+ "rxjs": "^7.8.1",
81
82
  "tslib": "^2.3.1"
82
83
  },
83
84
  "repository": {
@@ -88,5 +89,5 @@
88
89
  "publishConfig": {
89
90
  "access": "public"
90
91
  },
91
- "gitHead": "b7ee0f6f803626c4a575826bea4e2df5f8905533"
92
+ "gitHead": "7bb553d39e11fcfdb835a9238d5e7cfc162b5fc3"
92
93
  }