@openfin/node-adapter 38.83.85 → 38.83.86
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/node-adapter.js +1119 -1140
- package/package.json +2 -2
package/out/node-adapter.js
CHANGED
@@ -456,11 +456,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
456
456
|
};
|
457
457
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
458
458
|
|
459
|
-
var hasRequiredFactory$
|
459
|
+
var hasRequiredFactory$2;
|
460
460
|
|
461
|
-
function requireFactory$
|
462
|
-
if (hasRequiredFactory$
|
463
|
-
hasRequiredFactory$
|
461
|
+
function requireFactory$2 () {
|
462
|
+
if (hasRequiredFactory$2) return Factory$6;
|
463
|
+
hasRequiredFactory$2 = 1;
|
464
464
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
465
465
|
Factory$6.ViewModule = void 0;
|
466
466
|
const base_1 = base;
|
@@ -1339,8 +1339,8 @@ var main = {};
|
|
1339
1339
|
|
1340
1340
|
Object.defineProperty(main, "__esModule", { value: true });
|
1341
1341
|
main.WebContents = void 0;
|
1342
|
-
const base_1$
|
1343
|
-
class WebContents extends base_1$
|
1342
|
+
const base_1$l = base;
|
1343
|
+
class WebContents extends base_1$l.EmitterBase {
|
1344
1344
|
/**
|
1345
1345
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
1346
1346
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
@@ -2406,11 +2406,11 @@ class WebContents extends base_1$j.EmitterBase {
|
|
2406
2406
|
}
|
2407
2407
|
main.WebContents = WebContents;
|
2408
2408
|
|
2409
|
-
var hasRequiredInstance$
|
2409
|
+
var hasRequiredInstance$1;
|
2410
2410
|
|
2411
|
-
function requireInstance$
|
2412
|
-
if (hasRequiredInstance$
|
2413
|
-
hasRequiredInstance$
|
2411
|
+
function requireInstance$1 () {
|
2412
|
+
if (hasRequiredInstance$1) return Instance$5;
|
2413
|
+
hasRequiredInstance$1 = 1;
|
2414
2414
|
var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
2415
2415
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
2416
2416
|
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");
|
@@ -3022,1141 +3022,1120 @@ function requireView () {
|
|
3022
3022
|
*
|
3023
3023
|
* @packageDocumentation
|
3024
3024
|
*/
|
3025
|
-
__exportStar(requireFactory$
|
3026
|
-
__exportStar(requireInstance$
|
3025
|
+
__exportStar(requireFactory$2(), exports);
|
3026
|
+
__exportStar(requireInstance$1(), exports);
|
3027
3027
|
} (view));
|
3028
3028
|
return view;
|
3029
3029
|
}
|
3030
3030
|
|
3031
|
-
|
3032
|
-
|
3033
|
-
|
3034
|
-
|
3035
|
-
|
3036
|
-
|
3037
|
-
|
3038
|
-
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
|
3045
|
-
|
3046
|
-
|
3047
|
-
|
3048
|
-
|
3049
|
-
|
3050
|
-
|
3051
|
-
|
3052
|
-
|
3053
|
-
|
3054
|
-
|
3055
|
-
|
3056
|
-
|
3057
|
-
|
3058
|
-
|
3059
|
-
|
3060
|
-
|
3061
|
-
|
3062
|
-
|
3063
|
-
|
3064
|
-
|
3065
|
-
|
3066
|
-
|
3067
|
-
|
3068
|
-
|
3069
|
-
|
3070
|
-
|
3071
|
-
|
3072
|
-
|
3073
|
-
|
3074
|
-
|
3075
|
-
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3081
|
-
|
3082
|
-
|
3083
|
-
|
3084
|
-
|
3085
|
-
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
|
3146
|
-
|
3147
|
-
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
|
3182
|
-
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3297
|
-
|
3298
|
-
|
3299
|
-
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3304
|
-
|
3305
|
-
|
3306
|
-
|
3307
|
-
|
3308
|
-
|
3309
|
-
|
3310
|
-
|
3311
|
-
|
3312
|
-
|
3313
|
-
|
3314
|
-
|
3315
|
-
|
3316
|
-
|
3317
|
-
|
3318
|
-
|
3319
|
-
|
3320
|
-
|
3321
|
-
|
3322
|
-
|
3323
|
-
|
3324
|
-
|
3325
|
-
|
3326
|
-
|
3327
|
-
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3338
|
-
|
3339
|
-
|
3340
|
-
|
3341
|
-
|
3342
|
-
|
3343
|
-
|
3344
|
-
|
3345
|
-
|
3346
|
-
|
3347
|
-
|
3348
|
-
|
3349
|
-
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3353
|
-
|
3354
|
-
|
3355
|
-
|
3356
|
-
|
3357
|
-
|
3358
|
-
|
3359
|
-
|
3360
|
-
|
3361
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
|
3365
|
-
|
3366
|
-
|
3367
|
-
|
3368
|
-
|
3369
|
-
|
3370
|
-
|
3371
|
-
|
3372
|
-
|
3373
|
-
|
3374
|
-
|
3375
|
-
|
3376
|
-
|
3377
|
-
|
3378
|
-
|
3379
|
-
|
3380
|
-
|
3381
|
-
|
3382
|
-
|
3383
|
-
|
3384
|
-
|
3385
|
-
|
3386
|
-
|
3387
|
-
|
3388
|
-
|
3389
|
-
|
3390
|
-
|
3391
|
-
|
3392
|
-
|
3393
|
-
|
3394
|
-
|
3395
|
-
|
3396
|
-
|
3397
|
-
|
3398
|
-
|
3399
|
-
|
3400
|
-
|
3401
|
-
|
3402
|
-
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
|
3407
|
-
|
3408
|
-
|
3409
|
-
|
3410
|
-
|
3411
|
-
|
3412
|
-
|
3413
|
-
|
3414
|
-
|
3415
|
-
|
3416
|
-
|
3417
|
-
|
3418
|
-
|
3419
|
-
|
3420
|
-
|
3421
|
-
|
3422
|
-
|
3423
|
-
|
3424
|
-
|
3425
|
-
|
3426
|
-
|
3427
|
-
|
3428
|
-
|
3429
|
-
|
3430
|
-
|
3431
|
-
|
3432
|
-
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
|
3439
|
-
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
|
3456
|
-
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
|
3461
|
-
|
3462
|
-
|
3463
|
-
|
3464
|
-
|
3465
|
-
|
3466
|
-
|
3467
|
-
|
3468
|
-
|
3469
|
-
|
3470
|
-
|
3471
|
-
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3475
|
-
|
3476
|
-
|
3477
|
-
|
3478
|
-
|
3479
|
-
|
3480
|
-
|
3481
|
-
|
3482
|
-
|
3483
|
-
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
3487
|
-
|
3488
|
-
|
3489
|
-
|
3490
|
-
|
3491
|
-
|
3492
|
-
|
3493
|
-
|
3494
|
-
|
3495
|
-
|
3496
|
-
|
3497
|
-
|
3498
|
-
|
3499
|
-
|
3500
|
-
|
3501
|
-
|
3502
|
-
|
3503
|
-
|
3504
|
-
|
3505
|
-
|
3506
|
-
|
3507
|
-
|
3508
|
-
|
3509
|
-
|
3510
|
-
|
3511
|
-
|
3512
|
-
|
3513
|
-
|
3514
|
-
|
3515
|
-
|
3516
|
-
|
3517
|
-
|
3518
|
-
|
3519
|
-
|
3520
|
-
|
3521
|
-
|
3522
|
-
|
3523
|
-
|
3524
|
-
|
3525
|
-
|
3526
|
-
|
3527
|
-
|
3528
|
-
|
3529
|
-
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3535
|
-
|
3536
|
-
|
3537
|
-
|
3538
|
-
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
|
3543
|
-
|
3544
|
-
|
3545
|
-
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3549
|
-
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3553
|
-
|
3554
|
-
|
3555
|
-
|
3556
|
-
|
3557
|
-
|
3558
|
-
|
3559
|
-
|
3560
|
-
|
3561
|
-
|
3562
|
-
|
3563
|
-
|
3564
|
-
|
3565
|
-
|
3566
|
-
|
3567
|
-
|
3568
|
-
|
3569
|
-
|
3570
|
-
|
3571
|
-
|
3572
|
-
|
3573
|
-
|
3574
|
-
|
3575
|
-
|
3576
|
-
|
3577
|
-
|
3578
|
-
|
3579
|
-
|
3580
|
-
|
3581
|
-
|
3582
|
-
|
3583
|
-
|
3584
|
-
|
3585
|
-
|
3586
|
-
|
3587
|
-
|
3588
|
-
|
3589
|
-
|
3590
|
-
|
3591
|
-
|
3592
|
-
|
3593
|
-
|
3594
|
-
|
3595
|
-
|
3596
|
-
|
3597
|
-
|
3598
|
-
|
3599
|
-
|
3600
|
-
|
3601
|
-
|
3602
|
-
|
3603
|
-
|
3604
|
-
|
3605
|
-
|
3606
|
-
|
3607
|
-
|
3608
|
-
|
3609
|
-
|
3610
|
-
|
3611
|
-
|
3612
|
-
|
3613
|
-
|
3614
|
-
|
3615
|
-
|
3616
|
-
|
3617
|
-
|
3618
|
-
|
3619
|
-
|
3620
|
-
|
3621
|
-
|
3622
|
-
|
3623
|
-
|
3624
|
-
|
3625
|
-
|
3626
|
-
|
3627
|
-
|
3628
|
-
|
3629
|
-
|
3630
|
-
|
3631
|
-
|
3632
|
-
|
3633
|
-
|
3634
|
-
|
3635
|
-
|
3636
|
-
|
3637
|
-
|
3638
|
-
|
3639
|
-
|
3640
|
-
|
3641
|
-
|
3642
|
-
|
3643
|
-
|
3644
|
-
|
3645
|
-
|
3646
|
-
|
3647
|
-
|
3648
|
-
|
3649
|
-
|
3650
|
-
|
3651
|
-
|
3652
|
-
|
3653
|
-
|
3654
|
-
|
3655
|
-
|
3656
|
-
|
3657
|
-
|
3658
|
-
|
3659
|
-
|
3660
|
-
|
3661
|
-
|
3662
|
-
|
3663
|
-
|
3664
|
-
|
3665
|
-
|
3666
|
-
|
3667
|
-
|
3668
|
-
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
3672
|
-
|
3673
|
-
|
3674
|
-
|
3675
|
-
|
3676
|
-
|
3677
|
-
|
3678
|
-
|
3679
|
-
|
3680
|
-
|
3681
|
-
|
3682
|
-
|
3683
|
-
|
3684
|
-
|
3685
|
-
|
3686
|
-
|
3687
|
-
|
3688
|
-
|
3689
|
-
|
3690
|
-
|
3691
|
-
|
3692
|
-
|
3693
|
-
|
3694
|
-
|
3695
|
-
|
3696
|
-
|
3697
|
-
|
3698
|
-
|
3699
|
-
|
3700
|
-
|
3701
|
-
|
3702
|
-
|
3703
|
-
|
3704
|
-
|
3705
|
-
|
3706
|
-
|
3707
|
-
|
3708
|
-
|
3709
|
-
|
3710
|
-
|
3711
|
-
|
3712
|
-
|
3713
|
-
|
3714
|
-
|
3715
|
-
|
3716
|
-
|
3717
|
-
|
3718
|
-
|
3719
|
-
|
3720
|
-
|
3721
|
-
|
3722
|
-
|
3723
|
-
|
3724
|
-
|
3725
|
-
|
3726
|
-
|
3727
|
-
|
3728
|
-
|
3729
|
-
|
3730
|
-
|
3731
|
-
|
3732
|
-
|
3733
|
-
|
3734
|
-
|
3735
|
-
|
3736
|
-
|
3737
|
-
|
3738
|
-
|
3739
|
-
|
3740
|
-
|
3741
|
-
|
3742
|
-
|
3743
|
-
|
3744
|
-
|
3745
|
-
|
3746
|
-
|
3747
|
-
|
3748
|
-
|
3749
|
-
|
3750
|
-
|
3751
|
-
|
3752
|
-
|
3753
|
-
|
3754
|
-
|
3755
|
-
|
3756
|
-
|
3757
|
-
|
3758
|
-
|
3759
|
-
|
3760
|
-
|
3761
|
-
|
3762
|
-
|
3763
|
-
|
3764
|
-
|
3765
|
-
|
3766
|
-
|
3767
|
-
|
3768
|
-
|
3769
|
-
|
3770
|
-
|
3771
|
-
|
3772
|
-
|
3773
|
-
|
3774
|
-
|
3775
|
-
|
3776
|
-
|
3777
|
-
|
3778
|
-
|
3779
|
-
|
3780
|
-
|
3781
|
-
|
3782
|
-
|
3783
|
-
|
3784
|
-
|
3785
|
-
|
3786
|
-
|
3787
|
-
|
3788
|
-
|
3789
|
-
|
3790
|
-
|
3791
|
-
|
3792
|
-
|
3793
|
-
|
3794
|
-
|
3795
|
-
|
3796
|
-
|
3797
|
-
|
3798
|
-
|
3799
|
-
|
3800
|
-
|
3801
|
-
|
3802
|
-
|
3803
|
-
|
3804
|
-
|
3805
|
-
|
3806
|
-
|
3807
|
-
|
3808
|
-
|
3809
|
-
|
3810
|
-
|
3811
|
-
|
3812
|
-
|
3813
|
-
|
3814
|
-
|
3815
|
-
|
3816
|
-
|
3817
|
-
|
3818
|
-
|
3819
|
-
|
3820
|
-
|
3821
|
-
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
|
3826
|
-
|
3827
|
-
|
3828
|
-
|
3829
|
-
|
3830
|
-
|
3831
|
-
|
3832
|
-
|
3833
|
-
|
3834
|
-
|
3835
|
-
|
3836
|
-
|
3837
|
-
|
3838
|
-
|
3839
|
-
|
3840
|
-
|
3031
|
+
Object.defineProperty(Instance$6, "__esModule", { value: true });
|
3032
|
+
Instance$6.Application = void 0;
|
3033
|
+
/* eslint-disable import/prefer-default-export */
|
3034
|
+
const base_1$k = base;
|
3035
|
+
const window_1$1 = requireWindow();
|
3036
|
+
const view_1 = requireView();
|
3037
|
+
/**
|
3038
|
+
* An object representing an application. Allows the developer to create,
|
3039
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
3040
|
+
*/
|
3041
|
+
class Application extends base_1$k.EmitterBase {
|
3042
|
+
/**
|
3043
|
+
* @internal
|
3044
|
+
*/
|
3045
|
+
constructor(wire, identity) {
|
3046
|
+
super(wire, 'application', identity.uuid);
|
3047
|
+
this.identity = identity;
|
3048
|
+
this.window = new window_1$1._Window(this.wire, {
|
3049
|
+
uuid: this.identity.uuid,
|
3050
|
+
name: this.identity.uuid
|
3051
|
+
});
|
3052
|
+
}
|
3053
|
+
windowListFromIdentityList(identityList) {
|
3054
|
+
const windowList = [];
|
3055
|
+
identityList.forEach((identity) => {
|
3056
|
+
windowList.push(new window_1$1._Window(this.wire, {
|
3057
|
+
uuid: identity.uuid,
|
3058
|
+
name: identity.name
|
3059
|
+
}));
|
3060
|
+
});
|
3061
|
+
return windowList;
|
3062
|
+
}
|
3063
|
+
/**
|
3064
|
+
* Determines if the application is currently running.
|
3065
|
+
*
|
3066
|
+
* @example
|
3067
|
+
*
|
3068
|
+
* ```js
|
3069
|
+
* async function isAppRunning() {
|
3070
|
+
* const app = await fin.Application.getCurrent();
|
3071
|
+
* return await app.isRunning();
|
3072
|
+
* }
|
3073
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
3074
|
+
* ```
|
3075
|
+
*/
|
3076
|
+
isRunning() {
|
3077
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
3078
|
+
}
|
3079
|
+
/**
|
3080
|
+
* Closes the application and any child windows created by the application.
|
3081
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
3082
|
+
* @param force Close will be prevented from closing when force is false and
|
3083
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
3084
|
+
*
|
3085
|
+
* @example
|
3086
|
+
*
|
3087
|
+
* ```js
|
3088
|
+
* async function closeApp() {
|
3089
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
3090
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
3091
|
+
* await app.quit();
|
3092
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
3093
|
+
*
|
3094
|
+
* }
|
3095
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
3096
|
+
* ```
|
3097
|
+
*/
|
3098
|
+
async quit(force = false) {
|
3099
|
+
try {
|
3100
|
+
await this._close(force);
|
3101
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
3102
|
+
}
|
3103
|
+
catch (error) {
|
3104
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
3105
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
3106
|
+
throw error;
|
3107
|
+
}
|
3108
|
+
}
|
3109
|
+
}
|
3110
|
+
async _close(force = false) {
|
3111
|
+
try {
|
3112
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
3113
|
+
}
|
3114
|
+
catch (error) {
|
3115
|
+
if (!error.message.includes('Remote connection has closed')) {
|
3116
|
+
throw error;
|
3117
|
+
}
|
3118
|
+
}
|
3119
|
+
}
|
3120
|
+
/**
|
3121
|
+
* @deprecated use Application.quit instead
|
3122
|
+
* Closes the application and any child windows created by the application.
|
3123
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
3124
|
+
* @param callback - called if the method succeeds.
|
3125
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
3126
|
+
*
|
3127
|
+
* @example
|
3128
|
+
*
|
3129
|
+
* ```js
|
3130
|
+
* async function closeApp() {
|
3131
|
+
* const app = await fin.Application.getCurrent();
|
3132
|
+
* return await app.close();
|
3133
|
+
* }
|
3134
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
3135
|
+
* ```
|
3136
|
+
*/
|
3137
|
+
close(force = false) {
|
3138
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
3139
|
+
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
3140
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3141
|
+
});
|
3142
|
+
return this._close(force);
|
3143
|
+
}
|
3144
|
+
/**
|
3145
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
3146
|
+
*
|
3147
|
+
* @example
|
3148
|
+
*
|
3149
|
+
* ```js
|
3150
|
+
* async function getChildWindows() {
|
3151
|
+
* const app = await fin.Application.getCurrent();
|
3152
|
+
* return await app.getChildWindows();
|
3153
|
+
* }
|
3154
|
+
*
|
3155
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
3156
|
+
* ```
|
3157
|
+
*/
|
3158
|
+
getChildWindows() {
|
3159
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
3160
|
+
const identityList = [];
|
3161
|
+
payload.data.forEach((winName) => {
|
3162
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
3163
|
+
});
|
3164
|
+
return this.windowListFromIdentityList(identityList);
|
3165
|
+
});
|
3166
|
+
}
|
3167
|
+
/**
|
3168
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
3169
|
+
* if the application was not created from a manifest.
|
3170
|
+
*
|
3171
|
+
* @example
|
3172
|
+
*
|
3173
|
+
* ```js
|
3174
|
+
* async function getManifest() {
|
3175
|
+
* const app = await fin.Application.getCurrent();
|
3176
|
+
* return await app.getManifest();
|
3177
|
+
* }
|
3178
|
+
*
|
3179
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
3180
|
+
* ```
|
3181
|
+
*/
|
3182
|
+
getManifest() {
|
3183
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
3184
|
+
}
|
3185
|
+
/**
|
3186
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
3187
|
+
* if the application was created from a manifest.
|
3188
|
+
*
|
3189
|
+
* @example
|
3190
|
+
*
|
3191
|
+
* ```js
|
3192
|
+
* async function getParentUuid() {
|
3193
|
+
* const app = await fin.Application.start({
|
3194
|
+
* uuid: 'app-1',
|
3195
|
+
* name: 'myApp',
|
3196
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
3197
|
+
* autoShow: true
|
3198
|
+
* });
|
3199
|
+
* return await app.getParentUuid();
|
3200
|
+
* }
|
3201
|
+
*
|
3202
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
3203
|
+
* ```
|
3204
|
+
*/
|
3205
|
+
getParentUuid() {
|
3206
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
3207
|
+
}
|
3208
|
+
/**
|
3209
|
+
* Retrieves current application's shortcut configuration.
|
3210
|
+
*
|
3211
|
+
* @example
|
3212
|
+
*
|
3213
|
+
* ```js
|
3214
|
+
* async function getShortcuts() {
|
3215
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3216
|
+
* return await app.getShortcuts();
|
3217
|
+
* }
|
3218
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
3219
|
+
* ```
|
3220
|
+
*/
|
3221
|
+
getShortcuts() {
|
3222
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
3223
|
+
}
|
3224
|
+
/**
|
3225
|
+
* Retrieves current application's views.
|
3226
|
+
* @experimental
|
3227
|
+
*
|
3228
|
+
* @example
|
3229
|
+
*
|
3230
|
+
* ```js
|
3231
|
+
* async function getViews() {
|
3232
|
+
* const app = await fin.Application.getCurrent();
|
3233
|
+
* return await app.getViews();
|
3234
|
+
* }
|
3235
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
3236
|
+
* ```
|
3237
|
+
*/
|
3238
|
+
async getViews() {
|
3239
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
3240
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
3241
|
+
}
|
3242
|
+
/**
|
3243
|
+
* Returns the current zoom level of the application.
|
3244
|
+
*
|
3245
|
+
* @example
|
3246
|
+
*
|
3247
|
+
* ```js
|
3248
|
+
* async function getZoomLevel() {
|
3249
|
+
* const app = await fin.Application.getCurrent();
|
3250
|
+
* return await app.getZoomLevel();
|
3251
|
+
* }
|
3252
|
+
*
|
3253
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
3254
|
+
* ```
|
3255
|
+
*/
|
3256
|
+
getZoomLevel() {
|
3257
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
3258
|
+
}
|
3259
|
+
/**
|
3260
|
+
* Returns an instance of the main Window of the application
|
3261
|
+
*
|
3262
|
+
* @example
|
3263
|
+
*
|
3264
|
+
* ```js
|
3265
|
+
* async function getWindow() {
|
3266
|
+
* const app = await fin.Application.start({
|
3267
|
+
* uuid: 'app-1',
|
3268
|
+
* name: 'myApp',
|
3269
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
3270
|
+
* autoShow: true
|
3271
|
+
* });
|
3272
|
+
* return await app.getWindow();
|
3273
|
+
* }
|
3274
|
+
*
|
3275
|
+
* getWindow().then(win => {
|
3276
|
+
* win.showAt(0, 400);
|
3277
|
+
* win.flash();
|
3278
|
+
* }).catch(err => console.log(err));
|
3279
|
+
* ```
|
3280
|
+
*/
|
3281
|
+
getWindow() {
|
3282
|
+
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
3283
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3284
|
+
});
|
3285
|
+
return Promise.resolve(this.window);
|
3286
|
+
}
|
3287
|
+
/**
|
3288
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
3289
|
+
* @param userName - username to be passed to the RVM.
|
3290
|
+
* @param appName - app name to be passed to the RVM.
|
3291
|
+
*
|
3292
|
+
* @example
|
3293
|
+
*
|
3294
|
+
* ```js
|
3295
|
+
* async function registerUser() {
|
3296
|
+
* const app = await fin.Application.getCurrent();
|
3297
|
+
* return await app.registerUser('user', 'myApp');
|
3298
|
+
* }
|
3299
|
+
*
|
3300
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
3301
|
+
* ```
|
3302
|
+
*/
|
3303
|
+
registerUser(userName, appName) {
|
3304
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
3305
|
+
}
|
3306
|
+
/**
|
3307
|
+
* Removes the application’s icon from the tray.
|
3308
|
+
*
|
3309
|
+
* @example
|
3310
|
+
*
|
3311
|
+
* ```js
|
3312
|
+
* async function removeTrayIcon() {
|
3313
|
+
* const app = await fin.Application.getCurrent();
|
3314
|
+
* return await app.removeTrayIcon();
|
3315
|
+
* }
|
3316
|
+
*
|
3317
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
3318
|
+
* ```
|
3319
|
+
*/
|
3320
|
+
removeTrayIcon() {
|
3321
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
3322
|
+
}
|
3323
|
+
/**
|
3324
|
+
* Restarts the application.
|
3325
|
+
*
|
3326
|
+
* @example
|
3327
|
+
*
|
3328
|
+
* ```js
|
3329
|
+
* async function restartApp() {
|
3330
|
+
* const app = await fin.Application.getCurrent();
|
3331
|
+
* return await app.restart();
|
3332
|
+
* }
|
3333
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
3334
|
+
* ```
|
3335
|
+
*/
|
3336
|
+
restart() {
|
3337
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
3338
|
+
}
|
3339
|
+
/**
|
3340
|
+
* DEPRECATED method to run the application.
|
3341
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
3342
|
+
*
|
3343
|
+
* @example
|
3344
|
+
*
|
3345
|
+
* ```js
|
3346
|
+
* async function run() {
|
3347
|
+
* const app = await fin.Application.create({
|
3348
|
+
* name: 'myApp',
|
3349
|
+
* uuid: 'app-1',
|
3350
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
3351
|
+
* autoShow: true
|
3352
|
+
* });
|
3353
|
+
* await app.run();
|
3354
|
+
* }
|
3355
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3356
|
+
* ```
|
3357
|
+
*
|
3358
|
+
* @ignore
|
3359
|
+
*/
|
3360
|
+
run() {
|
3361
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
3362
|
+
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
3363
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3364
|
+
});
|
3365
|
+
return this._run();
|
3366
|
+
}
|
3367
|
+
_run(opts = {}) {
|
3368
|
+
return this.wire
|
3369
|
+
.sendAction('run-application', {
|
3370
|
+
manifestUrl: this._manifestUrl,
|
3371
|
+
opts,
|
3372
|
+
...this.identity
|
3373
|
+
})
|
3374
|
+
.then(() => undefined);
|
3375
|
+
}
|
3376
|
+
/**
|
3377
|
+
* Instructs the RVM to schedule one restart of the application.
|
3378
|
+
*
|
3379
|
+
* @example
|
3380
|
+
*
|
3381
|
+
* ```js
|
3382
|
+
* async function scheduleRestart() {
|
3383
|
+
* const app = await fin.Application.getCurrent();
|
3384
|
+
* return await app.scheduleRestart();
|
3385
|
+
* }
|
3386
|
+
*
|
3387
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
3388
|
+
* ```
|
3389
|
+
*/
|
3390
|
+
scheduleRestart() {
|
3391
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
3392
|
+
}
|
3393
|
+
/**
|
3394
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
3395
|
+
* an object containing logId is returned.
|
3396
|
+
*
|
3397
|
+
* @example
|
3398
|
+
*
|
3399
|
+
* ```js
|
3400
|
+
* async function sendLog() {
|
3401
|
+
* const app = await fin.Application.getCurrent();
|
3402
|
+
* return await app.sendApplicationLog();
|
3403
|
+
* }
|
3404
|
+
*
|
3405
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
3406
|
+
* ```
|
3407
|
+
*/
|
3408
|
+
async sendApplicationLog() {
|
3409
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
3410
|
+
return payload.data;
|
3411
|
+
}
|
3412
|
+
/**
|
3413
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
3414
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
3415
|
+
*
|
3416
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
3417
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
3418
|
+
*
|
3419
|
+
*
|
3420
|
+
* @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).
|
3421
|
+
*
|
3422
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
3423
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
3424
|
+
*
|
3425
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
3426
|
+
*
|
3427
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
3428
|
+
* uuid or shortcut.name is changed.
|
3429
|
+
*
|
3430
|
+
* @example
|
3431
|
+
*
|
3432
|
+
* ```js
|
3433
|
+
* const app = fin.Application.getCurrentSync();
|
3434
|
+
* const appName = 'My App';
|
3435
|
+
* const jumpListConfig = [ // array of JumpList categories
|
3436
|
+
* {
|
3437
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
3438
|
+
* items: [ // array of JumpList items
|
3439
|
+
* {
|
3440
|
+
* type: 'task',
|
3441
|
+
* title: `Launch ${appName}`,
|
3442
|
+
* description: `Runs ${appName} with the default configuration`,
|
3443
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
3444
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
3445
|
+
* iconIndex: 0
|
3446
|
+
* },
|
3447
|
+
* { type: 'separator' },
|
3448
|
+
* {
|
3449
|
+
* type: 'task',
|
3450
|
+
* title: `Restore ${appName}`,
|
3451
|
+
* description: 'Restore to last configuration',
|
3452
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
3453
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
3454
|
+
* iconIndex: 0
|
3455
|
+
* },
|
3456
|
+
* ]
|
3457
|
+
* },
|
3458
|
+
* {
|
3459
|
+
* name: 'Tools',
|
3460
|
+
* items: [ // array of JumpList items
|
3461
|
+
* {
|
3462
|
+
* type: 'task',
|
3463
|
+
* title: 'Tool A',
|
3464
|
+
* description: 'Runs Tool A',
|
3465
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
3466
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
3467
|
+
* iconIndex: 0
|
3468
|
+
* },
|
3469
|
+
* {
|
3470
|
+
* type: 'task',
|
3471
|
+
* title: 'Tool B',
|
3472
|
+
* description: 'Runs Tool B',
|
3473
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
3474
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
3475
|
+
* iconIndex: 0
|
3476
|
+
* }]
|
3477
|
+
* }
|
3478
|
+
* ];
|
3479
|
+
*
|
3480
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
3481
|
+
* ```
|
3482
|
+
*
|
3483
|
+
* To handle deeplink args:
|
3484
|
+
* ```js
|
3485
|
+
* function handleUseLastConfiguration() {
|
3486
|
+
* // this handler is called when the app is being launched
|
3487
|
+
* app.on('run-requested', event => {
|
3488
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
3489
|
+
* // your logic here
|
3490
|
+
* }
|
3491
|
+
* });
|
3492
|
+
* // this handler is called when the app was already running when the launch was requested
|
3493
|
+
* fin.desktop.main(function(args) {
|
3494
|
+
* if(args && args['use-last-configuration']) {
|
3495
|
+
* // your logic here
|
3496
|
+
* }
|
3497
|
+
* });
|
3498
|
+
* }
|
3499
|
+
* ```
|
3500
|
+
*/
|
3501
|
+
async setJumpList(jumpListCategories) {
|
3502
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
3503
|
+
}
|
3504
|
+
/**
|
3505
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
3506
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
3507
|
+
*
|
3508
|
+
* @example
|
3509
|
+
*
|
3510
|
+
* ```js
|
3511
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
3512
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
3513
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
3514
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
3515
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
3516
|
+
*
|
3517
|
+
* async function setTrayIcon(icon) {
|
3518
|
+
* const app = await fin.Application.getCurrent();
|
3519
|
+
* return await app.setTrayIcon(icon);
|
3520
|
+
* }
|
3521
|
+
*
|
3522
|
+
* // use image url to set tray icon
|
3523
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3524
|
+
*
|
3525
|
+
* // use base64 encoded string to set tray icon
|
3526
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3527
|
+
*
|
3528
|
+
* // use a dataURL to set tray icon
|
3529
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3530
|
+
* ```
|
3531
|
+
*/
|
3532
|
+
setTrayIcon(icon) {
|
3533
|
+
return this.wire
|
3534
|
+
.sendAction('set-tray-icon', {
|
3535
|
+
enabledIcon: icon,
|
3536
|
+
...this.identity
|
3537
|
+
})
|
3538
|
+
.then(() => undefined);
|
3539
|
+
}
|
3540
|
+
/**
|
3541
|
+
* Sets new application's shortcut configuration. Windows only.
|
3542
|
+
* @param config New application's shortcut configuration.
|
3543
|
+
*
|
3544
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
3545
|
+
* to be able to change shortcut states.
|
3546
|
+
*
|
3547
|
+
* @example
|
3548
|
+
*
|
3549
|
+
* ```js
|
3550
|
+
* async function setShortcuts(config) {
|
3551
|
+
* const app = await fin.Application.getCurrent();
|
3552
|
+
* return app.setShortcuts(config);
|
3553
|
+
* }
|
3554
|
+
*
|
3555
|
+
* setShortcuts({
|
3556
|
+
* desktop: true,
|
3557
|
+
* startMenu: false,
|
3558
|
+
* systemStartup: true
|
3559
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
3560
|
+
* ```
|
3561
|
+
*/
|
3562
|
+
setShortcuts(config) {
|
3563
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
3564
|
+
}
|
3565
|
+
/**
|
3566
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
3567
|
+
* @param queryString The new query string for this app's shortcuts.
|
3568
|
+
*
|
3569
|
+
* @example
|
3570
|
+
*
|
3571
|
+
* ```js
|
3572
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
3573
|
+
* const app = await fin.Application.getCurrent();
|
3574
|
+
* try {
|
3575
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
3576
|
+
* } catch(err) {
|
3577
|
+
* console.error(err)
|
3578
|
+
* }
|
3579
|
+
* ```
|
3580
|
+
*/
|
3581
|
+
async setShortcutQueryParams(queryString) {
|
3582
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
3583
|
+
}
|
3584
|
+
/**
|
3585
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
3586
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
3587
|
+
* @param level The zoom level
|
3588
|
+
*
|
3589
|
+
* @example
|
3590
|
+
*
|
3591
|
+
* ```js
|
3592
|
+
* async function setZoomLevel(number) {
|
3593
|
+
* const app = await fin.Application.getCurrent();
|
3594
|
+
* return await app.setZoomLevel(number);
|
3595
|
+
* }
|
3596
|
+
*
|
3597
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
3598
|
+
* ```
|
3599
|
+
*/
|
3600
|
+
setZoomLevel(level) {
|
3601
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
3602
|
+
}
|
3603
|
+
/**
|
3604
|
+
* Sets a username to correlate with App Log Management.
|
3605
|
+
* @param username Username to correlate with App's Log.
|
3606
|
+
*
|
3607
|
+
* @example
|
3608
|
+
*
|
3609
|
+
* ```js
|
3610
|
+
* async function setAppLogUser() {
|
3611
|
+
* const app = await fin.Application.getCurrent();
|
3612
|
+
* return await app.setAppLogUsername('username');
|
3613
|
+
* }
|
3614
|
+
*
|
3615
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
3616
|
+
*
|
3617
|
+
* ```
|
3618
|
+
*/
|
3619
|
+
async setAppLogUsername(username) {
|
3620
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
3621
|
+
}
|
3622
|
+
/**
|
3623
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
3624
|
+
* @remarks The only information currently returned is the position and dimensions.
|
3625
|
+
*
|
3626
|
+
* @example
|
3627
|
+
*
|
3628
|
+
* ```js
|
3629
|
+
* async function getTrayIconInfo() {
|
3630
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3631
|
+
* return await app.getTrayIconInfo();
|
3632
|
+
* }
|
3633
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3634
|
+
* ```
|
3635
|
+
*/
|
3636
|
+
getTrayIconInfo() {
|
3637
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
3638
|
+
}
|
3639
|
+
/**
|
3640
|
+
* Checks if the application has an associated tray icon.
|
3641
|
+
*
|
3642
|
+
* @example
|
3643
|
+
*
|
3644
|
+
* ```js
|
3645
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3646
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
3647
|
+
* console.log(hasTrayIcon);
|
3648
|
+
* ```
|
3649
|
+
*/
|
3650
|
+
hasTrayIcon() {
|
3651
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
3652
|
+
}
|
3653
|
+
/**
|
3654
|
+
* Closes the application by terminating its process.
|
3655
|
+
*
|
3656
|
+
* @example
|
3657
|
+
*
|
3658
|
+
* ```js
|
3659
|
+
* async function terminateApp() {
|
3660
|
+
* const app = await fin.Application.getCurrent();
|
3661
|
+
* return await app.terminate();
|
3662
|
+
* }
|
3663
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
3664
|
+
* ```
|
3665
|
+
*/
|
3666
|
+
terminate() {
|
3667
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
3668
|
+
}
|
3669
|
+
/**
|
3670
|
+
* Waits for a hanging application. This method can be called in response to an application
|
3671
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
3672
|
+
* message after a certain period of time.
|
3673
|
+
*
|
3674
|
+
* @ignore
|
3675
|
+
*/
|
3676
|
+
wait() {
|
3677
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
3678
|
+
}
|
3679
|
+
/**
|
3680
|
+
* Retrieves information about the application.
|
3681
|
+
*
|
3682
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
3683
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
3684
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
3685
|
+
*
|
3686
|
+
* @example
|
3687
|
+
*
|
3688
|
+
* ```js
|
3689
|
+
* async function getInfo() {
|
3690
|
+
* const app = await fin.Application.getCurrent();
|
3691
|
+
* return await app.getInfo();
|
3692
|
+
* }
|
3693
|
+
*
|
3694
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3695
|
+
* ```
|
3696
|
+
*/
|
3697
|
+
getInfo() {
|
3698
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
3699
|
+
}
|
3700
|
+
/**
|
3701
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
3702
|
+
*
|
3703
|
+
* @example
|
3704
|
+
* ```js
|
3705
|
+
* const app = await fin.Application.getCurrent();
|
3706
|
+
* const processInfo = await app.getProcessInfo();
|
3707
|
+
* ```
|
3708
|
+
* @experimental
|
3709
|
+
*/
|
3710
|
+
async getProcessInfo() {
|
3711
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
3712
|
+
return data;
|
3713
|
+
}
|
3714
|
+
/**
|
3715
|
+
* Sets file auto download location. It's only allowed in the same application.
|
3716
|
+
*
|
3717
|
+
* Note: This method is restricted by default and must be enabled via
|
3718
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3719
|
+
* @param downloadLocation file auto download location
|
3720
|
+
*
|
3721
|
+
* @throws if setting file auto download location on different applications.
|
3722
|
+
* @example
|
3723
|
+
*
|
3724
|
+
* ```js
|
3725
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
3726
|
+
* const app = await fin.Application.getCurrent();
|
3727
|
+
* try {
|
3728
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
3729
|
+
* console.log('File download location is set');
|
3730
|
+
* } catch(err) {
|
3731
|
+
* console.error(err)
|
3732
|
+
* }
|
3733
|
+
* ```
|
3734
|
+
*/
|
3735
|
+
async setFileDownloadLocation(downloadLocation) {
|
3736
|
+
const { name } = this.wire.me;
|
3737
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3738
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
3739
|
+
}
|
3740
|
+
/**
|
3741
|
+
* 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.
|
3742
|
+
*
|
3743
|
+
* Note: This method is restricted by default and must be enabled via
|
3744
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3745
|
+
*
|
3746
|
+
* @throws if getting file auto download location on different applications.
|
3747
|
+
* @example
|
3748
|
+
*
|
3749
|
+
* ```js
|
3750
|
+
* const app = await fin.Application.getCurrent();
|
3751
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
3752
|
+
* ```
|
3753
|
+
*/
|
3754
|
+
async getFileDownloadLocation() {
|
3755
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
3756
|
+
return data;
|
3757
|
+
}
|
3758
|
+
/**
|
3759
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
3760
|
+
* @param options
|
3761
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
3762
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
3763
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
3764
|
+
* these with a "reducer" pattern.
|
3765
|
+
* @throws if the application has no tray icon set
|
3766
|
+
* @throws if the system tray is currently hidden
|
3767
|
+
* @example
|
3768
|
+
*
|
3769
|
+
* ```js
|
3770
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
3771
|
+
* const app = fin.Application.getCurrentSync();
|
3772
|
+
*
|
3773
|
+
* await app.setTrayIcon(iconUrl);
|
3774
|
+
*
|
3775
|
+
* const template = [
|
3776
|
+
* {
|
3777
|
+
* label: 'Menu Item 1',
|
3778
|
+
* data: 'hello from item 1'
|
3779
|
+
* },
|
3780
|
+
* { type: 'separator' },
|
3781
|
+
* {
|
3782
|
+
* label: 'Menu Item 2',
|
3783
|
+
* type: 'checkbox',
|
3784
|
+
* checked: true,
|
3785
|
+
* data: 'The user clicked the checkbox'
|
3786
|
+
* },
|
3787
|
+
* {
|
3788
|
+
* label: 'see more',
|
3789
|
+
* enabled: false,
|
3790
|
+
* submenu: [
|
3791
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
3792
|
+
* ]
|
3793
|
+
* }
|
3794
|
+
* ];
|
3795
|
+
*
|
3796
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
3797
|
+
* // right-click
|
3798
|
+
* if (event.button === 2) {
|
3799
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
3800
|
+
* if (r.result === 'closed') {
|
3801
|
+
* console.log('nothing happened');
|
3802
|
+
* } else {
|
3803
|
+
* console.log(r.data);
|
3804
|
+
* }
|
3805
|
+
* });
|
3806
|
+
* }
|
3807
|
+
* });
|
3808
|
+
* ```
|
3809
|
+
*/
|
3810
|
+
async showTrayIconPopupMenu(options) {
|
3811
|
+
const { name } = this.wire.me;
|
3812
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3813
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
3814
|
+
return payload.data;
|
3815
|
+
}
|
3816
|
+
/**
|
3817
|
+
* Closes the tray icon menu.
|
3818
|
+
*
|
3819
|
+
* @throws if the application has no tray icon set
|
3820
|
+
* @example
|
3821
|
+
*
|
3822
|
+
* ```js
|
3823
|
+
* const app = fin.Application.getCurrentSync();
|
3824
|
+
*
|
3825
|
+
* await app.closeTrayIconPopupMenu();
|
3826
|
+
* ```
|
3827
|
+
*/
|
3828
|
+
async closeTrayIconPopupMenu() {
|
3829
|
+
const { name } = this.wire.me;
|
3830
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3831
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
3832
|
+
}
|
3833
|
+
}
|
3834
|
+
Instance$6.Application = Application;
|
3835
|
+
|
3836
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
3837
|
+
Factory$7.ApplicationModule = void 0;
|
3838
|
+
const base_1$j = base;
|
3839
|
+
const validate_1$4 = validate;
|
3840
|
+
const Instance_1$5 = Instance$6;
|
3841
|
+
/**
|
3842
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
3843
|
+
*/
|
3844
|
+
class ApplicationModule extends base_1$j.Base {
|
3845
|
+
/**
|
3846
|
+
* Asynchronously returns an API handle for the given Application identity.
|
3847
|
+
*
|
3848
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3849
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3850
|
+
* for an Application throughout its entire lifecycle.
|
3851
|
+
*
|
3852
|
+
* @example
|
3853
|
+
*
|
3854
|
+
* ```js
|
3855
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
3856
|
+
* .then(app => app.isRunning())
|
3857
|
+
* .then(running => console.log('Application is running: ' + running))
|
3858
|
+
* .catch(err => console.log(err));
|
3859
|
+
* ```
|
3860
|
+
*
|
3861
|
+
*/
|
3862
|
+
async wrap(identity) {
|
3863
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
3864
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3865
|
+
});
|
3866
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
3867
|
+
if (errorMsg) {
|
3868
|
+
throw new Error(errorMsg);
|
3869
|
+
}
|
3870
|
+
return new Instance_1$5.Application(this.wire, identity);
|
3871
|
+
}
|
3872
|
+
/**
|
3873
|
+
* Synchronously returns an API handle for the given Application identity.
|
3874
|
+
*
|
3875
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3876
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3877
|
+
* for an Aplication throughout its entire lifecycle.
|
3878
|
+
*
|
3879
|
+
* @example
|
3880
|
+
*
|
3881
|
+
* ```js
|
3882
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
3883
|
+
* await app.close();
|
3884
|
+
* ```
|
3885
|
+
*
|
3886
|
+
*/
|
3887
|
+
wrapSync(identity) {
|
3888
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
3889
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3890
|
+
});
|
3891
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
3892
|
+
if (errorMsg) {
|
3893
|
+
throw new Error(errorMsg);
|
3894
|
+
}
|
3895
|
+
return new Instance_1$5.Application(this.wire, identity);
|
3896
|
+
}
|
3897
|
+
async _create(appOptions) {
|
3898
|
+
// set defaults:
|
3899
|
+
if (appOptions.waitForPageLoad === undefined) {
|
3900
|
+
appOptions.waitForPageLoad = false;
|
3901
|
+
}
|
3902
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
3903
|
+
appOptions.autoShow = true;
|
3904
|
+
}
|
3905
|
+
await this.wire.sendAction('create-application', appOptions);
|
3906
|
+
return this.wrap({ uuid: appOptions.uuid });
|
3907
|
+
}
|
3908
|
+
/**
|
3909
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
3910
|
+
*
|
3911
|
+
* @example
|
3912
|
+
*
|
3913
|
+
* ```js
|
3914
|
+
* async function createApp() {
|
3915
|
+
* const app = await fin.Application.create({
|
3916
|
+
* name: 'myApp',
|
3917
|
+
* uuid: 'app-3',
|
3918
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
3919
|
+
* autoShow: true
|
3920
|
+
* });
|
3921
|
+
* await app.run();
|
3922
|
+
* }
|
3923
|
+
*
|
3924
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
3925
|
+
* ```
|
3926
|
+
*
|
3927
|
+
* @ignore
|
3928
|
+
*/
|
3929
|
+
create(appOptions) {
|
3930
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
3931
|
+
this.wire.sendAction('application-create').catch((e) => {
|
3932
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3933
|
+
});
|
3934
|
+
return this._create(appOptions);
|
3935
|
+
}
|
3936
|
+
/**
|
3937
|
+
* Creates and starts a new Application.
|
3938
|
+
*
|
3939
|
+
* @example
|
3940
|
+
*
|
3941
|
+
* ```js
|
3942
|
+
* async function start() {
|
3943
|
+
* return fin.Application.start({
|
3944
|
+
* name: 'app-1',
|
3945
|
+
* uuid: 'app-1',
|
3946
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
3947
|
+
* autoShow: true
|
3948
|
+
* });
|
3949
|
+
* }
|
3950
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3951
|
+
* ```
|
3952
|
+
*
|
3953
|
+
*/
|
3954
|
+
async start(appOptions) {
|
3955
|
+
this.wire.sendAction('start-application').catch((e) => {
|
3956
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3957
|
+
});
|
3958
|
+
const app = await this._create(appOptions);
|
3959
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
3960
|
+
return app;
|
3961
|
+
}
|
3962
|
+
/**
|
3963
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
3964
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
3965
|
+
* @param opts - Parameters that the RVM will use.
|
3966
|
+
*
|
3967
|
+
* @example
|
3968
|
+
*
|
3969
|
+
* ```js
|
3970
|
+
*
|
3971
|
+
* const applicationInfoArray = [
|
3972
|
+
* {
|
3973
|
+
* "uuid": 'App-1',
|
3974
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
3975
|
+
* },
|
3976
|
+
* {
|
3977
|
+
* "uuid": 'App-2',
|
3978
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
3979
|
+
* },
|
3980
|
+
* {
|
3981
|
+
* "uuid": 'App-3',
|
3982
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
3983
|
+
* }
|
3984
|
+
* ]
|
3985
|
+
*
|
3986
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
3987
|
+
* .then(() => {
|
3988
|
+
* console.log('RVM has finished launching the application list.');
|
3989
|
+
* })
|
3990
|
+
* .catch((err) => {
|
3991
|
+
* console.log(err);
|
3992
|
+
* })
|
3993
|
+
* ```
|
3994
|
+
*
|
3995
|
+
* @experimental
|
3996
|
+
*/
|
3997
|
+
async startManyManifests(applications, opts) {
|
3998
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
3999
|
+
}
|
4000
|
+
/**
|
4001
|
+
* Asynchronously returns an Application object that represents the current application
|
4002
|
+
*
|
4003
|
+
* @example
|
4004
|
+
*
|
4005
|
+
* ```js
|
4006
|
+
* async function isCurrentAppRunning () {
|
4007
|
+
* const app = await fin.Application.getCurrent();
|
4008
|
+
* return app.isRunning();
|
4009
|
+
* }
|
4010
|
+
*
|
4011
|
+
* isCurrentAppRunning().then(running => {
|
4012
|
+
* console.log(`Current app is running: ${running}`);
|
4013
|
+
* }).catch(err => {
|
4014
|
+
* console.error(err);
|
4015
|
+
* });
|
4016
|
+
*
|
4017
|
+
* ```
|
4018
|
+
*/
|
4019
|
+
getCurrent() {
|
4020
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
4021
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4022
|
+
});
|
4023
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
4024
|
+
}
|
4025
|
+
/**
|
4026
|
+
* Synchronously returns an Application object that represents the current application
|
4027
|
+
*
|
4028
|
+
* @example
|
4029
|
+
*
|
4030
|
+
* ```js
|
4031
|
+
* async function isCurrentAppRunning () {
|
4032
|
+
* const app = fin.Application.getCurrentSync();
|
4033
|
+
* return app.isRunning();
|
4034
|
+
* }
|
4035
|
+
*
|
4036
|
+
* isCurrentAppRunning().then(running => {
|
4037
|
+
* console.log(`Current app is running: ${running}`);
|
4038
|
+
* }).catch(err => {
|
4039
|
+
* console.error(err);
|
4040
|
+
* });
|
4041
|
+
*
|
4042
|
+
* ```
|
4043
|
+
*/
|
4044
|
+
getCurrentSync() {
|
4045
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
4046
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4047
|
+
});
|
4048
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
4049
|
+
}
|
4050
|
+
/**
|
4051
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
4052
|
+
* @param manifestUrl - The URL of app's manifest.
|
4053
|
+
* @param opts - Parameters that the RVM will use.
|
4054
|
+
*
|
4055
|
+
* @example
|
4056
|
+
*
|
4057
|
+
* ```js
|
4058
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
4059
|
+
*
|
4060
|
+
* // For a local manifest file:
|
4061
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
4062
|
+
* ```
|
4063
|
+
*/
|
4064
|
+
async startFromManifest(manifestUrl, opts) {
|
4065
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
4066
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4067
|
+
});
|
4068
|
+
const app = await this._createFromManifest(manifestUrl);
|
4069
|
+
// @ts-expect-error using private method without warning.
|
4070
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
4071
|
+
return app;
|
4072
|
+
}
|
4073
|
+
/**
|
4074
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
4075
|
+
* Retrieves application's manifest and returns a wrapped application.
|
4076
|
+
* @param manifestUrl - The URL of app's manifest.
|
4077
|
+
* @param callback - called if the method succeeds.
|
4078
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
4079
|
+
*
|
4080
|
+
* @example
|
4081
|
+
*
|
4082
|
+
* ```js
|
4083
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
4084
|
+
* ```
|
4085
|
+
* @ignore
|
4086
|
+
*/
|
4087
|
+
createFromManifest(manifestUrl) {
|
4088
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
4089
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
4090
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4091
|
+
});
|
4092
|
+
return this._createFromManifest(manifestUrl);
|
4093
|
+
}
|
4094
|
+
_createFromManifest(manifestUrl) {
|
4095
|
+
return this.wire
|
4096
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
4097
|
+
.then(({ payload }) => {
|
4098
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
4099
|
+
return this.wrap({ uuid });
|
4100
|
+
})
|
4101
|
+
.then((app) => {
|
4102
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
4103
|
+
return app;
|
4104
|
+
});
|
4105
|
+
}
|
3841
4106
|
}
|
4107
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
3842
4108
|
|
3843
|
-
|
3844
|
-
|
3845
|
-
|
3846
|
-
|
3847
|
-
|
3848
|
-
|
3849
|
-
|
3850
|
-
|
3851
|
-
|
3852
|
-
|
4109
|
+
(function (exports) {
|
4110
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4111
|
+
if (k2 === undefined) k2 = k;
|
4112
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
4113
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
4114
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
4115
|
+
}
|
4116
|
+
Object.defineProperty(o, k2, desc);
|
4117
|
+
}) : (function(o, m, k, k2) {
|
4118
|
+
if (k2 === undefined) k2 = k;
|
4119
|
+
o[k2] = m[k];
|
4120
|
+
}));
|
4121
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
4122
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
4123
|
+
};
|
4124
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3853
4125
|
/**
|
3854
|
-
*
|
4126
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
4127
|
+
*
|
4128
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
4129
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
4130
|
+
*
|
4131
|
+
* 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),
|
4132
|
+
* both of these were documented on the same page.
|
4133
|
+
*
|
4134
|
+
* @packageDocumentation
|
3855
4135
|
*/
|
3856
|
-
|
3857
|
-
|
3858
|
-
|
3859
|
-
*
|
3860
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3861
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3862
|
-
* for an Application throughout its entire lifecycle.
|
3863
|
-
*
|
3864
|
-
* @example
|
3865
|
-
*
|
3866
|
-
* ```js
|
3867
|
-
* fin.Application.wrap({ uuid: 'testapp' })
|
3868
|
-
* .then(app => app.isRunning())
|
3869
|
-
* .then(running => console.log('Application is running: ' + running))
|
3870
|
-
* .catch(err => console.log(err));
|
3871
|
-
* ```
|
3872
|
-
*
|
3873
|
-
*/
|
3874
|
-
async wrap(identity) {
|
3875
|
-
this.wire.sendAction('wrap-application').catch((e) => {
|
3876
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3877
|
-
});
|
3878
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3879
|
-
if (errorMsg) {
|
3880
|
-
throw new Error(errorMsg);
|
3881
|
-
}
|
3882
|
-
return new Instance_1.Application(this.wire, identity);
|
3883
|
-
}
|
3884
|
-
/**
|
3885
|
-
* Synchronously returns an API handle for the given Application identity.
|
3886
|
-
*
|
3887
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3888
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3889
|
-
* for an Aplication throughout its entire lifecycle.
|
3890
|
-
*
|
3891
|
-
* @example
|
3892
|
-
*
|
3893
|
-
* ```js
|
3894
|
-
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
3895
|
-
* await app.close();
|
3896
|
-
* ```
|
3897
|
-
*
|
3898
|
-
*/
|
3899
|
-
wrapSync(identity) {
|
3900
|
-
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
3901
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3902
|
-
});
|
3903
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3904
|
-
if (errorMsg) {
|
3905
|
-
throw new Error(errorMsg);
|
3906
|
-
}
|
3907
|
-
return new Instance_1.Application(this.wire, identity);
|
3908
|
-
}
|
3909
|
-
async _create(appOptions) {
|
3910
|
-
// set defaults:
|
3911
|
-
if (appOptions.waitForPageLoad === undefined) {
|
3912
|
-
appOptions.waitForPageLoad = false;
|
3913
|
-
}
|
3914
|
-
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
3915
|
-
appOptions.autoShow = true;
|
3916
|
-
}
|
3917
|
-
await this.wire.sendAction('create-application', appOptions);
|
3918
|
-
return this.wrap({ uuid: appOptions.uuid });
|
3919
|
-
}
|
3920
|
-
/**
|
3921
|
-
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
3922
|
-
*
|
3923
|
-
* @example
|
3924
|
-
*
|
3925
|
-
* ```js
|
3926
|
-
* async function createApp() {
|
3927
|
-
* const app = await fin.Application.create({
|
3928
|
-
* name: 'myApp',
|
3929
|
-
* uuid: 'app-3',
|
3930
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
3931
|
-
* autoShow: true
|
3932
|
-
* });
|
3933
|
-
* await app.run();
|
3934
|
-
* }
|
3935
|
-
*
|
3936
|
-
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
3937
|
-
* ```
|
3938
|
-
*
|
3939
|
-
* @ignore
|
3940
|
-
*/
|
3941
|
-
create(appOptions) {
|
3942
|
-
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
3943
|
-
this.wire.sendAction('application-create').catch((e) => {
|
3944
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3945
|
-
});
|
3946
|
-
return this._create(appOptions);
|
3947
|
-
}
|
3948
|
-
/**
|
3949
|
-
* Creates and starts a new Application.
|
3950
|
-
*
|
3951
|
-
* @example
|
3952
|
-
*
|
3953
|
-
* ```js
|
3954
|
-
* async function start() {
|
3955
|
-
* return fin.Application.start({
|
3956
|
-
* name: 'app-1',
|
3957
|
-
* uuid: 'app-1',
|
3958
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
3959
|
-
* autoShow: true
|
3960
|
-
* });
|
3961
|
-
* }
|
3962
|
-
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3963
|
-
* ```
|
3964
|
-
*
|
3965
|
-
*/
|
3966
|
-
async start(appOptions) {
|
3967
|
-
this.wire.sendAction('start-application').catch((e) => {
|
3968
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
3969
|
-
});
|
3970
|
-
const app = await this._create(appOptions);
|
3971
|
-
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
3972
|
-
return app;
|
3973
|
-
}
|
3974
|
-
/**
|
3975
|
-
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
3976
|
-
* Returns once the RVM is finished attempting to launch the applications.
|
3977
|
-
* @param opts - Parameters that the RVM will use.
|
3978
|
-
*
|
3979
|
-
* @example
|
3980
|
-
*
|
3981
|
-
* ```js
|
3982
|
-
*
|
3983
|
-
* const applicationInfoArray = [
|
3984
|
-
* {
|
3985
|
-
* "uuid": 'App-1',
|
3986
|
-
* "manifestUrl": 'http://localhost:5555/app1.json',
|
3987
|
-
* },
|
3988
|
-
* {
|
3989
|
-
* "uuid": 'App-2',
|
3990
|
-
* "manifestUrl": 'http://localhost:5555/app2.json',
|
3991
|
-
* },
|
3992
|
-
* {
|
3993
|
-
* "uuid": 'App-3',
|
3994
|
-
* "manifestUrl": 'http://localhost:5555/app3.json',
|
3995
|
-
* }
|
3996
|
-
* ]
|
3997
|
-
*
|
3998
|
-
* fin.Application.startManyManifests(applicationInfoArray)
|
3999
|
-
* .then(() => {
|
4000
|
-
* console.log('RVM has finished launching the application list.');
|
4001
|
-
* })
|
4002
|
-
* .catch((err) => {
|
4003
|
-
* console.log(err);
|
4004
|
-
* })
|
4005
|
-
* ```
|
4006
|
-
*
|
4007
|
-
* @experimental
|
4008
|
-
*/
|
4009
|
-
async startManyManifests(applications, opts) {
|
4010
|
-
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
4011
|
-
}
|
4012
|
-
/**
|
4013
|
-
* Asynchronously returns an Application object that represents the current application
|
4014
|
-
*
|
4015
|
-
* @example
|
4016
|
-
*
|
4017
|
-
* ```js
|
4018
|
-
* async function isCurrentAppRunning () {
|
4019
|
-
* const app = await fin.Application.getCurrent();
|
4020
|
-
* return app.isRunning();
|
4021
|
-
* }
|
4022
|
-
*
|
4023
|
-
* isCurrentAppRunning().then(running => {
|
4024
|
-
* console.log(`Current app is running: ${running}`);
|
4025
|
-
* }).catch(err => {
|
4026
|
-
* console.error(err);
|
4027
|
-
* });
|
4028
|
-
*
|
4029
|
-
* ```
|
4030
|
-
*/
|
4031
|
-
getCurrent() {
|
4032
|
-
this.wire.sendAction('get-current-application').catch((e) => {
|
4033
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4034
|
-
});
|
4035
|
-
return this.wrap({ uuid: this.wire.me.uuid });
|
4036
|
-
}
|
4037
|
-
/**
|
4038
|
-
* Synchronously returns an Application object that represents the current application
|
4039
|
-
*
|
4040
|
-
* @example
|
4041
|
-
*
|
4042
|
-
* ```js
|
4043
|
-
* async function isCurrentAppRunning () {
|
4044
|
-
* const app = fin.Application.getCurrentSync();
|
4045
|
-
* return app.isRunning();
|
4046
|
-
* }
|
4047
|
-
*
|
4048
|
-
* isCurrentAppRunning().then(running => {
|
4049
|
-
* console.log(`Current app is running: ${running}`);
|
4050
|
-
* }).catch(err => {
|
4051
|
-
* console.error(err);
|
4052
|
-
* });
|
4053
|
-
*
|
4054
|
-
* ```
|
4055
|
-
*/
|
4056
|
-
getCurrentSync() {
|
4057
|
-
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
4058
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4059
|
-
});
|
4060
|
-
return this.wrapSync({ uuid: this.wire.me.uuid });
|
4061
|
-
}
|
4062
|
-
/**
|
4063
|
-
* Retrieves application's manifest and returns a running instance of the application.
|
4064
|
-
* @param manifestUrl - The URL of app's manifest.
|
4065
|
-
* @param opts - Parameters that the RVM will use.
|
4066
|
-
*
|
4067
|
-
* @example
|
4068
|
-
*
|
4069
|
-
* ```js
|
4070
|
-
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
4071
|
-
*
|
4072
|
-
* // For a local manifest file:
|
4073
|
-
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
4074
|
-
* ```
|
4075
|
-
*/
|
4076
|
-
async startFromManifest(manifestUrl, opts) {
|
4077
|
-
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
4078
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4079
|
-
});
|
4080
|
-
const app = await this._createFromManifest(manifestUrl);
|
4081
|
-
// @ts-expect-error using private method without warning.
|
4082
|
-
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
4083
|
-
return app;
|
4084
|
-
}
|
4085
|
-
/**
|
4086
|
-
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
4087
|
-
* Retrieves application's manifest and returns a wrapped application.
|
4088
|
-
* @param manifestUrl - The URL of app's manifest.
|
4089
|
-
* @param callback - called if the method succeeds.
|
4090
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
4091
|
-
*
|
4092
|
-
* @example
|
4093
|
-
*
|
4094
|
-
* ```js
|
4095
|
-
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
4096
|
-
* ```
|
4097
|
-
* @ignore
|
4098
|
-
*/
|
4099
|
-
createFromManifest(manifestUrl) {
|
4100
|
-
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
4101
|
-
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
4102
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4103
|
-
});
|
4104
|
-
return this._createFromManifest(manifestUrl);
|
4105
|
-
}
|
4106
|
-
_createFromManifest(manifestUrl) {
|
4107
|
-
return this.wire
|
4108
|
-
.sendAction('get-application-manifest', { manifestUrl })
|
4109
|
-
.then(({ payload }) => {
|
4110
|
-
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
4111
|
-
return this.wrap({ uuid });
|
4112
|
-
})
|
4113
|
-
.then((app) => {
|
4114
|
-
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
4115
|
-
return app;
|
4116
|
-
});
|
4117
|
-
}
|
4118
|
-
}
|
4119
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
4120
|
-
return Factory$7;
|
4121
|
-
}
|
4122
|
-
|
4123
|
-
var hasRequiredApplication;
|
4124
|
-
|
4125
|
-
function requireApplication () {
|
4126
|
-
if (hasRequiredApplication) return application;
|
4127
|
-
hasRequiredApplication = 1;
|
4128
|
-
(function (exports) {
|
4129
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4130
|
-
if (k2 === undefined) k2 = k;
|
4131
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
4132
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
4133
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
4134
|
-
}
|
4135
|
-
Object.defineProperty(o, k2, desc);
|
4136
|
-
}) : (function(o, m, k, k2) {
|
4137
|
-
if (k2 === undefined) k2 = k;
|
4138
|
-
o[k2] = m[k];
|
4139
|
-
}));
|
4140
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
4141
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
4142
|
-
};
|
4143
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4144
|
-
/**
|
4145
|
-
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
4146
|
-
*
|
4147
|
-
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
4148
|
-
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
4149
|
-
*
|
4150
|
-
* 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),
|
4151
|
-
* both of these were documented on the same page.
|
4152
|
-
*
|
4153
|
-
* @packageDocumentation
|
4154
|
-
*/
|
4155
|
-
__exportStar(requireFactory$2(), exports);
|
4156
|
-
__exportStar(requireInstance$1(), exports);
|
4157
|
-
} (application));
|
4158
|
-
return application;
|
4159
|
-
}
|
4136
|
+
__exportStar(Factory$7, exports);
|
4137
|
+
__exportStar(Instance$6, exports);
|
4138
|
+
} (application));
|
4160
4139
|
|
4161
4140
|
var promisifySubscription$1 = {};
|
4162
4141
|
|
@@ -4200,7 +4179,7 @@ function requireInstance () {
|
|
4200
4179
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
4201
4180
|
/* eslint-disable no-console */
|
4202
4181
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
4203
|
-
const application_1 =
|
4182
|
+
const application_1 = application;
|
4204
4183
|
const main_1 = main;
|
4205
4184
|
const view_1 = requireView();
|
4206
4185
|
const warnings_1 = warnings;
|
@@ -16726,7 +16705,7 @@ const events_1$3 = require$$0;
|
|
16726
16705
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
16727
16706
|
const index_1 = system;
|
16728
16707
|
const index_2 = requireWindow();
|
16729
|
-
const index_3 =
|
16708
|
+
const index_3 = application;
|
16730
16709
|
const index_4 = interappbus;
|
16731
16710
|
const index_5 = clipboard;
|
16732
16711
|
const index_6 = externalApplication;
|
@@ -17523,7 +17502,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
|
|
17523
17502
|
};
|
17524
17503
|
}
|
17525
17504
|
getAdapterVersionSync() {
|
17526
|
-
return "38.83.
|
17505
|
+
return "38.83.86";
|
17527
17506
|
}
|
17528
17507
|
observeBounds(element, onChange) {
|
17529
17508
|
throw new Error('Method not implemented.');
|