@openfin/core 39.83.19 → 39.83.20
Sign up to get free protection for your applications and to get access to all the features.
- package/out/mock.js +1122 -1139
- package/package.json +1 -1
package/out/mock.js
CHANGED
@@ -741,11 +741,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
741
741
|
};
|
742
742
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
743
743
|
|
744
|
-
var hasRequiredFactory$
|
744
|
+
var hasRequiredFactory$2;
|
745
745
|
|
746
|
-
function requireFactory$
|
747
|
-
if (hasRequiredFactory$
|
748
|
-
hasRequiredFactory$
|
746
|
+
function requireFactory$2 () {
|
747
|
+
if (hasRequiredFactory$2) return Factory$6;
|
748
|
+
hasRequiredFactory$2 = 1;
|
749
749
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
750
750
|
Factory$6.ViewModule = void 0;
|
751
751
|
const base_1 = base;
|
@@ -960,8 +960,8 @@ var main = {};
|
|
960
960
|
|
961
961
|
Object.defineProperty(main, "__esModule", { value: true });
|
962
962
|
main.WebContents = void 0;
|
963
|
-
const base_1$
|
964
|
-
class WebContents extends base_1$
|
963
|
+
const base_1$l = base;
|
964
|
+
class WebContents extends base_1$l.EmitterBase {
|
965
965
|
/**
|
966
966
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
967
967
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
@@ -2027,11 +2027,11 @@ class WebContents extends base_1$j.EmitterBase {
|
|
2027
2027
|
}
|
2028
2028
|
main.WebContents = WebContents;
|
2029
2029
|
|
2030
|
-
var hasRequiredInstance$
|
2030
|
+
var hasRequiredInstance$1;
|
2031
2031
|
|
2032
|
-
function requireInstance$
|
2033
|
-
if (hasRequiredInstance$
|
2034
|
-
hasRequiredInstance$
|
2032
|
+
function requireInstance$1 () {
|
2033
|
+
if (hasRequiredInstance$1) return Instance$5;
|
2034
|
+
hasRequiredInstance$1 = 1;
|
2035
2035
|
var _View_providerChannelClient;
|
2036
2036
|
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
2037
2037
|
Instance$5.View = void 0;
|
@@ -2611,1141 +2611,1120 @@ function requireView () {
|
|
2611
2611
|
*
|
2612
2612
|
* @packageDocumentation
|
2613
2613
|
*/
|
2614
|
-
__exportStar(requireFactory$
|
2615
|
-
__exportStar(requireInstance$
|
2614
|
+
__exportStar(requireFactory$2(), exports);
|
2615
|
+
__exportStar(requireInstance$1(), exports);
|
2616
2616
|
} (view));
|
2617
2617
|
return view;
|
2618
2618
|
}
|
2619
2619
|
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2643
|
-
|
2644
|
-
|
2645
|
-
|
2646
|
-
|
2647
|
-
|
2648
|
-
|
2649
|
-
|
2650
|
-
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2672
|
-
|
2673
|
-
|
2674
|
-
|
2675
|
-
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
|
2684
|
-
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
|
2689
|
-
|
2690
|
-
|
2691
|
-
|
2692
|
-
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2698
|
-
|
2699
|
-
|
2700
|
-
|
2701
|
-
|
2702
|
-
|
2703
|
-
|
2704
|
-
|
2705
|
-
|
2706
|
-
|
2707
|
-
|
2708
|
-
|
2709
|
-
|
2710
|
-
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
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
|
-
|
2620
|
+
Object.defineProperty(Instance$6, "__esModule", { value: true });
|
2621
|
+
Instance$6.Application = void 0;
|
2622
|
+
/* eslint-disable import/prefer-default-export */
|
2623
|
+
const base_1$k = base;
|
2624
|
+
const window_1$1 = requireWindow();
|
2625
|
+
const view_1 = requireView();
|
2626
|
+
/**
|
2627
|
+
* An object representing an application. Allows the developer to create,
|
2628
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
2629
|
+
*/
|
2630
|
+
class Application extends base_1$k.EmitterBase {
|
2631
|
+
/**
|
2632
|
+
* @internal
|
2633
|
+
*/
|
2634
|
+
constructor(wire, identity) {
|
2635
|
+
super(wire, 'application', identity.uuid);
|
2636
|
+
this.identity = identity;
|
2637
|
+
this.window = new window_1$1._Window(this.wire, {
|
2638
|
+
uuid: this.identity.uuid,
|
2639
|
+
name: this.identity.uuid
|
2640
|
+
});
|
2641
|
+
}
|
2642
|
+
windowListFromIdentityList(identityList) {
|
2643
|
+
const windowList = [];
|
2644
|
+
identityList.forEach((identity) => {
|
2645
|
+
windowList.push(new window_1$1._Window(this.wire, {
|
2646
|
+
uuid: identity.uuid,
|
2647
|
+
name: identity.name
|
2648
|
+
}));
|
2649
|
+
});
|
2650
|
+
return windowList;
|
2651
|
+
}
|
2652
|
+
/**
|
2653
|
+
* Determines if the application is currently running.
|
2654
|
+
*
|
2655
|
+
* @example
|
2656
|
+
*
|
2657
|
+
* ```js
|
2658
|
+
* async function isAppRunning() {
|
2659
|
+
* const app = await fin.Application.getCurrent();
|
2660
|
+
* return await app.isRunning();
|
2661
|
+
* }
|
2662
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
2663
|
+
* ```
|
2664
|
+
*/
|
2665
|
+
isRunning() {
|
2666
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
2667
|
+
}
|
2668
|
+
/**
|
2669
|
+
* Closes the application and any child windows created by the application.
|
2670
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
2671
|
+
* @param force Close will be prevented from closing when force is false and
|
2672
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
2673
|
+
*
|
2674
|
+
* @example
|
2675
|
+
*
|
2676
|
+
* ```js
|
2677
|
+
* async function closeApp() {
|
2678
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
2679
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
2680
|
+
* await app.quit();
|
2681
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
2682
|
+
*
|
2683
|
+
* }
|
2684
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
2685
|
+
* ```
|
2686
|
+
*/
|
2687
|
+
async quit(force = false) {
|
2688
|
+
try {
|
2689
|
+
await this._close(force);
|
2690
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
2691
|
+
}
|
2692
|
+
catch (error) {
|
2693
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
2694
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
2695
|
+
throw error;
|
2696
|
+
}
|
2697
|
+
}
|
2698
|
+
}
|
2699
|
+
async _close(force = false) {
|
2700
|
+
try {
|
2701
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
2702
|
+
}
|
2703
|
+
catch (error) {
|
2704
|
+
if (!error.message.includes('Remote connection has closed')) {
|
2705
|
+
throw error;
|
2706
|
+
}
|
2707
|
+
}
|
2708
|
+
}
|
2709
|
+
/**
|
2710
|
+
* @deprecated use Application.quit instead
|
2711
|
+
* Closes the application and any child windows created by the application.
|
2712
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
2713
|
+
* @param callback - called if the method succeeds.
|
2714
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
2715
|
+
*
|
2716
|
+
* @example
|
2717
|
+
*
|
2718
|
+
* ```js
|
2719
|
+
* async function closeApp() {
|
2720
|
+
* const app = await fin.Application.getCurrent();
|
2721
|
+
* return await app.close();
|
2722
|
+
* }
|
2723
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
2724
|
+
* ```
|
2725
|
+
*/
|
2726
|
+
close(force = false) {
|
2727
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
2728
|
+
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
2729
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
2730
|
+
});
|
2731
|
+
return this._close(force);
|
2732
|
+
}
|
2733
|
+
/**
|
2734
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
2735
|
+
*
|
2736
|
+
* @example
|
2737
|
+
*
|
2738
|
+
* ```js
|
2739
|
+
* async function getChildWindows() {
|
2740
|
+
* const app = await fin.Application.getCurrent();
|
2741
|
+
* return await app.getChildWindows();
|
2742
|
+
* }
|
2743
|
+
*
|
2744
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
2745
|
+
* ```
|
2746
|
+
*/
|
2747
|
+
getChildWindows() {
|
2748
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
2749
|
+
const identityList = [];
|
2750
|
+
payload.data.forEach((winName) => {
|
2751
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
2752
|
+
});
|
2753
|
+
return this.windowListFromIdentityList(identityList);
|
2754
|
+
});
|
2755
|
+
}
|
2756
|
+
/**
|
2757
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
2758
|
+
* if the application was not created from a manifest.
|
2759
|
+
*
|
2760
|
+
* @example
|
2761
|
+
*
|
2762
|
+
* ```js
|
2763
|
+
* async function getManifest() {
|
2764
|
+
* const app = await fin.Application.getCurrent();
|
2765
|
+
* return await app.getManifest();
|
2766
|
+
* }
|
2767
|
+
*
|
2768
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
2769
|
+
* ```
|
2770
|
+
*/
|
2771
|
+
getManifest() {
|
2772
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
2773
|
+
}
|
2774
|
+
/**
|
2775
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
2776
|
+
* if the application was created from a manifest.
|
2777
|
+
*
|
2778
|
+
* @example
|
2779
|
+
*
|
2780
|
+
* ```js
|
2781
|
+
* async function getParentUuid() {
|
2782
|
+
* const app = await fin.Application.start({
|
2783
|
+
* uuid: 'app-1',
|
2784
|
+
* name: 'myApp',
|
2785
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
2786
|
+
* autoShow: true
|
2787
|
+
* });
|
2788
|
+
* return await app.getParentUuid();
|
2789
|
+
* }
|
2790
|
+
*
|
2791
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
2792
|
+
* ```
|
2793
|
+
*/
|
2794
|
+
getParentUuid() {
|
2795
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
2796
|
+
}
|
2797
|
+
/**
|
2798
|
+
* Retrieves current application's shortcut configuration.
|
2799
|
+
*
|
2800
|
+
* @example
|
2801
|
+
*
|
2802
|
+
* ```js
|
2803
|
+
* async function getShortcuts() {
|
2804
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
2805
|
+
* return await app.getShortcuts();
|
2806
|
+
* }
|
2807
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
2808
|
+
* ```
|
2809
|
+
*/
|
2810
|
+
getShortcuts() {
|
2811
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
2812
|
+
}
|
2813
|
+
/**
|
2814
|
+
* Retrieves current application's views.
|
2815
|
+
* @experimental
|
2816
|
+
*
|
2817
|
+
* @example
|
2818
|
+
*
|
2819
|
+
* ```js
|
2820
|
+
* async function getViews() {
|
2821
|
+
* const app = await fin.Application.getCurrent();
|
2822
|
+
* return await app.getViews();
|
2823
|
+
* }
|
2824
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
2825
|
+
* ```
|
2826
|
+
*/
|
2827
|
+
async getViews() {
|
2828
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
2829
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
2830
|
+
}
|
2831
|
+
/**
|
2832
|
+
* Returns the current zoom level of the application.
|
2833
|
+
*
|
2834
|
+
* @example
|
2835
|
+
*
|
2836
|
+
* ```js
|
2837
|
+
* async function getZoomLevel() {
|
2838
|
+
* const app = await fin.Application.getCurrent();
|
2839
|
+
* return await app.getZoomLevel();
|
2840
|
+
* }
|
2841
|
+
*
|
2842
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
2843
|
+
* ```
|
2844
|
+
*/
|
2845
|
+
getZoomLevel() {
|
2846
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
2847
|
+
}
|
2848
|
+
/**
|
2849
|
+
* Returns an instance of the main Window of the application
|
2850
|
+
*
|
2851
|
+
* @example
|
2852
|
+
*
|
2853
|
+
* ```js
|
2854
|
+
* async function getWindow() {
|
2855
|
+
* const app = await fin.Application.start({
|
2856
|
+
* uuid: 'app-1',
|
2857
|
+
* name: 'myApp',
|
2858
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
2859
|
+
* autoShow: true
|
2860
|
+
* });
|
2861
|
+
* return await app.getWindow();
|
2862
|
+
* }
|
2863
|
+
*
|
2864
|
+
* getWindow().then(win => {
|
2865
|
+
* win.showAt(0, 400);
|
2866
|
+
* win.flash();
|
2867
|
+
* }).catch(err => console.log(err));
|
2868
|
+
* ```
|
2869
|
+
*/
|
2870
|
+
getWindow() {
|
2871
|
+
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
2872
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
2873
|
+
});
|
2874
|
+
return Promise.resolve(this.window);
|
2875
|
+
}
|
2876
|
+
/**
|
2877
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
2878
|
+
* @param userName - username to be passed to the RVM.
|
2879
|
+
* @param appName - app name to be passed to the RVM.
|
2880
|
+
*
|
2881
|
+
* @example
|
2882
|
+
*
|
2883
|
+
* ```js
|
2884
|
+
* async function registerUser() {
|
2885
|
+
* const app = await fin.Application.getCurrent();
|
2886
|
+
* return await app.registerUser('user', 'myApp');
|
2887
|
+
* }
|
2888
|
+
*
|
2889
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
2890
|
+
* ```
|
2891
|
+
*/
|
2892
|
+
registerUser(userName, appName) {
|
2893
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
2894
|
+
}
|
2895
|
+
/**
|
2896
|
+
* Removes the application’s icon from the tray.
|
2897
|
+
*
|
2898
|
+
* @example
|
2899
|
+
*
|
2900
|
+
* ```js
|
2901
|
+
* async function removeTrayIcon() {
|
2902
|
+
* const app = await fin.Application.getCurrent();
|
2903
|
+
* return await app.removeTrayIcon();
|
2904
|
+
* }
|
2905
|
+
*
|
2906
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
2907
|
+
* ```
|
2908
|
+
*/
|
2909
|
+
removeTrayIcon() {
|
2910
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
2911
|
+
}
|
2912
|
+
/**
|
2913
|
+
* Restarts the application.
|
2914
|
+
*
|
2915
|
+
* @example
|
2916
|
+
*
|
2917
|
+
* ```js
|
2918
|
+
* async function restartApp() {
|
2919
|
+
* const app = await fin.Application.getCurrent();
|
2920
|
+
* return await app.restart();
|
2921
|
+
* }
|
2922
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
2923
|
+
* ```
|
2924
|
+
*/
|
2925
|
+
restart() {
|
2926
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
2927
|
+
}
|
2928
|
+
/**
|
2929
|
+
* DEPRECATED method to run the application.
|
2930
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
2931
|
+
*
|
2932
|
+
* @example
|
2933
|
+
*
|
2934
|
+
* ```js
|
2935
|
+
* async function run() {
|
2936
|
+
* const app = await fin.Application.create({
|
2937
|
+
* name: 'myApp',
|
2938
|
+
* uuid: 'app-1',
|
2939
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
2940
|
+
* autoShow: true
|
2941
|
+
* });
|
2942
|
+
* await app.run();
|
2943
|
+
* }
|
2944
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
2945
|
+
* ```
|
2946
|
+
*
|
2947
|
+
* @ignore
|
2948
|
+
*/
|
2949
|
+
run() {
|
2950
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
2951
|
+
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
2952
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
2953
|
+
});
|
2954
|
+
return this._run();
|
2955
|
+
}
|
2956
|
+
_run(opts = {}) {
|
2957
|
+
return this.wire
|
2958
|
+
.sendAction('run-application', {
|
2959
|
+
manifestUrl: this._manifestUrl,
|
2960
|
+
opts,
|
2961
|
+
...this.identity
|
2962
|
+
})
|
2963
|
+
.then(() => undefined);
|
2964
|
+
}
|
2965
|
+
/**
|
2966
|
+
* Instructs the RVM to schedule one restart of the application.
|
2967
|
+
*
|
2968
|
+
* @example
|
2969
|
+
*
|
2970
|
+
* ```js
|
2971
|
+
* async function scheduleRestart() {
|
2972
|
+
* const app = await fin.Application.getCurrent();
|
2973
|
+
* return await app.scheduleRestart();
|
2974
|
+
* }
|
2975
|
+
*
|
2976
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
2977
|
+
* ```
|
2978
|
+
*/
|
2979
|
+
scheduleRestart() {
|
2980
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
2981
|
+
}
|
2982
|
+
/**
|
2983
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
2984
|
+
* an object containing logId is returned.
|
2985
|
+
*
|
2986
|
+
* @example
|
2987
|
+
*
|
2988
|
+
* ```js
|
2989
|
+
* async function sendLog() {
|
2990
|
+
* const app = await fin.Application.getCurrent();
|
2991
|
+
* return await app.sendApplicationLog();
|
2992
|
+
* }
|
2993
|
+
*
|
2994
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
2995
|
+
* ```
|
2996
|
+
*/
|
2997
|
+
async sendApplicationLog() {
|
2998
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
2999
|
+
return payload.data;
|
3000
|
+
}
|
3001
|
+
/**
|
3002
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
3003
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
3004
|
+
*
|
3005
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
3006
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
3007
|
+
*
|
3008
|
+
*
|
3009
|
+
* @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).
|
3010
|
+
*
|
3011
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
3012
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
3013
|
+
*
|
3014
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
3015
|
+
*
|
3016
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
3017
|
+
* uuid or shortcut.name is changed.
|
3018
|
+
*
|
3019
|
+
* @example
|
3020
|
+
*
|
3021
|
+
* ```js
|
3022
|
+
* const app = fin.Application.getCurrentSync();
|
3023
|
+
* const appName = 'My App';
|
3024
|
+
* const jumpListConfig = [ // array of JumpList categories
|
3025
|
+
* {
|
3026
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
3027
|
+
* items: [ // array of JumpList items
|
3028
|
+
* {
|
3029
|
+
* type: 'task',
|
3030
|
+
* title: `Launch ${appName}`,
|
3031
|
+
* description: `Runs ${appName} with the default configuration`,
|
3032
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
3033
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
3034
|
+
* iconIndex: 0
|
3035
|
+
* },
|
3036
|
+
* { type: 'separator' },
|
3037
|
+
* {
|
3038
|
+
* type: 'task',
|
3039
|
+
* title: `Restore ${appName}`,
|
3040
|
+
* description: 'Restore to last configuration',
|
3041
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
3042
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
3043
|
+
* iconIndex: 0
|
3044
|
+
* },
|
3045
|
+
* ]
|
3046
|
+
* },
|
3047
|
+
* {
|
3048
|
+
* name: 'Tools',
|
3049
|
+
* items: [ // array of JumpList items
|
3050
|
+
* {
|
3051
|
+
* type: 'task',
|
3052
|
+
* title: 'Tool A',
|
3053
|
+
* description: 'Runs Tool A',
|
3054
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
3055
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
3056
|
+
* iconIndex: 0
|
3057
|
+
* },
|
3058
|
+
* {
|
3059
|
+
* type: 'task',
|
3060
|
+
* title: 'Tool B',
|
3061
|
+
* description: 'Runs Tool B',
|
3062
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
3063
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
3064
|
+
* iconIndex: 0
|
3065
|
+
* }]
|
3066
|
+
* }
|
3067
|
+
* ];
|
3068
|
+
*
|
3069
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
3070
|
+
* ```
|
3071
|
+
*
|
3072
|
+
* To handle deeplink args:
|
3073
|
+
* ```js
|
3074
|
+
* function handleUseLastConfiguration() {
|
3075
|
+
* // this handler is called when the app is being launched
|
3076
|
+
* app.on('run-requested', event => {
|
3077
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
3078
|
+
* // your logic here
|
3079
|
+
* }
|
3080
|
+
* });
|
3081
|
+
* // this handler is called when the app was already running when the launch was requested
|
3082
|
+
* fin.desktop.main(function(args) {
|
3083
|
+
* if(args && args['use-last-configuration']) {
|
3084
|
+
* // your logic here
|
3085
|
+
* }
|
3086
|
+
* });
|
3087
|
+
* }
|
3088
|
+
* ```
|
3089
|
+
*/
|
3090
|
+
async setJumpList(jumpListCategories) {
|
3091
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
3092
|
+
}
|
3093
|
+
/**
|
3094
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
3095
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
3096
|
+
*
|
3097
|
+
* @example
|
3098
|
+
*
|
3099
|
+
* ```js
|
3100
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
3101
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
3102
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
3103
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
3104
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
3105
|
+
*
|
3106
|
+
* async function setTrayIcon(icon) {
|
3107
|
+
* const app = await fin.Application.getCurrent();
|
3108
|
+
* return await app.setTrayIcon(icon);
|
3109
|
+
* }
|
3110
|
+
*
|
3111
|
+
* // use image url to set tray icon
|
3112
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3113
|
+
*
|
3114
|
+
* // use base64 encoded string to set tray icon
|
3115
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3116
|
+
*
|
3117
|
+
* // use a dataURL to set tray icon
|
3118
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3119
|
+
* ```
|
3120
|
+
*/
|
3121
|
+
setTrayIcon(icon) {
|
3122
|
+
return this.wire
|
3123
|
+
.sendAction('set-tray-icon', {
|
3124
|
+
enabledIcon: icon,
|
3125
|
+
...this.identity
|
3126
|
+
})
|
3127
|
+
.then(() => undefined);
|
3128
|
+
}
|
3129
|
+
/**
|
3130
|
+
* Sets new application's shortcut configuration. Windows only.
|
3131
|
+
* @param config New application's shortcut configuration.
|
3132
|
+
*
|
3133
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
3134
|
+
* to be able to change shortcut states.
|
3135
|
+
*
|
3136
|
+
* @example
|
3137
|
+
*
|
3138
|
+
* ```js
|
3139
|
+
* async function setShortcuts(config) {
|
3140
|
+
* const app = await fin.Application.getCurrent();
|
3141
|
+
* return app.setShortcuts(config);
|
3142
|
+
* }
|
3143
|
+
*
|
3144
|
+
* setShortcuts({
|
3145
|
+
* desktop: true,
|
3146
|
+
* startMenu: false,
|
3147
|
+
* systemStartup: true
|
3148
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
3149
|
+
* ```
|
3150
|
+
*/
|
3151
|
+
setShortcuts(config) {
|
3152
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
3153
|
+
}
|
3154
|
+
/**
|
3155
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
3156
|
+
* @param queryString The new query string for this app's shortcuts.
|
3157
|
+
*
|
3158
|
+
* @example
|
3159
|
+
*
|
3160
|
+
* ```js
|
3161
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
3162
|
+
* const app = await fin.Application.getCurrent();
|
3163
|
+
* try {
|
3164
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
3165
|
+
* } catch(err) {
|
3166
|
+
* console.error(err)
|
3167
|
+
* }
|
3168
|
+
* ```
|
3169
|
+
*/
|
3170
|
+
async setShortcutQueryParams(queryString) {
|
3171
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
3172
|
+
}
|
3173
|
+
/**
|
3174
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
3175
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
3176
|
+
* @param level The zoom level
|
3177
|
+
*
|
3178
|
+
* @example
|
3179
|
+
*
|
3180
|
+
* ```js
|
3181
|
+
* async function setZoomLevel(number) {
|
3182
|
+
* const app = await fin.Application.getCurrent();
|
3183
|
+
* return await app.setZoomLevel(number);
|
3184
|
+
* }
|
3185
|
+
*
|
3186
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
3187
|
+
* ```
|
3188
|
+
*/
|
3189
|
+
setZoomLevel(level) {
|
3190
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
3191
|
+
}
|
3192
|
+
/**
|
3193
|
+
* Sets a username to correlate with App Log Management.
|
3194
|
+
* @param username Username to correlate with App's Log.
|
3195
|
+
*
|
3196
|
+
* @example
|
3197
|
+
*
|
3198
|
+
* ```js
|
3199
|
+
* async function setAppLogUser() {
|
3200
|
+
* const app = await fin.Application.getCurrent();
|
3201
|
+
* return await app.setAppLogUsername('username');
|
3202
|
+
* }
|
3203
|
+
*
|
3204
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
3205
|
+
*
|
3206
|
+
* ```
|
3207
|
+
*/
|
3208
|
+
async setAppLogUsername(username) {
|
3209
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
3210
|
+
}
|
3211
|
+
/**
|
3212
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
3213
|
+
* @remarks The only information currently returned is the position and dimensions.
|
3214
|
+
*
|
3215
|
+
* @example
|
3216
|
+
*
|
3217
|
+
* ```js
|
3218
|
+
* async function getTrayIconInfo() {
|
3219
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3220
|
+
* return await app.getTrayIconInfo();
|
3221
|
+
* }
|
3222
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3223
|
+
* ```
|
3224
|
+
*/
|
3225
|
+
getTrayIconInfo() {
|
3226
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
3227
|
+
}
|
3228
|
+
/**
|
3229
|
+
* Checks if the application has an associated tray icon.
|
3230
|
+
*
|
3231
|
+
* @example
|
3232
|
+
*
|
3233
|
+
* ```js
|
3234
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3235
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
3236
|
+
* console.log(hasTrayIcon);
|
3237
|
+
* ```
|
3238
|
+
*/
|
3239
|
+
hasTrayIcon() {
|
3240
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
3241
|
+
}
|
3242
|
+
/**
|
3243
|
+
* Closes the application by terminating its process.
|
3244
|
+
*
|
3245
|
+
* @example
|
3246
|
+
*
|
3247
|
+
* ```js
|
3248
|
+
* async function terminateApp() {
|
3249
|
+
* const app = await fin.Application.getCurrent();
|
3250
|
+
* return await app.terminate();
|
3251
|
+
* }
|
3252
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
3253
|
+
* ```
|
3254
|
+
*/
|
3255
|
+
terminate() {
|
3256
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
3257
|
+
}
|
3258
|
+
/**
|
3259
|
+
* Waits for a hanging application. This method can be called in response to an application
|
3260
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
3261
|
+
* message after a certain period of time.
|
3262
|
+
*
|
3263
|
+
* @ignore
|
3264
|
+
*/
|
3265
|
+
wait() {
|
3266
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
3267
|
+
}
|
3268
|
+
/**
|
3269
|
+
* Retrieves information about the application.
|
3270
|
+
*
|
3271
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
3272
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
3273
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
3274
|
+
*
|
3275
|
+
* @example
|
3276
|
+
*
|
3277
|
+
* ```js
|
3278
|
+
* async function getInfo() {
|
3279
|
+
* const app = await fin.Application.getCurrent();
|
3280
|
+
* return await app.getInfo();
|
3281
|
+
* }
|
3282
|
+
*
|
3283
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3284
|
+
* ```
|
3285
|
+
*/
|
3286
|
+
getInfo() {
|
3287
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
3288
|
+
}
|
3289
|
+
/**
|
3290
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
3291
|
+
*
|
3292
|
+
* @example
|
3293
|
+
* ```js
|
3294
|
+
* const app = await fin.Application.getCurrent();
|
3295
|
+
* const processInfo = await app.getProcessInfo();
|
3296
|
+
* ```
|
3297
|
+
* @experimental
|
3298
|
+
*/
|
3299
|
+
async getProcessInfo() {
|
3300
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
3301
|
+
return data;
|
3302
|
+
}
|
3303
|
+
/**
|
3304
|
+
* Sets file auto download location. It's only allowed in the same application.
|
3305
|
+
*
|
3306
|
+
* Note: This method is restricted by default and must be enabled via
|
3307
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3308
|
+
* @param downloadLocation file auto download location
|
3309
|
+
*
|
3310
|
+
* @throws if setting file auto download location on different applications.
|
3311
|
+
* @example
|
3312
|
+
*
|
3313
|
+
* ```js
|
3314
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
3315
|
+
* const app = await fin.Application.getCurrent();
|
3316
|
+
* try {
|
3317
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
3318
|
+
* console.log('File download location is set');
|
3319
|
+
* } catch(err) {
|
3320
|
+
* console.error(err)
|
3321
|
+
* }
|
3322
|
+
* ```
|
3323
|
+
*/
|
3324
|
+
async setFileDownloadLocation(downloadLocation) {
|
3325
|
+
const { name } = this.wire.me;
|
3326
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3327
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
3328
|
+
}
|
3329
|
+
/**
|
3330
|
+
* 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.
|
3331
|
+
*
|
3332
|
+
* Note: This method is restricted by default and must be enabled via
|
3333
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3334
|
+
*
|
3335
|
+
* @throws if getting file auto download location on different applications.
|
3336
|
+
* @example
|
3337
|
+
*
|
3338
|
+
* ```js
|
3339
|
+
* const app = await fin.Application.getCurrent();
|
3340
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
3341
|
+
* ```
|
3342
|
+
*/
|
3343
|
+
async getFileDownloadLocation() {
|
3344
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
3345
|
+
return data;
|
3346
|
+
}
|
3347
|
+
/**
|
3348
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
3349
|
+
* @param options
|
3350
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
3351
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
3352
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
3353
|
+
* these with a "reducer" pattern.
|
3354
|
+
* @throws if the application has no tray icon set
|
3355
|
+
* @throws if the system tray is currently hidden
|
3356
|
+
* @example
|
3357
|
+
*
|
3358
|
+
* ```js
|
3359
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
3360
|
+
* const app = fin.Application.getCurrentSync();
|
3361
|
+
*
|
3362
|
+
* await app.setTrayIcon(iconUrl);
|
3363
|
+
*
|
3364
|
+
* const template = [
|
3365
|
+
* {
|
3366
|
+
* label: 'Menu Item 1',
|
3367
|
+
* data: 'hello from item 1'
|
3368
|
+
* },
|
3369
|
+
* { type: 'separator' },
|
3370
|
+
* {
|
3371
|
+
* label: 'Menu Item 2',
|
3372
|
+
* type: 'checkbox',
|
3373
|
+
* checked: true,
|
3374
|
+
* data: 'The user clicked the checkbox'
|
3375
|
+
* },
|
3376
|
+
* {
|
3377
|
+
* label: 'see more',
|
3378
|
+
* enabled: false,
|
3379
|
+
* submenu: [
|
3380
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
3381
|
+
* ]
|
3382
|
+
* }
|
3383
|
+
* ];
|
3384
|
+
*
|
3385
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
3386
|
+
* // right-click
|
3387
|
+
* if (event.button === 2) {
|
3388
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
3389
|
+
* if (r.result === 'closed') {
|
3390
|
+
* console.log('nothing happened');
|
3391
|
+
* } else {
|
3392
|
+
* console.log(r.data);
|
3393
|
+
* }
|
3394
|
+
* });
|
3395
|
+
* }
|
3396
|
+
* });
|
3397
|
+
* ```
|
3398
|
+
*/
|
3399
|
+
async showTrayIconPopupMenu(options) {
|
3400
|
+
const { name } = this.wire.me;
|
3401
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3402
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
3403
|
+
return payload.data;
|
3404
|
+
}
|
3405
|
+
/**
|
3406
|
+
* Closes the tray icon menu.
|
3407
|
+
*
|
3408
|
+
* @throws if the application has no tray icon set
|
3409
|
+
* @example
|
3410
|
+
*
|
3411
|
+
* ```js
|
3412
|
+
* const app = fin.Application.getCurrentSync();
|
3413
|
+
*
|
3414
|
+
* await app.closeTrayIconPopupMenu();
|
3415
|
+
* ```
|
3416
|
+
*/
|
3417
|
+
async closeTrayIconPopupMenu() {
|
3418
|
+
const { name } = this.wire.me;
|
3419
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3420
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
3421
|
+
}
|
3422
|
+
}
|
3423
|
+
Instance$6.Application = Application;
|
3424
|
+
|
3425
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
3426
|
+
Factory$7.ApplicationModule = void 0;
|
3427
|
+
const base_1$j = base;
|
3428
|
+
const validate_1$4 = validate;
|
3429
|
+
const Instance_1$5 = Instance$6;
|
3430
|
+
/**
|
3431
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
3432
|
+
*/
|
3433
|
+
class ApplicationModule extends base_1$j.Base {
|
3434
|
+
/**
|
3435
|
+
* Asynchronously returns an API handle for the given Application identity.
|
3436
|
+
*
|
3437
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3438
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3439
|
+
* for an Application throughout its entire lifecycle.
|
3440
|
+
*
|
3441
|
+
* @example
|
3442
|
+
*
|
3443
|
+
* ```js
|
3444
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
3445
|
+
* .then(app => app.isRunning())
|
3446
|
+
* .then(running => console.log('Application is running: ' + running))
|
3447
|
+
* .catch(err => console.log(err));
|
3448
|
+
* ```
|
3449
|
+
*
|
3450
|
+
*/
|
3451
|
+
async wrap(identity) {
|
3452
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
3453
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3454
|
+
});
|
3455
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
3456
|
+
if (errorMsg) {
|
3457
|
+
throw new Error(errorMsg);
|
3458
|
+
}
|
3459
|
+
return new Instance_1$5.Application(this.wire, identity);
|
3460
|
+
}
|
3461
|
+
/**
|
3462
|
+
* Synchronously returns an API handle for the given Application identity.
|
3463
|
+
*
|
3464
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3465
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3466
|
+
* for an Aplication throughout its entire lifecycle.
|
3467
|
+
*
|
3468
|
+
* @example
|
3469
|
+
*
|
3470
|
+
* ```js
|
3471
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
3472
|
+
* await app.close();
|
3473
|
+
* ```
|
3474
|
+
*
|
3475
|
+
*/
|
3476
|
+
wrapSync(identity) {
|
3477
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
3478
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3479
|
+
});
|
3480
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
3481
|
+
if (errorMsg) {
|
3482
|
+
throw new Error(errorMsg);
|
3483
|
+
}
|
3484
|
+
return new Instance_1$5.Application(this.wire, identity);
|
3485
|
+
}
|
3486
|
+
async _create(appOptions) {
|
3487
|
+
// set defaults:
|
3488
|
+
if (appOptions.waitForPageLoad === undefined) {
|
3489
|
+
appOptions.waitForPageLoad = false;
|
3490
|
+
}
|
3491
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
3492
|
+
appOptions.autoShow = true;
|
3493
|
+
}
|
3494
|
+
await this.wire.sendAction('create-application', appOptions);
|
3495
|
+
return this.wrap({ uuid: appOptions.uuid });
|
3496
|
+
}
|
3497
|
+
/**
|
3498
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
3499
|
+
*
|
3500
|
+
* @example
|
3501
|
+
*
|
3502
|
+
* ```js
|
3503
|
+
* async function createApp() {
|
3504
|
+
* const app = await fin.Application.create({
|
3505
|
+
* name: 'myApp',
|
3506
|
+
* uuid: 'app-3',
|
3507
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
3508
|
+
* autoShow: true
|
3509
|
+
* });
|
3510
|
+
* await app.run();
|
3511
|
+
* }
|
3512
|
+
*
|
3513
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
3514
|
+
* ```
|
3515
|
+
*
|
3516
|
+
* @ignore
|
3517
|
+
*/
|
3518
|
+
create(appOptions) {
|
3519
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
3520
|
+
this.wire.sendAction('application-create').catch((e) => {
|
3521
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3522
|
+
});
|
3523
|
+
return this._create(appOptions);
|
3524
|
+
}
|
3525
|
+
/**
|
3526
|
+
* Creates and starts a new Application.
|
3527
|
+
*
|
3528
|
+
* @example
|
3529
|
+
*
|
3530
|
+
* ```js
|
3531
|
+
* async function start() {
|
3532
|
+
* return fin.Application.start({
|
3533
|
+
* name: 'app-1',
|
3534
|
+
* uuid: 'app-1',
|
3535
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
3536
|
+
* autoShow: true
|
3537
|
+
* });
|
3538
|
+
* }
|
3539
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3540
|
+
* ```
|
3541
|
+
*
|
3542
|
+
*/
|
3543
|
+
async start(appOptions) {
|
3544
|
+
this.wire.sendAction('start-application').catch((e) => {
|
3545
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3546
|
+
});
|
3547
|
+
const app = await this._create(appOptions);
|
3548
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
3549
|
+
return app;
|
3550
|
+
}
|
3551
|
+
/**
|
3552
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
3553
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
3554
|
+
* @param opts - Parameters that the RVM will use.
|
3555
|
+
*
|
3556
|
+
* @example
|
3557
|
+
*
|
3558
|
+
* ```js
|
3559
|
+
*
|
3560
|
+
* const applicationInfoArray = [
|
3561
|
+
* {
|
3562
|
+
* "uuid": 'App-1',
|
3563
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
3564
|
+
* },
|
3565
|
+
* {
|
3566
|
+
* "uuid": 'App-2',
|
3567
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
3568
|
+
* },
|
3569
|
+
* {
|
3570
|
+
* "uuid": 'App-3',
|
3571
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
3572
|
+
* }
|
3573
|
+
* ]
|
3574
|
+
*
|
3575
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
3576
|
+
* .then(() => {
|
3577
|
+
* console.log('RVM has finished launching the application list.');
|
3578
|
+
* })
|
3579
|
+
* .catch((err) => {
|
3580
|
+
* console.log(err);
|
3581
|
+
* })
|
3582
|
+
* ```
|
3583
|
+
*
|
3584
|
+
* @experimental
|
3585
|
+
*/
|
3586
|
+
async startManyManifests(applications, opts) {
|
3587
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
3588
|
+
}
|
3589
|
+
/**
|
3590
|
+
* Asynchronously returns an Application object that represents the current application
|
3591
|
+
*
|
3592
|
+
* @example
|
3593
|
+
*
|
3594
|
+
* ```js
|
3595
|
+
* async function isCurrentAppRunning () {
|
3596
|
+
* const app = await fin.Application.getCurrent();
|
3597
|
+
* return app.isRunning();
|
3598
|
+
* }
|
3599
|
+
*
|
3600
|
+
* isCurrentAppRunning().then(running => {
|
3601
|
+
* console.log(`Current app is running: ${running}`);
|
3602
|
+
* }).catch(err => {
|
3603
|
+
* console.error(err);
|
3604
|
+
* });
|
3605
|
+
*
|
3606
|
+
* ```
|
3607
|
+
*/
|
3608
|
+
getCurrent() {
|
3609
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
3610
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3611
|
+
});
|
3612
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
3613
|
+
}
|
3614
|
+
/**
|
3615
|
+
* Synchronously returns an Application object that represents the current application
|
3616
|
+
*
|
3617
|
+
* @example
|
3618
|
+
*
|
3619
|
+
* ```js
|
3620
|
+
* async function isCurrentAppRunning () {
|
3621
|
+
* const app = fin.Application.getCurrentSync();
|
3622
|
+
* return app.isRunning();
|
3623
|
+
* }
|
3624
|
+
*
|
3625
|
+
* isCurrentAppRunning().then(running => {
|
3626
|
+
* console.log(`Current app is running: ${running}`);
|
3627
|
+
* }).catch(err => {
|
3628
|
+
* console.error(err);
|
3629
|
+
* });
|
3630
|
+
*
|
3631
|
+
* ```
|
3632
|
+
*/
|
3633
|
+
getCurrentSync() {
|
3634
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
3635
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3636
|
+
});
|
3637
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
3638
|
+
}
|
3639
|
+
/**
|
3640
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
3641
|
+
* @param manifestUrl - The URL of app's manifest.
|
3642
|
+
* @param opts - Parameters that the RVM will use.
|
3643
|
+
*
|
3644
|
+
* @example
|
3645
|
+
*
|
3646
|
+
* ```js
|
3647
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3648
|
+
*
|
3649
|
+
* // For a local manifest file:
|
3650
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3651
|
+
* ```
|
3652
|
+
*/
|
3653
|
+
async startFromManifest(manifestUrl, opts) {
|
3654
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
3655
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3656
|
+
});
|
3657
|
+
const app = await this._createFromManifest(manifestUrl);
|
3658
|
+
// @ts-expect-error using private method without warning.
|
3659
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
3660
|
+
return app;
|
3661
|
+
}
|
3662
|
+
/**
|
3663
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
3664
|
+
* Retrieves application's manifest and returns a wrapped application.
|
3665
|
+
* @param manifestUrl - The URL of app's manifest.
|
3666
|
+
* @param callback - called if the method succeeds.
|
3667
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
3668
|
+
*
|
3669
|
+
* @example
|
3670
|
+
*
|
3671
|
+
* ```js
|
3672
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
3673
|
+
* ```
|
3674
|
+
* @ignore
|
3675
|
+
*/
|
3676
|
+
createFromManifest(manifestUrl) {
|
3677
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
3678
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
3679
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3680
|
+
});
|
3681
|
+
return this._createFromManifest(manifestUrl);
|
3682
|
+
}
|
3683
|
+
_createFromManifest(manifestUrl) {
|
3684
|
+
return this.wire
|
3685
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
3686
|
+
.then(({ payload }) => {
|
3687
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
3688
|
+
return this.wrap({ uuid });
|
3689
|
+
})
|
3690
|
+
.then((app) => {
|
3691
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
3692
|
+
return app;
|
3693
|
+
});
|
3694
|
+
}
|
3430
3695
|
}
|
3696
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
3431
3697
|
|
3432
|
-
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
|
3439
|
-
|
3440
|
-
|
3441
|
-
|
3698
|
+
(function (exports) {
|
3699
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3700
|
+
if (k2 === undefined) k2 = k;
|
3701
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
3702
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
3703
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
3704
|
+
}
|
3705
|
+
Object.defineProperty(o, k2, desc);
|
3706
|
+
}) : (function(o, m, k, k2) {
|
3707
|
+
if (k2 === undefined) k2 = k;
|
3708
|
+
o[k2] = m[k];
|
3709
|
+
}));
|
3710
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
3711
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3712
|
+
};
|
3713
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3442
3714
|
/**
|
3443
|
-
*
|
3715
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
3716
|
+
*
|
3717
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
3718
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
3719
|
+
*
|
3720
|
+
* 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),
|
3721
|
+
* both of these were documented on the same page.
|
3722
|
+
*
|
3723
|
+
* @packageDocumentation
|
3444
3724
|
*/
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
*
|
3449
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3450
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3451
|
-
* for an Application throughout its entire lifecycle.
|
3452
|
-
*
|
3453
|
-
* @example
|
3454
|
-
*
|
3455
|
-
* ```js
|
3456
|
-
* fin.Application.wrap({ uuid: 'testapp' })
|
3457
|
-
* .then(app => app.isRunning())
|
3458
|
-
* .then(running => console.log('Application is running: ' + running))
|
3459
|
-
* .catch(err => console.log(err));
|
3460
|
-
* ```
|
3461
|
-
*
|
3462
|
-
*/
|
3463
|
-
async wrap(identity) {
|
3464
|
-
this.wire.sendAction('wrap-application').catch((e) => {
|
3465
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3466
|
-
});
|
3467
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3468
|
-
if (errorMsg) {
|
3469
|
-
throw new Error(errorMsg);
|
3470
|
-
}
|
3471
|
-
return new Instance_1.Application(this.wire, identity);
|
3472
|
-
}
|
3473
|
-
/**
|
3474
|
-
* Synchronously returns an API handle for the given Application identity.
|
3475
|
-
*
|
3476
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3477
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3478
|
-
* for an Aplication throughout its entire lifecycle.
|
3479
|
-
*
|
3480
|
-
* @example
|
3481
|
-
*
|
3482
|
-
* ```js
|
3483
|
-
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
3484
|
-
* await app.close();
|
3485
|
-
* ```
|
3486
|
-
*
|
3487
|
-
*/
|
3488
|
-
wrapSync(identity) {
|
3489
|
-
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
3490
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3491
|
-
});
|
3492
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3493
|
-
if (errorMsg) {
|
3494
|
-
throw new Error(errorMsg);
|
3495
|
-
}
|
3496
|
-
return new Instance_1.Application(this.wire, identity);
|
3497
|
-
}
|
3498
|
-
async _create(appOptions) {
|
3499
|
-
// set defaults:
|
3500
|
-
if (appOptions.waitForPageLoad === undefined) {
|
3501
|
-
appOptions.waitForPageLoad = false;
|
3502
|
-
}
|
3503
|
-
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
3504
|
-
appOptions.autoShow = true;
|
3505
|
-
}
|
3506
|
-
await this.wire.sendAction('create-application', appOptions);
|
3507
|
-
return this.wrap({ uuid: appOptions.uuid });
|
3508
|
-
}
|
3509
|
-
/**
|
3510
|
-
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
3511
|
-
*
|
3512
|
-
* @example
|
3513
|
-
*
|
3514
|
-
* ```js
|
3515
|
-
* async function createApp() {
|
3516
|
-
* const app = await fin.Application.create({
|
3517
|
-
* name: 'myApp',
|
3518
|
-
* uuid: 'app-3',
|
3519
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
3520
|
-
* autoShow: true
|
3521
|
-
* });
|
3522
|
-
* await app.run();
|
3523
|
-
* }
|
3524
|
-
*
|
3525
|
-
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
3526
|
-
* ```
|
3527
|
-
*
|
3528
|
-
* @ignore
|
3529
|
-
*/
|
3530
|
-
create(appOptions) {
|
3531
|
-
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
3532
|
-
this.wire.sendAction('application-create').catch((e) => {
|
3533
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3534
|
-
});
|
3535
|
-
return this._create(appOptions);
|
3536
|
-
}
|
3537
|
-
/**
|
3538
|
-
* Creates and starts a new Application.
|
3539
|
-
*
|
3540
|
-
* @example
|
3541
|
-
*
|
3542
|
-
* ```js
|
3543
|
-
* async function start() {
|
3544
|
-
* return fin.Application.start({
|
3545
|
-
* name: 'app-1',
|
3546
|
-
* uuid: 'app-1',
|
3547
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
3548
|
-
* autoShow: true
|
3549
|
-
* });
|
3550
|
-
* }
|
3551
|
-
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3552
|
-
* ```
|
3553
|
-
*
|
3554
|
-
*/
|
3555
|
-
async start(appOptions) {
|
3556
|
-
this.wire.sendAction('start-application').catch((e) => {
|
3557
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3558
|
-
});
|
3559
|
-
const app = await this._create(appOptions);
|
3560
|
-
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
3561
|
-
return app;
|
3562
|
-
}
|
3563
|
-
/**
|
3564
|
-
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
3565
|
-
* Returns once the RVM is finished attempting to launch the applications.
|
3566
|
-
* @param opts - Parameters that the RVM will use.
|
3567
|
-
*
|
3568
|
-
* @example
|
3569
|
-
*
|
3570
|
-
* ```js
|
3571
|
-
*
|
3572
|
-
* const applicationInfoArray = [
|
3573
|
-
* {
|
3574
|
-
* "uuid": 'App-1',
|
3575
|
-
* "manifestUrl": 'http://localhost:5555/app1.json',
|
3576
|
-
* },
|
3577
|
-
* {
|
3578
|
-
* "uuid": 'App-2',
|
3579
|
-
* "manifestUrl": 'http://localhost:5555/app2.json',
|
3580
|
-
* },
|
3581
|
-
* {
|
3582
|
-
* "uuid": 'App-3',
|
3583
|
-
* "manifestUrl": 'http://localhost:5555/app3.json',
|
3584
|
-
* }
|
3585
|
-
* ]
|
3586
|
-
*
|
3587
|
-
* fin.Application.startManyManifests(applicationInfoArray)
|
3588
|
-
* .then(() => {
|
3589
|
-
* console.log('RVM has finished launching the application list.');
|
3590
|
-
* })
|
3591
|
-
* .catch((err) => {
|
3592
|
-
* console.log(err);
|
3593
|
-
* })
|
3594
|
-
* ```
|
3595
|
-
*
|
3596
|
-
* @experimental
|
3597
|
-
*/
|
3598
|
-
async startManyManifests(applications, opts) {
|
3599
|
-
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
3600
|
-
}
|
3601
|
-
/**
|
3602
|
-
* Asynchronously returns an Application object that represents the current application
|
3603
|
-
*
|
3604
|
-
* @example
|
3605
|
-
*
|
3606
|
-
* ```js
|
3607
|
-
* async function isCurrentAppRunning () {
|
3608
|
-
* const app = await fin.Application.getCurrent();
|
3609
|
-
* return app.isRunning();
|
3610
|
-
* }
|
3611
|
-
*
|
3612
|
-
* isCurrentAppRunning().then(running => {
|
3613
|
-
* console.log(`Current app is running: ${running}`);
|
3614
|
-
* }).catch(err => {
|
3615
|
-
* console.error(err);
|
3616
|
-
* });
|
3617
|
-
*
|
3618
|
-
* ```
|
3619
|
-
*/
|
3620
|
-
getCurrent() {
|
3621
|
-
this.wire.sendAction('get-current-application').catch((e) => {
|
3622
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3623
|
-
});
|
3624
|
-
return this.wrap({ uuid: this.wire.me.uuid });
|
3625
|
-
}
|
3626
|
-
/**
|
3627
|
-
* Synchronously returns an Application object that represents the current application
|
3628
|
-
*
|
3629
|
-
* @example
|
3630
|
-
*
|
3631
|
-
* ```js
|
3632
|
-
* async function isCurrentAppRunning () {
|
3633
|
-
* const app = fin.Application.getCurrentSync();
|
3634
|
-
* return app.isRunning();
|
3635
|
-
* }
|
3636
|
-
*
|
3637
|
-
* isCurrentAppRunning().then(running => {
|
3638
|
-
* console.log(`Current app is running: ${running}`);
|
3639
|
-
* }).catch(err => {
|
3640
|
-
* console.error(err);
|
3641
|
-
* });
|
3642
|
-
*
|
3643
|
-
* ```
|
3644
|
-
*/
|
3645
|
-
getCurrentSync() {
|
3646
|
-
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
3647
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3648
|
-
});
|
3649
|
-
return this.wrapSync({ uuid: this.wire.me.uuid });
|
3650
|
-
}
|
3651
|
-
/**
|
3652
|
-
* Retrieves application's manifest and returns a running instance of the application.
|
3653
|
-
* @param manifestUrl - The URL of app's manifest.
|
3654
|
-
* @param opts - Parameters that the RVM will use.
|
3655
|
-
*
|
3656
|
-
* @example
|
3657
|
-
*
|
3658
|
-
* ```js
|
3659
|
-
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3660
|
-
*
|
3661
|
-
* // For a local manifest file:
|
3662
|
-
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3663
|
-
* ```
|
3664
|
-
*/
|
3665
|
-
async startFromManifest(manifestUrl, opts) {
|
3666
|
-
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
3667
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3668
|
-
});
|
3669
|
-
const app = await this._createFromManifest(manifestUrl);
|
3670
|
-
// @ts-expect-error using private method without warning.
|
3671
|
-
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
3672
|
-
return app;
|
3673
|
-
}
|
3674
|
-
/**
|
3675
|
-
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
3676
|
-
* Retrieves application's manifest and returns a wrapped application.
|
3677
|
-
* @param manifestUrl - The URL of app's manifest.
|
3678
|
-
* @param callback - called if the method succeeds.
|
3679
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
3680
|
-
*
|
3681
|
-
* @example
|
3682
|
-
*
|
3683
|
-
* ```js
|
3684
|
-
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
3685
|
-
* ```
|
3686
|
-
* @ignore
|
3687
|
-
*/
|
3688
|
-
createFromManifest(manifestUrl) {
|
3689
|
-
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
3690
|
-
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
3691
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3692
|
-
});
|
3693
|
-
return this._createFromManifest(manifestUrl);
|
3694
|
-
}
|
3695
|
-
_createFromManifest(manifestUrl) {
|
3696
|
-
return this.wire
|
3697
|
-
.sendAction('get-application-manifest', { manifestUrl })
|
3698
|
-
.then(({ payload }) => {
|
3699
|
-
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
3700
|
-
return this.wrap({ uuid });
|
3701
|
-
})
|
3702
|
-
.then((app) => {
|
3703
|
-
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
3704
|
-
return app;
|
3705
|
-
});
|
3706
|
-
}
|
3707
|
-
}
|
3708
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
3709
|
-
return Factory$7;
|
3710
|
-
}
|
3711
|
-
|
3712
|
-
var hasRequiredApplication;
|
3713
|
-
|
3714
|
-
function requireApplication () {
|
3715
|
-
if (hasRequiredApplication) return application;
|
3716
|
-
hasRequiredApplication = 1;
|
3717
|
-
(function (exports) {
|
3718
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3719
|
-
if (k2 === undefined) k2 = k;
|
3720
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
3721
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
3722
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
3723
|
-
}
|
3724
|
-
Object.defineProperty(o, k2, desc);
|
3725
|
-
}) : (function(o, m, k, k2) {
|
3726
|
-
if (k2 === undefined) k2 = k;
|
3727
|
-
o[k2] = m[k];
|
3728
|
-
}));
|
3729
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
3730
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3731
|
-
};
|
3732
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3733
|
-
/**
|
3734
|
-
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
3735
|
-
*
|
3736
|
-
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
3737
|
-
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
3738
|
-
*
|
3739
|
-
* 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),
|
3740
|
-
* both of these were documented on the same page.
|
3741
|
-
*
|
3742
|
-
* @packageDocumentation
|
3743
|
-
*/
|
3744
|
-
__exportStar(requireFactory$2(), exports);
|
3745
|
-
__exportStar(requireInstance$1(), exports);
|
3746
|
-
} (application));
|
3747
|
-
return application;
|
3748
|
-
}
|
3725
|
+
__exportStar(Factory$7, exports);
|
3726
|
+
__exportStar(Instance$6, exports);
|
3727
|
+
} (application));
|
3749
3728
|
|
3750
3729
|
var promisifySubscription$1 = {};
|
3751
3730
|
|
@@ -3789,7 +3768,7 @@ function requireInstance () {
|
|
3789
3768
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
3790
3769
|
/* eslint-disable no-console */
|
3791
3770
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
3792
|
-
const application_1 =
|
3771
|
+
const application_1 = application;
|
3793
3772
|
const main_1 = main;
|
3794
3773
|
const view_1 = requireView();
|
3795
3774
|
const warnings_1 = warnings;
|
@@ -12442,6 +12421,10 @@ class LayoutModule extends base_1$4.Base {
|
|
12442
12421
|
if (!allowedErrors.some((m) => e.message.includes(m))) {
|
12443
12422
|
throw e;
|
12444
12423
|
}
|
12424
|
+
// If a view is attached to provider window, return null
|
12425
|
+
if (layoutWindowIdentity.uuid === layoutWindowIdentity.name) {
|
12426
|
+
throw new Error(`View identity ${JSON.stringify(viewIdentity)} is not attached to any layout in provider window ${JSON.stringify(layoutWindowIdentity)}.`);
|
12427
|
+
}
|
12445
12428
|
// fallback logic for missing endpoint in older runtimes
|
12446
12429
|
return this.wrapSync(layoutWindowIdentity);
|
12447
12430
|
}
|
@@ -17072,7 +17055,7 @@ const events_1$3 = require$$0;
|
|
17072
17055
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
17073
17056
|
const index_1 = system;
|
17074
17057
|
const index_2 = requireWindow();
|
17075
|
-
const index_3 =
|
17058
|
+
const index_3 = application;
|
17076
17059
|
const index_4 = interappbus;
|
17077
17060
|
const index_5 = clipboard;
|
17078
17061
|
const index_6 = externalApplication;
|