@openfin/node-adapter 41.100.57 → 41.100.59
Sign up to get free protection for your applications and to get access to all the features.
- package/out/node-adapter.js +1158 -1137
- package/package.json +2 -2
package/out/node-adapter.js
CHANGED
@@ -552,11 +552,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
552
552
|
};
|
553
553
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
554
554
|
|
555
|
-
var hasRequiredFactory$
|
555
|
+
var hasRequiredFactory$2;
|
556
556
|
|
557
|
-
function requireFactory$
|
558
|
-
if (hasRequiredFactory$
|
559
|
-
hasRequiredFactory$
|
557
|
+
function requireFactory$2 () {
|
558
|
+
if (hasRequiredFactory$2) return Factory$6;
|
559
|
+
hasRequiredFactory$2 = 1;
|
560
560
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
561
561
|
Factory$6.ViewModule = void 0;
|
562
562
|
const base_1 = base;
|
@@ -771,8 +771,8 @@ var main = {};
|
|
771
771
|
|
772
772
|
Object.defineProperty(main, "__esModule", { value: true });
|
773
773
|
main.WebContents = void 0;
|
774
|
-
const base_1$
|
775
|
-
class WebContents extends base_1$
|
774
|
+
const base_1$m = base;
|
775
|
+
class WebContents extends base_1$m.EmitterBase {
|
776
776
|
/**
|
777
777
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
778
778
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
@@ -1853,11 +1853,11 @@ class WebContents extends base_1$o.EmitterBase {
|
|
1853
1853
|
}
|
1854
1854
|
main.WebContents = WebContents;
|
1855
1855
|
|
1856
|
-
var hasRequiredInstance$
|
1856
|
+
var hasRequiredInstance$2;
|
1857
1857
|
|
1858
|
-
function requireInstance$
|
1859
|
-
if (hasRequiredInstance$
|
1860
|
-
hasRequiredInstance$
|
1858
|
+
function requireInstance$2 () {
|
1859
|
+
if (hasRequiredInstance$2) return Instance$5;
|
1860
|
+
hasRequiredInstance$2 = 1;
|
1861
1861
|
var _View_providerChannelClient;
|
1862
1862
|
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
1863
1863
|
Instance$5.View = void 0;
|
@@ -2437,1139 +2437,1160 @@ function requireView () {
|
|
2437
2437
|
*
|
2438
2438
|
* @packageDocumentation
|
2439
2439
|
*/
|
2440
|
-
__exportStar(requireFactory$
|
2441
|
-
__exportStar(requireInstance$
|
2440
|
+
__exportStar(requireFactory$2(), exports);
|
2441
|
+
__exportStar(requireInstance$2(), exports);
|
2442
2442
|
} (view));
|
2443
2443
|
return view;
|
2444
2444
|
}
|
2445
2445
|
|
2446
|
-
|
2447
|
-
Instance$6.Application = void 0;
|
2448
|
-
/* eslint-disable import/prefer-default-export */
|
2449
|
-
const base_1$n = base;
|
2450
|
-
const window_1$1 = requireWindow();
|
2451
|
-
const view_1 = requireView();
|
2452
|
-
/**
|
2453
|
-
* An object representing an application. Allows the developer to create,
|
2454
|
-
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
2455
|
-
*/
|
2456
|
-
class Application extends base_1$n.EmitterBase {
|
2457
|
-
/**
|
2458
|
-
* @internal
|
2459
|
-
*/
|
2460
|
-
constructor(wire, identity) {
|
2461
|
-
super(wire, 'application', identity.uuid);
|
2462
|
-
this.identity = identity;
|
2463
|
-
this.window = new window_1$1._Window(this.wire, {
|
2464
|
-
uuid: this.identity.uuid,
|
2465
|
-
name: this.identity.uuid
|
2466
|
-
});
|
2467
|
-
}
|
2468
|
-
windowListFromIdentityList(identityList) {
|
2469
|
-
const windowList = [];
|
2470
|
-
identityList.forEach((identity) => {
|
2471
|
-
windowList.push(new window_1$1._Window(this.wire, {
|
2472
|
-
uuid: identity.uuid,
|
2473
|
-
name: identity.name
|
2474
|
-
}));
|
2475
|
-
});
|
2476
|
-
return windowList;
|
2477
|
-
}
|
2478
|
-
/**
|
2479
|
-
* Determines if the application is currently running.
|
2480
|
-
*
|
2481
|
-
* @example
|
2482
|
-
*
|
2483
|
-
* ```js
|
2484
|
-
* async function isAppRunning() {
|
2485
|
-
* const app = await fin.Application.getCurrent();
|
2486
|
-
* return await app.isRunning();
|
2487
|
-
* }
|
2488
|
-
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
2489
|
-
* ```
|
2490
|
-
*/
|
2491
|
-
isRunning() {
|
2492
|
-
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
2493
|
-
}
|
2494
|
-
/**
|
2495
|
-
* Closes the application and any child windows created by the application.
|
2496
|
-
* Cleans the application from state so it is no longer found in getAllApplications.
|
2497
|
-
* @param force Close will be prevented from closing when force is false and
|
2498
|
-
* ‘close-requested’ has been subscribed to for application’s main window.
|
2499
|
-
*
|
2500
|
-
* @example
|
2501
|
-
*
|
2502
|
-
* ```js
|
2503
|
-
* async function closeApp() {
|
2504
|
-
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
2505
|
-
* const app = await fin.Application.wrap({uuid: 'app2'});
|
2506
|
-
* await app.quit();
|
2507
|
-
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
2508
|
-
*
|
2509
|
-
* }
|
2510
|
-
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
2511
|
-
* ```
|
2512
|
-
*/
|
2513
|
-
async quit(force = false) {
|
2514
|
-
try {
|
2515
|
-
await this._close(force);
|
2516
|
-
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
2517
|
-
}
|
2518
|
-
catch (error) {
|
2519
|
-
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
2520
|
-
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
2521
|
-
throw error;
|
2522
|
-
}
|
2523
|
-
}
|
2524
|
-
}
|
2525
|
-
async _close(force = false) {
|
2526
|
-
try {
|
2527
|
-
await this.wire.sendAction('close-application', { force, ...this.identity });
|
2528
|
-
}
|
2529
|
-
catch (error) {
|
2530
|
-
if (!error.message.includes('Remote connection has closed')) {
|
2531
|
-
throw error;
|
2532
|
-
}
|
2533
|
-
}
|
2534
|
-
}
|
2535
|
-
/**
|
2536
|
-
* @deprecated use Application.quit instead
|
2537
|
-
* Closes the application and any child windows created by the application.
|
2538
|
-
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
2539
|
-
* @param callback - called if the method succeeds.
|
2540
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
2541
|
-
*
|
2542
|
-
* @example
|
2543
|
-
*
|
2544
|
-
* ```js
|
2545
|
-
* async function closeApp() {
|
2546
|
-
* const app = await fin.Application.getCurrent();
|
2547
|
-
* return await app.close();
|
2548
|
-
* }
|
2549
|
-
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
2550
|
-
* ```
|
2551
|
-
*/
|
2552
|
-
close(force = false) {
|
2553
|
-
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
2554
|
-
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
2555
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
2556
|
-
});
|
2557
|
-
return this._close(force);
|
2558
|
-
}
|
2559
|
-
/**
|
2560
|
-
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
2561
|
-
*
|
2562
|
-
* @example
|
2563
|
-
*
|
2564
|
-
* ```js
|
2565
|
-
* async function getChildWindows() {
|
2566
|
-
* const app = await fin.Application.getCurrent();
|
2567
|
-
* return await app.getChildWindows();
|
2568
|
-
* }
|
2569
|
-
*
|
2570
|
-
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
2571
|
-
* ```
|
2572
|
-
*/
|
2573
|
-
getChildWindows() {
|
2574
|
-
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
2575
|
-
const identityList = [];
|
2576
|
-
payload.data.forEach((winName) => {
|
2577
|
-
identityList.push({ uuid: this.identity.uuid, name: winName });
|
2578
|
-
});
|
2579
|
-
return this.windowListFromIdentityList(identityList);
|
2580
|
-
});
|
2581
|
-
}
|
2582
|
-
/**
|
2583
|
-
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
2584
|
-
* if the application was not created from a manifest.
|
2585
|
-
*
|
2586
|
-
* @example
|
2587
|
-
*
|
2588
|
-
* ```js
|
2589
|
-
* async function getManifest() {
|
2590
|
-
* const app = await fin.Application.getCurrent();
|
2591
|
-
* return await app.getManifest();
|
2592
|
-
* }
|
2593
|
-
*
|
2594
|
-
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
2595
|
-
* ```
|
2596
|
-
*/
|
2597
|
-
getManifest() {
|
2598
|
-
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
2599
|
-
}
|
2600
|
-
/**
|
2601
|
-
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
2602
|
-
* if the application was created from a manifest.
|
2603
|
-
*
|
2604
|
-
* @example
|
2605
|
-
*
|
2606
|
-
* ```js
|
2607
|
-
* async function getParentUuid() {
|
2608
|
-
* const app = await fin.Application.start({
|
2609
|
-
* uuid: 'app-1',
|
2610
|
-
* name: 'myApp',
|
2611
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
2612
|
-
* autoShow: true
|
2613
|
-
* });
|
2614
|
-
* return await app.getParentUuid();
|
2615
|
-
* }
|
2616
|
-
*
|
2617
|
-
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
2618
|
-
* ```
|
2619
|
-
*/
|
2620
|
-
getParentUuid() {
|
2621
|
-
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
2622
|
-
}
|
2623
|
-
/**
|
2624
|
-
* Retrieves current application's shortcut configuration.
|
2625
|
-
*
|
2626
|
-
* @example
|
2627
|
-
*
|
2628
|
-
* ```js
|
2629
|
-
* async function getShortcuts() {
|
2630
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
2631
|
-
* return await app.getShortcuts();
|
2632
|
-
* }
|
2633
|
-
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
2634
|
-
* ```
|
2635
|
-
*/
|
2636
|
-
getShortcuts() {
|
2637
|
-
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
2638
|
-
}
|
2639
|
-
/**
|
2640
|
-
* Retrieves current application's views.
|
2641
|
-
* @experimental
|
2642
|
-
*
|
2643
|
-
* @example
|
2644
|
-
*
|
2645
|
-
* ```js
|
2646
|
-
* async function getViews() {
|
2647
|
-
* const app = await fin.Application.getCurrent();
|
2648
|
-
* return await app.getViews();
|
2649
|
-
* }
|
2650
|
-
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
2651
|
-
* ```
|
2652
|
-
*/
|
2653
|
-
async getViews() {
|
2654
|
-
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
2655
|
-
return payload.data.map((id) => new view_1.View(this.wire, id));
|
2656
|
-
}
|
2657
|
-
/**
|
2658
|
-
* Returns the current zoom level of the application.
|
2659
|
-
*
|
2660
|
-
* @example
|
2661
|
-
*
|
2662
|
-
* ```js
|
2663
|
-
* async function getZoomLevel() {
|
2664
|
-
* const app = await fin.Application.getCurrent();
|
2665
|
-
* return await app.getZoomLevel();
|
2666
|
-
* }
|
2667
|
-
*
|
2668
|
-
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
2669
|
-
* ```
|
2670
|
-
*/
|
2671
|
-
getZoomLevel() {
|
2672
|
-
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
2673
|
-
}
|
2674
|
-
/**
|
2675
|
-
* Returns an instance of the main Window of the application
|
2676
|
-
*
|
2677
|
-
* @example
|
2678
|
-
*
|
2679
|
-
* ```js
|
2680
|
-
* async function getWindow() {
|
2681
|
-
* const app = await fin.Application.start({
|
2682
|
-
* uuid: 'app-1',
|
2683
|
-
* name: 'myApp',
|
2684
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
2685
|
-
* autoShow: true
|
2686
|
-
* });
|
2687
|
-
* return await app.getWindow();
|
2688
|
-
* }
|
2689
|
-
*
|
2690
|
-
* getWindow().then(win => {
|
2691
|
-
* win.showAt(0, 400);
|
2692
|
-
* win.flash();
|
2693
|
-
* }).catch(err => console.log(err));
|
2694
|
-
* ```
|
2695
|
-
*/
|
2696
|
-
getWindow() {
|
2697
|
-
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
2698
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
2699
|
-
});
|
2700
|
-
return Promise.resolve(this.window);
|
2701
|
-
}
|
2702
|
-
/**
|
2703
|
-
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
2704
|
-
* @param userName - username to be passed to the RVM.
|
2705
|
-
* @param appName - app name to be passed to the RVM.
|
2706
|
-
*
|
2707
|
-
* @example
|
2708
|
-
*
|
2709
|
-
* ```js
|
2710
|
-
* async function registerUser() {
|
2711
|
-
* const app = await fin.Application.getCurrent();
|
2712
|
-
* return await app.registerUser('user', 'myApp');
|
2713
|
-
* }
|
2714
|
-
*
|
2715
|
-
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
2716
|
-
* ```
|
2717
|
-
*/
|
2718
|
-
registerUser(userName, appName) {
|
2719
|
-
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
2720
|
-
}
|
2721
|
-
/**
|
2722
|
-
* Removes the application’s icon from the tray.
|
2723
|
-
*
|
2724
|
-
* @example
|
2725
|
-
*
|
2726
|
-
* ```js
|
2727
|
-
* async function removeTrayIcon() {
|
2728
|
-
* const app = await fin.Application.getCurrent();
|
2729
|
-
* return await app.removeTrayIcon();
|
2730
|
-
* }
|
2731
|
-
*
|
2732
|
-
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
2733
|
-
* ```
|
2734
|
-
*/
|
2735
|
-
removeTrayIcon() {
|
2736
|
-
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
2737
|
-
}
|
2738
|
-
/**
|
2739
|
-
* Restarts the application.
|
2740
|
-
*
|
2741
|
-
* @example
|
2742
|
-
*
|
2743
|
-
* ```js
|
2744
|
-
* async function restartApp() {
|
2745
|
-
* const app = await fin.Application.getCurrent();
|
2746
|
-
* return await app.restart();
|
2747
|
-
* }
|
2748
|
-
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
2749
|
-
* ```
|
2750
|
-
*/
|
2751
|
-
restart() {
|
2752
|
-
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
2753
|
-
}
|
2754
|
-
/**
|
2755
|
-
* DEPRECATED method to run the application.
|
2756
|
-
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
2757
|
-
*
|
2758
|
-
* @example
|
2759
|
-
*
|
2760
|
-
* ```js
|
2761
|
-
* async function run() {
|
2762
|
-
* const app = await fin.Application.create({
|
2763
|
-
* name: 'myApp',
|
2764
|
-
* uuid: 'app-1',
|
2765
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
2766
|
-
* autoShow: true
|
2767
|
-
* });
|
2768
|
-
* await app.run();
|
2769
|
-
* }
|
2770
|
-
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
2771
|
-
* ```
|
2772
|
-
*
|
2773
|
-
* @ignore
|
2774
|
-
*/
|
2775
|
-
run() {
|
2776
|
-
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
2777
|
-
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
2778
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
2779
|
-
});
|
2780
|
-
return this._run();
|
2781
|
-
}
|
2782
|
-
_run(opts = {}) {
|
2783
|
-
return this.wire
|
2784
|
-
.sendAction('run-application', {
|
2785
|
-
manifestUrl: this._manifestUrl,
|
2786
|
-
opts,
|
2787
|
-
...this.identity
|
2788
|
-
})
|
2789
|
-
.then(() => undefined);
|
2790
|
-
}
|
2791
|
-
/**
|
2792
|
-
* Instructs the RVM to schedule one restart of the application.
|
2793
|
-
*
|
2794
|
-
* @example
|
2795
|
-
*
|
2796
|
-
* ```js
|
2797
|
-
* async function scheduleRestart() {
|
2798
|
-
* const app = await fin.Application.getCurrent();
|
2799
|
-
* return await app.scheduleRestart();
|
2800
|
-
* }
|
2801
|
-
*
|
2802
|
-
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
2803
|
-
* ```
|
2804
|
-
*/
|
2805
|
-
scheduleRestart() {
|
2806
|
-
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
2807
|
-
}
|
2808
|
-
/**
|
2809
|
-
* Sends a message to the RVM to upload the application's logs. On success,
|
2810
|
-
* an object containing logId is returned.
|
2811
|
-
*
|
2812
|
-
* @example
|
2813
|
-
*
|
2814
|
-
* ```js
|
2815
|
-
* async function sendLog() {
|
2816
|
-
* const app = await fin.Application.getCurrent();
|
2817
|
-
* return await app.sendApplicationLog();
|
2818
|
-
* }
|
2819
|
-
*
|
2820
|
-
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
2821
|
-
* ```
|
2822
|
-
*/
|
2823
|
-
async sendApplicationLog() {
|
2824
|
-
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
2825
|
-
return payload.data;
|
2826
|
-
}
|
2827
|
-
/**
|
2828
|
-
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
2829
|
-
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
2830
|
-
*
|
2831
|
-
* Note: If the "name" property is omitted it defaults to "tasks".
|
2832
|
-
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
2833
|
-
*
|
2834
|
-
*
|
2835
|
-
* @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).
|
2836
|
-
*
|
2837
|
-
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
2838
|
-
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
2839
|
-
*
|
2840
|
-
* Note: If the "name" property is omitted it defaults to "tasks".
|
2841
|
-
*
|
2842
|
-
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
2843
|
-
* uuid or shortcut.name is changed.
|
2844
|
-
*
|
2845
|
-
* @example
|
2846
|
-
*
|
2847
|
-
* ```js
|
2848
|
-
* const app = fin.Application.getCurrentSync();
|
2849
|
-
* const appName = 'My App';
|
2850
|
-
* const jumpListConfig = [ // array of JumpList categories
|
2851
|
-
* {
|
2852
|
-
* // has no name and no type so `type` is assumed to be "tasks"
|
2853
|
-
* items: [ // array of JumpList items
|
2854
|
-
* {
|
2855
|
-
* type: 'task',
|
2856
|
-
* title: `Launch ${appName}`,
|
2857
|
-
* description: `Runs ${appName} with the default configuration`,
|
2858
|
-
* deepLink: 'fins://path.to/app/manifest.json',
|
2859
|
-
* iconPath: 'https://path.to/app/icon.ico',
|
2860
|
-
* iconIndex: 0
|
2861
|
-
* },
|
2862
|
-
* { type: 'separator' },
|
2863
|
-
* {
|
2864
|
-
* type: 'task',
|
2865
|
-
* title: `Restore ${appName}`,
|
2866
|
-
* description: 'Restore to last configuration',
|
2867
|
-
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
2868
|
-
* iconPath: 'https://path.to/app/icon.ico',
|
2869
|
-
* iconIndex: 0
|
2870
|
-
* },
|
2871
|
-
* ]
|
2872
|
-
* },
|
2873
|
-
* {
|
2874
|
-
* name: 'Tools',
|
2875
|
-
* items: [ // array of JumpList items
|
2876
|
-
* {
|
2877
|
-
* type: 'task',
|
2878
|
-
* title: 'Tool A',
|
2879
|
-
* description: 'Runs Tool A',
|
2880
|
-
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
2881
|
-
* iconPath: 'https://path.to/tool-a/icon.ico',
|
2882
|
-
* iconIndex: 0
|
2883
|
-
* },
|
2884
|
-
* {
|
2885
|
-
* type: 'task',
|
2886
|
-
* title: 'Tool B',
|
2887
|
-
* description: 'Runs Tool B',
|
2888
|
-
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
2889
|
-
* iconPath: 'https://path.to/tool-b/icon.ico',
|
2890
|
-
* iconIndex: 0
|
2891
|
-
* }]
|
2892
|
-
* }
|
2893
|
-
* ];
|
2894
|
-
*
|
2895
|
-
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
2896
|
-
* ```
|
2897
|
-
*
|
2898
|
-
* To handle deeplink args:
|
2899
|
-
* ```js
|
2900
|
-
* function handleUseLastConfiguration() {
|
2901
|
-
* // this handler is called when the app is being launched
|
2902
|
-
* app.on('run-requested', event => {
|
2903
|
-
* if(event.userAppConfigArgs['use-last-configuration']) {
|
2904
|
-
* // your logic here
|
2905
|
-
* }
|
2906
|
-
* });
|
2907
|
-
* // this handler is called when the app was already running when the launch was requested
|
2908
|
-
* fin.desktop.main(function(args) {
|
2909
|
-
* if(args && args['use-last-configuration']) {
|
2910
|
-
* // your logic here
|
2911
|
-
* }
|
2912
|
-
* });
|
2913
|
-
* }
|
2914
|
-
* ```
|
2915
|
-
*/
|
2916
|
-
async setJumpList(jumpListCategories) {
|
2917
|
-
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
2918
|
-
}
|
2919
|
-
/**
|
2920
|
-
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
2921
|
-
* @param icon Image URL or base64 encoded string to be used as the icon
|
2922
|
-
*
|
2923
|
-
* @example
|
2924
|
-
*
|
2925
|
-
* ```js
|
2926
|
-
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
2927
|
-
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
2928
|
-
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
2929
|
-
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
2930
|
-
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
2931
|
-
*
|
2932
|
-
* async function setTrayIcon(icon) {
|
2933
|
-
* const app = await fin.Application.getCurrent();
|
2934
|
-
* return await app.setTrayIcon(icon);
|
2935
|
-
* }
|
2936
|
-
*
|
2937
|
-
* // use image url to set tray icon
|
2938
|
-
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
2939
|
-
*
|
2940
|
-
* // use base64 encoded string to set tray icon
|
2941
|
-
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
2942
|
-
*
|
2943
|
-
* // use a dataURL to set tray icon
|
2944
|
-
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
2945
|
-
* ```
|
2946
|
-
*/
|
2947
|
-
setTrayIcon(icon) {
|
2948
|
-
return this.wire
|
2949
|
-
.sendAction('set-tray-icon', {
|
2950
|
-
enabledIcon: icon,
|
2951
|
-
...this.identity
|
2952
|
-
})
|
2953
|
-
.then(() => undefined);
|
2954
|
-
}
|
2955
|
-
/**
|
2956
|
-
* Set hover text for this application's system tray icon.
|
2957
|
-
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
2958
|
-
* @param toolTip
|
2959
|
-
*
|
2960
|
-
* @example
|
2961
|
-
*
|
2962
|
-
* ```js
|
2963
|
-
* const app = fin.Application.getCurrentSync();
|
2964
|
-
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
2965
|
-
*
|
2966
|
-
* await app.setTrayIcon(iconUrl);
|
2967
|
-
*
|
2968
|
-
* await app.setTrayIconToolTip('My Application');
|
2969
|
-
* ```
|
2970
|
-
*/
|
2971
|
-
async setTrayIconToolTip(toolTip) {
|
2972
|
-
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
2973
|
-
}
|
2974
|
-
/**
|
2975
|
-
* Sets new application's shortcut configuration. Windows only.
|
2976
|
-
* @param config New application's shortcut configuration.
|
2977
|
-
*
|
2978
|
-
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
2979
|
-
* to be able to change shortcut states.
|
2980
|
-
*
|
2981
|
-
* @example
|
2982
|
-
*
|
2983
|
-
* ```js
|
2984
|
-
* async function setShortcuts(config) {
|
2985
|
-
* const app = await fin.Application.getCurrent();
|
2986
|
-
* return app.setShortcuts(config);
|
2987
|
-
* }
|
2988
|
-
*
|
2989
|
-
* setShortcuts({
|
2990
|
-
* desktop: true,
|
2991
|
-
* startMenu: false,
|
2992
|
-
* systemStartup: true
|
2993
|
-
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
2994
|
-
* ```
|
2995
|
-
*/
|
2996
|
-
setShortcuts(config) {
|
2997
|
-
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
2998
|
-
}
|
2999
|
-
/**
|
3000
|
-
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
3001
|
-
* @param queryString The new query string for this app's shortcuts.
|
3002
|
-
*
|
3003
|
-
* @example
|
3004
|
-
*
|
3005
|
-
* ```js
|
3006
|
-
* const newQueryArgs = 'arg=true&arg2=false';
|
3007
|
-
* const app = await fin.Application.getCurrent();
|
3008
|
-
* try {
|
3009
|
-
* await app.setShortcutQueryParams(newQueryArgs);
|
3010
|
-
* } catch(err) {
|
3011
|
-
* console.error(err)
|
3012
|
-
* }
|
3013
|
-
* ```
|
3014
|
-
*/
|
3015
|
-
async setShortcutQueryParams(queryString) {
|
3016
|
-
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
3017
|
-
}
|
3018
|
-
/**
|
3019
|
-
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
3020
|
-
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
3021
|
-
* @param level The zoom level
|
3022
|
-
*
|
3023
|
-
* @example
|
3024
|
-
*
|
3025
|
-
* ```js
|
3026
|
-
* async function setZoomLevel(number) {
|
3027
|
-
* const app = await fin.Application.getCurrent();
|
3028
|
-
* return await app.setZoomLevel(number);
|
3029
|
-
* }
|
3030
|
-
*
|
3031
|
-
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
3032
|
-
* ```
|
3033
|
-
*/
|
3034
|
-
setZoomLevel(level) {
|
3035
|
-
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
3036
|
-
}
|
3037
|
-
/**
|
3038
|
-
* Sets a username to correlate with App Log Management.
|
3039
|
-
* @param username Username to correlate with App's Log.
|
3040
|
-
*
|
3041
|
-
* @example
|
3042
|
-
*
|
3043
|
-
* ```js
|
3044
|
-
* async function setAppLogUser() {
|
3045
|
-
* const app = await fin.Application.getCurrent();
|
3046
|
-
* return await app.setAppLogUsername('username');
|
3047
|
-
* }
|
3048
|
-
*
|
3049
|
-
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
3050
|
-
*
|
3051
|
-
* ```
|
3052
|
-
*/
|
3053
|
-
async setAppLogUsername(username) {
|
3054
|
-
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
3055
|
-
}
|
3056
|
-
/**
|
3057
|
-
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
3058
|
-
* @remarks The only information currently returned is the position and dimensions.
|
3059
|
-
*
|
3060
|
-
* @example
|
3061
|
-
*
|
3062
|
-
* ```js
|
3063
|
-
* async function getTrayIconInfo() {
|
3064
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3065
|
-
* return await app.getTrayIconInfo();
|
3066
|
-
* }
|
3067
|
-
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3068
|
-
* ```
|
3069
|
-
*/
|
3070
|
-
getTrayIconInfo() {
|
3071
|
-
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
3072
|
-
}
|
3073
|
-
/**
|
3074
|
-
* Checks if the application has an associated tray icon.
|
3075
|
-
*
|
3076
|
-
* @example
|
3077
|
-
*
|
3078
|
-
* ```js
|
3079
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3080
|
-
* const hasTrayIcon = await app.hasTrayIcon();
|
3081
|
-
* console.log(hasTrayIcon);
|
3082
|
-
* ```
|
3083
|
-
*/
|
3084
|
-
hasTrayIcon() {
|
3085
|
-
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
3086
|
-
}
|
3087
|
-
/**
|
3088
|
-
* Closes the application by terminating its process.
|
3089
|
-
*
|
3090
|
-
* @example
|
3091
|
-
*
|
3092
|
-
* ```js
|
3093
|
-
* async function terminateApp() {
|
3094
|
-
* const app = await fin.Application.getCurrent();
|
3095
|
-
* return await app.terminate();
|
3096
|
-
* }
|
3097
|
-
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
3098
|
-
* ```
|
3099
|
-
*/
|
3100
|
-
terminate() {
|
3101
|
-
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
3102
|
-
}
|
3103
|
-
/**
|
3104
|
-
* Waits for a hanging application. This method can be called in response to an application
|
3105
|
-
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
3106
|
-
* message after a certain period of time.
|
3107
|
-
*
|
3108
|
-
* @ignore
|
3109
|
-
*/
|
3110
|
-
wait() {
|
3111
|
-
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
3112
|
-
}
|
3113
|
-
/**
|
3114
|
-
* Retrieves information about the application.
|
3115
|
-
*
|
3116
|
-
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
3117
|
-
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
3118
|
-
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
3119
|
-
*
|
3120
|
-
* @example
|
3121
|
-
*
|
3122
|
-
* ```js
|
3123
|
-
* async function getInfo() {
|
3124
|
-
* const app = await fin.Application.getCurrent();
|
3125
|
-
* return await app.getInfo();
|
3126
|
-
* }
|
3127
|
-
*
|
3128
|
-
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3129
|
-
* ```
|
3130
|
-
*/
|
3131
|
-
getInfo() {
|
3132
|
-
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
3133
|
-
}
|
3134
|
-
/**
|
3135
|
-
* Retrieves all process information for entities (windows and views) associated with an application.
|
3136
|
-
*
|
3137
|
-
* @example
|
3138
|
-
* ```js
|
3139
|
-
* const app = await fin.Application.getCurrent();
|
3140
|
-
* const processInfo = await app.getProcessInfo();
|
3141
|
-
* ```
|
3142
|
-
* @experimental
|
3143
|
-
*/
|
3144
|
-
async getProcessInfo() {
|
3145
|
-
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
3146
|
-
return data;
|
3147
|
-
}
|
3148
|
-
/**
|
3149
|
-
* Sets file auto download location. It's only allowed in the same application.
|
3150
|
-
*
|
3151
|
-
* Note: This method is restricted by default and must be enabled via
|
3152
|
-
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3153
|
-
* @param downloadLocation file auto download location
|
3154
|
-
*
|
3155
|
-
* @throws if setting file auto download location on different applications.
|
3156
|
-
* @example
|
3157
|
-
*
|
3158
|
-
* ```js
|
3159
|
-
* const downloadLocation = 'C:\\dev\\temp';
|
3160
|
-
* const app = await fin.Application.getCurrent();
|
3161
|
-
* try {
|
3162
|
-
* await app.setFileDownloadLocation(downloadLocation);
|
3163
|
-
* console.log('File download location is set');
|
3164
|
-
* } catch(err) {
|
3165
|
-
* console.error(err)
|
3166
|
-
* }
|
3167
|
-
* ```
|
3168
|
-
*/
|
3169
|
-
async setFileDownloadLocation(downloadLocation) {
|
3170
|
-
const { name } = this.wire.me;
|
3171
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
3172
|
-
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
3173
|
-
}
|
3174
|
-
/**
|
3175
|
-
* 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.
|
3176
|
-
*
|
3177
|
-
* Note: This method is restricted by default and must be enabled via
|
3178
|
-
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3179
|
-
*
|
3180
|
-
* @throws if getting file auto download location on different applications.
|
3181
|
-
* @example
|
3182
|
-
*
|
3183
|
-
* ```js
|
3184
|
-
* const app = await fin.Application.getCurrent();
|
3185
|
-
* const fileDownloadDir = await app.getFileDownloadLocation();
|
3186
|
-
* ```
|
3187
|
-
*/
|
3188
|
-
async getFileDownloadLocation() {
|
3189
|
-
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
3190
|
-
return data;
|
3191
|
-
}
|
3192
|
-
/**
|
3193
|
-
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
3194
|
-
* @param options
|
3195
|
-
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
3196
|
-
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
3197
|
-
* of all possible data shapes for the entire menu, and the click handler should process
|
3198
|
-
* these with a "reducer" pattern.
|
3199
|
-
* @throws if the application has no tray icon set
|
3200
|
-
* @throws if the system tray is currently hidden
|
3201
|
-
* @example
|
3202
|
-
*
|
3203
|
-
* ```js
|
3204
|
-
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
3205
|
-
* const app = fin.Application.getCurrentSync();
|
3206
|
-
*
|
3207
|
-
* await app.setTrayIcon(iconUrl);
|
3208
|
-
*
|
3209
|
-
* const template = [
|
3210
|
-
* {
|
3211
|
-
* label: 'Menu Item 1',
|
3212
|
-
* data: 'hello from item 1'
|
3213
|
-
* },
|
3214
|
-
* { type: 'separator' },
|
3215
|
-
* {
|
3216
|
-
* label: 'Menu Item 2',
|
3217
|
-
* type: 'checkbox',
|
3218
|
-
* checked: true,
|
3219
|
-
* data: 'The user clicked the checkbox'
|
3220
|
-
* },
|
3221
|
-
* {
|
3222
|
-
* label: 'see more',
|
3223
|
-
* enabled: false,
|
3224
|
-
* submenu: [
|
3225
|
-
* { label: 'submenu 1', data: 'hello from submenu' }
|
3226
|
-
* ]
|
3227
|
-
* }
|
3228
|
-
* ];
|
3229
|
-
*
|
3230
|
-
* app.addListener('tray-icon-clicked', (event) => {
|
3231
|
-
* // right-click
|
3232
|
-
* if (event.button === 2) {
|
3233
|
-
* app.showTrayIconPopupMenu({ template }).then(r => {
|
3234
|
-
* if (r.result === 'closed') {
|
3235
|
-
* console.log('nothing happened');
|
3236
|
-
* } else {
|
3237
|
-
* console.log(r.data);
|
3238
|
-
* }
|
3239
|
-
* });
|
3240
|
-
* }
|
3241
|
-
* });
|
3242
|
-
* ```
|
3243
|
-
*/
|
3244
|
-
async showTrayIconPopupMenu(options) {
|
3245
|
-
const { name } = this.wire.me;
|
3246
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
3247
|
-
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
3248
|
-
return payload.data;
|
3249
|
-
}
|
3250
|
-
/**
|
3251
|
-
* Closes the tray icon menu.
|
3252
|
-
*
|
3253
|
-
* @throws if the application has no tray icon set
|
3254
|
-
* @example
|
3255
|
-
*
|
3256
|
-
* ```js
|
3257
|
-
* const app = fin.Application.getCurrentSync();
|
3258
|
-
*
|
3259
|
-
* await app.closeTrayIconPopupMenu();
|
3260
|
-
* ```
|
3261
|
-
*/
|
3262
|
-
async closeTrayIconPopupMenu() {
|
3263
|
-
const { name } = this.wire.me;
|
3264
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
3265
|
-
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
3266
|
-
}
|
3267
|
-
}
|
3268
|
-
Instance$6.Application = Application;
|
2446
|
+
var hasRequiredInstance$1;
|
3269
2447
|
|
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
|
-
|
2448
|
+
function requireInstance$1 () {
|
2449
|
+
if (hasRequiredInstance$1) return Instance$6;
|
2450
|
+
hasRequiredInstance$1 = 1;
|
2451
|
+
Object.defineProperty(Instance$6, "__esModule", { value: true });
|
2452
|
+
Instance$6.Application = void 0;
|
2453
|
+
/* eslint-disable import/prefer-default-export */
|
2454
|
+
const base_1 = base;
|
2455
|
+
const window_1 = requireWindow();
|
2456
|
+
const view_1 = requireView();
|
2457
|
+
/**
|
2458
|
+
* An object representing an application. Allows the developer to create,
|
2459
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
2460
|
+
*/
|
2461
|
+
class Application extends base_1.EmitterBase {
|
2462
|
+
/**
|
2463
|
+
* @internal
|
2464
|
+
*/
|
2465
|
+
constructor(wire, identity) {
|
2466
|
+
super(wire, 'application', identity.uuid);
|
2467
|
+
this.identity = identity;
|
2468
|
+
this.window = new window_1._Window(this.wire, {
|
2469
|
+
uuid: this.identity.uuid,
|
2470
|
+
name: this.identity.uuid
|
2471
|
+
});
|
2472
|
+
}
|
2473
|
+
windowListFromIdentityList(identityList) {
|
2474
|
+
const windowList = [];
|
2475
|
+
identityList.forEach((identity) => {
|
2476
|
+
windowList.push(new window_1._Window(this.wire, {
|
2477
|
+
uuid: identity.uuid,
|
2478
|
+
name: identity.name
|
2479
|
+
}));
|
2480
|
+
});
|
2481
|
+
return windowList;
|
2482
|
+
}
|
2483
|
+
/**
|
2484
|
+
* Determines if the application is currently running.
|
2485
|
+
*
|
2486
|
+
* @example
|
2487
|
+
*
|
2488
|
+
* ```js
|
2489
|
+
* async function isAppRunning() {
|
2490
|
+
* const app = await fin.Application.getCurrent();
|
2491
|
+
* return await app.isRunning();
|
2492
|
+
* }
|
2493
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
2494
|
+
* ```
|
2495
|
+
*/
|
2496
|
+
isRunning() {
|
2497
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
2498
|
+
}
|
2499
|
+
/**
|
2500
|
+
* Closes the application and any child windows created by the application.
|
2501
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
2502
|
+
* @param force Close will be prevented from closing when force is false and
|
2503
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
2504
|
+
*
|
2505
|
+
* @example
|
2506
|
+
*
|
2507
|
+
* ```js
|
2508
|
+
* async function closeApp() {
|
2509
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
2510
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
2511
|
+
* await app.quit();
|
2512
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
2513
|
+
*
|
2514
|
+
* }
|
2515
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
2516
|
+
* ```
|
2517
|
+
*/
|
2518
|
+
async quit(force = false) {
|
2519
|
+
try {
|
2520
|
+
await this._close(force);
|
2521
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
2522
|
+
}
|
2523
|
+
catch (error) {
|
2524
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
2525
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
2526
|
+
throw error;
|
2527
|
+
}
|
2528
|
+
}
|
2529
|
+
}
|
2530
|
+
async _close(force = false) {
|
2531
|
+
try {
|
2532
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
2533
|
+
}
|
2534
|
+
catch (error) {
|
2535
|
+
if (!error.message.includes('Remote connection has closed')) {
|
2536
|
+
throw error;
|
2537
|
+
}
|
2538
|
+
}
|
2539
|
+
}
|
2540
|
+
/**
|
2541
|
+
* @deprecated use Application.quit instead
|
2542
|
+
* Closes the application and any child windows created by the application.
|
2543
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
2544
|
+
* @param callback - called if the method succeeds.
|
2545
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
2546
|
+
*
|
2547
|
+
* @example
|
2548
|
+
*
|
2549
|
+
* ```js
|
2550
|
+
* async function closeApp() {
|
2551
|
+
* const app = await fin.Application.getCurrent();
|
2552
|
+
* return await app.close();
|
2553
|
+
* }
|
2554
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
2555
|
+
* ```
|
2556
|
+
*/
|
2557
|
+
close(force = false) {
|
2558
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
2559
|
+
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
2560
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
2561
|
+
});
|
2562
|
+
return this._close(force);
|
2563
|
+
}
|
2564
|
+
/**
|
2565
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
2566
|
+
*
|
2567
|
+
* @example
|
2568
|
+
*
|
2569
|
+
* ```js
|
2570
|
+
* async function getChildWindows() {
|
2571
|
+
* const app = await fin.Application.getCurrent();
|
2572
|
+
* return await app.getChildWindows();
|
2573
|
+
* }
|
2574
|
+
*
|
2575
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
2576
|
+
* ```
|
2577
|
+
*/
|
2578
|
+
getChildWindows() {
|
2579
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
2580
|
+
const identityList = [];
|
2581
|
+
payload.data.forEach((winName) => {
|
2582
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
2583
|
+
});
|
2584
|
+
return this.windowListFromIdentityList(identityList);
|
2585
|
+
});
|
2586
|
+
}
|
2587
|
+
/**
|
2588
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
2589
|
+
* if the application was not created from a manifest.
|
2590
|
+
*
|
2591
|
+
* @example
|
2592
|
+
*
|
2593
|
+
* ```js
|
2594
|
+
* async function getManifest() {
|
2595
|
+
* const app = await fin.Application.getCurrent();
|
2596
|
+
* return await app.getManifest();
|
2597
|
+
* }
|
2598
|
+
*
|
2599
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
2600
|
+
* ```
|
2601
|
+
*/
|
2602
|
+
getManifest() {
|
2603
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
2604
|
+
}
|
2605
|
+
/**
|
2606
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
2607
|
+
* if the application was created from a manifest.
|
2608
|
+
*
|
2609
|
+
* @example
|
2610
|
+
*
|
2611
|
+
* ```js
|
2612
|
+
* async function getParentUuid() {
|
2613
|
+
* const app = await fin.Application.start({
|
2614
|
+
* uuid: 'app-1',
|
2615
|
+
* name: 'myApp',
|
2616
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
2617
|
+
* autoShow: true
|
2618
|
+
* });
|
2619
|
+
* return await app.getParentUuid();
|
2620
|
+
* }
|
2621
|
+
*
|
2622
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
2623
|
+
* ```
|
2624
|
+
*/
|
2625
|
+
getParentUuid() {
|
2626
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
2627
|
+
}
|
2628
|
+
/**
|
2629
|
+
* Retrieves current application's shortcut configuration.
|
2630
|
+
*
|
2631
|
+
* @example
|
2632
|
+
*
|
2633
|
+
* ```js
|
2634
|
+
* async function getShortcuts() {
|
2635
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
2636
|
+
* return await app.getShortcuts();
|
2637
|
+
* }
|
2638
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
2639
|
+
* ```
|
2640
|
+
*/
|
2641
|
+
getShortcuts() {
|
2642
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
2643
|
+
}
|
2644
|
+
/**
|
2645
|
+
* Retrieves current application's views.
|
2646
|
+
* @experimental
|
2647
|
+
*
|
2648
|
+
* @example
|
2649
|
+
*
|
2650
|
+
* ```js
|
2651
|
+
* async function getViews() {
|
2652
|
+
* const app = await fin.Application.getCurrent();
|
2653
|
+
* return await app.getViews();
|
2654
|
+
* }
|
2655
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
2656
|
+
* ```
|
2657
|
+
*/
|
2658
|
+
async getViews() {
|
2659
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
2660
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
2661
|
+
}
|
2662
|
+
/**
|
2663
|
+
* Returns the current zoom level of the application.
|
2664
|
+
*
|
2665
|
+
* @example
|
2666
|
+
*
|
2667
|
+
* ```js
|
2668
|
+
* async function getZoomLevel() {
|
2669
|
+
* const app = await fin.Application.getCurrent();
|
2670
|
+
* return await app.getZoomLevel();
|
2671
|
+
* }
|
2672
|
+
*
|
2673
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
2674
|
+
* ```
|
2675
|
+
*/
|
2676
|
+
getZoomLevel() {
|
2677
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
2678
|
+
}
|
2679
|
+
/**
|
2680
|
+
* Returns an instance of the main Window of the application
|
2681
|
+
*
|
2682
|
+
* @example
|
2683
|
+
*
|
2684
|
+
* ```js
|
2685
|
+
* async function getWindow() {
|
2686
|
+
* const app = await fin.Application.start({
|
2687
|
+
* uuid: 'app-1',
|
2688
|
+
* name: 'myApp',
|
2689
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
2690
|
+
* autoShow: true
|
2691
|
+
* });
|
2692
|
+
* return await app.getWindow();
|
2693
|
+
* }
|
2694
|
+
*
|
2695
|
+
* getWindow().then(win => {
|
2696
|
+
* win.showAt(0, 400);
|
2697
|
+
* win.flash();
|
2698
|
+
* }).catch(err => console.log(err));
|
2699
|
+
* ```
|
2700
|
+
*/
|
2701
|
+
getWindow() {
|
2702
|
+
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
2703
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
2704
|
+
});
|
2705
|
+
return Promise.resolve(this.window);
|
2706
|
+
}
|
2707
|
+
/**
|
2708
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
2709
|
+
* @param userName - username to be passed to the RVM.
|
2710
|
+
* @param appName - app name to be passed to the RVM.
|
2711
|
+
*
|
2712
|
+
* @example
|
2713
|
+
*
|
2714
|
+
* ```js
|
2715
|
+
* async function registerUser() {
|
2716
|
+
* const app = await fin.Application.getCurrent();
|
2717
|
+
* return await app.registerUser('user', 'myApp');
|
2718
|
+
* }
|
2719
|
+
*
|
2720
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
2721
|
+
* ```
|
2722
|
+
*/
|
2723
|
+
registerUser(userName, appName) {
|
2724
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
2725
|
+
}
|
2726
|
+
/**
|
2727
|
+
* Removes the application’s icon from the tray.
|
2728
|
+
*
|
2729
|
+
* @example
|
2730
|
+
*
|
2731
|
+
* ```js
|
2732
|
+
* async function removeTrayIcon() {
|
2733
|
+
* const app = await fin.Application.getCurrent();
|
2734
|
+
* return await app.removeTrayIcon();
|
2735
|
+
* }
|
2736
|
+
*
|
2737
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
2738
|
+
* ```
|
2739
|
+
*/
|
2740
|
+
removeTrayIcon() {
|
2741
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
2742
|
+
}
|
2743
|
+
/**
|
2744
|
+
* Restarts the application.
|
2745
|
+
*
|
2746
|
+
* @example
|
2747
|
+
*
|
2748
|
+
* ```js
|
2749
|
+
* async function restartApp() {
|
2750
|
+
* const app = await fin.Application.getCurrent();
|
2751
|
+
* return await app.restart();
|
2752
|
+
* }
|
2753
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
2754
|
+
* ```
|
2755
|
+
*/
|
2756
|
+
restart() {
|
2757
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
2758
|
+
}
|
2759
|
+
/**
|
2760
|
+
* DEPRECATED method to run the application.
|
2761
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
2762
|
+
*
|
2763
|
+
* @example
|
2764
|
+
*
|
2765
|
+
* ```js
|
2766
|
+
* async function run() {
|
2767
|
+
* const app = await fin.Application.create({
|
2768
|
+
* name: 'myApp',
|
2769
|
+
* uuid: 'app-1',
|
2770
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
2771
|
+
* autoShow: true
|
2772
|
+
* });
|
2773
|
+
* await app.run();
|
2774
|
+
* }
|
2775
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
2776
|
+
* ```
|
2777
|
+
*
|
2778
|
+
* @ignore
|
2779
|
+
*/
|
2780
|
+
run() {
|
2781
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
2782
|
+
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
2783
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
2784
|
+
});
|
2785
|
+
return this._run();
|
2786
|
+
}
|
2787
|
+
_run(opts = {}) {
|
2788
|
+
return this.wire
|
2789
|
+
.sendAction('run-application', {
|
2790
|
+
manifestUrl: this._manifestUrl,
|
2791
|
+
opts,
|
2792
|
+
...this.identity
|
2793
|
+
})
|
2794
|
+
.then(() => undefined);
|
2795
|
+
}
|
2796
|
+
/**
|
2797
|
+
* Instructs the RVM to schedule one restart of the application.
|
2798
|
+
*
|
2799
|
+
* @example
|
2800
|
+
*
|
2801
|
+
* ```js
|
2802
|
+
* async function scheduleRestart() {
|
2803
|
+
* const app = await fin.Application.getCurrent();
|
2804
|
+
* return await app.scheduleRestart();
|
2805
|
+
* }
|
2806
|
+
*
|
2807
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
2808
|
+
* ```
|
2809
|
+
*/
|
2810
|
+
scheduleRestart() {
|
2811
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
2812
|
+
}
|
2813
|
+
/**
|
2814
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
2815
|
+
* an object containing logId is returned.
|
2816
|
+
*
|
2817
|
+
* @example
|
2818
|
+
*
|
2819
|
+
* ```js
|
2820
|
+
* async function sendLog() {
|
2821
|
+
* const app = await fin.Application.getCurrent();
|
2822
|
+
* return await app.sendApplicationLog();
|
2823
|
+
* }
|
2824
|
+
*
|
2825
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
2826
|
+
* ```
|
2827
|
+
*/
|
2828
|
+
async sendApplicationLog() {
|
2829
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
2830
|
+
return payload.data;
|
2831
|
+
}
|
2832
|
+
/**
|
2833
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
2834
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
2835
|
+
*
|
2836
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
2837
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
2838
|
+
*
|
2839
|
+
*
|
2840
|
+
* @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).
|
2841
|
+
*
|
2842
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
2843
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
2844
|
+
*
|
2845
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
2846
|
+
*
|
2847
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
2848
|
+
* uuid or shortcut.name is changed.
|
2849
|
+
*
|
2850
|
+
* @example
|
2851
|
+
*
|
2852
|
+
* ```js
|
2853
|
+
* const app = fin.Application.getCurrentSync();
|
2854
|
+
* const appName = 'My App';
|
2855
|
+
* const jumpListConfig = [ // array of JumpList categories
|
2856
|
+
* {
|
2857
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
2858
|
+
* items: [ // array of JumpList items
|
2859
|
+
* {
|
2860
|
+
* type: 'task',
|
2861
|
+
* title: `Launch ${appName}`,
|
2862
|
+
* description: `Runs ${appName} with the default configuration`,
|
2863
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
2864
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
2865
|
+
* iconIndex: 0
|
2866
|
+
* },
|
2867
|
+
* { type: 'separator' },
|
2868
|
+
* {
|
2869
|
+
* type: 'task',
|
2870
|
+
* title: `Restore ${appName}`,
|
2871
|
+
* description: 'Restore to last configuration',
|
2872
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
2873
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
2874
|
+
* iconIndex: 0
|
2875
|
+
* },
|
2876
|
+
* ]
|
2877
|
+
* },
|
2878
|
+
* {
|
2879
|
+
* name: 'Tools',
|
2880
|
+
* items: [ // array of JumpList items
|
2881
|
+
* {
|
2882
|
+
* type: 'task',
|
2883
|
+
* title: 'Tool A',
|
2884
|
+
* description: 'Runs Tool A',
|
2885
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
2886
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
2887
|
+
* iconIndex: 0
|
2888
|
+
* },
|
2889
|
+
* {
|
2890
|
+
* type: 'task',
|
2891
|
+
* title: 'Tool B',
|
2892
|
+
* description: 'Runs Tool B',
|
2893
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
2894
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
2895
|
+
* iconIndex: 0
|
2896
|
+
* }]
|
2897
|
+
* }
|
2898
|
+
* ];
|
2899
|
+
*
|
2900
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
2901
|
+
* ```
|
2902
|
+
*
|
2903
|
+
* To handle deeplink args:
|
2904
|
+
* ```js
|
2905
|
+
* function handleUseLastConfiguration() {
|
2906
|
+
* // this handler is called when the app is being launched
|
2907
|
+
* app.on('run-requested', event => {
|
2908
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
2909
|
+
* // your logic here
|
2910
|
+
* }
|
2911
|
+
* });
|
2912
|
+
* // this handler is called when the app was already running when the launch was requested
|
2913
|
+
* fin.desktop.main(function(args) {
|
2914
|
+
* if(args && args['use-last-configuration']) {
|
2915
|
+
* // your logic here
|
2916
|
+
* }
|
2917
|
+
* });
|
2918
|
+
* }
|
2919
|
+
* ```
|
2920
|
+
*/
|
2921
|
+
async setJumpList(jumpListCategories) {
|
2922
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
2923
|
+
}
|
2924
|
+
/**
|
2925
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
2926
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
2927
|
+
*
|
2928
|
+
* @example
|
2929
|
+
*
|
2930
|
+
* ```js
|
2931
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
2932
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
2933
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
2934
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
2935
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
2936
|
+
*
|
2937
|
+
* async function setTrayIcon(icon) {
|
2938
|
+
* const app = await fin.Application.getCurrent();
|
2939
|
+
* return await app.setTrayIcon(icon);
|
2940
|
+
* }
|
2941
|
+
*
|
2942
|
+
* // use image url to set tray icon
|
2943
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
2944
|
+
*
|
2945
|
+
* // use base64 encoded string to set tray icon
|
2946
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
2947
|
+
*
|
2948
|
+
* // use a dataURL to set tray icon
|
2949
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
2950
|
+
* ```
|
2951
|
+
*/
|
2952
|
+
setTrayIcon(icon) {
|
2953
|
+
return this.wire
|
2954
|
+
.sendAction('set-tray-icon', {
|
2955
|
+
enabledIcon: icon,
|
2956
|
+
...this.identity
|
2957
|
+
})
|
2958
|
+
.then(() => undefined);
|
2959
|
+
}
|
2960
|
+
/**
|
2961
|
+
* Set hover text for this application's system tray icon.
|
2962
|
+
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
2963
|
+
* @param toolTip
|
2964
|
+
*
|
2965
|
+
* @example
|
2966
|
+
*
|
2967
|
+
* ```js
|
2968
|
+
* const app = fin.Application.getCurrentSync();
|
2969
|
+
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
2970
|
+
*
|
2971
|
+
* await app.setTrayIcon(iconUrl);
|
2972
|
+
*
|
2973
|
+
* await app.setTrayIconToolTip('My Application');
|
2974
|
+
* ```
|
2975
|
+
*/
|
2976
|
+
async setTrayIconToolTip(toolTip) {
|
2977
|
+
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
2978
|
+
}
|
2979
|
+
/**
|
2980
|
+
* Sets new application's shortcut configuration. Windows only.
|
2981
|
+
* @param config New application's shortcut configuration.
|
2982
|
+
*
|
2983
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
2984
|
+
* to be able to change shortcut states.
|
2985
|
+
*
|
2986
|
+
* @example
|
2987
|
+
*
|
2988
|
+
* ```js
|
2989
|
+
* async function setShortcuts(config) {
|
2990
|
+
* const app = await fin.Application.getCurrent();
|
2991
|
+
* return app.setShortcuts(config);
|
2992
|
+
* }
|
2993
|
+
*
|
2994
|
+
* setShortcuts({
|
2995
|
+
* desktop: true,
|
2996
|
+
* startMenu: false,
|
2997
|
+
* systemStartup: true
|
2998
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
2999
|
+
* ```
|
3000
|
+
*/
|
3001
|
+
setShortcuts(config) {
|
3002
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
3003
|
+
}
|
3004
|
+
/**
|
3005
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
3006
|
+
* @param queryString The new query string for this app's shortcuts.
|
3007
|
+
*
|
3008
|
+
* @example
|
3009
|
+
*
|
3010
|
+
* ```js
|
3011
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
3012
|
+
* const app = await fin.Application.getCurrent();
|
3013
|
+
* try {
|
3014
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
3015
|
+
* } catch(err) {
|
3016
|
+
* console.error(err)
|
3017
|
+
* }
|
3018
|
+
* ```
|
3019
|
+
*/
|
3020
|
+
async setShortcutQueryParams(queryString) {
|
3021
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
3022
|
+
}
|
3023
|
+
/**
|
3024
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
3025
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
3026
|
+
* @param level The zoom level
|
3027
|
+
*
|
3028
|
+
* @example
|
3029
|
+
*
|
3030
|
+
* ```js
|
3031
|
+
* async function setZoomLevel(number) {
|
3032
|
+
* const app = await fin.Application.getCurrent();
|
3033
|
+
* return await app.setZoomLevel(number);
|
3034
|
+
* }
|
3035
|
+
*
|
3036
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
3037
|
+
* ```
|
3038
|
+
*/
|
3039
|
+
setZoomLevel(level) {
|
3040
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
3041
|
+
}
|
3042
|
+
/**
|
3043
|
+
* Sets a username to correlate with App Log Management.
|
3044
|
+
* @param username Username to correlate with App's Log.
|
3045
|
+
*
|
3046
|
+
* @example
|
3047
|
+
*
|
3048
|
+
* ```js
|
3049
|
+
* async function setAppLogUser() {
|
3050
|
+
* const app = await fin.Application.getCurrent();
|
3051
|
+
* return await app.setAppLogUsername('username');
|
3052
|
+
* }
|
3053
|
+
*
|
3054
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
3055
|
+
*
|
3056
|
+
* ```
|
3057
|
+
*/
|
3058
|
+
async setAppLogUsername(username) {
|
3059
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
3060
|
+
}
|
3061
|
+
/**
|
3062
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
3063
|
+
* @remarks The only information currently returned is the position and dimensions.
|
3064
|
+
*
|
3065
|
+
* @example
|
3066
|
+
*
|
3067
|
+
* ```js
|
3068
|
+
* async function getTrayIconInfo() {
|
3069
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3070
|
+
* return await app.getTrayIconInfo();
|
3071
|
+
* }
|
3072
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3073
|
+
* ```
|
3074
|
+
*/
|
3075
|
+
getTrayIconInfo() {
|
3076
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
3077
|
+
}
|
3078
|
+
/**
|
3079
|
+
* Checks if the application has an associated tray icon.
|
3080
|
+
*
|
3081
|
+
* @example
|
3082
|
+
*
|
3083
|
+
* ```js
|
3084
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
3085
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
3086
|
+
* console.log(hasTrayIcon);
|
3087
|
+
* ```
|
3088
|
+
*/
|
3089
|
+
hasTrayIcon() {
|
3090
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
3091
|
+
}
|
3092
|
+
/**
|
3093
|
+
* Closes the application by terminating its process.
|
3094
|
+
*
|
3095
|
+
* @example
|
3096
|
+
*
|
3097
|
+
* ```js
|
3098
|
+
* async function terminateApp() {
|
3099
|
+
* const app = await fin.Application.getCurrent();
|
3100
|
+
* return await app.terminate();
|
3101
|
+
* }
|
3102
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
3103
|
+
* ```
|
3104
|
+
*/
|
3105
|
+
terminate() {
|
3106
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
3107
|
+
}
|
3108
|
+
/**
|
3109
|
+
* Waits for a hanging application. This method can be called in response to an application
|
3110
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
3111
|
+
* message after a certain period of time.
|
3112
|
+
*
|
3113
|
+
* @ignore
|
3114
|
+
*/
|
3115
|
+
wait() {
|
3116
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
3117
|
+
}
|
3118
|
+
/**
|
3119
|
+
* Retrieves information about the application.
|
3120
|
+
*
|
3121
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
3122
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
3123
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
3124
|
+
*
|
3125
|
+
* @example
|
3126
|
+
*
|
3127
|
+
* ```js
|
3128
|
+
* async function getInfo() {
|
3129
|
+
* const app = await fin.Application.getCurrent();
|
3130
|
+
* return await app.getInfo();
|
3131
|
+
* }
|
3132
|
+
*
|
3133
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
3134
|
+
* ```
|
3135
|
+
*/
|
3136
|
+
getInfo() {
|
3137
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
3138
|
+
}
|
3139
|
+
/**
|
3140
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
3141
|
+
*
|
3142
|
+
* @example
|
3143
|
+
* ```js
|
3144
|
+
* const app = await fin.Application.getCurrent();
|
3145
|
+
* const processInfo = await app.getProcessInfo();
|
3146
|
+
* ```
|
3147
|
+
* @experimental
|
3148
|
+
*/
|
3149
|
+
async getProcessInfo() {
|
3150
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
3151
|
+
return data;
|
3152
|
+
}
|
3153
|
+
/**
|
3154
|
+
* Sets file auto download location. It's only allowed in the same application.
|
3155
|
+
*
|
3156
|
+
* Note: This method is restricted by default and must be enabled via
|
3157
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3158
|
+
* @param downloadLocation file auto download location
|
3159
|
+
*
|
3160
|
+
* @throws if setting file auto download location on different applications.
|
3161
|
+
* @example
|
3162
|
+
*
|
3163
|
+
* ```js
|
3164
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
3165
|
+
* const app = await fin.Application.getCurrent();
|
3166
|
+
* try {
|
3167
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
3168
|
+
* console.log('File download location is set');
|
3169
|
+
* } catch(err) {
|
3170
|
+
* console.error(err)
|
3171
|
+
* }
|
3172
|
+
* ```
|
3173
|
+
*/
|
3174
|
+
async setFileDownloadLocation(downloadLocation) {
|
3175
|
+
const { name } = this.wire.me;
|
3176
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3177
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
3178
|
+
}
|
3179
|
+
/**
|
3180
|
+
* 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.
|
3181
|
+
*
|
3182
|
+
* Note: This method is restricted by default and must be enabled via
|
3183
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
3184
|
+
*
|
3185
|
+
* @throws if getting file auto download location on different applications.
|
3186
|
+
* @example
|
3187
|
+
*
|
3188
|
+
* ```js
|
3189
|
+
* const app = await fin.Application.getCurrent();
|
3190
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
3191
|
+
* ```
|
3192
|
+
*/
|
3193
|
+
async getFileDownloadLocation() {
|
3194
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
3195
|
+
return data;
|
3196
|
+
}
|
3197
|
+
/**
|
3198
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
3199
|
+
* @param options
|
3200
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
3201
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
3202
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
3203
|
+
* these with a "reducer" pattern.
|
3204
|
+
* @throws if the application has no tray icon set
|
3205
|
+
* @throws if the system tray is currently hidden
|
3206
|
+
* @example
|
3207
|
+
*
|
3208
|
+
* ```js
|
3209
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
3210
|
+
* const app = fin.Application.getCurrentSync();
|
3211
|
+
*
|
3212
|
+
* await app.setTrayIcon(iconUrl);
|
3213
|
+
*
|
3214
|
+
* const template = [
|
3215
|
+
* {
|
3216
|
+
* label: 'Menu Item 1',
|
3217
|
+
* data: 'hello from item 1'
|
3218
|
+
* },
|
3219
|
+
* { type: 'separator' },
|
3220
|
+
* {
|
3221
|
+
* label: 'Menu Item 2',
|
3222
|
+
* type: 'checkbox',
|
3223
|
+
* checked: true,
|
3224
|
+
* data: 'The user clicked the checkbox'
|
3225
|
+
* },
|
3226
|
+
* {
|
3227
|
+
* label: 'see more',
|
3228
|
+
* enabled: false,
|
3229
|
+
* submenu: [
|
3230
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
3231
|
+
* ]
|
3232
|
+
* }
|
3233
|
+
* ];
|
3234
|
+
*
|
3235
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
3236
|
+
* // right-click
|
3237
|
+
* if (event.button === 2) {
|
3238
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
3239
|
+
* if (r.result === 'closed') {
|
3240
|
+
* console.log('nothing happened');
|
3241
|
+
* } else {
|
3242
|
+
* console.log(r.data);
|
3243
|
+
* }
|
3244
|
+
* });
|
3245
|
+
* }
|
3246
|
+
* });
|
3247
|
+
* ```
|
3248
|
+
*/
|
3249
|
+
async showTrayIconPopupMenu(options) {
|
3250
|
+
const { name } = this.wire.me;
|
3251
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3252
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
3253
|
+
return payload.data;
|
3254
|
+
}
|
3255
|
+
/**
|
3256
|
+
* Closes the tray icon menu.
|
3257
|
+
*
|
3258
|
+
* @throws if the application has no tray icon set
|
3259
|
+
* @example
|
3260
|
+
*
|
3261
|
+
* ```js
|
3262
|
+
* const app = fin.Application.getCurrentSync();
|
3263
|
+
*
|
3264
|
+
* await app.closeTrayIconPopupMenu();
|
3265
|
+
* ```
|
3266
|
+
*/
|
3267
|
+
async closeTrayIconPopupMenu() {
|
3268
|
+
const { name } = this.wire.me;
|
3269
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
3270
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
3271
|
+
}
|
3272
|
+
}
|
3273
|
+
Instance$6.Application = Application;
|
3274
|
+
return Instance$6;
|
3540
3275
|
}
|
3541
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
3542
3276
|
|
3543
|
-
|
3544
|
-
|
3545
|
-
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3549
|
-
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3553
|
-
o[k2] = m[k];
|
3554
|
-
}));
|
3555
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
3556
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3557
|
-
};
|
3558
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3277
|
+
var hasRequiredFactory$1;
|
3278
|
+
|
3279
|
+
function requireFactory$1 () {
|
3280
|
+
if (hasRequiredFactory$1) return Factory$7;
|
3281
|
+
hasRequiredFactory$1 = 1;
|
3282
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
3283
|
+
Factory$7.ApplicationModule = void 0;
|
3284
|
+
const base_1 = base;
|
3285
|
+
const validate_1 = validate;
|
3286
|
+
const Instance_1 = requireInstance$1();
|
3559
3287
|
/**
|
3560
|
-
*
|
3561
|
-
*
|
3562
|
-
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
3563
|
-
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
3564
|
-
*
|
3565
|
-
* 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),
|
3566
|
-
* both of these were documented on the same page.
|
3567
|
-
*
|
3568
|
-
* @packageDocumentation
|
3288
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
3569
3289
|
*/
|
3570
|
-
|
3571
|
-
|
3572
|
-
|
3290
|
+
class ApplicationModule extends base_1.Base {
|
3291
|
+
/**
|
3292
|
+
* Asynchronously returns an API handle for the given Application identity.
|
3293
|
+
*
|
3294
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3295
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3296
|
+
* for an Application throughout its entire lifecycle.
|
3297
|
+
*
|
3298
|
+
* @example
|
3299
|
+
*
|
3300
|
+
* ```js
|
3301
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
3302
|
+
* .then(app => app.isRunning())
|
3303
|
+
* .then(running => console.log('Application is running: ' + running))
|
3304
|
+
* .catch(err => console.log(err));
|
3305
|
+
* ```
|
3306
|
+
*
|
3307
|
+
*/
|
3308
|
+
async wrap(identity) {
|
3309
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
3310
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3311
|
+
});
|
3312
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3313
|
+
if (errorMsg) {
|
3314
|
+
throw new Error(errorMsg);
|
3315
|
+
}
|
3316
|
+
return new Instance_1.Application(this.wire, identity);
|
3317
|
+
}
|
3318
|
+
/**
|
3319
|
+
* Synchronously returns an API handle for the given Application identity.
|
3320
|
+
*
|
3321
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
3322
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
3323
|
+
* for an Aplication throughout its entire lifecycle.
|
3324
|
+
*
|
3325
|
+
* @example
|
3326
|
+
*
|
3327
|
+
* ```js
|
3328
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
3329
|
+
* await app.close();
|
3330
|
+
* ```
|
3331
|
+
*
|
3332
|
+
*/
|
3333
|
+
wrapSync(identity) {
|
3334
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
3335
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3336
|
+
});
|
3337
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
3338
|
+
if (errorMsg) {
|
3339
|
+
throw new Error(errorMsg);
|
3340
|
+
}
|
3341
|
+
return new Instance_1.Application(this.wire, identity);
|
3342
|
+
}
|
3343
|
+
async _create(appOptions) {
|
3344
|
+
// set defaults:
|
3345
|
+
if (appOptions.waitForPageLoad === undefined) {
|
3346
|
+
appOptions.waitForPageLoad = false;
|
3347
|
+
}
|
3348
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
3349
|
+
appOptions.autoShow = true;
|
3350
|
+
}
|
3351
|
+
await this.wire.sendAction('create-application', appOptions);
|
3352
|
+
return this.wrap({ uuid: appOptions.uuid });
|
3353
|
+
}
|
3354
|
+
/**
|
3355
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
3356
|
+
*
|
3357
|
+
* @example
|
3358
|
+
*
|
3359
|
+
* ```js
|
3360
|
+
* async function createApp() {
|
3361
|
+
* const app = await fin.Application.create({
|
3362
|
+
* name: 'myApp',
|
3363
|
+
* uuid: 'app-3',
|
3364
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
3365
|
+
* autoShow: true
|
3366
|
+
* });
|
3367
|
+
* await app.run();
|
3368
|
+
* }
|
3369
|
+
*
|
3370
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
3371
|
+
* ```
|
3372
|
+
*
|
3373
|
+
* @ignore
|
3374
|
+
*/
|
3375
|
+
create(appOptions) {
|
3376
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
3377
|
+
this.wire.sendAction('application-create').catch((e) => {
|
3378
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3379
|
+
});
|
3380
|
+
return this._create(appOptions);
|
3381
|
+
}
|
3382
|
+
/**
|
3383
|
+
* Creates and starts a new Application.
|
3384
|
+
*
|
3385
|
+
* @example
|
3386
|
+
*
|
3387
|
+
* ```js
|
3388
|
+
* async function start() {
|
3389
|
+
* return fin.Application.start({
|
3390
|
+
* name: 'app-1',
|
3391
|
+
* uuid: 'app-1',
|
3392
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
3393
|
+
* autoShow: true
|
3394
|
+
* });
|
3395
|
+
* }
|
3396
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
3397
|
+
* ```
|
3398
|
+
*
|
3399
|
+
*/
|
3400
|
+
async start(appOptions) {
|
3401
|
+
this.wire.sendAction('start-application').catch((e) => {
|
3402
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3403
|
+
});
|
3404
|
+
const app = await this._create(appOptions);
|
3405
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
3406
|
+
return app;
|
3407
|
+
}
|
3408
|
+
/**
|
3409
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
3410
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
3411
|
+
* @param opts - Parameters that the RVM will use.
|
3412
|
+
*
|
3413
|
+
* @example
|
3414
|
+
*
|
3415
|
+
* ```js
|
3416
|
+
*
|
3417
|
+
* const applicationInfoArray = [
|
3418
|
+
* {
|
3419
|
+
* "uuid": 'App-1',
|
3420
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
3421
|
+
* },
|
3422
|
+
* {
|
3423
|
+
* "uuid": 'App-2',
|
3424
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
3425
|
+
* },
|
3426
|
+
* {
|
3427
|
+
* "uuid": 'App-3',
|
3428
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
3429
|
+
* }
|
3430
|
+
* ]
|
3431
|
+
*
|
3432
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
3433
|
+
* .then(() => {
|
3434
|
+
* console.log('RVM has finished launching the application list.');
|
3435
|
+
* })
|
3436
|
+
* .catch((err) => {
|
3437
|
+
* console.log(err);
|
3438
|
+
* })
|
3439
|
+
* ```
|
3440
|
+
*
|
3441
|
+
* @experimental
|
3442
|
+
*/
|
3443
|
+
async startManyManifests(applications, opts) {
|
3444
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
3445
|
+
}
|
3446
|
+
/**
|
3447
|
+
* Asynchronously returns an Application object that represents the current application
|
3448
|
+
*
|
3449
|
+
* @example
|
3450
|
+
*
|
3451
|
+
* ```js
|
3452
|
+
* async function isCurrentAppRunning () {
|
3453
|
+
* const app = await fin.Application.getCurrent();
|
3454
|
+
* return app.isRunning();
|
3455
|
+
* }
|
3456
|
+
*
|
3457
|
+
* isCurrentAppRunning().then(running => {
|
3458
|
+
* console.log(`Current app is running: ${running}`);
|
3459
|
+
* }).catch(err => {
|
3460
|
+
* console.error(err);
|
3461
|
+
* });
|
3462
|
+
*
|
3463
|
+
* ```
|
3464
|
+
*/
|
3465
|
+
getCurrent() {
|
3466
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
3467
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3468
|
+
});
|
3469
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
3470
|
+
}
|
3471
|
+
/**
|
3472
|
+
* Synchronously returns an Application object that represents the current application
|
3473
|
+
*
|
3474
|
+
* @example
|
3475
|
+
*
|
3476
|
+
* ```js
|
3477
|
+
* async function isCurrentAppRunning () {
|
3478
|
+
* const app = fin.Application.getCurrentSync();
|
3479
|
+
* return app.isRunning();
|
3480
|
+
* }
|
3481
|
+
*
|
3482
|
+
* isCurrentAppRunning().then(running => {
|
3483
|
+
* console.log(`Current app is running: ${running}`);
|
3484
|
+
* }).catch(err => {
|
3485
|
+
* console.error(err);
|
3486
|
+
* });
|
3487
|
+
*
|
3488
|
+
* ```
|
3489
|
+
*/
|
3490
|
+
getCurrentSync() {
|
3491
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
3492
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3493
|
+
});
|
3494
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
3495
|
+
}
|
3496
|
+
/**
|
3497
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
3498
|
+
* @param manifestUrl - The URL of app's manifest.
|
3499
|
+
* @param opts - Parameters that the RVM will use.
|
3500
|
+
*
|
3501
|
+
* @example
|
3502
|
+
*
|
3503
|
+
* ```js
|
3504
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3505
|
+
*
|
3506
|
+
* // For a local manifest file:
|
3507
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
3508
|
+
* ```
|
3509
|
+
*/
|
3510
|
+
async startFromManifest(manifestUrl, opts) {
|
3511
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
3512
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3513
|
+
});
|
3514
|
+
const app = await this._createFromManifest(manifestUrl);
|
3515
|
+
// @ts-expect-error using private method without warning.
|
3516
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
3517
|
+
return app;
|
3518
|
+
}
|
3519
|
+
/**
|
3520
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
3521
|
+
* Retrieves application's manifest and returns a wrapped application.
|
3522
|
+
* @param manifestUrl - The URL of app's manifest.
|
3523
|
+
* @param callback - called if the method succeeds.
|
3524
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
3525
|
+
*
|
3526
|
+
* @example
|
3527
|
+
*
|
3528
|
+
* ```js
|
3529
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
3530
|
+
* ```
|
3531
|
+
* @ignore
|
3532
|
+
*/
|
3533
|
+
createFromManifest(manifestUrl) {
|
3534
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
3535
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
3536
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
3537
|
+
});
|
3538
|
+
return this._createFromManifest(manifestUrl);
|
3539
|
+
}
|
3540
|
+
_createFromManifest(manifestUrl) {
|
3541
|
+
return this.wire
|
3542
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
3543
|
+
.then(({ payload }) => {
|
3544
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
3545
|
+
return this.wrap({ uuid });
|
3546
|
+
})
|
3547
|
+
.then((app) => {
|
3548
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
3549
|
+
return app;
|
3550
|
+
});
|
3551
|
+
}
|
3552
|
+
}
|
3553
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
3554
|
+
return Factory$7;
|
3555
|
+
}
|
3556
|
+
|
3557
|
+
var hasRequiredApplication;
|
3558
|
+
|
3559
|
+
function requireApplication () {
|
3560
|
+
if (hasRequiredApplication) return application;
|
3561
|
+
hasRequiredApplication = 1;
|
3562
|
+
(function (exports) {
|
3563
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3564
|
+
if (k2 === undefined) k2 = k;
|
3565
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
3566
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
3567
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
3568
|
+
}
|
3569
|
+
Object.defineProperty(o, k2, desc);
|
3570
|
+
}) : (function(o, m, k, k2) {
|
3571
|
+
if (k2 === undefined) k2 = k;
|
3572
|
+
o[k2] = m[k];
|
3573
|
+
}));
|
3574
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
3575
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3576
|
+
};
|
3577
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3578
|
+
/**
|
3579
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
3580
|
+
*
|
3581
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
3582
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
3583
|
+
*
|
3584
|
+
* 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),
|
3585
|
+
* both of these were documented on the same page.
|
3586
|
+
*
|
3587
|
+
* @packageDocumentation
|
3588
|
+
*/
|
3589
|
+
__exportStar(requireFactory$1(), exports);
|
3590
|
+
__exportStar(requireInstance$1(), exports);
|
3591
|
+
} (application));
|
3592
|
+
return application;
|
3593
|
+
}
|
3573
3594
|
|
3574
3595
|
var promisifySubscription$1 = {};
|
3575
3596
|
|
@@ -3613,7 +3634,7 @@ function requireInstance () {
|
|
3613
3634
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
3614
3635
|
/* eslint-disable no-console */
|
3615
3636
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
3616
|
-
const application_1 =
|
3637
|
+
const application_1 = requireApplication();
|
3617
3638
|
const main_1 = main;
|
3618
3639
|
const view_1 = requireView();
|
3619
3640
|
const warnings_1 = warnings;
|
@@ -16899,7 +16920,7 @@ const events_1$3 = require$$0;
|
|
16899
16920
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
16900
16921
|
const index_1 = system;
|
16901
16922
|
const index_2 = requireWindow();
|
16902
|
-
const index_3 =
|
16923
|
+
const index_3 = requireApplication();
|
16903
16924
|
const index_4 = interappbus;
|
16904
16925
|
const index_5 = clipboard;
|
16905
16926
|
const index_6 = externalApplication;
|
@@ -17700,7 +17721,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
|
|
17700
17721
|
};
|
17701
17722
|
}
|
17702
17723
|
getAdapterVersionSync() {
|
17703
|
-
return "41.100.
|
17724
|
+
return "41.100.59";
|
17704
17725
|
}
|
17705
17726
|
observeBounds(element, onChange) {
|
17706
17727
|
throw new Error('Method not implemented.');
|