@openfin/core 41.103.3 → 41.103.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/mock-alpha.d.ts +202 -101
- package/out/mock-beta.d.ts +202 -101
- package/out/mock-public.d.ts +202 -101
- package/out/stub.d.ts +202 -101
- package/out/stub.js +1240 -1431
- package/package.json +41 -36
package/out/stub.js
CHANGED
|
@@ -332,35 +332,6 @@ var system = {};
|
|
|
332
332
|
|
|
333
333
|
var base = {};
|
|
334
334
|
|
|
335
|
-
var promises = {};
|
|
336
|
-
|
|
337
|
-
Object.defineProperty(promises, "__esModule", { value: true });
|
|
338
|
-
promises.promiseMapSerial = promises.serial = promises.promiseMap = promises.promisify = void 0;
|
|
339
|
-
function promisify(func) {
|
|
340
|
-
return (...args) => new Promise((resolve, reject) => {
|
|
341
|
-
func(...args, (err, val) => (err ? reject(err) : resolve(val)));
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
promises.promisify = promisify;
|
|
345
|
-
async function promiseMap(arr, asyncF) {
|
|
346
|
-
return Promise.all(arr.map(asyncF));
|
|
347
|
-
}
|
|
348
|
-
promises.promiseMap = promiseMap;
|
|
349
|
-
async function serial(arr) {
|
|
350
|
-
const ret = [];
|
|
351
|
-
for (const func of arr) {
|
|
352
|
-
// eslint-disable-next-line no-await-in-loop
|
|
353
|
-
const next = await func();
|
|
354
|
-
ret.push(next);
|
|
355
|
-
}
|
|
356
|
-
return ret;
|
|
357
|
-
}
|
|
358
|
-
promises.serial = serial;
|
|
359
|
-
async function promiseMapSerial(arr, func) {
|
|
360
|
-
return serial(arr.map((value, index, array) => () => func(value, index, array)));
|
|
361
|
-
}
|
|
362
|
-
promises.promiseMapSerial = promiseMapSerial;
|
|
363
|
-
|
|
364
335
|
var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
365
336
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
366
337
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -375,7 +346,6 @@ var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
|
375
346
|
var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
|
|
376
347
|
Object.defineProperty(base, "__esModule", { value: true });
|
|
377
348
|
base.Reply = base.EmitterBase = base.Base = void 0;
|
|
378
|
-
const promises_1 = promises;
|
|
379
349
|
class Base {
|
|
380
350
|
/**
|
|
381
351
|
* @internal
|
|
@@ -453,27 +423,8 @@ class EmitterBase extends Base {
|
|
|
453
423
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
454
424
|
};
|
|
455
425
|
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
456
|
-
/**
|
|
457
|
-
* Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
|
|
458
|
-
* `once` subscription.
|
|
459
|
-
*
|
|
460
|
-
* @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
|
|
461
|
-
* on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
|
|
462
|
-
* which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
|
|
463
|
-
*/
|
|
464
|
-
this.cleanUpRemovedListener = (eventType, listener) => {
|
|
465
|
-
const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
466
|
-
if (deregister) {
|
|
467
|
-
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
468
|
-
emitter.removeListener(eventType, deregister);
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
426
|
this.getOrCreateEmitter = () => {
|
|
472
|
-
|
|
473
|
-
if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
|
|
474
|
-
emitter.on('removeListener', this.cleanUpRemovedListener);
|
|
475
|
-
}
|
|
476
|
-
return emitter;
|
|
427
|
+
return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
477
428
|
};
|
|
478
429
|
this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
|
|
479
430
|
this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
|
|
@@ -513,7 +464,6 @@ class EmitterBase extends Base {
|
|
|
513
464
|
};
|
|
514
465
|
__classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
515
466
|
__classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
|
516
|
-
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
|
517
467
|
}
|
|
518
468
|
/**
|
|
519
469
|
* Adds a listener to the end of the listeners array for the specified event.
|
|
@@ -591,6 +541,10 @@ class EmitterBase extends Base {
|
|
|
591
541
|
const emitter = await this.deregisterEventListener(eventType, options);
|
|
592
542
|
if (emitter) {
|
|
593
543
|
emitter.removeListener(eventType, listener);
|
|
544
|
+
const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
545
|
+
if (deregister) {
|
|
546
|
+
emitter.removeListener(eventType, deregister);
|
|
547
|
+
}
|
|
594
548
|
this.deleteEmitterIfNothingRegistered(emitter);
|
|
595
549
|
}
|
|
596
550
|
return this;
|
|
@@ -626,12 +580,13 @@ class EmitterBase extends Base {
|
|
|
626
580
|
}
|
|
627
581
|
else if (this.hasEmitter()) {
|
|
628
582
|
const events = this.getOrCreateEmitter().eventNames();
|
|
629
|
-
await (
|
|
583
|
+
await Promise.all(events.map(removeByEvent));
|
|
630
584
|
}
|
|
631
585
|
return this;
|
|
632
586
|
}
|
|
633
587
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
634
|
-
|
|
588
|
+
// TODO: maybe emitterMap should clean up itself..
|
|
589
|
+
if (emitter.eventNames().length === 0) {
|
|
635
590
|
this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
|
|
636
591
|
}
|
|
637
592
|
}
|
|
@@ -864,11 +819,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
|
864
819
|
};
|
|
865
820
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
|
866
821
|
|
|
867
|
-
var hasRequiredFactory$
|
|
822
|
+
var hasRequiredFactory$1;
|
|
868
823
|
|
|
869
|
-
function requireFactory$
|
|
870
|
-
if (hasRequiredFactory$
|
|
871
|
-
hasRequiredFactory$
|
|
824
|
+
function requireFactory$1 () {
|
|
825
|
+
if (hasRequiredFactory$1) return Factory$6;
|
|
826
|
+
hasRequiredFactory$1 = 1;
|
|
872
827
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
|
873
828
|
Factory$6.ViewModule = void 0;
|
|
874
829
|
const base_1 = base;
|
|
@@ -940,9 +895,7 @@ function requireFactory$2 () {
|
|
|
940
895
|
* @experimental
|
|
941
896
|
*/
|
|
942
897
|
async wrap(identity) {
|
|
943
|
-
this.wire.
|
|
944
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
945
|
-
});
|
|
898
|
+
this.wire.recordAnalytic('view-wrap');
|
|
946
899
|
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
947
900
|
if (errorMsg) {
|
|
948
901
|
throw new Error(errorMsg);
|
|
@@ -964,9 +917,7 @@ function requireFactory$2 () {
|
|
|
964
917
|
* @experimental
|
|
965
918
|
*/
|
|
966
919
|
wrapSync(identity) {
|
|
967
|
-
this.wire.
|
|
968
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
969
|
-
});
|
|
920
|
+
this.wire.recordAnalytic('view-wrap-sync');
|
|
970
921
|
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
971
922
|
if (errorMsg) {
|
|
972
923
|
throw new Error(errorMsg);
|
|
@@ -986,9 +937,7 @@ function requireFactory$2 () {
|
|
|
986
937
|
* @experimental
|
|
987
938
|
*/
|
|
988
939
|
getCurrent() {
|
|
989
|
-
this.wire.
|
|
990
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
991
|
-
});
|
|
940
|
+
this.wire.recordAnalytic('view-get-current');
|
|
992
941
|
if (!this.wire.me.isView) {
|
|
993
942
|
throw new Error('You are not in a View context');
|
|
994
943
|
}
|
|
@@ -1007,9 +956,7 @@ function requireFactory$2 () {
|
|
|
1007
956
|
* @experimental
|
|
1008
957
|
*/
|
|
1009
958
|
getCurrentSync() {
|
|
1010
|
-
this.wire.
|
|
1011
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
1012
|
-
});
|
|
959
|
+
this.wire.recordAnalytic('view-get-current-sync');
|
|
1013
960
|
if (!this.wire.me.isView) {
|
|
1014
961
|
throw new Error('You are not in a View context');
|
|
1015
962
|
}
|
|
@@ -1083,8 +1030,8 @@ var main = {};
|
|
|
1083
1030
|
|
|
1084
1031
|
Object.defineProperty(main, "__esModule", { value: true });
|
|
1085
1032
|
main.WebContents = void 0;
|
|
1086
|
-
const base_1$
|
|
1087
|
-
class WebContents extends base_1$
|
|
1033
|
+
const base_1$o = base;
|
|
1034
|
+
class WebContents extends base_1$o.EmitterBase {
|
|
1088
1035
|
/**
|
|
1089
1036
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
1090
1037
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
@@ -2077,9 +2024,7 @@ class WebContents extends base_1$m.EmitterBase {
|
|
|
2077
2024
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
2078
2025
|
*/
|
|
2079
2026
|
async showPopupWindow(options) {
|
|
2080
|
-
this.wire.
|
|
2081
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2082
|
-
});
|
|
2027
|
+
this.wire.recordAnalytic(`${this.entityType}-show-popup-window`);
|
|
2083
2028
|
if (options?.onPopupReady) {
|
|
2084
2029
|
const readyListener = async ({ popupName }) => {
|
|
2085
2030
|
try {
|
|
@@ -2165,11 +2110,11 @@ class WebContents extends base_1$m.EmitterBase {
|
|
|
2165
2110
|
}
|
|
2166
2111
|
main.WebContents = WebContents;
|
|
2167
2112
|
|
|
2168
|
-
var hasRequiredInstance$
|
|
2113
|
+
var hasRequiredInstance$1;
|
|
2169
2114
|
|
|
2170
|
-
function requireInstance$
|
|
2171
|
-
if (hasRequiredInstance$
|
|
2172
|
-
hasRequiredInstance$
|
|
2115
|
+
function requireInstance$1 () {
|
|
2116
|
+
if (hasRequiredInstance$1) return Instance$5;
|
|
2117
|
+
hasRequiredInstance$1 = 1;
|
|
2173
2118
|
var _View_providerChannelClient;
|
|
2174
2119
|
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
|
2175
2120
|
Instance$5.View = void 0;
|
|
@@ -2505,9 +2450,7 @@ function requireInstance$2 () {
|
|
|
2505
2450
|
* @experimental
|
|
2506
2451
|
*/
|
|
2507
2452
|
this.getParentLayout = async () => {
|
|
2508
|
-
this.wire.
|
|
2509
|
-
// don't expose
|
|
2510
|
-
});
|
|
2453
|
+
this.wire.recordAnalytic('view-get-parent-layout');
|
|
2511
2454
|
return this.fin.Platform.Layout.getLayoutByViewIdentity(this.identity);
|
|
2512
2455
|
};
|
|
2513
2456
|
/**
|
|
@@ -2620,9 +2563,7 @@ function requireInstance$2 () {
|
|
|
2620
2563
|
* ```
|
|
2621
2564
|
*/
|
|
2622
2565
|
this.getCurrentStack = async () => {
|
|
2623
|
-
this.wire.
|
|
2624
|
-
// don't expose
|
|
2625
|
-
});
|
|
2566
|
+
this.wire.recordAnalytic('view-get-current-stack');
|
|
2626
2567
|
try {
|
|
2627
2568
|
const layout = await this.getParentLayout();
|
|
2628
2569
|
return layout.getStackByViewIdentity(this.identity);
|
|
@@ -2749,1160 +2690,1117 @@ function requireView () {
|
|
|
2749
2690
|
*
|
|
2750
2691
|
* @packageDocumentation
|
|
2751
2692
|
*/
|
|
2752
|
-
__exportStar(requireFactory$
|
|
2753
|
-
__exportStar(requireInstance$
|
|
2693
|
+
__exportStar(requireFactory$1(), exports);
|
|
2694
|
+
__exportStar(requireInstance$1(), exports);
|
|
2754
2695
|
} (view));
|
|
2755
2696
|
return view;
|
|
2756
2697
|
}
|
|
2757
2698
|
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
* ```js
|
|
3574
|
-
* const app = fin.Application.getCurrentSync();
|
|
3575
|
-
*
|
|
3576
|
-
* await app.closeTrayIconPopupMenu();
|
|
3577
|
-
* ```
|
|
3578
|
-
*/
|
|
3579
|
-
async closeTrayIconPopupMenu() {
|
|
3580
|
-
const { name } = this.wire.me;
|
|
3581
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3582
|
-
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
3583
|
-
}
|
|
3584
|
-
}
|
|
3585
|
-
Instance$6.Application = Application;
|
|
3586
|
-
return Instance$6;
|
|
2699
|
+
Object.defineProperty(Instance$6, "__esModule", { value: true });
|
|
2700
|
+
Instance$6.Application = void 0;
|
|
2701
|
+
/* eslint-disable import/prefer-default-export */
|
|
2702
|
+
const base_1$n = base;
|
|
2703
|
+
const window_1$1 = requireWindow();
|
|
2704
|
+
const view_1 = requireView();
|
|
2705
|
+
/**
|
|
2706
|
+
* An object representing an application. Allows the developer to create,
|
|
2707
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
|
2708
|
+
*/
|
|
2709
|
+
class Application extends base_1$n.EmitterBase {
|
|
2710
|
+
/**
|
|
2711
|
+
* @internal
|
|
2712
|
+
*/
|
|
2713
|
+
constructor(wire, identity) {
|
|
2714
|
+
super(wire, 'application', identity.uuid);
|
|
2715
|
+
this.identity = identity;
|
|
2716
|
+
this.window = new window_1$1._Window(this.wire, {
|
|
2717
|
+
uuid: this.identity.uuid,
|
|
2718
|
+
name: this.identity.uuid
|
|
2719
|
+
});
|
|
2720
|
+
}
|
|
2721
|
+
windowListFromIdentityList(identityList) {
|
|
2722
|
+
const windowList = [];
|
|
2723
|
+
identityList.forEach((identity) => {
|
|
2724
|
+
windowList.push(new window_1$1._Window(this.wire, {
|
|
2725
|
+
uuid: identity.uuid,
|
|
2726
|
+
name: identity.name
|
|
2727
|
+
}));
|
|
2728
|
+
});
|
|
2729
|
+
return windowList;
|
|
2730
|
+
}
|
|
2731
|
+
/**
|
|
2732
|
+
* Determines if the application is currently running.
|
|
2733
|
+
*
|
|
2734
|
+
* @example
|
|
2735
|
+
*
|
|
2736
|
+
* ```js
|
|
2737
|
+
* async function isAppRunning() {
|
|
2738
|
+
* const app = await fin.Application.getCurrent();
|
|
2739
|
+
* return await app.isRunning();
|
|
2740
|
+
* }
|
|
2741
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
|
2742
|
+
* ```
|
|
2743
|
+
*/
|
|
2744
|
+
isRunning() {
|
|
2745
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
|
2746
|
+
}
|
|
2747
|
+
/**
|
|
2748
|
+
* Closes the application and any child windows created by the application.
|
|
2749
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
|
2750
|
+
* @param force Close will be prevented from closing when force is false and
|
|
2751
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
|
2752
|
+
*
|
|
2753
|
+
* @example
|
|
2754
|
+
*
|
|
2755
|
+
* ```js
|
|
2756
|
+
* async function closeApp() {
|
|
2757
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
|
2758
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
|
2759
|
+
* await app.quit();
|
|
2760
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
|
2761
|
+
*
|
|
2762
|
+
* }
|
|
2763
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
|
2764
|
+
* ```
|
|
2765
|
+
*/
|
|
2766
|
+
async quit(force = false) {
|
|
2767
|
+
try {
|
|
2768
|
+
await this._close(force);
|
|
2769
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
|
2770
|
+
}
|
|
2771
|
+
catch (error) {
|
|
2772
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
|
2773
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
|
2774
|
+
throw error;
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
async _close(force = false) {
|
|
2779
|
+
try {
|
|
2780
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
|
2781
|
+
}
|
|
2782
|
+
catch (error) {
|
|
2783
|
+
if (!error.message.includes('Remote connection has closed')) {
|
|
2784
|
+
throw error;
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
/**
|
|
2789
|
+
* @deprecated use Application.quit instead
|
|
2790
|
+
* Closes the application and any child windows created by the application.
|
|
2791
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
|
2792
|
+
* @param callback - called if the method succeeds.
|
|
2793
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
2794
|
+
*
|
|
2795
|
+
* @example
|
|
2796
|
+
*
|
|
2797
|
+
* ```js
|
|
2798
|
+
* async function closeApp() {
|
|
2799
|
+
* const app = await fin.Application.getCurrent();
|
|
2800
|
+
* return await app.close();
|
|
2801
|
+
* }
|
|
2802
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
|
2803
|
+
* ```
|
|
2804
|
+
*/
|
|
2805
|
+
close(force = false) {
|
|
2806
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
|
2807
|
+
this.wire.recordAnalytic('application-close');
|
|
2808
|
+
return this._close(force);
|
|
2809
|
+
}
|
|
2810
|
+
/**
|
|
2811
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
|
2812
|
+
*
|
|
2813
|
+
* @example
|
|
2814
|
+
*
|
|
2815
|
+
* ```js
|
|
2816
|
+
* async function getChildWindows() {
|
|
2817
|
+
* const app = await fin.Application.getCurrent();
|
|
2818
|
+
* return await app.getChildWindows();
|
|
2819
|
+
* }
|
|
2820
|
+
*
|
|
2821
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
|
2822
|
+
* ```
|
|
2823
|
+
*/
|
|
2824
|
+
getChildWindows() {
|
|
2825
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
|
2826
|
+
const identityList = [];
|
|
2827
|
+
payload.data.forEach((winName) => {
|
|
2828
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
|
2829
|
+
});
|
|
2830
|
+
return this.windowListFromIdentityList(identityList);
|
|
2831
|
+
});
|
|
2832
|
+
}
|
|
2833
|
+
/**
|
|
2834
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
|
2835
|
+
* if the application was not created from a manifest.
|
|
2836
|
+
*
|
|
2837
|
+
* @example
|
|
2838
|
+
*
|
|
2839
|
+
* ```js
|
|
2840
|
+
* async function getManifest() {
|
|
2841
|
+
* const app = await fin.Application.getCurrent();
|
|
2842
|
+
* return await app.getManifest();
|
|
2843
|
+
* }
|
|
2844
|
+
*
|
|
2845
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
|
2846
|
+
* ```
|
|
2847
|
+
*/
|
|
2848
|
+
getManifest() {
|
|
2849
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
|
2850
|
+
}
|
|
2851
|
+
/**
|
|
2852
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
|
2853
|
+
* if the application was created from a manifest.
|
|
2854
|
+
*
|
|
2855
|
+
* @example
|
|
2856
|
+
*
|
|
2857
|
+
* ```js
|
|
2858
|
+
* async function getParentUuid() {
|
|
2859
|
+
* const app = await fin.Application.start({
|
|
2860
|
+
* uuid: 'app-1',
|
|
2861
|
+
* name: 'myApp',
|
|
2862
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
|
2863
|
+
* autoShow: true
|
|
2864
|
+
* });
|
|
2865
|
+
* return await app.getParentUuid();
|
|
2866
|
+
* }
|
|
2867
|
+
*
|
|
2868
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
|
2869
|
+
* ```
|
|
2870
|
+
*/
|
|
2871
|
+
getParentUuid() {
|
|
2872
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
|
2873
|
+
}
|
|
2874
|
+
/**
|
|
2875
|
+
* Retrieves current application's shortcut configuration.
|
|
2876
|
+
*
|
|
2877
|
+
* @example
|
|
2878
|
+
*
|
|
2879
|
+
* ```js
|
|
2880
|
+
* async function getShortcuts() {
|
|
2881
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
2882
|
+
* return await app.getShortcuts();
|
|
2883
|
+
* }
|
|
2884
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
|
2885
|
+
* ```
|
|
2886
|
+
*/
|
|
2887
|
+
getShortcuts() {
|
|
2888
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
|
2889
|
+
}
|
|
2890
|
+
/**
|
|
2891
|
+
* Retrieves current application's views.
|
|
2892
|
+
* @experimental
|
|
2893
|
+
*
|
|
2894
|
+
* @example
|
|
2895
|
+
*
|
|
2896
|
+
* ```js
|
|
2897
|
+
* async function getViews() {
|
|
2898
|
+
* const app = await fin.Application.getCurrent();
|
|
2899
|
+
* return await app.getViews();
|
|
2900
|
+
* }
|
|
2901
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
|
2902
|
+
* ```
|
|
2903
|
+
*/
|
|
2904
|
+
async getViews() {
|
|
2905
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
|
2906
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
|
2907
|
+
}
|
|
2908
|
+
/**
|
|
2909
|
+
* Returns the current zoom level of the application.
|
|
2910
|
+
*
|
|
2911
|
+
* @example
|
|
2912
|
+
*
|
|
2913
|
+
* ```js
|
|
2914
|
+
* async function getZoomLevel() {
|
|
2915
|
+
* const app = await fin.Application.getCurrent();
|
|
2916
|
+
* return await app.getZoomLevel();
|
|
2917
|
+
* }
|
|
2918
|
+
*
|
|
2919
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
2920
|
+
* ```
|
|
2921
|
+
*/
|
|
2922
|
+
getZoomLevel() {
|
|
2923
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
2924
|
+
}
|
|
2925
|
+
/**
|
|
2926
|
+
* Returns an instance of the main Window of the application
|
|
2927
|
+
*
|
|
2928
|
+
* @example
|
|
2929
|
+
*
|
|
2930
|
+
* ```js
|
|
2931
|
+
* async function getWindow() {
|
|
2932
|
+
* const app = await fin.Application.start({
|
|
2933
|
+
* uuid: 'app-1',
|
|
2934
|
+
* name: 'myApp',
|
|
2935
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
|
2936
|
+
* autoShow: true
|
|
2937
|
+
* });
|
|
2938
|
+
* return await app.getWindow();
|
|
2939
|
+
* }
|
|
2940
|
+
*
|
|
2941
|
+
* getWindow().then(win => {
|
|
2942
|
+
* win.showAt(0, 400);
|
|
2943
|
+
* win.flash();
|
|
2944
|
+
* }).catch(err => console.log(err));
|
|
2945
|
+
* ```
|
|
2946
|
+
*/
|
|
2947
|
+
getWindow() {
|
|
2948
|
+
this.wire.recordAnalytic('application-get-window');
|
|
2949
|
+
return Promise.resolve(this.window);
|
|
2950
|
+
}
|
|
2951
|
+
/**
|
|
2952
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
|
2953
|
+
* @param userName - username to be passed to the RVM.
|
|
2954
|
+
* @param appName - app name to be passed to the RVM.
|
|
2955
|
+
*
|
|
2956
|
+
* @example
|
|
2957
|
+
*
|
|
2958
|
+
* ```js
|
|
2959
|
+
* async function registerUser() {
|
|
2960
|
+
* const app = await fin.Application.getCurrent();
|
|
2961
|
+
* return await app.registerUser('user', 'myApp');
|
|
2962
|
+
* }
|
|
2963
|
+
*
|
|
2964
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
|
2965
|
+
* ```
|
|
2966
|
+
*/
|
|
2967
|
+
registerUser(userName, appName) {
|
|
2968
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
|
2969
|
+
}
|
|
2970
|
+
/**
|
|
2971
|
+
* Removes the application’s icon from the tray.
|
|
2972
|
+
*
|
|
2973
|
+
* @example
|
|
2974
|
+
*
|
|
2975
|
+
* ```js
|
|
2976
|
+
* async function removeTrayIcon() {
|
|
2977
|
+
* const app = await fin.Application.getCurrent();
|
|
2978
|
+
* return await app.removeTrayIcon();
|
|
2979
|
+
* }
|
|
2980
|
+
*
|
|
2981
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
|
2982
|
+
* ```
|
|
2983
|
+
*/
|
|
2984
|
+
removeTrayIcon() {
|
|
2985
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Restarts the application.
|
|
2989
|
+
*
|
|
2990
|
+
* @example
|
|
2991
|
+
*
|
|
2992
|
+
* ```js
|
|
2993
|
+
* async function restartApp() {
|
|
2994
|
+
* const app = await fin.Application.getCurrent();
|
|
2995
|
+
* return await app.restart();
|
|
2996
|
+
* }
|
|
2997
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
|
2998
|
+
* ```
|
|
2999
|
+
*/
|
|
3000
|
+
restart() {
|
|
3001
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
|
3002
|
+
}
|
|
3003
|
+
/**
|
|
3004
|
+
* DEPRECATED method to run the application.
|
|
3005
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
|
3006
|
+
*
|
|
3007
|
+
* @example
|
|
3008
|
+
*
|
|
3009
|
+
* ```js
|
|
3010
|
+
* async function run() {
|
|
3011
|
+
* const app = await fin.Application.create({
|
|
3012
|
+
* name: 'myApp',
|
|
3013
|
+
* uuid: 'app-1',
|
|
3014
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
|
3015
|
+
* autoShow: true
|
|
3016
|
+
* });
|
|
3017
|
+
* await app.run();
|
|
3018
|
+
* }
|
|
3019
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
3020
|
+
* ```
|
|
3021
|
+
*
|
|
3022
|
+
* @ignore
|
|
3023
|
+
*/
|
|
3024
|
+
run() {
|
|
3025
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
|
3026
|
+
this.wire.recordAnalytic('application-run');
|
|
3027
|
+
return this._run();
|
|
3028
|
+
}
|
|
3029
|
+
_run(opts = {}) {
|
|
3030
|
+
return this.wire
|
|
3031
|
+
.sendAction('run-application', {
|
|
3032
|
+
manifestUrl: this._manifestUrl,
|
|
3033
|
+
opts,
|
|
3034
|
+
...this.identity
|
|
3035
|
+
})
|
|
3036
|
+
.then(() => undefined);
|
|
3037
|
+
}
|
|
3038
|
+
/**
|
|
3039
|
+
* Instructs the RVM to schedule one restart of the application.
|
|
3040
|
+
*
|
|
3041
|
+
* @example
|
|
3042
|
+
*
|
|
3043
|
+
* ```js
|
|
3044
|
+
* async function scheduleRestart() {
|
|
3045
|
+
* const app = await fin.Application.getCurrent();
|
|
3046
|
+
* return await app.scheduleRestart();
|
|
3047
|
+
* }
|
|
3048
|
+
*
|
|
3049
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
|
3050
|
+
* ```
|
|
3051
|
+
*/
|
|
3052
|
+
scheduleRestart() {
|
|
3053
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
|
3054
|
+
}
|
|
3055
|
+
/**
|
|
3056
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
|
3057
|
+
* an object containing logId is returned.
|
|
3058
|
+
*
|
|
3059
|
+
* @example
|
|
3060
|
+
*
|
|
3061
|
+
* ```js
|
|
3062
|
+
* async function sendLog() {
|
|
3063
|
+
* const app = await fin.Application.getCurrent();
|
|
3064
|
+
* return await app.sendApplicationLog();
|
|
3065
|
+
* }
|
|
3066
|
+
*
|
|
3067
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
|
3068
|
+
* ```
|
|
3069
|
+
*/
|
|
3070
|
+
async sendApplicationLog() {
|
|
3071
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
|
3072
|
+
return payload.data;
|
|
3073
|
+
}
|
|
3074
|
+
/**
|
|
3075
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
|
3076
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
3077
|
+
*
|
|
3078
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
3079
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
|
3080
|
+
*
|
|
3081
|
+
*
|
|
3082
|
+
* @remarks If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
3083
|
+
*
|
|
3084
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
|
3085
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
|
3086
|
+
*
|
|
3087
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
3088
|
+
*
|
|
3089
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
|
3090
|
+
* uuid or shortcut.name is changed.
|
|
3091
|
+
*
|
|
3092
|
+
* @example
|
|
3093
|
+
*
|
|
3094
|
+
* ```js
|
|
3095
|
+
* const app = fin.Application.getCurrentSync();
|
|
3096
|
+
* const appName = 'My App';
|
|
3097
|
+
* const jumpListConfig = [ // array of JumpList categories
|
|
3098
|
+
* {
|
|
3099
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
|
3100
|
+
* items: [ // array of JumpList items
|
|
3101
|
+
* {
|
|
3102
|
+
* type: 'task',
|
|
3103
|
+
* title: `Launch ${appName}`,
|
|
3104
|
+
* description: `Runs ${appName} with the default configuration`,
|
|
3105
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
|
3106
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
3107
|
+
* iconIndex: 0
|
|
3108
|
+
* },
|
|
3109
|
+
* { type: 'separator' },
|
|
3110
|
+
* {
|
|
3111
|
+
* type: 'task',
|
|
3112
|
+
* title: `Restore ${appName}`,
|
|
3113
|
+
* description: 'Restore to last configuration',
|
|
3114
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
|
3115
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
3116
|
+
* iconIndex: 0
|
|
3117
|
+
* },
|
|
3118
|
+
* ]
|
|
3119
|
+
* },
|
|
3120
|
+
* {
|
|
3121
|
+
* name: 'Tools',
|
|
3122
|
+
* items: [ // array of JumpList items
|
|
3123
|
+
* {
|
|
3124
|
+
* type: 'task',
|
|
3125
|
+
* title: 'Tool A',
|
|
3126
|
+
* description: 'Runs Tool A',
|
|
3127
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
|
3128
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
|
3129
|
+
* iconIndex: 0
|
|
3130
|
+
* },
|
|
3131
|
+
* {
|
|
3132
|
+
* type: 'task',
|
|
3133
|
+
* title: 'Tool B',
|
|
3134
|
+
* description: 'Runs Tool B',
|
|
3135
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
|
3136
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
|
3137
|
+
* iconIndex: 0
|
|
3138
|
+
* }]
|
|
3139
|
+
* }
|
|
3140
|
+
* ];
|
|
3141
|
+
*
|
|
3142
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
|
3143
|
+
* ```
|
|
3144
|
+
*
|
|
3145
|
+
* To handle deeplink args:
|
|
3146
|
+
* ```js
|
|
3147
|
+
* function handleUseLastConfiguration() {
|
|
3148
|
+
* // this handler is called when the app is being launched
|
|
3149
|
+
* app.on('run-requested', event => {
|
|
3150
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
|
3151
|
+
* // your logic here
|
|
3152
|
+
* }
|
|
3153
|
+
* });
|
|
3154
|
+
* // this handler is called when the app was already running when the launch was requested
|
|
3155
|
+
* fin.desktop.main(function(args) {
|
|
3156
|
+
* if(args && args['use-last-configuration']) {
|
|
3157
|
+
* // your logic here
|
|
3158
|
+
* }
|
|
3159
|
+
* });
|
|
3160
|
+
* }
|
|
3161
|
+
* ```
|
|
3162
|
+
*/
|
|
3163
|
+
async setJumpList(jumpListCategories) {
|
|
3164
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
|
3165
|
+
}
|
|
3166
|
+
/**
|
|
3167
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
|
3168
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
|
3169
|
+
*
|
|
3170
|
+
* @example
|
|
3171
|
+
*
|
|
3172
|
+
* ```js
|
|
3173
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
3174
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
|
3175
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
|
3176
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
|
3177
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
|
3178
|
+
*
|
|
3179
|
+
* async function setTrayIcon(icon) {
|
|
3180
|
+
* const app = await fin.Application.getCurrent();
|
|
3181
|
+
* return await app.setTrayIcon(icon);
|
|
3182
|
+
* }
|
|
3183
|
+
*
|
|
3184
|
+
* // use image url to set tray icon
|
|
3185
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
3186
|
+
*
|
|
3187
|
+
* // use base64 encoded string to set tray icon
|
|
3188
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
3189
|
+
*
|
|
3190
|
+
* // use a dataURL to set tray icon
|
|
3191
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
3192
|
+
* ```
|
|
3193
|
+
*/
|
|
3194
|
+
setTrayIcon(icon) {
|
|
3195
|
+
return this.wire
|
|
3196
|
+
.sendAction('set-tray-icon', {
|
|
3197
|
+
enabledIcon: icon,
|
|
3198
|
+
...this.identity
|
|
3199
|
+
})
|
|
3200
|
+
.then(() => undefined);
|
|
3201
|
+
}
|
|
3202
|
+
/**
|
|
3203
|
+
* Set hover text for this application's system tray icon.
|
|
3204
|
+
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
|
3205
|
+
* @param toolTip
|
|
3206
|
+
*
|
|
3207
|
+
* @example
|
|
3208
|
+
*
|
|
3209
|
+
* ```js
|
|
3210
|
+
* const app = fin.Application.getCurrentSync();
|
|
3211
|
+
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
3212
|
+
*
|
|
3213
|
+
* await app.setTrayIcon(iconUrl);
|
|
3214
|
+
*
|
|
3215
|
+
* await app.setTrayIconToolTip('My Application');
|
|
3216
|
+
* ```
|
|
3217
|
+
*/
|
|
3218
|
+
async setTrayIconToolTip(toolTip) {
|
|
3219
|
+
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
|
3220
|
+
}
|
|
3221
|
+
/**
|
|
3222
|
+
* Sets new application's shortcut configuration. Windows only.
|
|
3223
|
+
* @param config New application's shortcut configuration.
|
|
3224
|
+
*
|
|
3225
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
|
3226
|
+
* to be able to change shortcut states.
|
|
3227
|
+
*
|
|
3228
|
+
* @example
|
|
3229
|
+
*
|
|
3230
|
+
* ```js
|
|
3231
|
+
* async function setShortcuts(config) {
|
|
3232
|
+
* const app = await fin.Application.getCurrent();
|
|
3233
|
+
* return app.setShortcuts(config);
|
|
3234
|
+
* }
|
|
3235
|
+
*
|
|
3236
|
+
* setShortcuts({
|
|
3237
|
+
* desktop: true,
|
|
3238
|
+
* startMenu: false,
|
|
3239
|
+
* systemStartup: true
|
|
3240
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
|
3241
|
+
* ```
|
|
3242
|
+
*/
|
|
3243
|
+
setShortcuts(config) {
|
|
3244
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
|
3245
|
+
}
|
|
3246
|
+
/**
|
|
3247
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
|
3248
|
+
* @param queryString The new query string for this app's shortcuts.
|
|
3249
|
+
*
|
|
3250
|
+
* @example
|
|
3251
|
+
*
|
|
3252
|
+
* ```js
|
|
3253
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
|
3254
|
+
* const app = await fin.Application.getCurrent();
|
|
3255
|
+
* try {
|
|
3256
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
|
3257
|
+
* } catch(err) {
|
|
3258
|
+
* console.error(err)
|
|
3259
|
+
* }
|
|
3260
|
+
* ```
|
|
3261
|
+
*/
|
|
3262
|
+
async setShortcutQueryParams(queryString) {
|
|
3263
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
|
3264
|
+
}
|
|
3265
|
+
/**
|
|
3266
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
|
3267
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
|
3268
|
+
* @param level The zoom level
|
|
3269
|
+
*
|
|
3270
|
+
* @example
|
|
3271
|
+
*
|
|
3272
|
+
* ```js
|
|
3273
|
+
* async function setZoomLevel(number) {
|
|
3274
|
+
* const app = await fin.Application.getCurrent();
|
|
3275
|
+
* return await app.setZoomLevel(number);
|
|
3276
|
+
* }
|
|
3277
|
+
*
|
|
3278
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
3279
|
+
* ```
|
|
3280
|
+
*/
|
|
3281
|
+
setZoomLevel(level) {
|
|
3282
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
|
3283
|
+
}
|
|
3284
|
+
/**
|
|
3285
|
+
* Sets a username to correlate with App Log Management.
|
|
3286
|
+
* @param username Username to correlate with App's Log.
|
|
3287
|
+
*
|
|
3288
|
+
* @example
|
|
3289
|
+
*
|
|
3290
|
+
* ```js
|
|
3291
|
+
* async function setAppLogUser() {
|
|
3292
|
+
* const app = await fin.Application.getCurrent();
|
|
3293
|
+
* return await app.setAppLogUsername('username');
|
|
3294
|
+
* }
|
|
3295
|
+
*
|
|
3296
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
|
3297
|
+
*
|
|
3298
|
+
* ```
|
|
3299
|
+
*/
|
|
3300
|
+
async setAppLogUsername(username) {
|
|
3301
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
|
3302
|
+
}
|
|
3303
|
+
/**
|
|
3304
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
|
3305
|
+
* @remarks The only information currently returned is the position and dimensions.
|
|
3306
|
+
*
|
|
3307
|
+
* @example
|
|
3308
|
+
*
|
|
3309
|
+
* ```js
|
|
3310
|
+
* async function getTrayIconInfo() {
|
|
3311
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3312
|
+
* return await app.getTrayIconInfo();
|
|
3313
|
+
* }
|
|
3314
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3315
|
+
* ```
|
|
3316
|
+
*/
|
|
3317
|
+
getTrayIconInfo() {
|
|
3318
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* Checks if the application has an associated tray icon.
|
|
3322
|
+
*
|
|
3323
|
+
* @example
|
|
3324
|
+
*
|
|
3325
|
+
* ```js
|
|
3326
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3327
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
|
3328
|
+
* console.log(hasTrayIcon);
|
|
3329
|
+
* ```
|
|
3330
|
+
*/
|
|
3331
|
+
hasTrayIcon() {
|
|
3332
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
3333
|
+
}
|
|
3334
|
+
/**
|
|
3335
|
+
* Closes the application by terminating its process.
|
|
3336
|
+
*
|
|
3337
|
+
* @example
|
|
3338
|
+
*
|
|
3339
|
+
* ```js
|
|
3340
|
+
* async function terminateApp() {
|
|
3341
|
+
* const app = await fin.Application.getCurrent();
|
|
3342
|
+
* return await app.terminate();
|
|
3343
|
+
* }
|
|
3344
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
|
3345
|
+
* ```
|
|
3346
|
+
*/
|
|
3347
|
+
terminate() {
|
|
3348
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
|
3349
|
+
}
|
|
3350
|
+
/**
|
|
3351
|
+
* Waits for a hanging application. This method can be called in response to an application
|
|
3352
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
|
3353
|
+
* message after a certain period of time.
|
|
3354
|
+
*
|
|
3355
|
+
* @ignore
|
|
3356
|
+
*/
|
|
3357
|
+
wait() {
|
|
3358
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
|
3359
|
+
}
|
|
3360
|
+
/**
|
|
3361
|
+
* Retrieves information about the application.
|
|
3362
|
+
*
|
|
3363
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
|
3364
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
|
3365
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
|
3366
|
+
*
|
|
3367
|
+
* @example
|
|
3368
|
+
*
|
|
3369
|
+
* ```js
|
|
3370
|
+
* async function getInfo() {
|
|
3371
|
+
* const app = await fin.Application.getCurrent();
|
|
3372
|
+
* return await app.getInfo();
|
|
3373
|
+
* }
|
|
3374
|
+
*
|
|
3375
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3376
|
+
* ```
|
|
3377
|
+
*/
|
|
3378
|
+
getInfo() {
|
|
3379
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
|
3380
|
+
}
|
|
3381
|
+
/**
|
|
3382
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
|
3383
|
+
*
|
|
3384
|
+
* @example
|
|
3385
|
+
* ```js
|
|
3386
|
+
* const app = await fin.Application.getCurrent();
|
|
3387
|
+
* const processInfo = await app.getProcessInfo();
|
|
3388
|
+
* ```
|
|
3389
|
+
* @experimental
|
|
3390
|
+
*/
|
|
3391
|
+
async getProcessInfo() {
|
|
3392
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
|
3393
|
+
return data;
|
|
3394
|
+
}
|
|
3395
|
+
/**
|
|
3396
|
+
* Sets file auto download location. It's only allowed in the same application.
|
|
3397
|
+
*
|
|
3398
|
+
* Note: This method is restricted by default and must be enabled via
|
|
3399
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
3400
|
+
* @param downloadLocation file auto download location
|
|
3401
|
+
*
|
|
3402
|
+
* @throws if setting file auto download location on different applications.
|
|
3403
|
+
* @example
|
|
3404
|
+
*
|
|
3405
|
+
* ```js
|
|
3406
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
|
3407
|
+
* const app = await fin.Application.getCurrent();
|
|
3408
|
+
* try {
|
|
3409
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
|
3410
|
+
* console.log('File download location is set');
|
|
3411
|
+
* } catch(err) {
|
|
3412
|
+
* console.error(err)
|
|
3413
|
+
* }
|
|
3414
|
+
* ```
|
|
3415
|
+
*/
|
|
3416
|
+
async setFileDownloadLocation(downloadLocation) {
|
|
3417
|
+
const { name } = this.wire.me;
|
|
3418
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3419
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
3420
|
+
}
|
|
3421
|
+
/**
|
|
3422
|
+
* Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
|
|
3423
|
+
*
|
|
3424
|
+
* Note: This method is restricted by default and must be enabled via
|
|
3425
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
3426
|
+
*
|
|
3427
|
+
* @throws if getting file auto download location on different applications.
|
|
3428
|
+
* @example
|
|
3429
|
+
*
|
|
3430
|
+
* ```js
|
|
3431
|
+
* const app = await fin.Application.getCurrent();
|
|
3432
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
|
3433
|
+
* ```
|
|
3434
|
+
*/
|
|
3435
|
+
async getFileDownloadLocation() {
|
|
3436
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
3437
|
+
return data;
|
|
3438
|
+
}
|
|
3439
|
+
/**
|
|
3440
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
|
3441
|
+
* @param options
|
|
3442
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
|
3443
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
|
3444
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
|
3445
|
+
* these with a "reducer" pattern.
|
|
3446
|
+
* @throws if the application has no tray icon set
|
|
3447
|
+
* @throws if the system tray is currently hidden
|
|
3448
|
+
* @example
|
|
3449
|
+
*
|
|
3450
|
+
* ```js
|
|
3451
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
|
3452
|
+
* const app = fin.Application.getCurrentSync();
|
|
3453
|
+
*
|
|
3454
|
+
* await app.setTrayIcon(iconUrl);
|
|
3455
|
+
*
|
|
3456
|
+
* const template = [
|
|
3457
|
+
* {
|
|
3458
|
+
* label: 'Menu Item 1',
|
|
3459
|
+
* data: 'hello from item 1'
|
|
3460
|
+
* },
|
|
3461
|
+
* { type: 'separator' },
|
|
3462
|
+
* {
|
|
3463
|
+
* label: 'Menu Item 2',
|
|
3464
|
+
* type: 'checkbox',
|
|
3465
|
+
* checked: true,
|
|
3466
|
+
* data: 'The user clicked the checkbox'
|
|
3467
|
+
* },
|
|
3468
|
+
* {
|
|
3469
|
+
* label: 'see more',
|
|
3470
|
+
* enabled: false,
|
|
3471
|
+
* submenu: [
|
|
3472
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
|
3473
|
+
* ]
|
|
3474
|
+
* }
|
|
3475
|
+
* ];
|
|
3476
|
+
*
|
|
3477
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
|
3478
|
+
* // right-click
|
|
3479
|
+
* if (event.button === 2) {
|
|
3480
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
|
3481
|
+
* if (r.result === 'closed') {
|
|
3482
|
+
* console.log('nothing happened');
|
|
3483
|
+
* } else {
|
|
3484
|
+
* console.log(r.data);
|
|
3485
|
+
* }
|
|
3486
|
+
* });
|
|
3487
|
+
* }
|
|
3488
|
+
* });
|
|
3489
|
+
* ```
|
|
3490
|
+
*/
|
|
3491
|
+
async showTrayIconPopupMenu(options) {
|
|
3492
|
+
const { name } = this.wire.me;
|
|
3493
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3494
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
|
3495
|
+
return payload.data;
|
|
3496
|
+
}
|
|
3497
|
+
/**
|
|
3498
|
+
* Closes the tray icon menu.
|
|
3499
|
+
*
|
|
3500
|
+
* @throws if the application has no tray icon set
|
|
3501
|
+
* @example
|
|
3502
|
+
*
|
|
3503
|
+
* ```js
|
|
3504
|
+
* const app = fin.Application.getCurrentSync();
|
|
3505
|
+
*
|
|
3506
|
+
* await app.closeTrayIconPopupMenu();
|
|
3507
|
+
* ```
|
|
3508
|
+
*/
|
|
3509
|
+
async closeTrayIconPopupMenu() {
|
|
3510
|
+
const { name } = this.wire.me;
|
|
3511
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3512
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
3513
|
+
}
|
|
3587
3514
|
}
|
|
3515
|
+
Instance$6.Application = Application;
|
|
3588
3516
|
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
* @ignore
|
|
3844
|
-
*/
|
|
3845
|
-
createFromManifest(manifestUrl) {
|
|
3846
|
-
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
3847
|
-
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
|
3848
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3849
|
-
});
|
|
3850
|
-
return this._createFromManifest(manifestUrl);
|
|
3851
|
-
}
|
|
3852
|
-
_createFromManifest(manifestUrl) {
|
|
3853
|
-
return this.wire
|
|
3854
|
-
.sendAction('get-application-manifest', { manifestUrl })
|
|
3855
|
-
.then(({ payload }) => {
|
|
3856
|
-
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
3857
|
-
return this.wrap({ uuid });
|
|
3858
|
-
})
|
|
3859
|
-
.then((app) => {
|
|
3860
|
-
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
3861
|
-
return app;
|
|
3862
|
-
});
|
|
3863
|
-
}
|
|
3864
|
-
}
|
|
3865
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
|
3866
|
-
return Factory$7;
|
|
3517
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
|
3518
|
+
Factory$7.ApplicationModule = void 0;
|
|
3519
|
+
const base_1$m = base;
|
|
3520
|
+
const validate_1$4 = validate;
|
|
3521
|
+
const Instance_1$5 = Instance$6;
|
|
3522
|
+
/**
|
|
3523
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
|
3524
|
+
*/
|
|
3525
|
+
class ApplicationModule extends base_1$m.Base {
|
|
3526
|
+
/**
|
|
3527
|
+
* Asynchronously returns an API handle for the given Application identity.
|
|
3528
|
+
*
|
|
3529
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
3530
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
3531
|
+
* for an Application throughout its entire lifecycle.
|
|
3532
|
+
*
|
|
3533
|
+
* @example
|
|
3534
|
+
*
|
|
3535
|
+
* ```js
|
|
3536
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
|
3537
|
+
* .then(app => app.isRunning())
|
|
3538
|
+
* .then(running => console.log('Application is running: ' + running))
|
|
3539
|
+
* .catch(err => console.log(err));
|
|
3540
|
+
* ```
|
|
3541
|
+
*
|
|
3542
|
+
*/
|
|
3543
|
+
async wrap(identity) {
|
|
3544
|
+
this.wire.recordAnalytic('wrap-application');
|
|
3545
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
|
3546
|
+
if (errorMsg) {
|
|
3547
|
+
throw new Error(errorMsg);
|
|
3548
|
+
}
|
|
3549
|
+
return new Instance_1$5.Application(this.wire, identity);
|
|
3550
|
+
}
|
|
3551
|
+
/**
|
|
3552
|
+
* Synchronously returns an API handle for the given Application identity.
|
|
3553
|
+
*
|
|
3554
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
3555
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
3556
|
+
* for an Aplication throughout its entire lifecycle.
|
|
3557
|
+
*
|
|
3558
|
+
* @example
|
|
3559
|
+
*
|
|
3560
|
+
* ```js
|
|
3561
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
|
3562
|
+
* await app.close();
|
|
3563
|
+
* ```
|
|
3564
|
+
*
|
|
3565
|
+
*/
|
|
3566
|
+
wrapSync(identity) {
|
|
3567
|
+
this.wire.recordAnalytic('wrap-application-sync');
|
|
3568
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
|
3569
|
+
if (errorMsg) {
|
|
3570
|
+
throw new Error(errorMsg);
|
|
3571
|
+
}
|
|
3572
|
+
return new Instance_1$5.Application(this.wire, identity);
|
|
3573
|
+
}
|
|
3574
|
+
async _create(appOptions) {
|
|
3575
|
+
// set defaults:
|
|
3576
|
+
if (appOptions.waitForPageLoad === undefined) {
|
|
3577
|
+
appOptions.waitForPageLoad = false;
|
|
3578
|
+
}
|
|
3579
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
|
3580
|
+
appOptions.autoShow = true;
|
|
3581
|
+
}
|
|
3582
|
+
await this.wire.sendAction('create-application', appOptions);
|
|
3583
|
+
return this.wrap({ uuid: appOptions.uuid });
|
|
3584
|
+
}
|
|
3585
|
+
/**
|
|
3586
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
|
3587
|
+
*
|
|
3588
|
+
* @example
|
|
3589
|
+
*
|
|
3590
|
+
* ```js
|
|
3591
|
+
* async function createApp() {
|
|
3592
|
+
* const app = await fin.Application.create({
|
|
3593
|
+
* name: 'myApp',
|
|
3594
|
+
* uuid: 'app-3',
|
|
3595
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
|
3596
|
+
* autoShow: true
|
|
3597
|
+
* });
|
|
3598
|
+
* await app.run();
|
|
3599
|
+
* }
|
|
3600
|
+
*
|
|
3601
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
|
3602
|
+
* ```
|
|
3603
|
+
*
|
|
3604
|
+
* @ignore
|
|
3605
|
+
*/
|
|
3606
|
+
create(appOptions) {
|
|
3607
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
|
3608
|
+
this.wire.recordAnalytic('application-create');
|
|
3609
|
+
return this._create(appOptions);
|
|
3610
|
+
}
|
|
3611
|
+
/**
|
|
3612
|
+
* Creates and starts a new Application.
|
|
3613
|
+
*
|
|
3614
|
+
* @example
|
|
3615
|
+
*
|
|
3616
|
+
* ```js
|
|
3617
|
+
* async function start() {
|
|
3618
|
+
* return fin.Application.start({
|
|
3619
|
+
* name: 'app-1',
|
|
3620
|
+
* uuid: 'app-1',
|
|
3621
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
|
3622
|
+
* autoShow: true
|
|
3623
|
+
* });
|
|
3624
|
+
* }
|
|
3625
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
3626
|
+
* ```
|
|
3627
|
+
*
|
|
3628
|
+
*/
|
|
3629
|
+
async start(appOptions) {
|
|
3630
|
+
this.wire.recordAnalytic('start-application');
|
|
3631
|
+
const app = await this._create(appOptions);
|
|
3632
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
|
3633
|
+
return app;
|
|
3634
|
+
}
|
|
3635
|
+
/**
|
|
3636
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
|
3637
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
|
3638
|
+
* @param opts - Parameters that the RVM will use.
|
|
3639
|
+
*
|
|
3640
|
+
* @example
|
|
3641
|
+
*
|
|
3642
|
+
* ```js
|
|
3643
|
+
*
|
|
3644
|
+
* const applicationInfoArray = [
|
|
3645
|
+
* {
|
|
3646
|
+
* "uuid": 'App-1',
|
|
3647
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
|
3648
|
+
* },
|
|
3649
|
+
* {
|
|
3650
|
+
* "uuid": 'App-2',
|
|
3651
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
|
3652
|
+
* },
|
|
3653
|
+
* {
|
|
3654
|
+
* "uuid": 'App-3',
|
|
3655
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
|
3656
|
+
* }
|
|
3657
|
+
* ]
|
|
3658
|
+
*
|
|
3659
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
|
3660
|
+
* .then(() => {
|
|
3661
|
+
* console.log('RVM has finished launching the application list.');
|
|
3662
|
+
* })
|
|
3663
|
+
* .catch((err) => {
|
|
3664
|
+
* console.log(err);
|
|
3665
|
+
* })
|
|
3666
|
+
* ```
|
|
3667
|
+
*
|
|
3668
|
+
* @experimental
|
|
3669
|
+
*/
|
|
3670
|
+
async startManyManifests(applications, opts) {
|
|
3671
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
|
3672
|
+
}
|
|
3673
|
+
/**
|
|
3674
|
+
* Asynchronously returns an Application object that represents the current application
|
|
3675
|
+
*
|
|
3676
|
+
* @example
|
|
3677
|
+
*
|
|
3678
|
+
* ```js
|
|
3679
|
+
* async function isCurrentAppRunning () {
|
|
3680
|
+
* const app = await fin.Application.getCurrent();
|
|
3681
|
+
* return app.isRunning();
|
|
3682
|
+
* }
|
|
3683
|
+
*
|
|
3684
|
+
* isCurrentAppRunning().then(running => {
|
|
3685
|
+
* console.log(`Current app is running: ${running}`);
|
|
3686
|
+
* }).catch(err => {
|
|
3687
|
+
* console.error(err);
|
|
3688
|
+
* });
|
|
3689
|
+
*
|
|
3690
|
+
* ```
|
|
3691
|
+
*/
|
|
3692
|
+
getCurrent() {
|
|
3693
|
+
this.wire.recordAnalytic('get-current-application');
|
|
3694
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
|
3695
|
+
}
|
|
3696
|
+
/**
|
|
3697
|
+
* Synchronously returns an Application object that represents the current application
|
|
3698
|
+
*
|
|
3699
|
+
* @example
|
|
3700
|
+
*
|
|
3701
|
+
* ```js
|
|
3702
|
+
* async function isCurrentAppRunning () {
|
|
3703
|
+
* const app = fin.Application.getCurrentSync();
|
|
3704
|
+
* return app.isRunning();
|
|
3705
|
+
* }
|
|
3706
|
+
*
|
|
3707
|
+
* isCurrentAppRunning().then(running => {
|
|
3708
|
+
* console.log(`Current app is running: ${running}`);
|
|
3709
|
+
* }).catch(err => {
|
|
3710
|
+
* console.error(err);
|
|
3711
|
+
* });
|
|
3712
|
+
*
|
|
3713
|
+
* ```
|
|
3714
|
+
*/
|
|
3715
|
+
getCurrentSync() {
|
|
3716
|
+
this.wire.recordAnalytic('get-current-application-sync');
|
|
3717
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
3718
|
+
}
|
|
3719
|
+
/**
|
|
3720
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
|
3721
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
3722
|
+
* @param opts - Parameters that the RVM will use.
|
|
3723
|
+
*
|
|
3724
|
+
* @example
|
|
3725
|
+
*
|
|
3726
|
+
* ```js
|
|
3727
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
3728
|
+
*
|
|
3729
|
+
* // For a local manifest file:
|
|
3730
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
3731
|
+
* ```
|
|
3732
|
+
*/
|
|
3733
|
+
async startFromManifest(manifestUrl, opts) {
|
|
3734
|
+
this.wire.recordAnalytic('application-start-from-manifest');
|
|
3735
|
+
const app = await this._createFromManifest(manifestUrl);
|
|
3736
|
+
// @ts-expect-error using private method without warning.
|
|
3737
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
3738
|
+
return app;
|
|
3739
|
+
}
|
|
3740
|
+
/**
|
|
3741
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
|
3742
|
+
* Retrieves application's manifest and returns a wrapped application.
|
|
3743
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
3744
|
+
* @param callback - called if the method succeeds.
|
|
3745
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
3746
|
+
*
|
|
3747
|
+
* @example
|
|
3748
|
+
*
|
|
3749
|
+
* ```js
|
|
3750
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
|
3751
|
+
* ```
|
|
3752
|
+
* @ignore
|
|
3753
|
+
*/
|
|
3754
|
+
createFromManifest(manifestUrl) {
|
|
3755
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
3756
|
+
this.wire.recordAnalytic('application-create-from-manifest');
|
|
3757
|
+
return this._createFromManifest(manifestUrl);
|
|
3758
|
+
}
|
|
3759
|
+
_createFromManifest(manifestUrl) {
|
|
3760
|
+
return this.wire
|
|
3761
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
|
3762
|
+
.then(({ payload }) => {
|
|
3763
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
3764
|
+
return this.wrap({ uuid });
|
|
3765
|
+
})
|
|
3766
|
+
.then((app) => {
|
|
3767
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
3768
|
+
return app;
|
|
3769
|
+
});
|
|
3770
|
+
}
|
|
3867
3771
|
}
|
|
3772
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
|
3868
3773
|
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
* @packageDocumentation
|
|
3900
|
-
*/
|
|
3901
|
-
__exportStar(requireFactory$1(), exports);
|
|
3902
|
-
__exportStar(requireInstance$1(), exports);
|
|
3903
|
-
} (application));
|
|
3904
|
-
return application;
|
|
3905
|
-
}
|
|
3774
|
+
(function (exports) {
|
|
3775
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3776
|
+
if (k2 === undefined) k2 = k;
|
|
3777
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3778
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3779
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
3780
|
+
}
|
|
3781
|
+
Object.defineProperty(o, k2, desc);
|
|
3782
|
+
}) : (function(o, m, k, k2) {
|
|
3783
|
+
if (k2 === undefined) k2 = k;
|
|
3784
|
+
o[k2] = m[k];
|
|
3785
|
+
}));
|
|
3786
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
3787
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3788
|
+
};
|
|
3789
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3790
|
+
/**
|
|
3791
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
|
3792
|
+
*
|
|
3793
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
|
3794
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
|
3795
|
+
*
|
|
3796
|
+
* These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/32.114.76.10/index.html),
|
|
3797
|
+
* both of these were documented on the same page.
|
|
3798
|
+
*
|
|
3799
|
+
* @packageDocumentation
|
|
3800
|
+
*/
|
|
3801
|
+
__exportStar(Factory$7, exports);
|
|
3802
|
+
__exportStar(Instance$6, exports);
|
|
3803
|
+
} (application));
|
|
3906
3804
|
|
|
3907
3805
|
var promisifySubscription$1 = {};
|
|
3908
3806
|
|
|
@@ -3946,7 +3844,7 @@ function requireInstance () {
|
|
|
3946
3844
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3947
3845
|
/* eslint-disable no-console */
|
|
3948
3846
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
3949
|
-
const application_1 =
|
|
3847
|
+
const application_1 = application;
|
|
3950
3848
|
const main_1 = main;
|
|
3951
3849
|
const view_1 = requireView();
|
|
3952
3850
|
const warnings_1 = warnings;
|
|
@@ -3967,9 +3865,7 @@ function requireInstance () {
|
|
|
3967
3865
|
super(wire, identity, 'window');
|
|
3968
3866
|
}
|
|
3969
3867
|
async createWindow(options) {
|
|
3970
|
-
this.wire.
|
|
3971
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3972
|
-
});
|
|
3868
|
+
this.wire.recordAnalytic('window-create-window');
|
|
3973
3869
|
const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
|
|
3974
3870
|
const responseSubscription = await (0, promisifySubscription_1.promisifySubscription)(this, CONSTRUCTOR_CB_TOPIC);
|
|
3975
3871
|
// set defaults:
|
|
@@ -4443,9 +4339,7 @@ function requireInstance () {
|
|
|
4443
4339
|
* @experimental
|
|
4444
4340
|
*/
|
|
4445
4341
|
async getLayout(layoutIdentity) {
|
|
4446
|
-
this.wire.
|
|
4447
|
-
// don't expose
|
|
4448
|
-
});
|
|
4342
|
+
this.wire.recordAnalytic('window-get-layout');
|
|
4449
4343
|
const opts = await this.getOptions();
|
|
4450
4344
|
if (!opts.layout && !opts.layoutSnapshot) {
|
|
4451
4345
|
throw new Error('Window does not have a Layout');
|
|
@@ -4494,9 +4388,7 @@ function requireInstance () {
|
|
|
4494
4388
|
* ```
|
|
4495
4389
|
*/
|
|
4496
4390
|
getParentApplication() {
|
|
4497
|
-
this.wire.
|
|
4498
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4499
|
-
});
|
|
4391
|
+
this.wire.recordAnalytic('window-get-parent-application');
|
|
4500
4392
|
return Promise.resolve(new application_1.Application(this.wire, this.identity));
|
|
4501
4393
|
}
|
|
4502
4394
|
/**
|
|
@@ -4519,9 +4411,7 @@ function requireInstance () {
|
|
|
4519
4411
|
* ```
|
|
4520
4412
|
*/
|
|
4521
4413
|
getParentWindow() {
|
|
4522
|
-
this.wire.
|
|
4523
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4524
|
-
});
|
|
4414
|
+
this.wire.recordAnalytic('window-get-parent-window');
|
|
4525
4415
|
return Promise.resolve(new application_1.Application(this.wire, this.identity)).then((app) => app.getWindow());
|
|
4526
4416
|
}
|
|
4527
4417
|
/**
|
|
@@ -4625,9 +4515,7 @@ function requireInstance () {
|
|
|
4625
4515
|
* ```
|
|
4626
4516
|
*/
|
|
4627
4517
|
getWebWindow() {
|
|
4628
|
-
this.wire.
|
|
4629
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4630
|
-
});
|
|
4518
|
+
this.wire.recordAnalytic('window-get-web-window');
|
|
4631
4519
|
return this.wire.environment.getWebWindow(this.identity);
|
|
4632
4520
|
}
|
|
4633
4521
|
/**
|
|
@@ -4641,9 +4529,7 @@ function requireInstance () {
|
|
|
4641
4529
|
* ```
|
|
4642
4530
|
*/
|
|
4643
4531
|
isMainWindow() {
|
|
4644
|
-
this.wire.
|
|
4645
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
4646
|
-
});
|
|
4532
|
+
this.wire.recordAnalytic('window-is-main-window');
|
|
4647
4533
|
return this.me.uuid === this.me.name;
|
|
4648
4534
|
}
|
|
4649
4535
|
/**
|
|
@@ -5026,6 +4912,9 @@ function requireInstance () {
|
|
|
5026
4912
|
* ```
|
|
5027
4913
|
*/
|
|
5028
4914
|
updateOptions(options) {
|
|
4915
|
+
if ('frame' in options) {
|
|
4916
|
+
console.warn(`Deprecation Warning: Starting with version 45 it will not be possible to change the frame value after window has been created.`);
|
|
4917
|
+
}
|
|
5029
4918
|
return this.wire.sendAction('update-window-options', { options, ...this.identity }).then(() => undefined);
|
|
5030
4919
|
}
|
|
5031
4920
|
/**
|
|
@@ -5162,9 +5051,7 @@ function requireInstance () {
|
|
|
5162
5051
|
* ```
|
|
5163
5052
|
*/
|
|
5164
5053
|
async dispatchPopupResult(data) {
|
|
5165
|
-
this.wire.
|
|
5166
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
5167
|
-
});
|
|
5054
|
+
this.wire.recordAnalytic('window-dispatch-popup-result');
|
|
5168
5055
|
await this.wire.sendAction('dispatch-popup-result', { data, ...this.identity });
|
|
5169
5056
|
}
|
|
5170
5057
|
/**
|
|
@@ -5264,9 +5151,7 @@ function requireFactory () {
|
|
|
5264
5151
|
* ```
|
|
5265
5152
|
*/
|
|
5266
5153
|
async wrap(identity) {
|
|
5267
|
-
this.wire.
|
|
5268
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
5269
|
-
});
|
|
5154
|
+
this.wire.recordAnalytic('window-wrap');
|
|
5270
5155
|
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
5271
5156
|
if (errorMsg) {
|
|
5272
5157
|
throw new Error(errorMsg);
|
|
@@ -5296,9 +5181,7 @@ function requireFactory () {
|
|
|
5296
5181
|
* ```
|
|
5297
5182
|
*/
|
|
5298
5183
|
wrapSync(identity) {
|
|
5299
|
-
this.wire.
|
|
5300
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
5301
|
-
});
|
|
5184
|
+
this.wire.recordAnalytic('window-wrap-sync');
|
|
5302
5185
|
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
5303
5186
|
if (errorMsg) {
|
|
5304
5187
|
throw new Error(errorMsg);
|
|
@@ -5327,9 +5210,7 @@ function requireFactory () {
|
|
|
5327
5210
|
* ```
|
|
5328
5211
|
*/
|
|
5329
5212
|
create(options) {
|
|
5330
|
-
this.wire.
|
|
5331
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
5332
|
-
});
|
|
5213
|
+
this.wire.recordAnalytic('create-window');
|
|
5333
5214
|
const win = new Instance_1._Window(this.wire, { uuid: this.me.uuid, name: options.name });
|
|
5334
5215
|
return win.createWindow(options);
|
|
5335
5216
|
}
|
|
@@ -5345,9 +5226,7 @@ function requireFactory () {
|
|
|
5345
5226
|
* ```
|
|
5346
5227
|
*/
|
|
5347
5228
|
getCurrent() {
|
|
5348
|
-
this.wire.
|
|
5349
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
5350
|
-
});
|
|
5229
|
+
this.wire.recordAnalytic('get-current-window');
|
|
5351
5230
|
if (!this.wire.me.isWindow) {
|
|
5352
5231
|
throw new Error('You are not in a Window context');
|
|
5353
5232
|
}
|
|
@@ -5366,9 +5245,7 @@ function requireFactory () {
|
|
|
5366
5245
|
* ```
|
|
5367
5246
|
*/
|
|
5368
5247
|
getCurrentSync() {
|
|
5369
|
-
this.wire.
|
|
5370
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
5371
|
-
});
|
|
5248
|
+
this.wire.recordAnalytic('get-current-window-sync');
|
|
5372
5249
|
if (!this.wire.me.isWindow) {
|
|
5373
5250
|
throw new Error('You are not in a Window context');
|
|
5374
5251
|
}
|
|
@@ -5514,13 +5391,15 @@ class System extends base_1$l.EmitterBase {
|
|
|
5514
5391
|
* * cookies: browser [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies)
|
|
5515
5392
|
* * localStorage: browser data that can be used across sessions ([local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage))
|
|
5516
5393
|
* * appcache: html5 [application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache)
|
|
5394
|
+
* * windowState: clears data written for windows using `saveWindowState`; after clearing, previously saved bounds and state will not be restored until new state is written
|
|
5517
5395
|
* @example
|
|
5518
5396
|
* ```js
|
|
5519
5397
|
* const clearCacheOptions = {
|
|
5520
5398
|
* appcache: true,
|
|
5521
5399
|
* cache: true,
|
|
5522
5400
|
* cookies: true,
|
|
5523
|
-
* localStorage: true
|
|
5401
|
+
* localStorage: true,
|
|
5402
|
+
* windowState: true
|
|
5524
5403
|
* };
|
|
5525
5404
|
* fin.System.clearCache(clearCacheOptions).then(() => console.log('Cache cleared')).catch(err => console.log(err));
|
|
5526
5405
|
* ```
|
|
@@ -6922,9 +6801,7 @@ class System extends base_1$l.EmitterBase {
|
|
|
6922
6801
|
* @experimental
|
|
6923
6802
|
*/
|
|
6924
6803
|
async registerShutdownHandler(handler) {
|
|
6925
|
-
this.wire.
|
|
6926
|
-
// don't expose, analytics-only call
|
|
6927
|
-
});
|
|
6804
|
+
this.wire.recordAnalytic('system-register-shutdown-handler');
|
|
6928
6805
|
const SystemShutdownEventName = 'system-shutdown';
|
|
6929
6806
|
const SystemShutdownHandledEventName = 'system-shutdown-handled';
|
|
6930
6807
|
const { uuid, name } = this.wire.me;
|
|
@@ -9628,6 +9505,16 @@ class InterApplicationBus extends base_1$g.Base {
|
|
|
9628
9505
|
*/
|
|
9629
9506
|
constructor(wire) {
|
|
9630
9507
|
super(wire);
|
|
9508
|
+
/**
|
|
9509
|
+
* Event types for the InterApplicationBus.
|
|
9510
|
+
*
|
|
9511
|
+
* @remarks The `subscriber-added` and `subscriber-removed` events are disabled by default.
|
|
9512
|
+
* To re-enable them, launch the runtime with the `--emit-legacy-iab-events` flag.
|
|
9513
|
+
* These events will be removed in a future version. Use {@link Channel} for connection
|
|
9514
|
+
* lifecycle management instead.
|
|
9515
|
+
*
|
|
9516
|
+
* @deprecated Use {@link Channel} `onConnection` / `onDisconnection` instead.
|
|
9517
|
+
*/
|
|
9631
9518
|
this.events = {
|
|
9632
9519
|
subscriberAdded: 'subscriber-added',
|
|
9633
9520
|
subscriberRemoved: 'subscriber-removed'
|
|
@@ -10114,9 +10001,7 @@ class ExternalApplicationModule extends base_1$d.Base {
|
|
|
10114
10001
|
* ```
|
|
10115
10002
|
*/
|
|
10116
10003
|
wrap(uuid) {
|
|
10117
|
-
this.wire.
|
|
10118
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
10119
|
-
});
|
|
10004
|
+
this.wire.recordAnalytic('external-application-wrap');
|
|
10120
10005
|
return Promise.resolve(new Instance_1$4.ExternalApplication(this.wire, { uuid }));
|
|
10121
10006
|
}
|
|
10122
10007
|
/**
|
|
@@ -10133,9 +10018,7 @@ class ExternalApplicationModule extends base_1$d.Base {
|
|
|
10133
10018
|
* ```
|
|
10134
10019
|
*/
|
|
10135
10020
|
wrapSync(uuid) {
|
|
10136
|
-
this.wire.
|
|
10137
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
10138
|
-
});
|
|
10021
|
+
this.wire.recordAnalytic('external-application-wrap-sync');
|
|
10139
10022
|
return new Instance_1$4.ExternalApplication(this.wire, { uuid });
|
|
10140
10023
|
}
|
|
10141
10024
|
}
|
|
@@ -10270,9 +10153,7 @@ class _FrameModule extends base_1$b.Base {
|
|
|
10270
10153
|
* ```
|
|
10271
10154
|
*/
|
|
10272
10155
|
async wrap(identity) {
|
|
10273
|
-
this.wire.
|
|
10274
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
10275
|
-
});
|
|
10156
|
+
this.wire.recordAnalytic('frame-wrap');
|
|
10276
10157
|
const errorMsg = (0, validate_1$2.validateIdentity)(identity);
|
|
10277
10158
|
if (errorMsg) {
|
|
10278
10159
|
throw new Error(errorMsg);
|
|
@@ -10294,9 +10175,7 @@ class _FrameModule extends base_1$b.Base {
|
|
|
10294
10175
|
* ```
|
|
10295
10176
|
*/
|
|
10296
10177
|
wrapSync(identity) {
|
|
10297
|
-
this.wire.
|
|
10298
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
10299
|
-
});
|
|
10178
|
+
this.wire.recordAnalytic('frame-wrap-sync');
|
|
10300
10179
|
const errorMsg = (0, validate_1$2.validateIdentity)(identity);
|
|
10301
10180
|
if (errorMsg) {
|
|
10302
10181
|
throw new Error(errorMsg);
|
|
@@ -10314,9 +10193,7 @@ class _FrameModule extends base_1$b.Base {
|
|
|
10314
10193
|
* ```
|
|
10315
10194
|
*/
|
|
10316
10195
|
getCurrent() {
|
|
10317
|
-
this.wire.
|
|
10318
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
10319
|
-
});
|
|
10196
|
+
this.wire.recordAnalytic('frame-get-current');
|
|
10320
10197
|
return Promise.resolve(new Instance_1$3._Frame(this.wire, this.wire.environment.getCurrentEntityIdentity()));
|
|
10321
10198
|
}
|
|
10322
10199
|
/**
|
|
@@ -10330,9 +10207,7 @@ class _FrameModule extends base_1$b.Base {
|
|
|
10330
10207
|
* ```
|
|
10331
10208
|
*/
|
|
10332
10209
|
getCurrentSync() {
|
|
10333
|
-
this.wire.
|
|
10334
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
10335
|
-
});
|
|
10210
|
+
this.wire.recordAnalytic('frame-get-current-sync');
|
|
10336
10211
|
return new Instance_1$3._Frame(this.wire, this.wire.environment.getCurrentEntityIdentity());
|
|
10337
10212
|
}
|
|
10338
10213
|
}
|
|
@@ -12562,9 +12437,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12562
12437
|
* ```
|
|
12563
12438
|
*/
|
|
12564
12439
|
this.init = async (options = {}) => {
|
|
12565
|
-
this.wire.
|
|
12566
|
-
// don't expose
|
|
12567
|
-
});
|
|
12440
|
+
this.wire.recordAnalytic('layout-init');
|
|
12568
12441
|
if (!this.wire.environment.layoutAllowedInContext(this.fin)) {
|
|
12569
12442
|
throw new Error('Layout.init can only be called from a Window context.');
|
|
12570
12443
|
}
|
|
@@ -12642,9 +12515,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12642
12515
|
* ```
|
|
12643
12516
|
*/
|
|
12644
12517
|
async wrap(identity) {
|
|
12645
|
-
this.wire.
|
|
12646
|
-
// don't expose
|
|
12647
|
-
});
|
|
12518
|
+
this.wire.recordAnalytic('layout-wrap');
|
|
12648
12519
|
return new Instance_1$2.Layout(identity, this.wire);
|
|
12649
12520
|
}
|
|
12650
12521
|
/**
|
|
@@ -12667,9 +12538,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12667
12538
|
* ```
|
|
12668
12539
|
*/
|
|
12669
12540
|
wrapSync(identity) {
|
|
12670
|
-
this.wire.
|
|
12671
|
-
// don't expose
|
|
12672
|
-
});
|
|
12541
|
+
this.wire.recordAnalytic('layout-wrap-sync');
|
|
12673
12542
|
return new Instance_1$2.Layout(identity, this.wire);
|
|
12674
12543
|
}
|
|
12675
12544
|
/**
|
|
@@ -12683,9 +12552,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12683
12552
|
* ```
|
|
12684
12553
|
*/
|
|
12685
12554
|
async getCurrent() {
|
|
12686
|
-
this.wire.
|
|
12687
|
-
// don't expose
|
|
12688
|
-
});
|
|
12555
|
+
this.wire.recordAnalytic('layout-get-current');
|
|
12689
12556
|
if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
|
|
12690
12557
|
throw new Error('You are not in a Window context. Only Windows can have a Layout.');
|
|
12691
12558
|
}
|
|
@@ -12706,9 +12573,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12706
12573
|
* ```
|
|
12707
12574
|
*/
|
|
12708
12575
|
getCurrentSync() {
|
|
12709
|
-
this.wire.
|
|
12710
|
-
// don't expose
|
|
12711
|
-
});
|
|
12576
|
+
this.wire.recordAnalytic('layout-get-current-sync');
|
|
12712
12577
|
if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
|
|
12713
12578
|
throw new Error('You are not in a Window context. Only Windows can have a Layout.');
|
|
12714
12579
|
}
|
|
@@ -12726,9 +12591,7 @@ class LayoutModule extends base_1$7.Base {
|
|
|
12726
12591
|
* ```
|
|
12727
12592
|
*/
|
|
12728
12593
|
async getLayoutByViewIdentity(viewIdentity) {
|
|
12729
|
-
this.wire.
|
|
12730
|
-
// don't expose
|
|
12731
|
-
});
|
|
12594
|
+
this.wire.recordAnalytic('layout-get-by-view-identity');
|
|
12732
12595
|
const winIdentity = await this.wire.environment.getViewWindowIdentity(this.fin, viewIdentity);
|
|
12733
12596
|
let layoutWindowIdentity = winIdentity;
|
|
12734
12597
|
// TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
|
|
@@ -12890,9 +12753,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12890
12753
|
* ```
|
|
12891
12754
|
*/
|
|
12892
12755
|
async wrap(identity) {
|
|
12893
|
-
this.wire.
|
|
12894
|
-
// don't expose
|
|
12895
|
-
});
|
|
12756
|
+
this.wire.recordAnalytic('platform-wrap');
|
|
12896
12757
|
return new Instance_1$1.Platform(this.wire, { uuid: identity.uuid });
|
|
12897
12758
|
}
|
|
12898
12759
|
/**
|
|
@@ -12907,9 +12768,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12907
12768
|
* ```
|
|
12908
12769
|
*/
|
|
12909
12770
|
wrapSync(identity) {
|
|
12910
|
-
this.wire.
|
|
12911
|
-
// don't expose
|
|
12912
|
-
});
|
|
12771
|
+
this.wire.recordAnalytic('platform-wrap-sync');
|
|
12913
12772
|
return new Instance_1$1.Platform(this.wire, { uuid: identity.uuid });
|
|
12914
12773
|
}
|
|
12915
12774
|
/**
|
|
@@ -12923,9 +12782,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12923
12782
|
* ```
|
|
12924
12783
|
*/
|
|
12925
12784
|
async getCurrent() {
|
|
12926
|
-
this.wire.
|
|
12927
|
-
// don't expose
|
|
12928
|
-
});
|
|
12785
|
+
this.wire.recordAnalytic('platform-get-current');
|
|
12929
12786
|
return this.wrap({ uuid: this.wire.me.uuid });
|
|
12930
12787
|
}
|
|
12931
12788
|
/**
|
|
@@ -12939,9 +12796,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12939
12796
|
* ```
|
|
12940
12797
|
*/
|
|
12941
12798
|
getCurrentSync() {
|
|
12942
|
-
this.wire.
|
|
12943
|
-
// don't expose
|
|
12944
|
-
});
|
|
12799
|
+
this.wire.recordAnalytic('platform-get-current-sync');
|
|
12945
12800
|
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
12946
12801
|
}
|
|
12947
12802
|
/**
|
|
@@ -12969,9 +12824,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
12969
12824
|
* ```
|
|
12970
12825
|
*/
|
|
12971
12826
|
start(platformOptions) {
|
|
12972
|
-
this.wire.
|
|
12973
|
-
// don't expose
|
|
12974
|
-
});
|
|
12827
|
+
this.wire.recordAnalytic('platform-start');
|
|
12975
12828
|
// eslint-disable-next-line no-async-promise-executor
|
|
12976
12829
|
return new Promise(async (resolve, reject) => {
|
|
12977
12830
|
try {
|
|
@@ -13013,9 +12866,7 @@ class PlatformModule extends base_1$6.Base {
|
|
|
13013
12866
|
* ```
|
|
13014
12867
|
*/
|
|
13015
12868
|
startFromManifest(manifestUrl, opts) {
|
|
13016
|
-
this.wire.
|
|
13017
|
-
// don't expose
|
|
13018
|
-
});
|
|
12869
|
+
this.wire.recordAnalytic('platform-start-from-manifest');
|
|
13019
12870
|
// eslint-disable-next-line no-async-promise-executor
|
|
13020
12871
|
return new Promise(async (resolve, reject) => {
|
|
13021
12872
|
try {
|
|
@@ -16057,7 +15908,6 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
|
|
|
16057
15908
|
// Generate an ID to make a session context group with. We will pass that ID to the Broker.
|
|
16058
15909
|
// The broker will then setContext on that session context group later with our Intent Result,
|
|
16059
15910
|
const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
|
|
16060
|
-
let isPromiseSettled = false;
|
|
16061
15911
|
// Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
|
|
16062
15912
|
const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
|
|
16063
15913
|
const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
|
|
@@ -16073,21 +15923,11 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
|
|
|
16073
15923
|
reject(new Error('getResult is not supported in this environment'));
|
|
16074
15924
|
});
|
|
16075
15925
|
});
|
|
16076
|
-
getResultPromise
|
|
16077
|
-
.then(() => {
|
|
16078
|
-
isPromiseSettled = true;
|
|
16079
|
-
})
|
|
16080
|
-
.catch(() => {
|
|
16081
|
-
isPromiseSettled = true;
|
|
16082
|
-
});
|
|
16083
15926
|
// Set up the getResult call.
|
|
16084
15927
|
const getResult = async () => {
|
|
16085
|
-
// All this mumbo jumbo is needed to make sure that getResult resolves correctly and conforms to the FDC3 spec.
|
|
16086
|
-
if (!isPromiseSettled) {
|
|
16087
|
-
return undefined;
|
|
16088
|
-
}
|
|
16089
15928
|
let intentResult = await getResultPromise;
|
|
16090
|
-
|
|
15929
|
+
// void / no payload, or web path where subscribe resolves undefined (see getResultPromise above)
|
|
15930
|
+
if (intentResult == null) {
|
|
16091
15931
|
return undefined;
|
|
16092
15932
|
}
|
|
16093
15933
|
if (typeof intentResult !== 'object') {
|
|
@@ -16178,9 +16018,7 @@ class FDC3ModuleBase {
|
|
|
16178
16018
|
* @static
|
|
16179
16019
|
*/
|
|
16180
16020
|
async broadcast(context) {
|
|
16181
|
-
this.wire.
|
|
16182
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16183
|
-
});
|
|
16021
|
+
this.wire.recordAnalytic('fdc3-broadcast');
|
|
16184
16022
|
return this.client.setContext(context);
|
|
16185
16023
|
}
|
|
16186
16024
|
/**
|
|
@@ -16191,9 +16029,7 @@ class FDC3ModuleBase {
|
|
|
16191
16029
|
* @tutorial fdc3.open
|
|
16192
16030
|
*/
|
|
16193
16031
|
async _open(app, context) {
|
|
16194
|
-
this.wire.
|
|
16195
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16196
|
-
});
|
|
16032
|
+
this.wire.recordAnalytic('fdc3-open');
|
|
16197
16033
|
try {
|
|
16198
16034
|
return await InteropClient_1$2.InteropClient.ferryFdc3Call(this.client, 'fdc3Open', { app, context });
|
|
16199
16035
|
}
|
|
@@ -16217,9 +16053,7 @@ class FDC3ModuleBase {
|
|
|
16217
16053
|
* @tutorial fdc3.getOrCreateChannel
|
|
16218
16054
|
*/
|
|
16219
16055
|
async getOrCreateChannel(channelId, fdc3Factory) {
|
|
16220
|
-
this.wire.
|
|
16221
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16222
|
-
});
|
|
16056
|
+
this.wire.recordAnalytic('fdc3-get-or-create-channel');
|
|
16223
16057
|
const hasChannelIdBeenUsed = await InteropClient_1$2.InteropClient.ferryFdc3Call(this.client, 'isIdUsedByPrivateChannel', {
|
|
16224
16058
|
channelId
|
|
16225
16059
|
});
|
|
@@ -16247,9 +16081,7 @@ class FDC3ModuleBase {
|
|
|
16247
16081
|
* @static
|
|
16248
16082
|
*/
|
|
16249
16083
|
async getSystemChannels() {
|
|
16250
|
-
this.wire.
|
|
16251
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16252
|
-
});
|
|
16084
|
+
this.wire.recordAnalytic('fdc3-get-system-channels');
|
|
16253
16085
|
return this._getChannels();
|
|
16254
16086
|
}
|
|
16255
16087
|
/**
|
|
@@ -16264,9 +16096,7 @@ class FDC3ModuleBase {
|
|
|
16264
16096
|
* @static
|
|
16265
16097
|
*/
|
|
16266
16098
|
async joinChannel(channelId) {
|
|
16267
|
-
this.wire.
|
|
16268
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16269
|
-
});
|
|
16099
|
+
this.wire.recordAnalytic('fdc3-join-channel');
|
|
16270
16100
|
try {
|
|
16271
16101
|
return await this.client.joinContextGroup(channelId);
|
|
16272
16102
|
}
|
|
@@ -16289,9 +16119,7 @@ class FDC3ModuleBase {
|
|
|
16289
16119
|
* @tutorial fdc3.getCurrentChannel
|
|
16290
16120
|
*/
|
|
16291
16121
|
async getCurrentChannel() {
|
|
16292
|
-
this.wire.
|
|
16293
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16294
|
-
});
|
|
16122
|
+
this.wire.recordAnalytic('fdc3-get-current-channel');
|
|
16295
16123
|
const currentContextGroupInfo = await this.getCurrentContextGroupInfo();
|
|
16296
16124
|
if (!currentContextGroupInfo) {
|
|
16297
16125
|
return null;
|
|
@@ -16306,9 +16134,7 @@ class FDC3ModuleBase {
|
|
|
16306
16134
|
* @static
|
|
16307
16135
|
*/
|
|
16308
16136
|
async leaveCurrentChannel() {
|
|
16309
|
-
this.wire.
|
|
16310
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16311
|
-
});
|
|
16137
|
+
this.wire.recordAnalytic('fdc3-leave-current-channel');
|
|
16312
16138
|
return this.client.removeFromContextGroup();
|
|
16313
16139
|
}
|
|
16314
16140
|
// utils
|
|
@@ -16434,9 +16260,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16434
16260
|
*/
|
|
16435
16261
|
// @ts-expect-error TODO [CORE-1524]
|
|
16436
16262
|
addContextListener(contextType, handler) {
|
|
16437
|
-
this.wire.
|
|
16438
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16439
|
-
});
|
|
16263
|
+
this.wire.recordAnalytic('fdc3-add-context-listener');
|
|
16440
16264
|
let listener;
|
|
16441
16265
|
if (typeof contextType === 'function') {
|
|
16442
16266
|
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
|
@@ -16459,9 +16283,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16459
16283
|
* @static
|
|
16460
16284
|
*/
|
|
16461
16285
|
addIntentListener(intent, handler) {
|
|
16462
|
-
this.wire.
|
|
16463
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16464
|
-
});
|
|
16286
|
+
this.wire.recordAnalytic('fdc3-add-intent-listener');
|
|
16465
16287
|
const contextHandler = (raisedIntent) => {
|
|
16466
16288
|
const { context, metadata: intentMetadata } = raisedIntent;
|
|
16467
16289
|
const { metadata } = context;
|
|
@@ -16489,9 +16311,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16489
16311
|
* @static
|
|
16490
16312
|
*/
|
|
16491
16313
|
async raiseIntent(intent, context, app) {
|
|
16492
|
-
this.wire.
|
|
16493
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16494
|
-
});
|
|
16314
|
+
this.wire.recordAnalytic('fdc3-raise-intent');
|
|
16495
16315
|
const intentObj = app
|
|
16496
16316
|
? { name: intent, context, metadata: { target: app } }
|
|
16497
16317
|
: { name: intent, context };
|
|
@@ -16511,9 +16331,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16511
16331
|
* @tutorial fdc3.findIntent
|
|
16512
16332
|
*/
|
|
16513
16333
|
async findIntent(intent, context) {
|
|
16514
|
-
this.wire.
|
|
16515
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16516
|
-
});
|
|
16334
|
+
this.wire.recordAnalytic('fdc3-find-intent');
|
|
16517
16335
|
try {
|
|
16518
16336
|
return await this.client.getInfoForIntent({ name: intent, context });
|
|
16519
16337
|
}
|
|
@@ -16529,9 +16347,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16529
16347
|
* @tutorial fdc3.findIntentsByContext
|
|
16530
16348
|
*/
|
|
16531
16349
|
async findIntentsByContext(context) {
|
|
16532
|
-
this.wire.
|
|
16533
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16534
|
-
});
|
|
16350
|
+
this.wire.recordAnalytic('fdc3-find-intents-by-context');
|
|
16535
16351
|
try {
|
|
16536
16352
|
return await this.client.getInfoForIntentsByContext(context);
|
|
16537
16353
|
}
|
|
@@ -16548,9 +16364,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16548
16364
|
* @tutorial fdc3.raiseIntentForContext
|
|
16549
16365
|
*/
|
|
16550
16366
|
async raiseIntentForContext(context, app) {
|
|
16551
|
-
this.wire.
|
|
16552
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16553
|
-
});
|
|
16367
|
+
this.wire.recordAnalytic('fdc3-raise-intent-for-context');
|
|
16554
16368
|
try {
|
|
16555
16369
|
return await this.client.fireIntentForContext({ ...context, metadata: { target: app } });
|
|
16556
16370
|
}
|
|
@@ -16574,9 +16388,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
|
|
|
16574
16388
|
* @tutorial fdc3.getInfo
|
|
16575
16389
|
*/
|
|
16576
16390
|
getInfo() {
|
|
16577
|
-
this.wire.
|
|
16578
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16579
|
-
});
|
|
16391
|
+
this.wire.recordAnalytic('fdc3-get-info');
|
|
16580
16392
|
const version = this.wire.environment.getAdapterVersionSync();
|
|
16581
16393
|
return {
|
|
16582
16394
|
providerVersion: version,
|
|
@@ -16654,9 +16466,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16654
16466
|
* @tutorial fdc3v2.findInstances
|
|
16655
16467
|
*/
|
|
16656
16468
|
async findInstances(app) {
|
|
16657
|
-
this.wire.
|
|
16658
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16659
|
-
});
|
|
16469
|
+
this.wire.recordAnalytic('fdc3-find-instances');
|
|
16660
16470
|
try {
|
|
16661
16471
|
return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3FindInstances', app);
|
|
16662
16472
|
}
|
|
@@ -16672,9 +16482,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16672
16482
|
* @tutorial fdc3v2.getAppMetadata
|
|
16673
16483
|
*/
|
|
16674
16484
|
async getAppMetadata(app) {
|
|
16675
|
-
this.wire.
|
|
16676
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16677
|
-
});
|
|
16485
|
+
this.wire.recordAnalytic('fdc3-get-app-metadata');
|
|
16678
16486
|
try {
|
|
16679
16487
|
return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3GetAppMetadata', app);
|
|
16680
16488
|
}
|
|
@@ -16692,9 +16500,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16692
16500
|
*/
|
|
16693
16501
|
// @ts-expect-error TODO [CORE-1524]
|
|
16694
16502
|
async addContextListener(contextType, handler) {
|
|
16695
|
-
this.wire.
|
|
16696
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16697
|
-
});
|
|
16503
|
+
this.wire.recordAnalytic('fdc3-add-context-listener');
|
|
16698
16504
|
// The FDC3 ContextHandler only expects the context and optional ContextMetadata, so we wrap the handler
|
|
16699
16505
|
// here so it only gets passed these parameters
|
|
16700
16506
|
const getWrappedHandler = (handlerToWrap) => {
|
|
@@ -16723,9 +16529,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16723
16529
|
* @tutorial fdc3.findIntent
|
|
16724
16530
|
*/
|
|
16725
16531
|
async findIntent(intent, context, resultType) {
|
|
16726
|
-
this.wire.
|
|
16727
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16728
|
-
});
|
|
16532
|
+
this.wire.recordAnalytic('fdc3-find-intent');
|
|
16729
16533
|
try {
|
|
16730
16534
|
return await this.client.getInfoForIntent({ name: intent, context, metadata: { resultType } });
|
|
16731
16535
|
}
|
|
@@ -16742,9 +16546,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16742
16546
|
* @tutorial fdc3v2.findIntentsByContext
|
|
16743
16547
|
*/
|
|
16744
16548
|
async findIntentsByContext(context, resultType) {
|
|
16745
|
-
this.wire.
|
|
16746
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16747
|
-
});
|
|
16549
|
+
this.wire.recordAnalytic('fdc3-find-intents-by-context');
|
|
16748
16550
|
const payload = resultType ? { context, metadata: { resultType } } : context;
|
|
16749
16551
|
try {
|
|
16750
16552
|
return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3v2FindIntentsByContext', payload);
|
|
@@ -16763,9 +16565,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16763
16565
|
* @tutorial fdc3v2.raiseIntent
|
|
16764
16566
|
*/
|
|
16765
16567
|
async raiseIntent(intent, context, app) {
|
|
16766
|
-
this.wire.
|
|
16767
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16768
|
-
});
|
|
16568
|
+
this.wire.recordAnalytic('fdc3-raise-intent');
|
|
16769
16569
|
try {
|
|
16770
16570
|
if (typeof app === 'string') {
|
|
16771
16571
|
console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
|
|
@@ -16786,9 +16586,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16786
16586
|
*/
|
|
16787
16587
|
async raiseIntentForContext(context, app) {
|
|
16788
16588
|
// TODO: We have to do the same thing we do for raiseIntent here as well.
|
|
16789
|
-
this.wire.
|
|
16790
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16791
|
-
});
|
|
16589
|
+
this.wire.recordAnalytic('fdc3-raise-intent-for-context');
|
|
16792
16590
|
try {
|
|
16793
16591
|
if (typeof app === 'string') {
|
|
16794
16592
|
console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
|
|
@@ -16808,9 +16606,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
|
|
|
16808
16606
|
* @tutorial fdc3.addIntentListener
|
|
16809
16607
|
*/
|
|
16810
16608
|
async addIntentListener(intent, handler) {
|
|
16811
|
-
this.wire.
|
|
16812
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
16813
|
-
});
|
|
16609
|
+
this.wire.recordAnalytic('fdc3-add-intent-listener');
|
|
16814
16610
|
if (typeof intent !== 'string') {
|
|
16815
16611
|
throw new Error('First argument must be an Intent name');
|
|
16816
16612
|
}
|
|
@@ -16987,9 +16783,7 @@ class InteropModule extends base_1$2.Base {
|
|
|
16987
16783
|
* ```
|
|
16988
16784
|
*/
|
|
16989
16785
|
async init(name, override = defaultOverride) {
|
|
16990
|
-
this.wire.
|
|
16991
|
-
// don't expose, analytics-only call
|
|
16992
|
-
});
|
|
16786
|
+
this.wire.recordAnalytic('interop-init');
|
|
16993
16787
|
// Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
|
|
16994
16788
|
const options = await this.wire.environment.getInteropInfo(this.wire.getFin());
|
|
16995
16789
|
const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
|
|
@@ -17038,9 +16832,7 @@ class InteropModule extends base_1$2.Base {
|
|
|
17038
16832
|
* ```
|
|
17039
16833
|
*/
|
|
17040
16834
|
connectSync(name, interopConfig) {
|
|
17041
|
-
this.wire.
|
|
17042
|
-
// don't expose, analytics-only call
|
|
17043
|
-
});
|
|
16835
|
+
this.wire.recordAnalytic('interop-connect-sync');
|
|
17044
16836
|
return new InteropClient_1.InteropClient(this.wire, this.wire.environment.whenReady().then(() => {
|
|
17045
16837
|
return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
|
|
17046
16838
|
payload: interopConfig
|
|
@@ -17209,9 +17001,7 @@ class SnapshotSource extends base_1$1.Base {
|
|
|
17209
17001
|
* ```
|
|
17210
17002
|
*/
|
|
17211
17003
|
async ready() {
|
|
17212
|
-
this.wire.
|
|
17213
|
-
// don't expose, analytics-only call
|
|
17214
|
-
});
|
|
17004
|
+
this.wire.recordAnalytic('snapshot-source-ready');
|
|
17215
17005
|
// eslint-disable-next-line no-async-promise-executor
|
|
17216
17006
|
try {
|
|
17217
17007
|
// If getClient was already called before this, do we have a timing issue where the channel might have been created but we missed the event but this still fails?
|
|
@@ -17227,9 +17017,7 @@ class SnapshotSource extends base_1$1.Base {
|
|
|
17227
17017
|
*
|
|
17228
17018
|
*/
|
|
17229
17019
|
async getSnapshot() {
|
|
17230
|
-
this.wire.
|
|
17231
|
-
// don't expose, analytics-only call
|
|
17232
|
-
});
|
|
17020
|
+
this.wire.recordAnalytic('snapshot-source-get-snapshot');
|
|
17233
17021
|
const client = await __classPrivateFieldGet$1(this, _SnapshotSource_getClient, "f").call(this);
|
|
17234
17022
|
const response = (await client.dispatch('get-snapshot'));
|
|
17235
17023
|
return (await response).snapshot;
|
|
@@ -17239,9 +17027,7 @@ class SnapshotSource extends base_1$1.Base {
|
|
|
17239
17027
|
*
|
|
17240
17028
|
*/
|
|
17241
17029
|
async applySnapshot(snapshot) {
|
|
17242
|
-
this.wire.
|
|
17243
|
-
// don't expose, analytics-only call
|
|
17244
|
-
});
|
|
17030
|
+
this.wire.recordAnalytic('snapshot-source-apply-snapshot');
|
|
17245
17031
|
const client = await __classPrivateFieldGet$1(this, _SnapshotSource_getClient, "f").call(this);
|
|
17246
17032
|
return client.dispatch('apply-snapshot', { snapshot });
|
|
17247
17033
|
}
|
|
@@ -17282,9 +17068,7 @@ class SnapshotSourceModule extends base_1.Base {
|
|
|
17282
17068
|
*
|
|
17283
17069
|
*/
|
|
17284
17070
|
async init(provider) {
|
|
17285
|
-
this.wire.
|
|
17286
|
-
// don't expose, analytics-only call
|
|
17287
|
-
});
|
|
17071
|
+
this.wire.recordAnalytic('snapshot-source-init');
|
|
17288
17072
|
if (typeof provider !== 'object' ||
|
|
17289
17073
|
typeof provider.getSnapshot !== 'function' ||
|
|
17290
17074
|
typeof provider.applySnapshot !== 'function') {
|
|
@@ -17308,9 +17092,7 @@ class SnapshotSourceModule extends base_1.Base {
|
|
|
17308
17092
|
* ```
|
|
17309
17093
|
*/
|
|
17310
17094
|
wrapSync(identity) {
|
|
17311
|
-
this.wire.
|
|
17312
|
-
// don't expose, analytics-only call
|
|
17313
|
-
});
|
|
17095
|
+
this.wire.recordAnalytic('snapshot-source-wrap-sync');
|
|
17314
17096
|
return new Instance_1.SnapshotSource(this.wire, identity);
|
|
17315
17097
|
}
|
|
17316
17098
|
/**
|
|
@@ -17324,9 +17106,7 @@ class SnapshotSourceModule extends base_1.Base {
|
|
|
17324
17106
|
* ```
|
|
17325
17107
|
*/
|
|
17326
17108
|
async wrap(identity) {
|
|
17327
|
-
this.wire.
|
|
17328
|
-
// don't expose, analytics-only call
|
|
17329
|
-
});
|
|
17109
|
+
this.wire.recordAnalytic('snapshot-source-wrap');
|
|
17330
17110
|
return this.wrapSync(identity);
|
|
17331
17111
|
}
|
|
17332
17112
|
}
|
|
@@ -17369,7 +17149,7 @@ const events_1$3 = require$$0;
|
|
|
17369
17149
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
|
17370
17150
|
const index_1 = system;
|
|
17371
17151
|
const index_2 = requireWindow();
|
|
17372
|
-
const index_3 =
|
|
17152
|
+
const index_3 = application;
|
|
17373
17153
|
const index_4 = interappbus;
|
|
17374
17154
|
const index_5 = clipboard;
|
|
17375
17155
|
const index_6 = externalApplication;
|
|
@@ -17544,7 +17324,7 @@ var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFie
|
|
|
17544
17324
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
17545
17325
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17546
17326
|
};
|
|
17547
|
-
var _Transport_wire, _Transport_fin;
|
|
17327
|
+
var _Transport_instances, _Transport_wire, _Transport_analyticsEnabled, _Transport_analyticsBuffer, _Transport_analyticsFlushTimeout, _Transport_fin, _Transport_flushAnalytics;
|
|
17548
17328
|
Object.defineProperty(transport, "__esModule", { value: true });
|
|
17549
17329
|
var Transport_1 = transport.Transport = void 0;
|
|
17550
17330
|
const events_1$1 = require$$0;
|
|
@@ -17556,11 +17336,15 @@ const errors_1 = errors;
|
|
|
17556
17336
|
class Transport extends events_1$1.EventEmitter {
|
|
17557
17337
|
constructor(factory, environment, config) {
|
|
17558
17338
|
super();
|
|
17339
|
+
_Transport_instances.add(this);
|
|
17559
17340
|
this.wireListeners = new Map();
|
|
17560
17341
|
this.topicRefMap = new Map();
|
|
17561
17342
|
this.eventAggregator = new eventAggregator_1.default();
|
|
17562
17343
|
this.messageHandlers = [this.eventAggregator.dispatchEvent];
|
|
17563
17344
|
_Transport_wire.set(this, void 0);
|
|
17345
|
+
_Transport_analyticsEnabled.set(this, true);
|
|
17346
|
+
_Transport_analyticsBuffer.set(this, new Map());
|
|
17347
|
+
_Transport_analyticsFlushTimeout.set(this, void 0);
|
|
17564
17348
|
// Typing as unknown to avoid circular dependency, should not be used directly.
|
|
17565
17349
|
_Transport_fin.set(this, void 0);
|
|
17566
17350
|
this.connectSync = () => {
|
|
@@ -17574,6 +17358,7 @@ class Transport extends events_1$1.EventEmitter {
|
|
|
17574
17358
|
};
|
|
17575
17359
|
__classPrivateFieldSet(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
|
|
17576
17360
|
this.environment = environment;
|
|
17361
|
+
__classPrivateFieldSet(this, _Transport_analyticsEnabled, config.apiDiagnostics !== false, "f");
|
|
17577
17362
|
this.sendRaw = __classPrivateFieldGet(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet(this, _Transport_wire, "f"));
|
|
17578
17363
|
this.registerMessageHandler(this.handleMessage.bind(this));
|
|
17579
17364
|
__classPrivateFieldGet(this, _Transport_wire, "f").on('disconnected', () => {
|
|
@@ -17581,6 +17366,9 @@ class Transport extends events_1$1.EventEmitter {
|
|
|
17581
17366
|
handleNack({ reason: 'Remote connection has closed' });
|
|
17582
17367
|
}
|
|
17583
17368
|
this.wireListeners.clear();
|
|
17369
|
+
clearTimeout(__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f"));
|
|
17370
|
+
__classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
|
|
17371
|
+
__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
|
|
17584
17372
|
this.emit('disconnected');
|
|
17585
17373
|
});
|
|
17586
17374
|
const { uuid, name } = config;
|
|
@@ -17599,6 +17387,18 @@ class Transport extends events_1$1.EventEmitter {
|
|
|
17599
17387
|
}
|
|
17600
17388
|
__classPrivateFieldSet(this, _Transport_fin, _fin, "f");
|
|
17601
17389
|
}
|
|
17390
|
+
recordAnalytic(action) {
|
|
17391
|
+
if (!__classPrivateFieldGet(this, _Transport_analyticsEnabled, "f"))
|
|
17392
|
+
return;
|
|
17393
|
+
__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").set(action, (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").get(action) ?? 0) + 1);
|
|
17394
|
+
if (__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f") === undefined) {
|
|
17395
|
+
const timeout = setTimeout(() => __classPrivateFieldGet(this, _Transport_instances, "m", _Transport_flushAnalytics).call(this), 30000);
|
|
17396
|
+
if (typeof timeout === 'object' && timeout !== null) {
|
|
17397
|
+
timeout.unref?.();
|
|
17398
|
+
}
|
|
17399
|
+
__classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, timeout, "f");
|
|
17400
|
+
}
|
|
17401
|
+
}
|
|
17602
17402
|
shutdown() {
|
|
17603
17403
|
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
|
17604
17404
|
return wire.shutdown();
|
|
@@ -17762,7 +17562,16 @@ class Transport extends events_1$1.EventEmitter {
|
|
|
17762
17562
|
}
|
|
17763
17563
|
}
|
|
17764
17564
|
Transport_1 = transport.Transport = Transport;
|
|
17765
|
-
_Transport_wire = new WeakMap(), _Transport_fin = new WeakMap()
|
|
17565
|
+
_Transport_wire = new WeakMap(), _Transport_analyticsEnabled = new WeakMap(), _Transport_analyticsBuffer = new WeakMap(), _Transport_analyticsFlushTimeout = new WeakMap(), _Transport_fin = new WeakMap(), _Transport_instances = new WeakSet(), _Transport_flushAnalytics = function _Transport_flushAnalytics() {
|
|
17566
|
+
__classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
|
|
17567
|
+
if (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").size === 0)
|
|
17568
|
+
return;
|
|
17569
|
+
const counts = Object.fromEntries(__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f"));
|
|
17570
|
+
__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
|
|
17571
|
+
this.sendAction('send-analytics-batch', { counts }).catch(() => {
|
|
17572
|
+
// analytics flush failure is non-fatal, counts are already cleared
|
|
17573
|
+
});
|
|
17574
|
+
};
|
|
17766
17575
|
|
|
17767
17576
|
var stubEnvironment = {};
|
|
17768
17577
|
|