@openfin/core 40.101.1 → 40.102.2
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/GlobalOpenFin.d.ts +2 -1
- package/out/mock-alpha.d.ts +43 -6
- package/out/mock-beta.d.ts +43 -6
- package/out/mock-public.d.ts +43 -6
- package/out/{mock.d.ts → stub.d.ts} +43 -6
- package/out/{mock.js → stub.js} +1185 -1207
- package/package.json +3 -3
package/out/{mock.js → stub.js}
RENAMED
@@ -372,7 +372,7 @@ var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateF
|
|
372
372
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
373
373
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
374
374
|
};
|
375
|
-
var _EmitterBase_emitterAccessor;
|
375
|
+
var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
|
376
376
|
Object.defineProperty(base, "__esModule", { value: true });
|
377
377
|
base.Reply = base.EmitterBase = base.Base = void 0;
|
378
378
|
const promises_1 = promises;
|
@@ -444,6 +444,7 @@ class EmitterBase extends Base {
|
|
444
444
|
super(wire);
|
445
445
|
this.topic = topic;
|
446
446
|
_EmitterBase_emitterAccessor.set(this, void 0);
|
447
|
+
_EmitterBase_deregisterOnceListeners.set(this, void 0);
|
447
448
|
this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
|
448
449
|
/**
|
449
450
|
* @internal
|
@@ -452,7 +453,28 @@ class EmitterBase extends Base {
|
|
452
453
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
453
454
|
};
|
454
455
|
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
455
|
-
|
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$e(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
466
|
+
if (deregister) {
|
467
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
468
|
+
emitter.removeListener(eventType, deregister);
|
469
|
+
}
|
470
|
+
};
|
471
|
+
this.getOrCreateEmitter = () => {
|
472
|
+
const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
473
|
+
if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
|
474
|
+
emitter.on('removeListener', this.cleanUpRemovedListener);
|
475
|
+
}
|
476
|
+
return emitter;
|
477
|
+
};
|
456
478
|
this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
|
457
479
|
this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
|
458
480
|
this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
|
@@ -484,13 +506,13 @@ class EmitterBase extends Base {
|
|
484
506
|
type: eventType
|
485
507
|
};
|
486
508
|
await this.wire.sendAction('unsubscribe-to-desktop-event', runtimeEvent).catch(() => null);
|
487
|
-
|
488
|
-
return emitter;
|
509
|
+
return this.getOrCreateEmitter();
|
489
510
|
}
|
490
511
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
491
512
|
return Promise.resolve();
|
492
513
|
};
|
493
514
|
__classPrivateFieldSet$d(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
515
|
+
__classPrivateFieldSet$d(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
494
516
|
this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
|
495
517
|
}
|
496
518
|
/**
|
@@ -519,6 +541,7 @@ class EmitterBase extends Base {
|
|
519
541
|
*/
|
520
542
|
async once(eventType, listener, options) {
|
521
543
|
const deregister = () => this.deregisterEventListener(eventType);
|
544
|
+
__classPrivateFieldGet$e(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
522
545
|
await this.registerEventListener(eventType, options, (emitter) => {
|
523
546
|
emitter.once(eventType, deregister);
|
524
547
|
emitter.once(eventType, listener);
|
@@ -549,6 +572,7 @@ class EmitterBase extends Base {
|
|
549
572
|
*/
|
550
573
|
async prependOnceListener(eventType, listener, options) {
|
551
574
|
const deregister = () => this.deregisterEventListener(eventType);
|
575
|
+
__classPrivateFieldGet$e(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
552
576
|
await this.registerEventListener(eventType, options, (emitter) => {
|
553
577
|
emitter.prependOnceListener(eventType, listener);
|
554
578
|
emitter.once(eventType, deregister);
|
@@ -607,13 +631,13 @@ class EmitterBase extends Base {
|
|
607
631
|
return this;
|
608
632
|
}
|
609
633
|
deleteEmitterIfNothingRegistered(emitter) {
|
610
|
-
if (emitter.eventNames().
|
634
|
+
if (emitter.eventNames().every((type) => type === 'removeListener')) {
|
611
635
|
this.wire.eventAggregator.delete(__classPrivateFieldGet$e(this, _EmitterBase_emitterAccessor, "f"));
|
612
636
|
}
|
613
637
|
}
|
614
638
|
}
|
615
639
|
base.EmitterBase = EmitterBase;
|
616
|
-
_EmitterBase_emitterAccessor = new WeakMap();
|
640
|
+
_EmitterBase_emitterAccessor = new WeakMap(), _EmitterBase_deregisterOnceListeners = new WeakMap();
|
617
641
|
class Reply {
|
618
642
|
}
|
619
643
|
base.Reply = Reply;
|
@@ -840,11 +864,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
840
864
|
};
|
841
865
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
842
866
|
|
843
|
-
var hasRequiredFactory$
|
867
|
+
var hasRequiredFactory$2;
|
844
868
|
|
845
|
-
function requireFactory$
|
846
|
-
if (hasRequiredFactory$
|
847
|
-
hasRequiredFactory$
|
869
|
+
function requireFactory$2 () {
|
870
|
+
if (hasRequiredFactory$2) return Factory$6;
|
871
|
+
hasRequiredFactory$2 = 1;
|
848
872
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
849
873
|
Factory$6.ViewModule = void 0;
|
850
874
|
const base_1 = base;
|
@@ -1059,8 +1083,8 @@ var main = {};
|
|
1059
1083
|
|
1060
1084
|
Object.defineProperty(main, "__esModule", { value: true });
|
1061
1085
|
main.WebContents = void 0;
|
1062
|
-
const base_1$
|
1063
|
-
class WebContents extends base_1$
|
1086
|
+
const base_1$l = base;
|
1087
|
+
class WebContents extends base_1$l.EmitterBase {
|
1064
1088
|
/**
|
1065
1089
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
1066
1090
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
@@ -2126,11 +2150,11 @@ class WebContents extends base_1$j.EmitterBase {
|
|
2126
2150
|
}
|
2127
2151
|
main.WebContents = WebContents;
|
2128
2152
|
|
2129
|
-
var hasRequiredInstance$
|
2153
|
+
var hasRequiredInstance$1;
|
2130
2154
|
|
2131
|
-
function requireInstance$
|
2132
|
-
if (hasRequiredInstance$
|
2133
|
-
hasRequiredInstance$
|
2155
|
+
function requireInstance$1 () {
|
2156
|
+
if (hasRequiredInstance$1) return Instance$5;
|
2157
|
+
hasRequiredInstance$1 = 1;
|
2134
2158
|
var _View_providerChannelClient;
|
2135
2159
|
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
2136
2160
|
Instance$5.View = void 0;
|
@@ -2710,1160 +2734,1139 @@ function requireView () {
|
|
2710
2734
|
*
|
2711
2735
|
* @packageDocumentation
|
2712
2736
|
*/
|
2713
|
-
__exportStar(requireFactory$
|
2714
|
-
__exportStar(requireInstance$
|
2737
|
+
__exportStar(requireFactory$2(), exports);
|
2738
|
+
__exportStar(requireInstance$1(), exports);
|
2715
2739
|
} (view));
|
2716
2740
|
return view;
|
2717
2741
|
}
|
2718
2742
|
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
|
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
|
-
|
2743
|
+
Object.defineProperty(Instance$6, "__esModule", { value: true });
|
2744
|
+
Instance$6.Application = void 0;
|
2745
|
+
/* eslint-disable import/prefer-default-export */
|
2746
|
+
const base_1$k = base;
|
2747
|
+
const window_1$1 = requireWindow();
|
2748
|
+
const view_1 = requireView();
|
2749
|
+
/**
|
2750
|
+
* An object representing an application. Allows the developer to create,
|
2751
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
2752
|
+
*/
|
2753
|
+
class Application extends base_1$k.EmitterBase {
|
2754
|
+
/**
|
2755
|
+
* @internal
|
2756
|
+
*/
|
2757
|
+
constructor(wire, identity) {
|
2758
|
+
super(wire, 'application', identity.uuid);
|
2759
|
+
this.identity = identity;
|
2760
|
+
this.window = new window_1$1._Window(this.wire, {
|
2761
|
+
uuid: this.identity.uuid,
|
2762
|
+
name: this.identity.uuid
|
2763
|
+
});
|
2764
|
+
}
|
2765
|
+
windowListFromIdentityList(identityList) {
|
2766
|
+
const windowList = [];
|
2767
|
+
identityList.forEach((identity) => {
|
2768
|
+
windowList.push(new window_1$1._Window(this.wire, {
|
2769
|
+
uuid: identity.uuid,
|
2770
|
+
name: identity.name
|
2771
|
+
}));
|
2772
|
+
});
|
2773
|
+
return windowList;
|
2774
|
+
}
|
2775
|
+
/**
|
2776
|
+
* Determines if the application is currently running.
|
2777
|
+
*
|
2778
|
+
* @example
|
2779
|
+
*
|
2780
|
+
* ```js
|
2781
|
+
* async function isAppRunning() {
|
2782
|
+
* const app = await fin.Application.getCurrent();
|
2783
|
+
* return await app.isRunning();
|
2784
|
+
* }
|
2785
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
2786
|
+
* ```
|
2787
|
+
*/
|
2788
|
+
isRunning() {
|
2789
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
2790
|
+
}
|
2791
|
+
/**
|
2792
|
+
* Closes the application and any child windows created by the application.
|
2793
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
2794
|
+
* @param force Close will be prevented from closing when force is false and
|
2795
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
2796
|
+
*
|
2797
|
+
* @example
|
2798
|
+
*
|
2799
|
+
* ```js
|
2800
|
+
* async function closeApp() {
|
2801
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
2802
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
2803
|
+
* await app.quit();
|
2804
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
2805
|
+
*
|
2806
|
+
* }
|
2807
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
2808
|
+
* ```
|
2809
|
+
*/
|
2810
|
+
async quit(force = false) {
|
2811
|
+
try {
|
2812
|
+
await this._close(force);
|
2813
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
2814
|
+
}
|
2815
|
+
catch (error) {
|
2816
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
2817
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
2818
|
+
throw error;
|
2819
|
+
}
|
2820
|
+
}
|
2821
|
+
}
|
2822
|
+
async _close(force = false) {
|
2823
|
+
try {
|
2824
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
2825
|
+
}
|
2826
|
+
catch (error) {
|
2827
|
+
if (!error.message.includes('Remote connection has closed')) {
|
2828
|
+
throw error;
|
2829
|
+
}
|
2830
|
+
}
|
2831
|
+
}
|
2832
|
+
/**
|
2833
|
+
* @deprecated use Application.quit instead
|
2834
|
+
* Closes the application and any child windows created by the application.
|
2835
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
2836
|
+
* @param callback - called if the method succeeds.
|
2837
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
2838
|
+
*
|
2839
|
+
* @example
|
2840
|
+
*
|
2841
|
+
* ```js
|
2842
|
+
* async function closeApp() {
|
2843
|
+
* const app = await fin.Application.getCurrent();
|
2844
|
+
* return await app.close();
|
2845
|
+
* }
|
2846
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
2847
|
+
* ```
|
2848
|
+
*/
|
2849
|
+
close(force = false) {
|
2850
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
2851
|
+
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
2852
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
2853
|
+
});
|
2854
|
+
return this._close(force);
|
2855
|
+
}
|
2856
|
+
/**
|
2857
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
2858
|
+
*
|
2859
|
+
* @example
|
2860
|
+
*
|
2861
|
+
* ```js
|
2862
|
+
* async function getChildWindows() {
|
2863
|
+
* const app = await fin.Application.getCurrent();
|
2864
|
+
* return await app.getChildWindows();
|
2865
|
+
* }
|
2866
|
+
*
|
2867
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
2868
|
+
* ```
|
2869
|
+
*/
|
2870
|
+
getChildWindows() {
|
2871
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
2872
|
+
const identityList = [];
|
2873
|
+
payload.data.forEach((winName) => {
|
2874
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
2875
|
+
});
|
2876
|
+
return this.windowListFromIdentityList(identityList);
|
2877
|
+
});
|
2878
|
+
}
|
2879
|
+
/**
|
2880
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
2881
|
+
* if the application was not created from a manifest.
|
2882
|
+
*
|
2883
|
+
* @example
|
2884
|
+
*
|
2885
|
+
* ```js
|
2886
|
+
* async function getManifest() {
|
2887
|
+
* const app = await fin.Application.getCurrent();
|
2888
|
+
* return await app.getManifest();
|
2889
|
+
* }
|
2890
|
+
*
|
2891
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
2892
|
+
* ```
|
2893
|
+
*/
|
2894
|
+
getManifest() {
|
2895
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
2896
|
+
}
|
2897
|
+
/**
|
2898
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
2899
|
+
* if the application was created from a manifest.
|
2900
|
+
*
|
2901
|
+
* @example
|
2902
|
+
*
|
2903
|
+
* ```js
|
2904
|
+
* async function getParentUuid() {
|
2905
|
+
* const app = await fin.Application.start({
|
2906
|
+
* uuid: 'app-1',
|
2907
|
+
* name: 'myApp',
|
2908
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
2909
|
+
* autoShow: true
|
2910
|
+
* });
|
2911
|
+
* return await app.getParentUuid();
|
2912
|
+
* }
|
2913
|
+
*
|
2914
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
2915
|
+
* ```
|
2916
|
+
*/
|
2917
|
+
getParentUuid() {
|
2918
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
2919
|
+
}
|
2920
|
+
/**
|
2921
|
+
* Retrieves current application's shortcut configuration.
|
2922
|
+
*
|
2923
|
+
* @example
|
2924
|
+
*
|
2925
|
+
* ```js
|
2926
|
+
* async function getShortcuts() {
|
2927
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
2928
|
+
* return await app.getShortcuts();
|
2929
|
+
* }
|
2930
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
2931
|
+
* ```
|
2932
|
+
*/
|
2933
|
+
getShortcuts() {
|
2934
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
2935
|
+
}
|
2936
|
+
/**
|
2937
|
+
* Retrieves current application's views.
|
2938
|
+
* @experimental
|
2939
|
+
*
|
2940
|
+
* @example
|
2941
|
+
*
|
2942
|
+
* ```js
|
2943
|
+
* async function getViews() {
|
2944
|
+
* const app = await fin.Application.getCurrent();
|
2945
|
+
* return await app.getViews();
|
2946
|
+
* }
|
2947
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
2948
|
+
* ```
|
2949
|
+
*/
|
2950
|
+
async getViews() {
|
2951
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
2952
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
2953
|
+
}
|
2954
|
+
/**
|
2955
|
+
* Returns the current zoom level of the application.
|
2956
|
+
*
|
2957
|
+
* @example
|
2958
|
+
*
|
2959
|
+
* ```js
|
2960
|
+
* async function getZoomLevel() {
|
2961
|
+
* const app = await fin.Application.getCurrent();
|
2962
|
+
* return await app.getZoomLevel();
|
2963
|
+
* }
|
2964
|
+
*
|
2965
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
2966
|
+
* ```
|
2967
|
+
*/
|
2968
|
+
getZoomLevel() {
|
2969
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
2970
|
+
}
|
2971
|
+
/**
|
2972
|
+
* Returns an instance of the main Window of the application
|
2973
|
+
*
|
2974
|
+
* @example
|
2975
|
+
*
|
2976
|
+
* ```js
|
2977
|
+
* async function getWindow() {
|
2978
|
+
* const app = await fin.Application.start({
|
2979
|
+
* uuid: 'app-1',
|
2980
|
+
* name: 'myApp',
|
2981
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
2982
|
+
* autoShow: true
|
2983
|
+
* });
|
2984
|
+
* return await app.getWindow();
|
2985
|
+
* }
|
2986
|
+
*
|
2987
|
+
* getWindow().then(win => {
|
2988
|
+
* win.showAt(0, 400);
|
2989
|
+
* win.flash();
|
2990
|
+
* }).catch(err => console.log(err));
|
2991
|
+
* ```
|
2992
|
+
*/
|
2993
|
+
getWindow() {
|
2994
|
+
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
2995
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
2996
|
+
});
|
2997
|
+
return Promise.resolve(this.window);
|
2998
|
+
}
|
2999
|
+
/**
|
3000
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
3001
|
+
* @param userName - username to be passed to the RVM.
|
3002
|
+
* @param appName - app name to be passed to the RVM.
|
3003
|
+
*
|
3004
|
+
* @example
|
3005
|
+
*
|
3006
|
+
* ```js
|
3007
|
+
* async function registerUser() {
|
3008
|
+
* const app = await fin.Application.getCurrent();
|
3009
|
+
* return await app.registerUser('user', 'myApp');
|
3010
|
+
* }
|
3011
|
+
*
|
3012
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
3013
|
+
* ```
|
3014
|
+
*/
|
3015
|
+
registerUser(userName, appName) {
|
3016
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
3017
|
+
}
|
3018
|
+
/**
|
3019
|
+
* Removes the application’s icon from the tray.
|
3020
|
+
*
|
3021
|
+
* @example
|
3022
|
+
*
|
3023
|
+
* ```js
|
3024
|
+
* async function removeTrayIcon() {
|
3025
|
+
* const app = await fin.Application.getCurrent();
|
3026
|
+
* return await app.removeTrayIcon();
|
3027
|
+
* }
|
3028
|
+
*
|
3029
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
3030
|
+
* ```
|
3031
|
+
*/
|
3032
|
+
removeTrayIcon() {
|
3033
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
3034
|
+
}
|
3035
|
+
/**
|
3036
|
+
* Restarts the application.
|
3037
|
+
*
|
3038
|
+
* @example
|
3039
|
+
*
|
3040
|
+
* ```js
|
3041
|
+
* async function restartApp() {
|
3042
|
+
* const app = await fin.Application.getCurrent();
|
3043
|
+
* return await app.restart();
|
3044
|
+
* }
|
3045
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
3046
|
+
* ```
|
3047
|
+
*/
|
3048
|
+
restart() {
|
3049
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
3050
|
+
}
|
3051
|
+
/**
|
3052
|
+
* DEPRECATED method to run the application.
|
3053
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
3054
|
+
*
|
3055
|
+
* @example
|
3056
|
+
*
|
3057
|
+
* ```js
|
3058
|
+
* async function run() {
|
3059
|
+
* const app = await fin.Application.create({
|
3060
|
+
* name: 'myApp',
|
3061
|
+
* uuid: 'app-1',
|
3062
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
3063
|
+
* autoShow: true
|
3064
|
+
* });
|
3065
|
+
* await app.run();
|
3066
|
+
* }
|
3067
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3068
|
+
* ```
|
3069
|
+
*
|
3070
|
+
* @ignore
|
3071
|
+
*/
|
3072
|
+
run() {
|
3073
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
3074
|
+
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
3075
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3076
|
+
});
|
3077
|
+
return this._run();
|
3078
|
+
}
|
3079
|
+
_run(opts = {}) {
|
3080
|
+
return this.wire
|
3081
|
+
.sendAction('run-application', {
|
3082
|
+
manifestUrl: this._manifestUrl,
|
3083
|
+
opts,
|
3084
|
+
...this.identity
|
3085
|
+
})
|
3086
|
+
.then(() => undefined);
|
3087
|
+
}
|
3088
|
+
/**
|
3089
|
+
* Instructs the RVM to schedule one restart of the application.
|
3090
|
+
*
|
3091
|
+
* @example
|
3092
|
+
*
|
3093
|
+
* ```js
|
3094
|
+
* async function scheduleRestart() {
|
3095
|
+
* const app = await fin.Application.getCurrent();
|
3096
|
+
* return await app.scheduleRestart();
|
3097
|
+
* }
|
3098
|
+
*
|
3099
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
3100
|
+
* ```
|
3101
|
+
*/
|
3102
|
+
scheduleRestart() {
|
3103
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
3104
|
+
}
|
3105
|
+
/**
|
3106
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
3107
|
+
* an object containing logId is returned.
|
3108
|
+
*
|
3109
|
+
* @example
|
3110
|
+
*
|
3111
|
+
* ```js
|
3112
|
+
* async function sendLog() {
|
3113
|
+
* const app = await fin.Application.getCurrent();
|
3114
|
+
* return await app.sendApplicationLog();
|
3115
|
+
* }
|
3116
|
+
*
|
3117
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
3118
|
+
* ```
|
3119
|
+
*/
|
3120
|
+
async sendApplicationLog() {
|
3121
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
3122
|
+
return payload.data;
|
3123
|
+
}
|
3124
|
+
/**
|
3125
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
3126
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
3127
|
+
*
|
3128
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
3129
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
3130
|
+
*
|
3131
|
+
*
|
3132
|
+
* @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).
|
3133
|
+
*
|
3134
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
3135
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
3136
|
+
*
|
3137
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
3138
|
+
*
|
3139
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
3140
|
+
* uuid or shortcut.name is changed.
|
3141
|
+
*
|
3142
|
+
* @example
|
3143
|
+
*
|
3144
|
+
* ```js
|
3145
|
+
* const app = fin.Application.getCurrentSync();
|
3146
|
+
* const appName = 'My App';
|
3147
|
+
* const jumpListConfig = [ // array of JumpList categories
|
3148
|
+
* {
|
3149
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
3150
|
+
* items: [ // array of JumpList items
|
3151
|
+
* {
|
3152
|
+
* type: 'task',
|
3153
|
+
* title: `Launch ${appName}`,
|
3154
|
+
* description: `Runs ${appName} with the default configuration`,
|
3155
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
3156
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
3157
|
+
* iconIndex: 0
|
3158
|
+
* },
|
3159
|
+
* { type: 'separator' },
|
3160
|
+
* {
|
3161
|
+
* type: 'task',
|
3162
|
+
* title: `Restore ${appName}`,
|
3163
|
+
* description: 'Restore to last configuration',
|
3164
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
3165
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
3166
|
+
* iconIndex: 0
|
3167
|
+
* },
|
3168
|
+
* ]
|
3169
|
+
* },
|
3170
|
+
* {
|
3171
|
+
* name: 'Tools',
|
3172
|
+
* items: [ // array of JumpList items
|
3173
|
+
* {
|
3174
|
+
* type: 'task',
|
3175
|
+
* title: 'Tool A',
|
3176
|
+
* description: 'Runs Tool A',
|
3177
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
3178
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
3179
|
+
* iconIndex: 0
|
3180
|
+
* },
|
3181
|
+
* {
|
3182
|
+
* type: 'task',
|
3183
|
+
* title: 'Tool B',
|
3184
|
+
* description: 'Runs Tool B',
|
3185
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
3186
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
3187
|
+
* iconIndex: 0
|
3188
|
+
* }]
|
3189
|
+
* }
|
3190
|
+
* ];
|
3191
|
+
*
|
3192
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
3193
|
+
* ```
|
3194
|
+
*
|
3195
|
+
* To handle deeplink args:
|
3196
|
+
* ```js
|
3197
|
+
* function handleUseLastConfiguration() {
|
3198
|
+
* // this handler is called when the app is being launched
|
3199
|
+
* app.on('run-requested', event => {
|
3200
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
3201
|
+
* // your logic here
|
3202
|
+
* }
|
3203
|
+
* });
|
3204
|
+
* // this handler is called when the app was already running when the launch was requested
|
3205
|
+
* fin.desktop.main(function(args) {
|
3206
|
+
* if(args && args['use-last-configuration']) {
|
3207
|
+
* // your logic here
|
3208
|
+
* }
|
3209
|
+
* });
|
3210
|
+
* }
|
3211
|
+
* ```
|
3212
|
+
*/
|
3213
|
+
async setJumpList(jumpListCategories) {
|
3214
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
3215
|
+
}
|
3216
|
+
/**
|
3217
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
3218
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
3219
|
+
*
|
3220
|
+
* @example
|
3221
|
+
*
|
3222
|
+
* ```js
|
3223
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
3224
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
3225
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
3226
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
3227
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
3228
|
+
*
|
3229
|
+
* async function setTrayIcon(icon) {
|
3230
|
+
* const app = await fin.Application.getCurrent();
|
3231
|
+
* return await app.setTrayIcon(icon);
|
3232
|
+
* }
|
3233
|
+
*
|
3234
|
+
* // use image url to set tray icon
|
3235
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3236
|
+
*
|
3237
|
+
* // use base64 encoded string to set tray icon
|
3238
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3239
|
+
*
|
3240
|
+
* // use a dataURL to set tray icon
|
3241
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3242
|
+
* ```
|
3243
|
+
*/
|
3244
|
+
setTrayIcon(icon) {
|
3245
|
+
return this.wire
|
3246
|
+
.sendAction('set-tray-icon', {
|
3247
|
+
enabledIcon: icon,
|
3248
|
+
...this.identity
|
3249
|
+
})
|
3250
|
+
.then(() => undefined);
|
3251
|
+
}
|
3252
|
+
/**
|
3253
|
+
* Set hover text for this application's system tray icon.
|
3254
|
+
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
3255
|
+
* @param toolTip
|
3256
|
+
*
|
3257
|
+
* @example
|
3258
|
+
*
|
3259
|
+
* ```js
|
3260
|
+
* const app = fin.Application.getCurrentSync();
|
3261
|
+
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
3262
|
+
*
|
3263
|
+
* await app.setTrayIcon(iconUrl);
|
3264
|
+
*
|
3265
|
+
* await app.setTrayIconToolTip('My Application');
|
3266
|
+
* ```
|
3267
|
+
*/
|
3268
|
+
async setTrayIconToolTip(toolTip) {
|
3269
|
+
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
3270
|
+
}
|
3271
|
+
/**
|
3272
|
+
* Sets new application's shortcut configuration. Windows only.
|
3273
|
+
* @param config New application's shortcut configuration.
|
3274
|
+
*
|
3275
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
3276
|
+
* to be able to change shortcut states.
|
3277
|
+
*
|
3278
|
+
* @example
|
3279
|
+
*
|
3280
|
+
* ```js
|
3281
|
+
* async function setShortcuts(config) {
|
3282
|
+
* const app = await fin.Application.getCurrent();
|
3283
|
+
* return app.setShortcuts(config);
|
3284
|
+
* }
|
3285
|
+
*
|
3286
|
+
* setShortcuts({
|
3287
|
+
* desktop: true,
|
3288
|
+
* startMenu: false,
|
3289
|
+
* systemStartup: true
|
3290
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
3291
|
+
* ```
|
3292
|
+
*/
|
3293
|
+
setShortcuts(config) {
|
3294
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
3295
|
+
}
|
3296
|
+
/**
|
3297
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
3298
|
+
* @param queryString The new query string for this app's shortcuts.
|
3299
|
+
*
|
3300
|
+
* @example
|
3301
|
+
*
|
3302
|
+
* ```js
|
3303
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
3304
|
+
* const app = await fin.Application.getCurrent();
|
3305
|
+
* try {
|
3306
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
3307
|
+
* } catch(err) {
|
3308
|
+
* console.error(err)
|
3309
|
+
* }
|
3310
|
+
* ```
|
3311
|
+
*/
|
3312
|
+
async setShortcutQueryParams(queryString) {
|
3313
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
3314
|
+
}
|
3315
|
+
/**
|
3316
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
3317
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
3318
|
+
* @param level The zoom level
|
3319
|
+
*
|
3320
|
+
* @example
|
3321
|
+
*
|
3322
|
+
* ```js
|
3323
|
+
* async function setZoomLevel(number) {
|
3324
|
+
* const app = await fin.Application.getCurrent();
|
3325
|
+
* return await app.setZoomLevel(number);
|
3326
|
+
* }
|
3327
|
+
*
|
3328
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
3329
|
+
* ```
|
3330
|
+
*/
|
3331
|
+
setZoomLevel(level) {
|
3332
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
3333
|
+
}
|
3334
|
+
/**
|
3335
|
+
* Sets a username to correlate with App Log Management.
|
3336
|
+
* @param username Username to correlate with App's Log.
|
3337
|
+
*
|
3338
|
+
* @example
|
3339
|
+
*
|
3340
|
+
* ```js
|
3341
|
+
* async function setAppLogUser() {
|
3342
|
+
* const app = await fin.Application.getCurrent();
|
3343
|
+
* return await app.setAppLogUsername('username');
|
3344
|
+
* }
|
3345
|
+
*
|
3346
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
3347
|
+
*
|
3348
|
+
* ```
|
3349
|
+
*/
|
3350
|
+
async setAppLogUsername(username) {
|
3351
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
3352
|
+
}
|
3353
|
+
/**
|
3354
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
3355
|
+
* @remarks The only information currently returned is the position and dimensions.
|
3356
|
+
*
|
3357
|
+
* @example
|
3358
|
+
*
|
3359
|
+
* ```js
|
3360
|
+
* async function getTrayIconInfo() {
|
3361
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3362
|
+
* return await app.getTrayIconInfo();
|
3363
|
+
* }
|
3364
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3365
|
+
* ```
|
3366
|
+
*/
|
3367
|
+
getTrayIconInfo() {
|
3368
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
3369
|
+
}
|
3370
|
+
/**
|
3371
|
+
* Checks if the application has an associated tray icon.
|
3372
|
+
*
|
3373
|
+
* @example
|
3374
|
+
*
|
3375
|
+
* ```js
|
3376
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3377
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
3378
|
+
* console.log(hasTrayIcon);
|
3379
|
+
* ```
|
3380
|
+
*/
|
3381
|
+
hasTrayIcon() {
|
3382
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
3383
|
+
}
|
3384
|
+
/**
|
3385
|
+
* Closes the application by terminating its process.
|
3386
|
+
*
|
3387
|
+
* @example
|
3388
|
+
*
|
3389
|
+
* ```js
|
3390
|
+
* async function terminateApp() {
|
3391
|
+
* const app = await fin.Application.getCurrent();
|
3392
|
+
* return await app.terminate();
|
3393
|
+
* }
|
3394
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
3395
|
+
* ```
|
3396
|
+
*/
|
3397
|
+
terminate() {
|
3398
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
3399
|
+
}
|
3400
|
+
/**
|
3401
|
+
* Waits for a hanging application. This method can be called in response to an application
|
3402
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
3403
|
+
* message after a certain period of time.
|
3404
|
+
*
|
3405
|
+
* @ignore
|
3406
|
+
*/
|
3407
|
+
wait() {
|
3408
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
3409
|
+
}
|
3410
|
+
/**
|
3411
|
+
* Retrieves information about the application.
|
3412
|
+
*
|
3413
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
3414
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
3415
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
3416
|
+
*
|
3417
|
+
* @example
|
3418
|
+
*
|
3419
|
+
* ```js
|
3420
|
+
* async function getInfo() {
|
3421
|
+
* const app = await fin.Application.getCurrent();
|
3422
|
+
* return await app.getInfo();
|
3423
|
+
* }
|
3424
|
+
*
|
3425
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3426
|
+
* ```
|
3427
|
+
*/
|
3428
|
+
getInfo() {
|
3429
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
3430
|
+
}
|
3431
|
+
/**
|
3432
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
3433
|
+
*
|
3434
|
+
* @example
|
3435
|
+
* ```js
|
3436
|
+
* const app = await fin.Application.getCurrent();
|
3437
|
+
* const processInfo = await app.getProcessInfo();
|
3438
|
+
* ```
|
3439
|
+
* @experimental
|
3440
|
+
*/
|
3441
|
+
async getProcessInfo() {
|
3442
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
3443
|
+
return data;
|
3444
|
+
}
|
3445
|
+
/**
|
3446
|
+
* Sets file auto download location. It's only allowed in the same application.
|
3447
|
+
*
|
3448
|
+
* Note: This method is restricted by default and must be enabled via
|
3449
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3450
|
+
* @param downloadLocation file auto download location
|
3451
|
+
*
|
3452
|
+
* @throws if setting file auto download location on different applications.
|
3453
|
+
* @example
|
3454
|
+
*
|
3455
|
+
* ```js
|
3456
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
3457
|
+
* const app = await fin.Application.getCurrent();
|
3458
|
+
* try {
|
3459
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
3460
|
+
* console.log('File download location is set');
|
3461
|
+
* } catch(err) {
|
3462
|
+
* console.error(err)
|
3463
|
+
* }
|
3464
|
+
* ```
|
3465
|
+
*/
|
3466
|
+
async setFileDownloadLocation(downloadLocation) {
|
3467
|
+
const { name } = this.wire.me;
|
3468
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3469
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
3470
|
+
}
|
3471
|
+
/**
|
3472
|
+
* 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.
|
3473
|
+
*
|
3474
|
+
* Note: This method is restricted by default and must be enabled via
|
3475
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3476
|
+
*
|
3477
|
+
* @throws if getting file auto download location on different applications.
|
3478
|
+
* @example
|
3479
|
+
*
|
3480
|
+
* ```js
|
3481
|
+
* const app = await fin.Application.getCurrent();
|
3482
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
3483
|
+
* ```
|
3484
|
+
*/
|
3485
|
+
async getFileDownloadLocation() {
|
3486
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
3487
|
+
return data;
|
3488
|
+
}
|
3489
|
+
/**
|
3490
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
3491
|
+
* @param options
|
3492
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
3493
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
3494
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
3495
|
+
* these with a "reducer" pattern.
|
3496
|
+
* @throws if the application has no tray icon set
|
3497
|
+
* @throws if the system tray is currently hidden
|
3498
|
+
* @example
|
3499
|
+
*
|
3500
|
+
* ```js
|
3501
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
3502
|
+
* const app = fin.Application.getCurrentSync();
|
3503
|
+
*
|
3504
|
+
* await app.setTrayIcon(iconUrl);
|
3505
|
+
*
|
3506
|
+
* const template = [
|
3507
|
+
* {
|
3508
|
+
* label: 'Menu Item 1',
|
3509
|
+
* data: 'hello from item 1'
|
3510
|
+
* },
|
3511
|
+
* { type: 'separator' },
|
3512
|
+
* {
|
3513
|
+
* label: 'Menu Item 2',
|
3514
|
+
* type: 'checkbox',
|
3515
|
+
* checked: true,
|
3516
|
+
* data: 'The user clicked the checkbox'
|
3517
|
+
* },
|
3518
|
+
* {
|
3519
|
+
* label: 'see more',
|
3520
|
+
* enabled: false,
|
3521
|
+
* submenu: [
|
3522
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
3523
|
+
* ]
|
3524
|
+
* }
|
3525
|
+
* ];
|
3526
|
+
*
|
3527
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
3528
|
+
* // right-click
|
3529
|
+
* if (event.button === 2) {
|
3530
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
3531
|
+
* if (r.result === 'closed') {
|
3532
|
+
* console.log('nothing happened');
|
3533
|
+
* } else {
|
3534
|
+
* console.log(r.data);
|
3535
|
+
* }
|
3536
|
+
* });
|
3537
|
+
* }
|
3538
|
+
* });
|
3539
|
+
* ```
|
3540
|
+
*/
|
3541
|
+
async showTrayIconPopupMenu(options) {
|
3542
|
+
const { name } = this.wire.me;
|
3543
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3544
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
3545
|
+
return payload.data;
|
3546
|
+
}
|
3547
|
+
/**
|
3548
|
+
* Closes the tray icon menu.
|
3549
|
+
*
|
3550
|
+
* @throws if the application has no tray icon set
|
3551
|
+
* @example
|
3552
|
+
*
|
3553
|
+
* ```js
|
3554
|
+
* const app = fin.Application.getCurrentSync();
|
3555
|
+
*
|
3556
|
+
* await app.closeTrayIconPopupMenu();
|
3557
|
+
* ```
|
3558
|
+
*/
|
3559
|
+
async closeTrayIconPopupMenu() {
|
3560
|
+
const { name } = this.wire.me;
|
3561
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3562
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
3563
|
+
}
|
3564
|
+
}
|
3565
|
+
Instance$6.Application = Application;
|
3566
|
+
|
3567
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
3568
|
+
Factory$7.ApplicationModule = void 0;
|
3569
|
+
const base_1$j = base;
|
3570
|
+
const validate_1$4 = validate;
|
3571
|
+
const Instance_1$5 = Instance$6;
|
3572
|
+
/**
|
3573
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
3574
|
+
*/
|
3575
|
+
class ApplicationModule extends base_1$j.Base {
|
3576
|
+
/**
|
3577
|
+
* Asynchronously returns an API handle for the given Application identity.
|
3578
|
+
*
|
3579
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3580
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3581
|
+
* for an Application throughout its entire lifecycle.
|
3582
|
+
*
|
3583
|
+
* @example
|
3584
|
+
*
|
3585
|
+
* ```js
|
3586
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
3587
|
+
* .then(app => app.isRunning())
|
3588
|
+
* .then(running => console.log('Application is running: ' + running))
|
3589
|
+
* .catch(err => console.log(err));
|
3590
|
+
* ```
|
3591
|
+
*
|
3592
|
+
*/
|
3593
|
+
async wrap(identity) {
|
3594
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
3595
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3596
|
+
});
|
3597
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
3598
|
+
if (errorMsg) {
|
3599
|
+
throw new Error(errorMsg);
|
3600
|
+
}
|
3601
|
+
return new Instance_1$5.Application(this.wire, identity);
|
3602
|
+
}
|
3603
|
+
/**
|
3604
|
+
* Synchronously returns an API handle for the given Application identity.
|
3605
|
+
*
|
3606
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3607
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3608
|
+
* for an Aplication throughout its entire lifecycle.
|
3609
|
+
*
|
3610
|
+
* @example
|
3611
|
+
*
|
3612
|
+
* ```js
|
3613
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
3614
|
+
* await app.close();
|
3615
|
+
* ```
|
3616
|
+
*
|
3617
|
+
*/
|
3618
|
+
wrapSync(identity) {
|
3619
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
3620
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3621
|
+
});
|
3622
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
3623
|
+
if (errorMsg) {
|
3624
|
+
throw new Error(errorMsg);
|
3625
|
+
}
|
3626
|
+
return new Instance_1$5.Application(this.wire, identity);
|
3627
|
+
}
|
3628
|
+
async _create(appOptions) {
|
3629
|
+
// set defaults:
|
3630
|
+
if (appOptions.waitForPageLoad === undefined) {
|
3631
|
+
appOptions.waitForPageLoad = false;
|
3632
|
+
}
|
3633
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
3634
|
+
appOptions.autoShow = true;
|
3635
|
+
}
|
3636
|
+
await this.wire.sendAction('create-application', appOptions);
|
3637
|
+
return this.wrap({ uuid: appOptions.uuid });
|
3638
|
+
}
|
3639
|
+
/**
|
3640
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
3641
|
+
*
|
3642
|
+
* @example
|
3643
|
+
*
|
3644
|
+
* ```js
|
3645
|
+
* async function createApp() {
|
3646
|
+
* const app = await fin.Application.create({
|
3647
|
+
* name: 'myApp',
|
3648
|
+
* uuid: 'app-3',
|
3649
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
3650
|
+
* autoShow: true
|
3651
|
+
* });
|
3652
|
+
* await app.run();
|
3653
|
+
* }
|
3654
|
+
*
|
3655
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
3656
|
+
* ```
|
3657
|
+
*
|
3658
|
+
* @ignore
|
3659
|
+
*/
|
3660
|
+
create(appOptions) {
|
3661
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
3662
|
+
this.wire.sendAction('application-create').catch((e) => {
|
3663
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3664
|
+
});
|
3665
|
+
return this._create(appOptions);
|
3666
|
+
}
|
3667
|
+
/**
|
3668
|
+
* Creates and starts a new Application.
|
3669
|
+
*
|
3670
|
+
* @example
|
3671
|
+
*
|
3672
|
+
* ```js
|
3673
|
+
* async function start() {
|
3674
|
+
* return fin.Application.start({
|
3675
|
+
* name: 'app-1',
|
3676
|
+
* uuid: 'app-1',
|
3677
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
3678
|
+
* autoShow: true
|
3679
|
+
* });
|
3680
|
+
* }
|
3681
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3682
|
+
* ```
|
3683
|
+
*
|
3684
|
+
*/
|
3685
|
+
async start(appOptions) {
|
3686
|
+
this.wire.sendAction('start-application').catch((e) => {
|
3687
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3688
|
+
});
|
3689
|
+
const app = await this._create(appOptions);
|
3690
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
3691
|
+
return app;
|
3692
|
+
}
|
3693
|
+
/**
|
3694
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
3695
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
3696
|
+
* @param opts - Parameters that the RVM will use.
|
3697
|
+
*
|
3698
|
+
* @example
|
3699
|
+
*
|
3700
|
+
* ```js
|
3701
|
+
*
|
3702
|
+
* const applicationInfoArray = [
|
3703
|
+
* {
|
3704
|
+
* "uuid": 'App-1',
|
3705
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
3706
|
+
* },
|
3707
|
+
* {
|
3708
|
+
* "uuid": 'App-2',
|
3709
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
3710
|
+
* },
|
3711
|
+
* {
|
3712
|
+
* "uuid": 'App-3',
|
3713
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
3714
|
+
* }
|
3715
|
+
* ]
|
3716
|
+
*
|
3717
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
3718
|
+
* .then(() => {
|
3719
|
+
* console.log('RVM has finished launching the application list.');
|
3720
|
+
* })
|
3721
|
+
* .catch((err) => {
|
3722
|
+
* console.log(err);
|
3723
|
+
* })
|
3724
|
+
* ```
|
3725
|
+
*
|
3726
|
+
* @experimental
|
3727
|
+
*/
|
3728
|
+
async startManyManifests(applications, opts) {
|
3729
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
3730
|
+
}
|
3731
|
+
/**
|
3732
|
+
* Asynchronously returns an Application object that represents the current application
|
3733
|
+
*
|
3734
|
+
* @example
|
3735
|
+
*
|
3736
|
+
* ```js
|
3737
|
+
* async function isCurrentAppRunning () {
|
3738
|
+
* const app = await fin.Application.getCurrent();
|
3739
|
+
* return app.isRunning();
|
3740
|
+
* }
|
3741
|
+
*
|
3742
|
+
* isCurrentAppRunning().then(running => {
|
3743
|
+
* console.log(`Current app is running: ${running}`);
|
3744
|
+
* }).catch(err => {
|
3745
|
+
* console.error(err);
|
3746
|
+
* });
|
3747
|
+
*
|
3748
|
+
* ```
|
3749
|
+
*/
|
3750
|
+
getCurrent() {
|
3751
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
3752
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3753
|
+
});
|
3754
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
3755
|
+
}
|
3756
|
+
/**
|
3757
|
+
* Synchronously returns an Application object that represents the current application
|
3758
|
+
*
|
3759
|
+
* @example
|
3760
|
+
*
|
3761
|
+
* ```js
|
3762
|
+
* async function isCurrentAppRunning () {
|
3763
|
+
* const app = fin.Application.getCurrentSync();
|
3764
|
+
* return app.isRunning();
|
3765
|
+
* }
|
3766
|
+
*
|
3767
|
+
* isCurrentAppRunning().then(running => {
|
3768
|
+
* console.log(`Current app is running: ${running}`);
|
3769
|
+
* }).catch(err => {
|
3770
|
+
* console.error(err);
|
3771
|
+
* });
|
3772
|
+
*
|
3773
|
+
* ```
|
3774
|
+
*/
|
3775
|
+
getCurrentSync() {
|
3776
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
3777
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3778
|
+
});
|
3779
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
3780
|
+
}
|
3781
|
+
/**
|
3782
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
3783
|
+
* @param manifestUrl - The URL of app's manifest.
|
3784
|
+
* @param opts - Parameters that the RVM will use.
|
3785
|
+
*
|
3786
|
+
* @example
|
3787
|
+
*
|
3788
|
+
* ```js
|
3789
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3790
|
+
*
|
3791
|
+
* // For a local manifest file:
|
3792
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3793
|
+
* ```
|
3794
|
+
*/
|
3795
|
+
async startFromManifest(manifestUrl, opts) {
|
3796
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
3797
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3798
|
+
});
|
3799
|
+
const app = await this._createFromManifest(manifestUrl);
|
3800
|
+
// @ts-expect-error using private method without warning.
|
3801
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
3802
|
+
return app;
|
3803
|
+
}
|
3804
|
+
/**
|
3805
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
3806
|
+
* Retrieves application's manifest and returns a wrapped application.
|
3807
|
+
* @param manifestUrl - The URL of app's manifest.
|
3808
|
+
* @param callback - called if the method succeeds.
|
3809
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
3810
|
+
*
|
3811
|
+
* @example
|
3812
|
+
*
|
3813
|
+
* ```js
|
3814
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
3815
|
+
* ```
|
3816
|
+
* @ignore
|
3817
|
+
*/
|
3818
|
+
createFromManifest(manifestUrl) {
|
3819
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
3820
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
3821
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3822
|
+
});
|
3823
|
+
return this._createFromManifest(manifestUrl);
|
3824
|
+
}
|
3825
|
+
_createFromManifest(manifestUrl) {
|
3826
|
+
return this.wire
|
3827
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
3828
|
+
.then(({ payload }) => {
|
3829
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
3830
|
+
return this.wrap({ uuid });
|
3831
|
+
})
|
3832
|
+
.then((app) => {
|
3833
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
3834
|
+
return app;
|
3835
|
+
});
|
3836
|
+
}
|
3548
3837
|
}
|
3838
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
3549
3839
|
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3553
|
-
|
3554
|
-
|
3555
|
-
|
3556
|
-
|
3557
|
-
|
3558
|
-
|
3559
|
-
|
3840
|
+
(function (exports) {
|
3841
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3842
|
+
if (k2 === undefined) k2 = k;
|
3843
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
3844
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
3845
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
3846
|
+
}
|
3847
|
+
Object.defineProperty(o, k2, desc);
|
3848
|
+
}) : (function(o, m, k, k2) {
|
3849
|
+
if (k2 === undefined) k2 = k;
|
3850
|
+
o[k2] = m[k];
|
3851
|
+
}));
|
3852
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
3853
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3854
|
+
};
|
3855
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3560
3856
|
/**
|
3561
|
-
*
|
3857
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
3858
|
+
*
|
3859
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
3860
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
3861
|
+
*
|
3862
|
+
* 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),
|
3863
|
+
* both of these were documented on the same page.
|
3864
|
+
*
|
3865
|
+
* @packageDocumentation
|
3562
3866
|
*/
|
3563
|
-
|
3564
|
-
|
3565
|
-
|
3566
|
-
*
|
3567
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3568
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3569
|
-
* for an Application throughout its entire lifecycle.
|
3570
|
-
*
|
3571
|
-
* @example
|
3572
|
-
*
|
3573
|
-
* ```js
|
3574
|
-
* fin.Application.wrap({ uuid: 'testapp' })
|
3575
|
-
* .then(app => app.isRunning())
|
3576
|
-
* .then(running => console.log('Application is running: ' + running))
|
3577
|
-
* .catch(err => console.log(err));
|
3578
|
-
* ```
|
3579
|
-
*
|
3580
|
-
*/
|
3581
|
-
async wrap(identity) {
|
3582
|
-
this.wire.sendAction('wrap-application').catch((e) => {
|
3583
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3584
|
-
});
|
3585
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3586
|
-
if (errorMsg) {
|
3587
|
-
throw new Error(errorMsg);
|
3588
|
-
}
|
3589
|
-
return new Instance_1.Application(this.wire, identity);
|
3590
|
-
}
|
3591
|
-
/**
|
3592
|
-
* Synchronously returns an API handle for the given Application identity.
|
3593
|
-
*
|
3594
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3595
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3596
|
-
* for an Aplication throughout its entire lifecycle.
|
3597
|
-
*
|
3598
|
-
* @example
|
3599
|
-
*
|
3600
|
-
* ```js
|
3601
|
-
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
3602
|
-
* await app.close();
|
3603
|
-
* ```
|
3604
|
-
*
|
3605
|
-
*/
|
3606
|
-
wrapSync(identity) {
|
3607
|
-
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
3608
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3609
|
-
});
|
3610
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3611
|
-
if (errorMsg) {
|
3612
|
-
throw new Error(errorMsg);
|
3613
|
-
}
|
3614
|
-
return new Instance_1.Application(this.wire, identity);
|
3615
|
-
}
|
3616
|
-
async _create(appOptions) {
|
3617
|
-
// set defaults:
|
3618
|
-
if (appOptions.waitForPageLoad === undefined) {
|
3619
|
-
appOptions.waitForPageLoad = false;
|
3620
|
-
}
|
3621
|
-
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
3622
|
-
appOptions.autoShow = true;
|
3623
|
-
}
|
3624
|
-
await this.wire.sendAction('create-application', appOptions);
|
3625
|
-
return this.wrap({ uuid: appOptions.uuid });
|
3626
|
-
}
|
3627
|
-
/**
|
3628
|
-
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
3629
|
-
*
|
3630
|
-
* @example
|
3631
|
-
*
|
3632
|
-
* ```js
|
3633
|
-
* async function createApp() {
|
3634
|
-
* const app = await fin.Application.create({
|
3635
|
-
* name: 'myApp',
|
3636
|
-
* uuid: 'app-3',
|
3637
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
3638
|
-
* autoShow: true
|
3639
|
-
* });
|
3640
|
-
* await app.run();
|
3641
|
-
* }
|
3642
|
-
*
|
3643
|
-
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
3644
|
-
* ```
|
3645
|
-
*
|
3646
|
-
* @ignore
|
3647
|
-
*/
|
3648
|
-
create(appOptions) {
|
3649
|
-
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
3650
|
-
this.wire.sendAction('application-create').catch((e) => {
|
3651
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3652
|
-
});
|
3653
|
-
return this._create(appOptions);
|
3654
|
-
}
|
3655
|
-
/**
|
3656
|
-
* Creates and starts a new Application.
|
3657
|
-
*
|
3658
|
-
* @example
|
3659
|
-
*
|
3660
|
-
* ```js
|
3661
|
-
* async function start() {
|
3662
|
-
* return fin.Application.start({
|
3663
|
-
* name: 'app-1',
|
3664
|
-
* uuid: 'app-1',
|
3665
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
3666
|
-
* autoShow: true
|
3667
|
-
* });
|
3668
|
-
* }
|
3669
|
-
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3670
|
-
* ```
|
3671
|
-
*
|
3672
|
-
*/
|
3673
|
-
async start(appOptions) {
|
3674
|
-
this.wire.sendAction('start-application').catch((e) => {
|
3675
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3676
|
-
});
|
3677
|
-
const app = await this._create(appOptions);
|
3678
|
-
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
3679
|
-
return app;
|
3680
|
-
}
|
3681
|
-
/**
|
3682
|
-
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
3683
|
-
* Returns once the RVM is finished attempting to launch the applications.
|
3684
|
-
* @param opts - Parameters that the RVM will use.
|
3685
|
-
*
|
3686
|
-
* @example
|
3687
|
-
*
|
3688
|
-
* ```js
|
3689
|
-
*
|
3690
|
-
* const applicationInfoArray = [
|
3691
|
-
* {
|
3692
|
-
* "uuid": 'App-1',
|
3693
|
-
* "manifestUrl": 'http://localhost:5555/app1.json',
|
3694
|
-
* },
|
3695
|
-
* {
|
3696
|
-
* "uuid": 'App-2',
|
3697
|
-
* "manifestUrl": 'http://localhost:5555/app2.json',
|
3698
|
-
* },
|
3699
|
-
* {
|
3700
|
-
* "uuid": 'App-3',
|
3701
|
-
* "manifestUrl": 'http://localhost:5555/app3.json',
|
3702
|
-
* }
|
3703
|
-
* ]
|
3704
|
-
*
|
3705
|
-
* fin.Application.startManyManifests(applicationInfoArray)
|
3706
|
-
* .then(() => {
|
3707
|
-
* console.log('RVM has finished launching the application list.');
|
3708
|
-
* })
|
3709
|
-
* .catch((err) => {
|
3710
|
-
* console.log(err);
|
3711
|
-
* })
|
3712
|
-
* ```
|
3713
|
-
*
|
3714
|
-
* @experimental
|
3715
|
-
*/
|
3716
|
-
async startManyManifests(applications, opts) {
|
3717
|
-
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
3718
|
-
}
|
3719
|
-
/**
|
3720
|
-
* Asynchronously returns an Application object that represents the current application
|
3721
|
-
*
|
3722
|
-
* @example
|
3723
|
-
*
|
3724
|
-
* ```js
|
3725
|
-
* async function isCurrentAppRunning () {
|
3726
|
-
* const app = await fin.Application.getCurrent();
|
3727
|
-
* return app.isRunning();
|
3728
|
-
* }
|
3729
|
-
*
|
3730
|
-
* isCurrentAppRunning().then(running => {
|
3731
|
-
* console.log(`Current app is running: ${running}`);
|
3732
|
-
* }).catch(err => {
|
3733
|
-
* console.error(err);
|
3734
|
-
* });
|
3735
|
-
*
|
3736
|
-
* ```
|
3737
|
-
*/
|
3738
|
-
getCurrent() {
|
3739
|
-
this.wire.sendAction('get-current-application').catch((e) => {
|
3740
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3741
|
-
});
|
3742
|
-
return this.wrap({ uuid: this.wire.me.uuid });
|
3743
|
-
}
|
3744
|
-
/**
|
3745
|
-
* Synchronously returns an Application object that represents the current application
|
3746
|
-
*
|
3747
|
-
* @example
|
3748
|
-
*
|
3749
|
-
* ```js
|
3750
|
-
* async function isCurrentAppRunning () {
|
3751
|
-
* const app = fin.Application.getCurrentSync();
|
3752
|
-
* return app.isRunning();
|
3753
|
-
* }
|
3754
|
-
*
|
3755
|
-
* isCurrentAppRunning().then(running => {
|
3756
|
-
* console.log(`Current app is running: ${running}`);
|
3757
|
-
* }).catch(err => {
|
3758
|
-
* console.error(err);
|
3759
|
-
* });
|
3760
|
-
*
|
3761
|
-
* ```
|
3762
|
-
*/
|
3763
|
-
getCurrentSync() {
|
3764
|
-
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
3765
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3766
|
-
});
|
3767
|
-
return this.wrapSync({ uuid: this.wire.me.uuid });
|
3768
|
-
}
|
3769
|
-
/**
|
3770
|
-
* Retrieves application's manifest and returns a running instance of the application.
|
3771
|
-
* @param manifestUrl - The URL of app's manifest.
|
3772
|
-
* @param opts - Parameters that the RVM will use.
|
3773
|
-
*
|
3774
|
-
* @example
|
3775
|
-
*
|
3776
|
-
* ```js
|
3777
|
-
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3778
|
-
*
|
3779
|
-
* // For a local manifest file:
|
3780
|
-
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3781
|
-
* ```
|
3782
|
-
*/
|
3783
|
-
async startFromManifest(manifestUrl, opts) {
|
3784
|
-
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
3785
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3786
|
-
});
|
3787
|
-
const app = await this._createFromManifest(manifestUrl);
|
3788
|
-
// @ts-expect-error using private method without warning.
|
3789
|
-
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
3790
|
-
return app;
|
3791
|
-
}
|
3792
|
-
/**
|
3793
|
-
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
3794
|
-
* Retrieves application's manifest and returns a wrapped application.
|
3795
|
-
* @param manifestUrl - The URL of app's manifest.
|
3796
|
-
* @param callback - called if the method succeeds.
|
3797
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
3798
|
-
*
|
3799
|
-
* @example
|
3800
|
-
*
|
3801
|
-
* ```js
|
3802
|
-
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
3803
|
-
* ```
|
3804
|
-
* @ignore
|
3805
|
-
*/
|
3806
|
-
createFromManifest(manifestUrl) {
|
3807
|
-
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
3808
|
-
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
3809
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3810
|
-
});
|
3811
|
-
return this._createFromManifest(manifestUrl);
|
3812
|
-
}
|
3813
|
-
_createFromManifest(manifestUrl) {
|
3814
|
-
return this.wire
|
3815
|
-
.sendAction('get-application-manifest', { manifestUrl })
|
3816
|
-
.then(({ payload }) => {
|
3817
|
-
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
3818
|
-
return this.wrap({ uuid });
|
3819
|
-
})
|
3820
|
-
.then((app) => {
|
3821
|
-
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
3822
|
-
return app;
|
3823
|
-
});
|
3824
|
-
}
|
3825
|
-
}
|
3826
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
3827
|
-
return Factory$7;
|
3828
|
-
}
|
3829
|
-
|
3830
|
-
var hasRequiredApplication;
|
3831
|
-
|
3832
|
-
function requireApplication () {
|
3833
|
-
if (hasRequiredApplication) return application;
|
3834
|
-
hasRequiredApplication = 1;
|
3835
|
-
(function (exports) {
|
3836
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3837
|
-
if (k2 === undefined) k2 = k;
|
3838
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
3839
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
3840
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
3841
|
-
}
|
3842
|
-
Object.defineProperty(o, k2, desc);
|
3843
|
-
}) : (function(o, m, k, k2) {
|
3844
|
-
if (k2 === undefined) k2 = k;
|
3845
|
-
o[k2] = m[k];
|
3846
|
-
}));
|
3847
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
3848
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3849
|
-
};
|
3850
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3851
|
-
/**
|
3852
|
-
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
3853
|
-
*
|
3854
|
-
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
3855
|
-
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
3856
|
-
*
|
3857
|
-
* 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),
|
3858
|
-
* both of these were documented on the same page.
|
3859
|
-
*
|
3860
|
-
* @packageDocumentation
|
3861
|
-
*/
|
3862
|
-
__exportStar(requireFactory$2(), exports);
|
3863
|
-
__exportStar(requireInstance$1(), exports);
|
3864
|
-
} (application));
|
3865
|
-
return application;
|
3866
|
-
}
|
3867
|
+
__exportStar(Factory$7, exports);
|
3868
|
+
__exportStar(Instance$6, exports);
|
3869
|
+
} (application));
|
3867
3870
|
|
3868
3871
|
var promisifySubscription$1 = {};
|
3869
3872
|
|
@@ -3907,7 +3910,7 @@ function requireInstance () {
|
|
3907
3910
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
3908
3911
|
/* eslint-disable no-console */
|
3909
3912
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
3910
|
-
const application_1 =
|
3913
|
+
const application_1 = application;
|
3911
3914
|
const main_1 = main;
|
3912
3915
|
const view_1 = requireView();
|
3913
3916
|
const warnings_1 = warnings;
|
@@ -4024,9 +4027,9 @@ function requireInstance () {
|
|
4024
4027
|
* getBounds().then(bounds => console.log(bounds)).catch(err => console.log(err));
|
4025
4028
|
* ```
|
4026
4029
|
*/
|
4027
|
-
getBounds() {
|
4030
|
+
getBounds(options) {
|
4028
4031
|
return this.wire
|
4029
|
-
.sendAction('get-window-bounds', this.identity)
|
4032
|
+
.sendAction('get-window-bounds', { ...this.identity, options })
|
4030
4033
|
.then(({ payload }) => payload.data);
|
4031
4034
|
}
|
4032
4035
|
/**
|
@@ -11976,7 +11979,7 @@ const layout_constants_1$1 = layout_constants;
|
|
11976
11979
|
*
|
11977
11980
|
* @remarks The built-in event emitter is not an OpenFin event emitter so it doesn't share propagation semantics.
|
11978
11981
|
*
|
11979
|
-
* ####
|
11982
|
+
* #### [addEventListener(type, listener [, options]);](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)
|
11980
11983
|
* Adds a listener to the end of the listeners array for the specified event.
|
11981
11984
|
* @example
|
11982
11985
|
* ```js
|
@@ -11993,7 +11996,7 @@ const layout_constants_1$1 = layout_constants;
|
|
11993
11996
|
* });
|
11994
11997
|
* ```
|
11995
11998
|
*
|
11996
|
-
* ####
|
11999
|
+
* #### [removeEventListener(type, listener [, options]);](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener)
|
11997
12000
|
* Adds a listener to the end of the listeners array for the specified event.
|
11998
12001
|
* @example
|
11999
12002
|
* ```js
|
@@ -12344,7 +12347,7 @@ class Layout extends base_1$5.Base {
|
|
12344
12347
|
return layout_entities_1.LayoutNode.getEntity(stack, client);
|
12345
12348
|
}
|
12346
12349
|
/**
|
12347
|
-
* Adds a view to the platform layout. Behaves like @link
|
12350
|
+
* Adds a view to the platform layout. Behaves like {@link Platform#createView Platform.createView} with the current layout as the target.
|
12348
12351
|
*
|
12349
12352
|
* @param viewOptions - The options for creating the view.
|
12350
12353
|
* @param options - Optional parameters for adding the view.
|
@@ -12365,7 +12368,7 @@ class Layout extends base_1$5.Base {
|
|
12365
12368
|
}
|
12366
12369
|
/**
|
12367
12370
|
* Closes a view by its identity. Throws an error if the view does not belong to the current layout.
|
12368
|
-
* Behaves like @link
|
12371
|
+
* Behaves like {@link Platform#closeView Platform.closeView} but only closes the view if it belongs the current layout.
|
12369
12372
|
*
|
12370
12373
|
* @param viewIdentity - The identity of the view to close.
|
12371
12374
|
* @returns A promise that resolves when the view is closed.
|
@@ -14737,31 +14740,6 @@ function requireInteropBroker () {
|
|
14737
14740
|
if (!context.type) {
|
14738
14741
|
return { isValid: false, reason: 'Context must have a type property' };
|
14739
14742
|
}
|
14740
|
-
if (context.id && typeof context.id !== 'object') {
|
14741
|
-
return {
|
14742
|
-
isValid: false,
|
14743
|
-
reason: 'Context id must be an Object populated with key-value identifiers (if set)'
|
14744
|
-
};
|
14745
|
-
}
|
14746
|
-
if (context.id) {
|
14747
|
-
const { id } = context;
|
14748
|
-
const keys = Object.keys(id);
|
14749
|
-
let foundBadIdentifier = false;
|
14750
|
-
if (!keys.length) {
|
14751
|
-
return { isValid: false, reason: 'Context id must have at least one key-value identifier' };
|
14752
|
-
}
|
14753
|
-
keys.forEach((key) => {
|
14754
|
-
if (typeof key !== 'string' || typeof id[key] !== 'string') {
|
14755
|
-
foundBadIdentifier = true;
|
14756
|
-
}
|
14757
|
-
});
|
14758
|
-
if (foundBadIdentifier) {
|
14759
|
-
return { isValid: false, reason: 'Context id key-value identifiers must be of type string' };
|
14760
|
-
}
|
14761
|
-
}
|
14762
|
-
if (context.name && typeof context.name !== 'string') {
|
14763
|
-
return { isValid: false, reason: 'Context name must be of string type (if set)' };
|
14764
|
-
}
|
14765
14743
|
return { isValid: true };
|
14766
14744
|
}
|
14767
14745
|
// Util to check a client identity.
|
@@ -17274,7 +17252,7 @@ const events_1$3 = require$$0;
|
|
17274
17252
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
17275
17253
|
const index_1 = system;
|
17276
17254
|
const index_2 = requireWindow();
|
17277
|
-
const index_3 =
|
17255
|
+
const index_3 = application;
|
17278
17256
|
const index_4 = interappbus;
|
17279
17257
|
const index_5 = clipboard;
|
17280
17258
|
const index_6 = externalApplication;
|
@@ -17669,12 +17647,12 @@ class Transport extends events_1$1.EventEmitter {
|
|
17669
17647
|
Transport_1 = transport.Transport = Transport;
|
17670
17648
|
_Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
|
17671
17649
|
|
17672
|
-
var
|
17650
|
+
var stubEnvironment = {};
|
17673
17651
|
|
17674
|
-
Object.defineProperty(
|
17675
|
-
var
|
17652
|
+
Object.defineProperty(stubEnvironment, "__esModule", { value: true });
|
17653
|
+
var StubEnvironment_1 = stubEnvironment.StubEnvironment = void 0;
|
17676
17654
|
const me_1 = me;
|
17677
|
-
class
|
17655
|
+
class StubEnvironment {
|
17678
17656
|
constructor() {
|
17679
17657
|
this.type = 'other';
|
17680
17658
|
this.childViews = true;
|
@@ -17755,15 +17733,15 @@ class MockEnvironment {
|
|
17755
17733
|
throw new Error('Method not implemented.');
|
17756
17734
|
}
|
17757
17735
|
}
|
17758
|
-
|
17736
|
+
StubEnvironment_1 = stubEnvironment.StubEnvironment = StubEnvironment;
|
17759
17737
|
|
17760
|
-
var
|
17738
|
+
var stubWire = {};
|
17761
17739
|
|
17762
|
-
Object.defineProperty(
|
17763
|
-
var
|
17740
|
+
Object.defineProperty(stubWire, "__esModule", { value: true });
|
17741
|
+
var StubWire_1 = stubWire.StubWire = void 0;
|
17764
17742
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
17765
17743
|
const events_1 = require$$0;
|
17766
|
-
class
|
17744
|
+
class StubWire extends events_1.EventEmitter {
|
17767
17745
|
connect() {
|
17768
17746
|
throw new Error('You are not running in OpenFin.');
|
17769
17747
|
}
|
@@ -17784,12 +17762,12 @@ class MockWire extends events_1.EventEmitter {
|
|
17784
17762
|
super();
|
17785
17763
|
}
|
17786
17764
|
}
|
17787
|
-
|
17765
|
+
StubWire_1 = stubWire.StubWire = StubWire;
|
17788
17766
|
|
17789
17767
|
const fin$1 = ((typeof window !== 'undefined' && window?.fin) ||
|
17790
17768
|
(() => {
|
17791
|
-
const environment = new
|
17792
|
-
const transport = new Transport_1(
|
17769
|
+
const environment = new StubEnvironment_1();
|
17770
|
+
const transport = new Transport_1(StubWire_1, environment, {
|
17793
17771
|
uuid: '',
|
17794
17772
|
name: ''
|
17795
17773
|
});
|