@openfin/core 38.81.48 → 38.81.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/mock.js +1118 -1139
- package/package.json +1 -1
package/out/mock.js
CHANGED
@@ -706,11 +706,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
706
706
|
};
|
707
707
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
708
708
|
|
709
|
-
var hasRequiredFactory$
|
709
|
+
var hasRequiredFactory$2;
|
710
710
|
|
711
|
-
function requireFactory$
|
712
|
-
if (hasRequiredFactory$
|
713
|
-
hasRequiredFactory$
|
711
|
+
function requireFactory$2 () {
|
712
|
+
if (hasRequiredFactory$2) return Factory$6;
|
713
|
+
hasRequiredFactory$2 = 1;
|
714
714
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
715
715
|
Factory$6.ViewModule = void 0;
|
716
716
|
const base_1 = base;
|
@@ -1587,8 +1587,8 @@ var main = {};
|
|
1587
1587
|
|
1588
1588
|
Object.defineProperty(main, "__esModule", { value: true });
|
1589
1589
|
main.WebContents = void 0;
|
1590
|
-
const base_1$
|
1591
|
-
class WebContents extends base_1$
|
1590
|
+
const base_1$l = base;
|
1591
|
+
class WebContents extends base_1$l.EmitterBase {
|
1592
1592
|
/**
|
1593
1593
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
1594
1594
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
@@ -2654,11 +2654,11 @@ class WebContents extends base_1$j.EmitterBase {
|
|
2654
2654
|
}
|
2655
2655
|
main.WebContents = WebContents;
|
2656
2656
|
|
2657
|
-
var hasRequiredInstance$
|
2657
|
+
var hasRequiredInstance$1;
|
2658
2658
|
|
2659
|
-
function requireInstance$
|
2660
|
-
if (hasRequiredInstance$
|
2661
|
-
hasRequiredInstance$
|
2659
|
+
function requireInstance$1 () {
|
2660
|
+
if (hasRequiredInstance$1) return Instance$5;
|
2661
|
+
hasRequiredInstance$1 = 1;
|
2662
2662
|
var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
2663
2663
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
2664
2664
|
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");
|
@@ -3253,1141 +3253,1120 @@ function requireView () {
|
|
3253
3253
|
*
|
3254
3254
|
* @packageDocumentation
|
3255
3255
|
*/
|
3256
|
-
__exportStar(requireFactory$
|
3257
|
-
__exportStar(requireInstance$
|
3256
|
+
__exportStar(requireFactory$2(), exports);
|
3257
|
+
__exportStar(requireInstance$1(), exports);
|
3258
3258
|
} (view));
|
3259
3259
|
return view;
|
3260
3260
|
}
|
3261
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
|
-
|
3841
|
-
|
3842
|
-
|
3843
|
-
|
3844
|
-
|
3845
|
-
|
3846
|
-
|
3847
|
-
|
3848
|
-
|
3849
|
-
|
3850
|
-
|
3851
|
-
|
3852
|
-
|
3853
|
-
|
3854
|
-
|
3855
|
-
|
3856
|
-
|
3857
|
-
|
3858
|
-
|
3859
|
-
|
3860
|
-
|
3861
|
-
|
3862
|
-
|
3863
|
-
|
3864
|
-
|
3865
|
-
|
3866
|
-
|
3867
|
-
|
3868
|
-
|
3869
|
-
|
3870
|
-
|
3871
|
-
|
3872
|
-
|
3873
|
-
|
3874
|
-
|
3875
|
-
|
3876
|
-
|
3877
|
-
|
3878
|
-
|
3879
|
-
|
3880
|
-
|
3881
|
-
|
3882
|
-
|
3883
|
-
|
3884
|
-
|
3885
|
-
|
3886
|
-
|
3887
|
-
|
3888
|
-
|
3889
|
-
|
3890
|
-
|
3891
|
-
|
3892
|
-
|
3893
|
-
|
3894
|
-
|
3895
|
-
|
3896
|
-
|
3897
|
-
|
3898
|
-
|
3899
|
-
|
3900
|
-
|
3901
|
-
|
3902
|
-
|
3903
|
-
|
3904
|
-
|
3905
|
-
|
3906
|
-
|
3907
|
-
|
3908
|
-
|
3909
|
-
|
3910
|
-
|
3911
|
-
|
3912
|
-
|
3913
|
-
|
3914
|
-
|
3915
|
-
|
3916
|
-
|
3917
|
-
|
3918
|
-
|
3919
|
-
|
3920
|
-
|
3921
|
-
|
3922
|
-
|
3923
|
-
|
3924
|
-
|
3925
|
-
|
3926
|
-
|
3927
|
-
|
3928
|
-
|
3929
|
-
|
3930
|
-
|
3931
|
-
|
3932
|
-
|
3933
|
-
|
3934
|
-
|
3935
|
-
|
3936
|
-
|
3937
|
-
|
3938
|
-
|
3939
|
-
|
3940
|
-
|
3941
|
-
|
3942
|
-
|
3943
|
-
|
3944
|
-
|
3945
|
-
|
3946
|
-
|
3947
|
-
|
3948
|
-
|
3949
|
-
|
3950
|
-
|
3951
|
-
|
3952
|
-
|
3953
|
-
|
3954
|
-
|
3955
|
-
|
3956
|
-
|
3957
|
-
|
3958
|
-
|
3959
|
-
|
3960
|
-
|
3961
|
-
|
3962
|
-
|
3963
|
-
|
3964
|
-
|
3965
|
-
|
3966
|
-
|
3967
|
-
|
3968
|
-
|
3969
|
-
|
3970
|
-
|
3971
|
-
|
3972
|
-
|
3973
|
-
|
3974
|
-
|
3975
|
-
|
3976
|
-
|
3977
|
-
|
3978
|
-
|
3979
|
-
|
3980
|
-
|
3981
|
-
|
3982
|
-
|
3983
|
-
|
3984
|
-
|
3985
|
-
|
3986
|
-
|
3987
|
-
|
3988
|
-
|
3989
|
-
|
3990
|
-
|
3991
|
-
|
3992
|
-
|
3993
|
-
|
3994
|
-
|
3995
|
-
|
3996
|
-
|
3997
|
-
|
3998
|
-
|
3999
|
-
|
4000
|
-
|
4001
|
-
|
4002
|
-
|
4003
|
-
|
4004
|
-
|
4005
|
-
|
4006
|
-
|
4007
|
-
|
4008
|
-
|
4009
|
-
|
4010
|
-
|
4011
|
-
|
4012
|
-
|
4013
|
-
|
4014
|
-
|
4015
|
-
|
4016
|
-
|
4017
|
-
|
4018
|
-
|
4019
|
-
|
4020
|
-
|
4021
|
-
|
4022
|
-
|
4023
|
-
|
4024
|
-
|
4025
|
-
|
4026
|
-
|
4027
|
-
|
4028
|
-
|
4029
|
-
|
4030
|
-
|
4031
|
-
|
4032
|
-
|
4033
|
-
|
4034
|
-
|
4035
|
-
|
4036
|
-
|
4037
|
-
|
4038
|
-
|
4039
|
-
|
4040
|
-
|
4041
|
-
|
4042
|
-
|
4043
|
-
|
4044
|
-
|
4045
|
-
|
4046
|
-
|
4047
|
-
|
4048
|
-
|
4049
|
-
|
4050
|
-
|
4051
|
-
|
4052
|
-
|
4053
|
-
|
4054
|
-
|
4055
|
-
|
4056
|
-
|
4057
|
-
|
4058
|
-
|
4059
|
-
|
4060
|
-
|
4061
|
-
|
4062
|
-
|
4063
|
-
|
4064
|
-
|
4065
|
-
|
4066
|
-
|
4067
|
-
|
4068
|
-
|
4069
|
-
|
4070
|
-
|
4071
|
-
|
3262
|
+
Object.defineProperty(Instance$6, "__esModule", { value: true });
|
3263
|
+
Instance$6.Application = void 0;
|
3264
|
+
/* eslint-disable import/prefer-default-export */
|
3265
|
+
const base_1$k = base;
|
3266
|
+
const window_1$1 = requireWindow();
|
3267
|
+
const view_1 = requireView();
|
3268
|
+
/**
|
3269
|
+
* An object representing an application. Allows the developer to create,
|
3270
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
3271
|
+
*/
|
3272
|
+
class Application extends base_1$k.EmitterBase {
|
3273
|
+
/**
|
3274
|
+
* @internal
|
3275
|
+
*/
|
3276
|
+
constructor(wire, identity) {
|
3277
|
+
super(wire, 'application', identity.uuid);
|
3278
|
+
this.identity = identity;
|
3279
|
+
this.window = new window_1$1._Window(this.wire, {
|
3280
|
+
uuid: this.identity.uuid,
|
3281
|
+
name: this.identity.uuid
|
3282
|
+
});
|
3283
|
+
}
|
3284
|
+
windowListFromIdentityList(identityList) {
|
3285
|
+
const windowList = [];
|
3286
|
+
identityList.forEach((identity) => {
|
3287
|
+
windowList.push(new window_1$1._Window(this.wire, {
|
3288
|
+
uuid: identity.uuid,
|
3289
|
+
name: identity.name
|
3290
|
+
}));
|
3291
|
+
});
|
3292
|
+
return windowList;
|
3293
|
+
}
|
3294
|
+
/**
|
3295
|
+
* Determines if the application is currently running.
|
3296
|
+
*
|
3297
|
+
* @example
|
3298
|
+
*
|
3299
|
+
* ```js
|
3300
|
+
* async function isAppRunning() {
|
3301
|
+
* const app = await fin.Application.getCurrent();
|
3302
|
+
* return await app.isRunning();
|
3303
|
+
* }
|
3304
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
3305
|
+
* ```
|
3306
|
+
*/
|
3307
|
+
isRunning() {
|
3308
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
3309
|
+
}
|
3310
|
+
/**
|
3311
|
+
* Closes the application and any child windows created by the application.
|
3312
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
3313
|
+
* @param force Close will be prevented from closing when force is false and
|
3314
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
3315
|
+
*
|
3316
|
+
* @example
|
3317
|
+
*
|
3318
|
+
* ```js
|
3319
|
+
* async function closeApp() {
|
3320
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
3321
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
3322
|
+
* await app.quit();
|
3323
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
3324
|
+
*
|
3325
|
+
* }
|
3326
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
3327
|
+
* ```
|
3328
|
+
*/
|
3329
|
+
async quit(force = false) {
|
3330
|
+
try {
|
3331
|
+
await this._close(force);
|
3332
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
3333
|
+
}
|
3334
|
+
catch (error) {
|
3335
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
3336
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
3337
|
+
throw error;
|
3338
|
+
}
|
3339
|
+
}
|
3340
|
+
}
|
3341
|
+
async _close(force = false) {
|
3342
|
+
try {
|
3343
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
3344
|
+
}
|
3345
|
+
catch (error) {
|
3346
|
+
if (!error.message.includes('Remote connection has closed')) {
|
3347
|
+
throw error;
|
3348
|
+
}
|
3349
|
+
}
|
3350
|
+
}
|
3351
|
+
/**
|
3352
|
+
* @deprecated use Application.quit instead
|
3353
|
+
* Closes the application and any child windows created by the application.
|
3354
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
3355
|
+
* @param callback - called if the method succeeds.
|
3356
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
3357
|
+
*
|
3358
|
+
* @example
|
3359
|
+
*
|
3360
|
+
* ```js
|
3361
|
+
* async function closeApp() {
|
3362
|
+
* const app = await fin.Application.getCurrent();
|
3363
|
+
* return await app.close();
|
3364
|
+
* }
|
3365
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
3366
|
+
* ```
|
3367
|
+
*/
|
3368
|
+
close(force = false) {
|
3369
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
3370
|
+
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
3371
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3372
|
+
});
|
3373
|
+
return this._close(force);
|
3374
|
+
}
|
3375
|
+
/**
|
3376
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
3377
|
+
*
|
3378
|
+
* @example
|
3379
|
+
*
|
3380
|
+
* ```js
|
3381
|
+
* async function getChildWindows() {
|
3382
|
+
* const app = await fin.Application.getCurrent();
|
3383
|
+
* return await app.getChildWindows();
|
3384
|
+
* }
|
3385
|
+
*
|
3386
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
3387
|
+
* ```
|
3388
|
+
*/
|
3389
|
+
getChildWindows() {
|
3390
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
3391
|
+
const identityList = [];
|
3392
|
+
payload.data.forEach((winName) => {
|
3393
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
3394
|
+
});
|
3395
|
+
return this.windowListFromIdentityList(identityList);
|
3396
|
+
});
|
3397
|
+
}
|
3398
|
+
/**
|
3399
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
3400
|
+
* if the application was not created from a manifest.
|
3401
|
+
*
|
3402
|
+
* @example
|
3403
|
+
*
|
3404
|
+
* ```js
|
3405
|
+
* async function getManifest() {
|
3406
|
+
* const app = await fin.Application.getCurrent();
|
3407
|
+
* return await app.getManifest();
|
3408
|
+
* }
|
3409
|
+
*
|
3410
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
3411
|
+
* ```
|
3412
|
+
*/
|
3413
|
+
getManifest() {
|
3414
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
3415
|
+
}
|
3416
|
+
/**
|
3417
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
3418
|
+
* if the application was created from a manifest.
|
3419
|
+
*
|
3420
|
+
* @example
|
3421
|
+
*
|
3422
|
+
* ```js
|
3423
|
+
* async function getParentUuid() {
|
3424
|
+
* const app = await fin.Application.start({
|
3425
|
+
* uuid: 'app-1',
|
3426
|
+
* name: 'myApp',
|
3427
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
3428
|
+
* autoShow: true
|
3429
|
+
* });
|
3430
|
+
* return await app.getParentUuid();
|
3431
|
+
* }
|
3432
|
+
*
|
3433
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
3434
|
+
* ```
|
3435
|
+
*/
|
3436
|
+
getParentUuid() {
|
3437
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
3438
|
+
}
|
3439
|
+
/**
|
3440
|
+
* Retrieves current application's shortcut configuration.
|
3441
|
+
*
|
3442
|
+
* @example
|
3443
|
+
*
|
3444
|
+
* ```js
|
3445
|
+
* async function getShortcuts() {
|
3446
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3447
|
+
* return await app.getShortcuts();
|
3448
|
+
* }
|
3449
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
3450
|
+
* ```
|
3451
|
+
*/
|
3452
|
+
getShortcuts() {
|
3453
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
3454
|
+
}
|
3455
|
+
/**
|
3456
|
+
* Retrieves current application's views.
|
3457
|
+
* @experimental
|
3458
|
+
*
|
3459
|
+
* @example
|
3460
|
+
*
|
3461
|
+
* ```js
|
3462
|
+
* async function getViews() {
|
3463
|
+
* const app = await fin.Application.getCurrent();
|
3464
|
+
* return await app.getViews();
|
3465
|
+
* }
|
3466
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
3467
|
+
* ```
|
3468
|
+
*/
|
3469
|
+
async getViews() {
|
3470
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
3471
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
3472
|
+
}
|
3473
|
+
/**
|
3474
|
+
* Returns the current zoom level of the application.
|
3475
|
+
*
|
3476
|
+
* @example
|
3477
|
+
*
|
3478
|
+
* ```js
|
3479
|
+
* async function getZoomLevel() {
|
3480
|
+
* const app = await fin.Application.getCurrent();
|
3481
|
+
* return await app.getZoomLevel();
|
3482
|
+
* }
|
3483
|
+
*
|
3484
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
3485
|
+
* ```
|
3486
|
+
*/
|
3487
|
+
getZoomLevel() {
|
3488
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
3489
|
+
}
|
3490
|
+
/**
|
3491
|
+
* Returns an instance of the main Window of the application
|
3492
|
+
*
|
3493
|
+
* @example
|
3494
|
+
*
|
3495
|
+
* ```js
|
3496
|
+
* async function getWindow() {
|
3497
|
+
* const app = await fin.Application.start({
|
3498
|
+
* uuid: 'app-1',
|
3499
|
+
* name: 'myApp',
|
3500
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
3501
|
+
* autoShow: true
|
3502
|
+
* });
|
3503
|
+
* return await app.getWindow();
|
3504
|
+
* }
|
3505
|
+
*
|
3506
|
+
* getWindow().then(win => {
|
3507
|
+
* win.showAt(0, 400);
|
3508
|
+
* win.flash();
|
3509
|
+
* }).catch(err => console.log(err));
|
3510
|
+
* ```
|
3511
|
+
*/
|
3512
|
+
getWindow() {
|
3513
|
+
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
3514
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3515
|
+
});
|
3516
|
+
return Promise.resolve(this.window);
|
3517
|
+
}
|
3518
|
+
/**
|
3519
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
3520
|
+
* @param userName - username to be passed to the RVM.
|
3521
|
+
* @param appName - app name to be passed to the RVM.
|
3522
|
+
*
|
3523
|
+
* @example
|
3524
|
+
*
|
3525
|
+
* ```js
|
3526
|
+
* async function registerUser() {
|
3527
|
+
* const app = await fin.Application.getCurrent();
|
3528
|
+
* return await app.registerUser('user', 'myApp');
|
3529
|
+
* }
|
3530
|
+
*
|
3531
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
3532
|
+
* ```
|
3533
|
+
*/
|
3534
|
+
registerUser(userName, appName) {
|
3535
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
3536
|
+
}
|
3537
|
+
/**
|
3538
|
+
* Removes the application’s icon from the tray.
|
3539
|
+
*
|
3540
|
+
* @example
|
3541
|
+
*
|
3542
|
+
* ```js
|
3543
|
+
* async function removeTrayIcon() {
|
3544
|
+
* const app = await fin.Application.getCurrent();
|
3545
|
+
* return await app.removeTrayIcon();
|
3546
|
+
* }
|
3547
|
+
*
|
3548
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
3549
|
+
* ```
|
3550
|
+
*/
|
3551
|
+
removeTrayIcon() {
|
3552
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
3553
|
+
}
|
3554
|
+
/**
|
3555
|
+
* Restarts the application.
|
3556
|
+
*
|
3557
|
+
* @example
|
3558
|
+
*
|
3559
|
+
* ```js
|
3560
|
+
* async function restartApp() {
|
3561
|
+
* const app = await fin.Application.getCurrent();
|
3562
|
+
* return await app.restart();
|
3563
|
+
* }
|
3564
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
3565
|
+
* ```
|
3566
|
+
*/
|
3567
|
+
restart() {
|
3568
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
3569
|
+
}
|
3570
|
+
/**
|
3571
|
+
* DEPRECATED method to run the application.
|
3572
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
3573
|
+
*
|
3574
|
+
* @example
|
3575
|
+
*
|
3576
|
+
* ```js
|
3577
|
+
* async function run() {
|
3578
|
+
* const app = await fin.Application.create({
|
3579
|
+
* name: 'myApp',
|
3580
|
+
* uuid: 'app-1',
|
3581
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
3582
|
+
* autoShow: true
|
3583
|
+
* });
|
3584
|
+
* await app.run();
|
3585
|
+
* }
|
3586
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3587
|
+
* ```
|
3588
|
+
*
|
3589
|
+
* @ignore
|
3590
|
+
*/
|
3591
|
+
run() {
|
3592
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
3593
|
+
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
3594
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3595
|
+
});
|
3596
|
+
return this._run();
|
3597
|
+
}
|
3598
|
+
_run(opts = {}) {
|
3599
|
+
return this.wire
|
3600
|
+
.sendAction('run-application', {
|
3601
|
+
manifestUrl: this._manifestUrl,
|
3602
|
+
opts,
|
3603
|
+
...this.identity
|
3604
|
+
})
|
3605
|
+
.then(() => undefined);
|
3606
|
+
}
|
3607
|
+
/**
|
3608
|
+
* Instructs the RVM to schedule one restart of the application.
|
3609
|
+
*
|
3610
|
+
* @example
|
3611
|
+
*
|
3612
|
+
* ```js
|
3613
|
+
* async function scheduleRestart() {
|
3614
|
+
* const app = await fin.Application.getCurrent();
|
3615
|
+
* return await app.scheduleRestart();
|
3616
|
+
* }
|
3617
|
+
*
|
3618
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
3619
|
+
* ```
|
3620
|
+
*/
|
3621
|
+
scheduleRestart() {
|
3622
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
3623
|
+
}
|
3624
|
+
/**
|
3625
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
3626
|
+
* an object containing logId is returned.
|
3627
|
+
*
|
3628
|
+
* @example
|
3629
|
+
*
|
3630
|
+
* ```js
|
3631
|
+
* async function sendLog() {
|
3632
|
+
* const app = await fin.Application.getCurrent();
|
3633
|
+
* return await app.sendApplicationLog();
|
3634
|
+
* }
|
3635
|
+
*
|
3636
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
3637
|
+
* ```
|
3638
|
+
*/
|
3639
|
+
async sendApplicationLog() {
|
3640
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
3641
|
+
return payload.data;
|
3642
|
+
}
|
3643
|
+
/**
|
3644
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
3645
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
3646
|
+
*
|
3647
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
3648
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
3649
|
+
*
|
3650
|
+
*
|
3651
|
+
* @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).
|
3652
|
+
*
|
3653
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
3654
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
3655
|
+
*
|
3656
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
3657
|
+
*
|
3658
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
3659
|
+
* uuid or shortcut.name is changed.
|
3660
|
+
*
|
3661
|
+
* @example
|
3662
|
+
*
|
3663
|
+
* ```js
|
3664
|
+
* const app = fin.Application.getCurrentSync();
|
3665
|
+
* const appName = 'My App';
|
3666
|
+
* const jumpListConfig = [ // array of JumpList categories
|
3667
|
+
* {
|
3668
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
3669
|
+
* items: [ // array of JumpList items
|
3670
|
+
* {
|
3671
|
+
* type: 'task',
|
3672
|
+
* title: `Launch ${appName}`,
|
3673
|
+
* description: `Runs ${appName} with the default configuration`,
|
3674
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
3675
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
3676
|
+
* iconIndex: 0
|
3677
|
+
* },
|
3678
|
+
* { type: 'separator' },
|
3679
|
+
* {
|
3680
|
+
* type: 'task',
|
3681
|
+
* title: `Restore ${appName}`,
|
3682
|
+
* description: 'Restore to last configuration',
|
3683
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
3684
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
3685
|
+
* iconIndex: 0
|
3686
|
+
* },
|
3687
|
+
* ]
|
3688
|
+
* },
|
3689
|
+
* {
|
3690
|
+
* name: 'Tools',
|
3691
|
+
* items: [ // array of JumpList items
|
3692
|
+
* {
|
3693
|
+
* type: 'task',
|
3694
|
+
* title: 'Tool A',
|
3695
|
+
* description: 'Runs Tool A',
|
3696
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
3697
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
3698
|
+
* iconIndex: 0
|
3699
|
+
* },
|
3700
|
+
* {
|
3701
|
+
* type: 'task',
|
3702
|
+
* title: 'Tool B',
|
3703
|
+
* description: 'Runs Tool B',
|
3704
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
3705
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
3706
|
+
* iconIndex: 0
|
3707
|
+
* }]
|
3708
|
+
* }
|
3709
|
+
* ];
|
3710
|
+
*
|
3711
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
3712
|
+
* ```
|
3713
|
+
*
|
3714
|
+
* To handle deeplink args:
|
3715
|
+
* ```js
|
3716
|
+
* function handleUseLastConfiguration() {
|
3717
|
+
* // this handler is called when the app is being launched
|
3718
|
+
* app.on('run-requested', event => {
|
3719
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
3720
|
+
* // your logic here
|
3721
|
+
* }
|
3722
|
+
* });
|
3723
|
+
* // this handler is called when the app was already running when the launch was requested
|
3724
|
+
* fin.desktop.main(function(args) {
|
3725
|
+
* if(args && args['use-last-configuration']) {
|
3726
|
+
* // your logic here
|
3727
|
+
* }
|
3728
|
+
* });
|
3729
|
+
* }
|
3730
|
+
* ```
|
3731
|
+
*/
|
3732
|
+
async setJumpList(jumpListCategories) {
|
3733
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
3734
|
+
}
|
3735
|
+
/**
|
3736
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
3737
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
3738
|
+
*
|
3739
|
+
* @example
|
3740
|
+
*
|
3741
|
+
* ```js
|
3742
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
3743
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
3744
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
3745
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
3746
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
3747
|
+
*
|
3748
|
+
* async function setTrayIcon(icon) {
|
3749
|
+
* const app = await fin.Application.getCurrent();
|
3750
|
+
* return await app.setTrayIcon(icon);
|
3751
|
+
* }
|
3752
|
+
*
|
3753
|
+
* // use image url to set tray icon
|
3754
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3755
|
+
*
|
3756
|
+
* // use base64 encoded string to set tray icon
|
3757
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3758
|
+
*
|
3759
|
+
* // use a dataURL to set tray icon
|
3760
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
3761
|
+
* ```
|
3762
|
+
*/
|
3763
|
+
setTrayIcon(icon) {
|
3764
|
+
return this.wire
|
3765
|
+
.sendAction('set-tray-icon', {
|
3766
|
+
enabledIcon: icon,
|
3767
|
+
...this.identity
|
3768
|
+
})
|
3769
|
+
.then(() => undefined);
|
3770
|
+
}
|
3771
|
+
/**
|
3772
|
+
* Sets new application's shortcut configuration. Windows only.
|
3773
|
+
* @param config New application's shortcut configuration.
|
3774
|
+
*
|
3775
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
3776
|
+
* to be able to change shortcut states.
|
3777
|
+
*
|
3778
|
+
* @example
|
3779
|
+
*
|
3780
|
+
* ```js
|
3781
|
+
* async function setShortcuts(config) {
|
3782
|
+
* const app = await fin.Application.getCurrent();
|
3783
|
+
* return app.setShortcuts(config);
|
3784
|
+
* }
|
3785
|
+
*
|
3786
|
+
* setShortcuts({
|
3787
|
+
* desktop: true,
|
3788
|
+
* startMenu: false,
|
3789
|
+
* systemStartup: true
|
3790
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
3791
|
+
* ```
|
3792
|
+
*/
|
3793
|
+
setShortcuts(config) {
|
3794
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
3795
|
+
}
|
3796
|
+
/**
|
3797
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
3798
|
+
* @param queryString The new query string for this app's shortcuts.
|
3799
|
+
*
|
3800
|
+
* @example
|
3801
|
+
*
|
3802
|
+
* ```js
|
3803
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
3804
|
+
* const app = await fin.Application.getCurrent();
|
3805
|
+
* try {
|
3806
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
3807
|
+
* } catch(err) {
|
3808
|
+
* console.error(err)
|
3809
|
+
* }
|
3810
|
+
* ```
|
3811
|
+
*/
|
3812
|
+
async setShortcutQueryParams(queryString) {
|
3813
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
3814
|
+
}
|
3815
|
+
/**
|
3816
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
3817
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
3818
|
+
* @param level The zoom level
|
3819
|
+
*
|
3820
|
+
* @example
|
3821
|
+
*
|
3822
|
+
* ```js
|
3823
|
+
* async function setZoomLevel(number) {
|
3824
|
+
* const app = await fin.Application.getCurrent();
|
3825
|
+
* return await app.setZoomLevel(number);
|
3826
|
+
* }
|
3827
|
+
*
|
3828
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
3829
|
+
* ```
|
3830
|
+
*/
|
3831
|
+
setZoomLevel(level) {
|
3832
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
3833
|
+
}
|
3834
|
+
/**
|
3835
|
+
* Sets a username to correlate with App Log Management.
|
3836
|
+
* @param username Username to correlate with App's Log.
|
3837
|
+
*
|
3838
|
+
* @example
|
3839
|
+
*
|
3840
|
+
* ```js
|
3841
|
+
* async function setAppLogUser() {
|
3842
|
+
* const app = await fin.Application.getCurrent();
|
3843
|
+
* return await app.setAppLogUsername('username');
|
3844
|
+
* }
|
3845
|
+
*
|
3846
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
3847
|
+
*
|
3848
|
+
* ```
|
3849
|
+
*/
|
3850
|
+
async setAppLogUsername(username) {
|
3851
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
3852
|
+
}
|
3853
|
+
/**
|
3854
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
3855
|
+
* @remarks The only information currently returned is the position and dimensions.
|
3856
|
+
*
|
3857
|
+
* @example
|
3858
|
+
*
|
3859
|
+
* ```js
|
3860
|
+
* async function getTrayIconInfo() {
|
3861
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3862
|
+
* return await app.getTrayIconInfo();
|
3863
|
+
* }
|
3864
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3865
|
+
* ```
|
3866
|
+
*/
|
3867
|
+
getTrayIconInfo() {
|
3868
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
3869
|
+
}
|
3870
|
+
/**
|
3871
|
+
* Checks if the application has an associated tray icon.
|
3872
|
+
*
|
3873
|
+
* @example
|
3874
|
+
*
|
3875
|
+
* ```js
|
3876
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3877
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
3878
|
+
* console.log(hasTrayIcon);
|
3879
|
+
* ```
|
3880
|
+
*/
|
3881
|
+
hasTrayIcon() {
|
3882
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
3883
|
+
}
|
3884
|
+
/**
|
3885
|
+
* Closes the application by terminating its process.
|
3886
|
+
*
|
3887
|
+
* @example
|
3888
|
+
*
|
3889
|
+
* ```js
|
3890
|
+
* async function terminateApp() {
|
3891
|
+
* const app = await fin.Application.getCurrent();
|
3892
|
+
* return await app.terminate();
|
3893
|
+
* }
|
3894
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
3895
|
+
* ```
|
3896
|
+
*/
|
3897
|
+
terminate() {
|
3898
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
3899
|
+
}
|
3900
|
+
/**
|
3901
|
+
* Waits for a hanging application. This method can be called in response to an application
|
3902
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
3903
|
+
* message after a certain period of time.
|
3904
|
+
*
|
3905
|
+
* @ignore
|
3906
|
+
*/
|
3907
|
+
wait() {
|
3908
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
3909
|
+
}
|
3910
|
+
/**
|
3911
|
+
* Retrieves information about the application.
|
3912
|
+
*
|
3913
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
3914
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
3915
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
3916
|
+
*
|
3917
|
+
* @example
|
3918
|
+
*
|
3919
|
+
* ```js
|
3920
|
+
* async function getInfo() {
|
3921
|
+
* const app = await fin.Application.getCurrent();
|
3922
|
+
* return await app.getInfo();
|
3923
|
+
* }
|
3924
|
+
*
|
3925
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3926
|
+
* ```
|
3927
|
+
*/
|
3928
|
+
getInfo() {
|
3929
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
3930
|
+
}
|
3931
|
+
/**
|
3932
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
3933
|
+
*
|
3934
|
+
* @example
|
3935
|
+
* ```js
|
3936
|
+
* const app = await fin.Application.getCurrent();
|
3937
|
+
* const processInfo = await app.getProcessInfo();
|
3938
|
+
* ```
|
3939
|
+
* @experimental
|
3940
|
+
*/
|
3941
|
+
async getProcessInfo() {
|
3942
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
3943
|
+
return data;
|
3944
|
+
}
|
3945
|
+
/**
|
3946
|
+
* Sets file auto download location. It's only allowed in the same application.
|
3947
|
+
*
|
3948
|
+
* Note: This method is restricted by default and must be enabled via
|
3949
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3950
|
+
* @param downloadLocation file auto download location
|
3951
|
+
*
|
3952
|
+
* @throws if setting file auto download location on different applications.
|
3953
|
+
* @example
|
3954
|
+
*
|
3955
|
+
* ```js
|
3956
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
3957
|
+
* const app = await fin.Application.getCurrent();
|
3958
|
+
* try {
|
3959
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
3960
|
+
* console.log('File download location is set');
|
3961
|
+
* } catch(err) {
|
3962
|
+
* console.error(err)
|
3963
|
+
* }
|
3964
|
+
* ```
|
3965
|
+
*/
|
3966
|
+
async setFileDownloadLocation(downloadLocation) {
|
3967
|
+
const { name } = this.wire.me;
|
3968
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3969
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
3970
|
+
}
|
3971
|
+
/**
|
3972
|
+
* 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.
|
3973
|
+
*
|
3974
|
+
* Note: This method is restricted by default and must be enabled via
|
3975
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3976
|
+
*
|
3977
|
+
* @throws if getting file auto download location on different applications.
|
3978
|
+
* @example
|
3979
|
+
*
|
3980
|
+
* ```js
|
3981
|
+
* const app = await fin.Application.getCurrent();
|
3982
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
3983
|
+
* ```
|
3984
|
+
*/
|
3985
|
+
async getFileDownloadLocation() {
|
3986
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
3987
|
+
return data;
|
3988
|
+
}
|
3989
|
+
/**
|
3990
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
3991
|
+
* @param options
|
3992
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
3993
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
3994
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
3995
|
+
* these with a "reducer" pattern.
|
3996
|
+
* @throws if the application has no tray icon set
|
3997
|
+
* @throws if the system tray is currently hidden
|
3998
|
+
* @example
|
3999
|
+
*
|
4000
|
+
* ```js
|
4001
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
4002
|
+
* const app = fin.Application.getCurrentSync();
|
4003
|
+
*
|
4004
|
+
* await app.setTrayIcon(iconUrl);
|
4005
|
+
*
|
4006
|
+
* const template = [
|
4007
|
+
* {
|
4008
|
+
* label: 'Menu Item 1',
|
4009
|
+
* data: 'hello from item 1'
|
4010
|
+
* },
|
4011
|
+
* { type: 'separator' },
|
4012
|
+
* {
|
4013
|
+
* label: 'Menu Item 2',
|
4014
|
+
* type: 'checkbox',
|
4015
|
+
* checked: true,
|
4016
|
+
* data: 'The user clicked the checkbox'
|
4017
|
+
* },
|
4018
|
+
* {
|
4019
|
+
* label: 'see more',
|
4020
|
+
* enabled: false,
|
4021
|
+
* submenu: [
|
4022
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
4023
|
+
* ]
|
4024
|
+
* }
|
4025
|
+
* ];
|
4026
|
+
*
|
4027
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
4028
|
+
* // right-click
|
4029
|
+
* if (event.button === 2) {
|
4030
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
4031
|
+
* if (r.result === 'closed') {
|
4032
|
+
* console.log('nothing happened');
|
4033
|
+
* } else {
|
4034
|
+
* console.log(r.data);
|
4035
|
+
* }
|
4036
|
+
* });
|
4037
|
+
* }
|
4038
|
+
* });
|
4039
|
+
* ```
|
4040
|
+
*/
|
4041
|
+
async showTrayIconPopupMenu(options) {
|
4042
|
+
const { name } = this.wire.me;
|
4043
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
4044
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
4045
|
+
return payload.data;
|
4046
|
+
}
|
4047
|
+
/**
|
4048
|
+
* Closes the tray icon menu.
|
4049
|
+
*
|
4050
|
+
* @throws if the application has no tray icon set
|
4051
|
+
* @example
|
4052
|
+
*
|
4053
|
+
* ```js
|
4054
|
+
* const app = fin.Application.getCurrentSync();
|
4055
|
+
*
|
4056
|
+
* await app.closeTrayIconPopupMenu();
|
4057
|
+
* ```
|
4058
|
+
*/
|
4059
|
+
async closeTrayIconPopupMenu() {
|
4060
|
+
const { name } = this.wire.me;
|
4061
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
4062
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
4063
|
+
}
|
4064
|
+
}
|
4065
|
+
Instance$6.Application = Application;
|
4066
|
+
|
4067
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
4068
|
+
Factory$7.ApplicationModule = void 0;
|
4069
|
+
const base_1$j = base;
|
4070
|
+
const validate_1$4 = validate;
|
4071
|
+
const Instance_1$5 = Instance$6;
|
4072
|
+
/**
|
4073
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
4074
|
+
*/
|
4075
|
+
class ApplicationModule extends base_1$j.Base {
|
4076
|
+
/**
|
4077
|
+
* Asynchronously returns an API handle for the given Application identity.
|
4078
|
+
*
|
4079
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
4080
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
4081
|
+
* for an Application throughout its entire lifecycle.
|
4082
|
+
*
|
4083
|
+
* @example
|
4084
|
+
*
|
4085
|
+
* ```js
|
4086
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
4087
|
+
* .then(app => app.isRunning())
|
4088
|
+
* .then(running => console.log('Application is running: ' + running))
|
4089
|
+
* .catch(err => console.log(err));
|
4090
|
+
* ```
|
4091
|
+
*
|
4092
|
+
*/
|
4093
|
+
async wrap(identity) {
|
4094
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
4095
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4096
|
+
});
|
4097
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
4098
|
+
if (errorMsg) {
|
4099
|
+
throw new Error(errorMsg);
|
4100
|
+
}
|
4101
|
+
return new Instance_1$5.Application(this.wire, identity);
|
4102
|
+
}
|
4103
|
+
/**
|
4104
|
+
* Synchronously returns an API handle for the given Application identity.
|
4105
|
+
*
|
4106
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
4107
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
4108
|
+
* for an Aplication throughout its entire lifecycle.
|
4109
|
+
*
|
4110
|
+
* @example
|
4111
|
+
*
|
4112
|
+
* ```js
|
4113
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
4114
|
+
* await app.close();
|
4115
|
+
* ```
|
4116
|
+
*
|
4117
|
+
*/
|
4118
|
+
wrapSync(identity) {
|
4119
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
4120
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4121
|
+
});
|
4122
|
+
const errorMsg = (0, validate_1$4.validateIdentity)(identity);
|
4123
|
+
if (errorMsg) {
|
4124
|
+
throw new Error(errorMsg);
|
4125
|
+
}
|
4126
|
+
return new Instance_1$5.Application(this.wire, identity);
|
4127
|
+
}
|
4128
|
+
async _create(appOptions) {
|
4129
|
+
// set defaults:
|
4130
|
+
if (appOptions.waitForPageLoad === undefined) {
|
4131
|
+
appOptions.waitForPageLoad = false;
|
4132
|
+
}
|
4133
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
4134
|
+
appOptions.autoShow = true;
|
4135
|
+
}
|
4136
|
+
await this.wire.sendAction('create-application', appOptions);
|
4137
|
+
return this.wrap({ uuid: appOptions.uuid });
|
4138
|
+
}
|
4139
|
+
/**
|
4140
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
4141
|
+
*
|
4142
|
+
* @example
|
4143
|
+
*
|
4144
|
+
* ```js
|
4145
|
+
* async function createApp() {
|
4146
|
+
* const app = await fin.Application.create({
|
4147
|
+
* name: 'myApp',
|
4148
|
+
* uuid: 'app-3',
|
4149
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
4150
|
+
* autoShow: true
|
4151
|
+
* });
|
4152
|
+
* await app.run();
|
4153
|
+
* }
|
4154
|
+
*
|
4155
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
4156
|
+
* ```
|
4157
|
+
*
|
4158
|
+
* @ignore
|
4159
|
+
*/
|
4160
|
+
create(appOptions) {
|
4161
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
4162
|
+
this.wire.sendAction('application-create').catch((e) => {
|
4163
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4164
|
+
});
|
4165
|
+
return this._create(appOptions);
|
4166
|
+
}
|
4167
|
+
/**
|
4168
|
+
* Creates and starts a new Application.
|
4169
|
+
*
|
4170
|
+
* @example
|
4171
|
+
*
|
4172
|
+
* ```js
|
4173
|
+
* async function start() {
|
4174
|
+
* return fin.Application.start({
|
4175
|
+
* name: 'app-1',
|
4176
|
+
* uuid: 'app-1',
|
4177
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
4178
|
+
* autoShow: true
|
4179
|
+
* });
|
4180
|
+
* }
|
4181
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
4182
|
+
* ```
|
4183
|
+
*
|
4184
|
+
*/
|
4185
|
+
async start(appOptions) {
|
4186
|
+
this.wire.sendAction('start-application').catch((e) => {
|
4187
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4188
|
+
});
|
4189
|
+
const app = await this._create(appOptions);
|
4190
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
4191
|
+
return app;
|
4192
|
+
}
|
4193
|
+
/**
|
4194
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
4195
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
4196
|
+
* @param opts - Parameters that the RVM will use.
|
4197
|
+
*
|
4198
|
+
* @example
|
4199
|
+
*
|
4200
|
+
* ```js
|
4201
|
+
*
|
4202
|
+
* const applicationInfoArray = [
|
4203
|
+
* {
|
4204
|
+
* "uuid": 'App-1',
|
4205
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
4206
|
+
* },
|
4207
|
+
* {
|
4208
|
+
* "uuid": 'App-2',
|
4209
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
4210
|
+
* },
|
4211
|
+
* {
|
4212
|
+
* "uuid": 'App-3',
|
4213
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
4214
|
+
* }
|
4215
|
+
* ]
|
4216
|
+
*
|
4217
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
4218
|
+
* .then(() => {
|
4219
|
+
* console.log('RVM has finished launching the application list.');
|
4220
|
+
* })
|
4221
|
+
* .catch((err) => {
|
4222
|
+
* console.log(err);
|
4223
|
+
* })
|
4224
|
+
* ```
|
4225
|
+
*
|
4226
|
+
* @experimental
|
4227
|
+
*/
|
4228
|
+
async startManyManifests(applications, opts) {
|
4229
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
4230
|
+
}
|
4231
|
+
/**
|
4232
|
+
* Asynchronously returns an Application object that represents the current application
|
4233
|
+
*
|
4234
|
+
* @example
|
4235
|
+
*
|
4236
|
+
* ```js
|
4237
|
+
* async function isCurrentAppRunning () {
|
4238
|
+
* const app = await fin.Application.getCurrent();
|
4239
|
+
* return app.isRunning();
|
4240
|
+
* }
|
4241
|
+
*
|
4242
|
+
* isCurrentAppRunning().then(running => {
|
4243
|
+
* console.log(`Current app is running: ${running}`);
|
4244
|
+
* }).catch(err => {
|
4245
|
+
* console.error(err);
|
4246
|
+
* });
|
4247
|
+
*
|
4248
|
+
* ```
|
4249
|
+
*/
|
4250
|
+
getCurrent() {
|
4251
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
4252
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4253
|
+
});
|
4254
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
4255
|
+
}
|
4256
|
+
/**
|
4257
|
+
* Synchronously returns an Application object that represents the current application
|
4258
|
+
*
|
4259
|
+
* @example
|
4260
|
+
*
|
4261
|
+
* ```js
|
4262
|
+
* async function isCurrentAppRunning () {
|
4263
|
+
* const app = fin.Application.getCurrentSync();
|
4264
|
+
* return app.isRunning();
|
4265
|
+
* }
|
4266
|
+
*
|
4267
|
+
* isCurrentAppRunning().then(running => {
|
4268
|
+
* console.log(`Current app is running: ${running}`);
|
4269
|
+
* }).catch(err => {
|
4270
|
+
* console.error(err);
|
4271
|
+
* });
|
4272
|
+
*
|
4273
|
+
* ```
|
4274
|
+
*/
|
4275
|
+
getCurrentSync() {
|
4276
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
4277
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4278
|
+
});
|
4279
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
4280
|
+
}
|
4281
|
+
/**
|
4282
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
4283
|
+
* @param manifestUrl - The URL of app's manifest.
|
4284
|
+
* @param opts - Parameters that the RVM will use.
|
4285
|
+
*
|
4286
|
+
* @example
|
4287
|
+
*
|
4288
|
+
* ```js
|
4289
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
4290
|
+
*
|
4291
|
+
* // For a local manifest file:
|
4292
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
4293
|
+
* ```
|
4294
|
+
*/
|
4295
|
+
async startFromManifest(manifestUrl, opts) {
|
4296
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
4297
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4298
|
+
});
|
4299
|
+
const app = await this._createFromManifest(manifestUrl);
|
4300
|
+
// @ts-expect-error using private method without warning.
|
4301
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
4302
|
+
return app;
|
4303
|
+
}
|
4304
|
+
/**
|
4305
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
4306
|
+
* Retrieves application's manifest and returns a wrapped application.
|
4307
|
+
* @param manifestUrl - The URL of app's manifest.
|
4308
|
+
* @param callback - called if the method succeeds.
|
4309
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
4310
|
+
*
|
4311
|
+
* @example
|
4312
|
+
*
|
4313
|
+
* ```js
|
4314
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
4315
|
+
* ```
|
4316
|
+
* @ignore
|
4317
|
+
*/
|
4318
|
+
createFromManifest(manifestUrl) {
|
4319
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
4320
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
4321
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
4322
|
+
});
|
4323
|
+
return this._createFromManifest(manifestUrl);
|
4324
|
+
}
|
4325
|
+
_createFromManifest(manifestUrl) {
|
4326
|
+
return this.wire
|
4327
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
4328
|
+
.then(({ payload }) => {
|
4329
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
4330
|
+
return this.wrap({ uuid });
|
4331
|
+
})
|
4332
|
+
.then((app) => {
|
4333
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
4334
|
+
return app;
|
4335
|
+
});
|
4336
|
+
}
|
4072
4337
|
}
|
4338
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
4073
4339
|
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4077
|
-
|
4078
|
-
|
4079
|
-
|
4080
|
-
|
4081
|
-
|
4082
|
-
|
4083
|
-
|
4340
|
+
(function (exports) {
|
4341
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4342
|
+
if (k2 === undefined) k2 = k;
|
4343
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
4344
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
4345
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
4346
|
+
}
|
4347
|
+
Object.defineProperty(o, k2, desc);
|
4348
|
+
}) : (function(o, m, k, k2) {
|
4349
|
+
if (k2 === undefined) k2 = k;
|
4350
|
+
o[k2] = m[k];
|
4351
|
+
}));
|
4352
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
4353
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
4354
|
+
};
|
4355
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4084
4356
|
/**
|
4085
|
-
*
|
4357
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
4358
|
+
*
|
4359
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
4360
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
4361
|
+
*
|
4362
|
+
* 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),
|
4363
|
+
* both of these were documented on the same page.
|
4364
|
+
*
|
4365
|
+
* @packageDocumentation
|
4086
4366
|
*/
|
4087
|
-
|
4088
|
-
|
4089
|
-
|
4090
|
-
*
|
4091
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
4092
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
4093
|
-
* for an Application throughout its entire lifecycle.
|
4094
|
-
*
|
4095
|
-
* @example
|
4096
|
-
*
|
4097
|
-
* ```js
|
4098
|
-
* fin.Application.wrap({ uuid: 'testapp' })
|
4099
|
-
* .then(app => app.isRunning())
|
4100
|
-
* .then(running => console.log('Application is running: ' + running))
|
4101
|
-
* .catch(err => console.log(err));
|
4102
|
-
* ```
|
4103
|
-
*
|
4104
|
-
*/
|
4105
|
-
async wrap(identity) {
|
4106
|
-
this.wire.sendAction('wrap-application').catch((e) => {
|
4107
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4108
|
-
});
|
4109
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
4110
|
-
if (errorMsg) {
|
4111
|
-
throw new Error(errorMsg);
|
4112
|
-
}
|
4113
|
-
return new Instance_1.Application(this.wire, identity);
|
4114
|
-
}
|
4115
|
-
/**
|
4116
|
-
* Synchronously returns an API handle for the given Application identity.
|
4117
|
-
*
|
4118
|
-
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
4119
|
-
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
4120
|
-
* for an Aplication throughout its entire lifecycle.
|
4121
|
-
*
|
4122
|
-
* @example
|
4123
|
-
*
|
4124
|
-
* ```js
|
4125
|
-
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
4126
|
-
* await app.close();
|
4127
|
-
* ```
|
4128
|
-
*
|
4129
|
-
*/
|
4130
|
-
wrapSync(identity) {
|
4131
|
-
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
4132
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4133
|
-
});
|
4134
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
4135
|
-
if (errorMsg) {
|
4136
|
-
throw new Error(errorMsg);
|
4137
|
-
}
|
4138
|
-
return new Instance_1.Application(this.wire, identity);
|
4139
|
-
}
|
4140
|
-
async _create(appOptions) {
|
4141
|
-
// set defaults:
|
4142
|
-
if (appOptions.waitForPageLoad === undefined) {
|
4143
|
-
appOptions.waitForPageLoad = false;
|
4144
|
-
}
|
4145
|
-
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
4146
|
-
appOptions.autoShow = true;
|
4147
|
-
}
|
4148
|
-
await this.wire.sendAction('create-application', appOptions);
|
4149
|
-
return this.wrap({ uuid: appOptions.uuid });
|
4150
|
-
}
|
4151
|
-
/**
|
4152
|
-
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
4153
|
-
*
|
4154
|
-
* @example
|
4155
|
-
*
|
4156
|
-
* ```js
|
4157
|
-
* async function createApp() {
|
4158
|
-
* const app = await fin.Application.create({
|
4159
|
-
* name: 'myApp',
|
4160
|
-
* uuid: 'app-3',
|
4161
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
4162
|
-
* autoShow: true
|
4163
|
-
* });
|
4164
|
-
* await app.run();
|
4165
|
-
* }
|
4166
|
-
*
|
4167
|
-
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
4168
|
-
* ```
|
4169
|
-
*
|
4170
|
-
* @ignore
|
4171
|
-
*/
|
4172
|
-
create(appOptions) {
|
4173
|
-
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
4174
|
-
this.wire.sendAction('application-create').catch((e) => {
|
4175
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4176
|
-
});
|
4177
|
-
return this._create(appOptions);
|
4178
|
-
}
|
4179
|
-
/**
|
4180
|
-
* Creates and starts a new Application.
|
4181
|
-
*
|
4182
|
-
* @example
|
4183
|
-
*
|
4184
|
-
* ```js
|
4185
|
-
* async function start() {
|
4186
|
-
* return fin.Application.start({
|
4187
|
-
* name: 'app-1',
|
4188
|
-
* uuid: 'app-1',
|
4189
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
4190
|
-
* autoShow: true
|
4191
|
-
* });
|
4192
|
-
* }
|
4193
|
-
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
4194
|
-
* ```
|
4195
|
-
*
|
4196
|
-
*/
|
4197
|
-
async start(appOptions) {
|
4198
|
-
this.wire.sendAction('start-application').catch((e) => {
|
4199
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4200
|
-
});
|
4201
|
-
const app = await this._create(appOptions);
|
4202
|
-
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
4203
|
-
return app;
|
4204
|
-
}
|
4205
|
-
/**
|
4206
|
-
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
4207
|
-
* Returns once the RVM is finished attempting to launch the applications.
|
4208
|
-
* @param opts - Parameters that the RVM will use.
|
4209
|
-
*
|
4210
|
-
* @example
|
4211
|
-
*
|
4212
|
-
* ```js
|
4213
|
-
*
|
4214
|
-
* const applicationInfoArray = [
|
4215
|
-
* {
|
4216
|
-
* "uuid": 'App-1',
|
4217
|
-
* "manifestUrl": 'http://localhost:5555/app1.json',
|
4218
|
-
* },
|
4219
|
-
* {
|
4220
|
-
* "uuid": 'App-2',
|
4221
|
-
* "manifestUrl": 'http://localhost:5555/app2.json',
|
4222
|
-
* },
|
4223
|
-
* {
|
4224
|
-
* "uuid": 'App-3',
|
4225
|
-
* "manifestUrl": 'http://localhost:5555/app3.json',
|
4226
|
-
* }
|
4227
|
-
* ]
|
4228
|
-
*
|
4229
|
-
* fin.Application.startManyManifests(applicationInfoArray)
|
4230
|
-
* .then(() => {
|
4231
|
-
* console.log('RVM has finished launching the application list.');
|
4232
|
-
* })
|
4233
|
-
* .catch((err) => {
|
4234
|
-
* console.log(err);
|
4235
|
-
* })
|
4236
|
-
* ```
|
4237
|
-
*
|
4238
|
-
* @experimental
|
4239
|
-
*/
|
4240
|
-
async startManyManifests(applications, opts) {
|
4241
|
-
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
4242
|
-
}
|
4243
|
-
/**
|
4244
|
-
* Asynchronously returns an Application object that represents the current application
|
4245
|
-
*
|
4246
|
-
* @example
|
4247
|
-
*
|
4248
|
-
* ```js
|
4249
|
-
* async function isCurrentAppRunning () {
|
4250
|
-
* const app = await fin.Application.getCurrent();
|
4251
|
-
* return app.isRunning();
|
4252
|
-
* }
|
4253
|
-
*
|
4254
|
-
* isCurrentAppRunning().then(running => {
|
4255
|
-
* console.log(`Current app is running: ${running}`);
|
4256
|
-
* }).catch(err => {
|
4257
|
-
* console.error(err);
|
4258
|
-
* });
|
4259
|
-
*
|
4260
|
-
* ```
|
4261
|
-
*/
|
4262
|
-
getCurrent() {
|
4263
|
-
this.wire.sendAction('get-current-application').catch((e) => {
|
4264
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4265
|
-
});
|
4266
|
-
return this.wrap({ uuid: this.wire.me.uuid });
|
4267
|
-
}
|
4268
|
-
/**
|
4269
|
-
* Synchronously returns an Application object that represents the current application
|
4270
|
-
*
|
4271
|
-
* @example
|
4272
|
-
*
|
4273
|
-
* ```js
|
4274
|
-
* async function isCurrentAppRunning () {
|
4275
|
-
* const app = fin.Application.getCurrentSync();
|
4276
|
-
* return app.isRunning();
|
4277
|
-
* }
|
4278
|
-
*
|
4279
|
-
* isCurrentAppRunning().then(running => {
|
4280
|
-
* console.log(`Current app is running: ${running}`);
|
4281
|
-
* }).catch(err => {
|
4282
|
-
* console.error(err);
|
4283
|
-
* });
|
4284
|
-
*
|
4285
|
-
* ```
|
4286
|
-
*/
|
4287
|
-
getCurrentSync() {
|
4288
|
-
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
4289
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4290
|
-
});
|
4291
|
-
return this.wrapSync({ uuid: this.wire.me.uuid });
|
4292
|
-
}
|
4293
|
-
/**
|
4294
|
-
* Retrieves application's manifest and returns a running instance of the application.
|
4295
|
-
* @param manifestUrl - The URL of app's manifest.
|
4296
|
-
* @param opts - Parameters that the RVM will use.
|
4297
|
-
*
|
4298
|
-
* @example
|
4299
|
-
*
|
4300
|
-
* ```js
|
4301
|
-
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
4302
|
-
*
|
4303
|
-
* // For a local manifest file:
|
4304
|
-
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
4305
|
-
* ```
|
4306
|
-
*/
|
4307
|
-
async startFromManifest(manifestUrl, opts) {
|
4308
|
-
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
4309
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4310
|
-
});
|
4311
|
-
const app = await this._createFromManifest(manifestUrl);
|
4312
|
-
// @ts-expect-error using private method without warning.
|
4313
|
-
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
4314
|
-
return app;
|
4315
|
-
}
|
4316
|
-
/**
|
4317
|
-
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
4318
|
-
* Retrieves application's manifest and returns a wrapped application.
|
4319
|
-
* @param manifestUrl - The URL of app's manifest.
|
4320
|
-
* @param callback - called if the method succeeds.
|
4321
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
4322
|
-
*
|
4323
|
-
* @example
|
4324
|
-
*
|
4325
|
-
* ```js
|
4326
|
-
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
4327
|
-
* ```
|
4328
|
-
* @ignore
|
4329
|
-
*/
|
4330
|
-
createFromManifest(manifestUrl) {
|
4331
|
-
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
4332
|
-
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
4333
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
4334
|
-
});
|
4335
|
-
return this._createFromManifest(manifestUrl);
|
4336
|
-
}
|
4337
|
-
_createFromManifest(manifestUrl) {
|
4338
|
-
return this.wire
|
4339
|
-
.sendAction('get-application-manifest', { manifestUrl })
|
4340
|
-
.then(({ payload }) => {
|
4341
|
-
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
4342
|
-
return this.wrap({ uuid });
|
4343
|
-
})
|
4344
|
-
.then((app) => {
|
4345
|
-
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
4346
|
-
return app;
|
4347
|
-
});
|
4348
|
-
}
|
4349
|
-
}
|
4350
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
4351
|
-
return Factory$7;
|
4352
|
-
}
|
4353
|
-
|
4354
|
-
var hasRequiredApplication;
|
4355
|
-
|
4356
|
-
function requireApplication () {
|
4357
|
-
if (hasRequiredApplication) return application;
|
4358
|
-
hasRequiredApplication = 1;
|
4359
|
-
(function (exports) {
|
4360
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4361
|
-
if (k2 === undefined) k2 = k;
|
4362
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
4363
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
4364
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
4365
|
-
}
|
4366
|
-
Object.defineProperty(o, k2, desc);
|
4367
|
-
}) : (function(o, m, k, k2) {
|
4368
|
-
if (k2 === undefined) k2 = k;
|
4369
|
-
o[k2] = m[k];
|
4370
|
-
}));
|
4371
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
4372
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
4373
|
-
};
|
4374
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4375
|
-
/**
|
4376
|
-
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
4377
|
-
*
|
4378
|
-
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
4379
|
-
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
4380
|
-
*
|
4381
|
-
* 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),
|
4382
|
-
* both of these were documented on the same page.
|
4383
|
-
*
|
4384
|
-
* @packageDocumentation
|
4385
|
-
*/
|
4386
|
-
__exportStar(requireFactory$2(), exports);
|
4387
|
-
__exportStar(requireInstance$1(), exports);
|
4388
|
-
} (application));
|
4389
|
-
return application;
|
4390
|
-
}
|
4367
|
+
__exportStar(Factory$7, exports);
|
4368
|
+
__exportStar(Instance$6, exports);
|
4369
|
+
} (application));
|
4391
4370
|
|
4392
4371
|
var promisifySubscription$1 = {};
|
4393
4372
|
|
@@ -4431,7 +4410,7 @@ function requireInstance () {
|
|
4431
4410
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
4432
4411
|
/* eslint-disable no-console */
|
4433
4412
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
4434
|
-
const application_1 =
|
4413
|
+
const application_1 = application;
|
4435
4414
|
const main_1 = main;
|
4436
4415
|
const view_1 = requireView();
|
4437
4416
|
const warnings_1 = warnings;
|
@@ -16873,7 +16852,7 @@ const events_1$3 = require$$0;
|
|
16873
16852
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
16874
16853
|
const index_1 = system;
|
16875
16854
|
const index_2 = requireWindow();
|
16876
|
-
const index_3 =
|
16855
|
+
const index_3 = application;
|
16877
16856
|
const index_4 = interappbus;
|
16878
16857
|
const index_5 = clipboard;
|
16879
16858
|
const index_6 = externalApplication;
|