@openfin/node-adapter 43.100.104 → 43.100.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/node-adapter.js +1294 -1141
- package/package.json +2 -2
package/out/node-adapter.js
CHANGED
|
@@ -531,11 +531,11 @@ const handleDeprecatedWarnings = (options) => {
|
|
|
531
531
|
};
|
|
532
532
|
warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
|
|
533
533
|
|
|
534
|
-
var hasRequiredFactory$
|
|
534
|
+
var hasRequiredFactory$2;
|
|
535
535
|
|
|
536
|
-
function requireFactory$
|
|
537
|
-
if (hasRequiredFactory$
|
|
538
|
-
hasRequiredFactory$
|
|
536
|
+
function requireFactory$2 () {
|
|
537
|
+
if (hasRequiredFactory$2) return Factory$6;
|
|
538
|
+
hasRequiredFactory$2 = 1;
|
|
539
539
|
Object.defineProperty(Factory$6, "__esModule", { value: true });
|
|
540
540
|
Factory$6.ViewModule = void 0;
|
|
541
541
|
const base_1 = base;
|
|
@@ -750,8 +750,8 @@ var main = {};
|
|
|
750
750
|
|
|
751
751
|
Object.defineProperty(main, "__esModule", { value: true });
|
|
752
752
|
main.WebContents = void 0;
|
|
753
|
-
const base_1$
|
|
754
|
-
class WebContents extends base_1$
|
|
753
|
+
const base_1$n = base;
|
|
754
|
+
class WebContents extends base_1$n.EmitterBase {
|
|
755
755
|
/**
|
|
756
756
|
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
757
757
|
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
|
@@ -1832,11 +1832,11 @@ class WebContents extends base_1$p.EmitterBase {
|
|
|
1832
1832
|
}
|
|
1833
1833
|
main.WebContents = WebContents;
|
|
1834
1834
|
|
|
1835
|
-
var hasRequiredInstance$
|
|
1835
|
+
var hasRequiredInstance$2;
|
|
1836
1836
|
|
|
1837
|
-
function requireInstance$
|
|
1838
|
-
if (hasRequiredInstance$
|
|
1839
|
-
hasRequiredInstance$
|
|
1837
|
+
function requireInstance$2 () {
|
|
1838
|
+
if (hasRequiredInstance$2) return Instance$5;
|
|
1839
|
+
hasRequiredInstance$2 = 1;
|
|
1840
1840
|
var _View_providerChannelClient;
|
|
1841
1841
|
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
|
1842
1842
|
Instance$5.View = void 0;
|
|
@@ -2416,1139 +2416,1160 @@ function requireView () {
|
|
|
2416
2416
|
*
|
|
2417
2417
|
* @packageDocumentation
|
|
2418
2418
|
*/
|
|
2419
|
-
__exportStar(requireFactory$
|
|
2420
|
-
__exportStar(requireInstance$
|
|
2419
|
+
__exportStar(requireFactory$2(), exports);
|
|
2420
|
+
__exportStar(requireInstance$2(), exports);
|
|
2421
2421
|
} (view));
|
|
2422
2422
|
return view;
|
|
2423
2423
|
}
|
|
2424
2424
|
|
|
2425
|
-
|
|
2426
|
-
Instance$6.Application = void 0;
|
|
2427
|
-
/* eslint-disable import/prefer-default-export */
|
|
2428
|
-
const base_1$o = base;
|
|
2429
|
-
const window_1$1 = requireWindow();
|
|
2430
|
-
const view_1 = requireView();
|
|
2431
|
-
/**
|
|
2432
|
-
* An object representing an application. Allows the developer to create,
|
|
2433
|
-
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
|
2434
|
-
*/
|
|
2435
|
-
class Application extends base_1$o.EmitterBase {
|
|
2436
|
-
/**
|
|
2437
|
-
* @internal
|
|
2438
|
-
*/
|
|
2439
|
-
constructor(wire, identity) {
|
|
2440
|
-
super(wire, 'application', identity.uuid);
|
|
2441
|
-
this.identity = identity;
|
|
2442
|
-
this.window = new window_1$1._Window(this.wire, {
|
|
2443
|
-
uuid: this.identity.uuid,
|
|
2444
|
-
name: this.identity.uuid
|
|
2445
|
-
});
|
|
2446
|
-
}
|
|
2447
|
-
windowListFromIdentityList(identityList) {
|
|
2448
|
-
const windowList = [];
|
|
2449
|
-
identityList.forEach((identity) => {
|
|
2450
|
-
windowList.push(new window_1$1._Window(this.wire, {
|
|
2451
|
-
uuid: identity.uuid,
|
|
2452
|
-
name: identity.name
|
|
2453
|
-
}));
|
|
2454
|
-
});
|
|
2455
|
-
return windowList;
|
|
2456
|
-
}
|
|
2457
|
-
/**
|
|
2458
|
-
* Determines if the application is currently running.
|
|
2459
|
-
*
|
|
2460
|
-
* @example
|
|
2461
|
-
*
|
|
2462
|
-
* ```js
|
|
2463
|
-
* async function isAppRunning() {
|
|
2464
|
-
* const app = await fin.Application.getCurrent();
|
|
2465
|
-
* return await app.isRunning();
|
|
2466
|
-
* }
|
|
2467
|
-
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
|
2468
|
-
* ```
|
|
2469
|
-
*/
|
|
2470
|
-
isRunning() {
|
|
2471
|
-
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
|
2472
|
-
}
|
|
2473
|
-
/**
|
|
2474
|
-
* Closes the application and any child windows created by the application.
|
|
2475
|
-
* Cleans the application from state so it is no longer found in getAllApplications.
|
|
2476
|
-
* @param force Close will be prevented from closing when force is false and
|
|
2477
|
-
* ‘close-requested’ has been subscribed to for application’s main window.
|
|
2478
|
-
*
|
|
2479
|
-
* @example
|
|
2480
|
-
*
|
|
2481
|
-
* ```js
|
|
2482
|
-
* async function closeApp() {
|
|
2483
|
-
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
|
2484
|
-
* const app = await fin.Application.wrap({uuid: 'app2'});
|
|
2485
|
-
* await app.quit();
|
|
2486
|
-
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
|
2487
|
-
*
|
|
2488
|
-
* }
|
|
2489
|
-
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
|
2490
|
-
* ```
|
|
2491
|
-
*/
|
|
2492
|
-
async quit(force = false) {
|
|
2493
|
-
try {
|
|
2494
|
-
await this._close(force);
|
|
2495
|
-
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
|
2496
|
-
}
|
|
2497
|
-
catch (error) {
|
|
2498
|
-
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
|
2499
|
-
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
|
2500
|
-
throw error;
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
async _close(force = false) {
|
|
2505
|
-
try {
|
|
2506
|
-
await this.wire.sendAction('close-application', { force, ...this.identity });
|
|
2507
|
-
}
|
|
2508
|
-
catch (error) {
|
|
2509
|
-
if (!error.message.includes('Remote connection has closed')) {
|
|
2510
|
-
throw error;
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
}
|
|
2514
|
-
/**
|
|
2515
|
-
* @deprecated use Application.quit instead
|
|
2516
|
-
* Closes the application and any child windows created by the application.
|
|
2517
|
-
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
|
2518
|
-
* @param callback - called if the method succeeds.
|
|
2519
|
-
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
2520
|
-
*
|
|
2521
|
-
* @example
|
|
2522
|
-
*
|
|
2523
|
-
* ```js
|
|
2524
|
-
* async function closeApp() {
|
|
2525
|
-
* const app = await fin.Application.getCurrent();
|
|
2526
|
-
* return await app.close();
|
|
2527
|
-
* }
|
|
2528
|
-
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
|
2529
|
-
* ```
|
|
2530
|
-
*/
|
|
2531
|
-
close(force = false) {
|
|
2532
|
-
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
|
2533
|
-
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
|
2534
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2535
|
-
});
|
|
2536
|
-
return this._close(force);
|
|
2537
|
-
}
|
|
2538
|
-
/**
|
|
2539
|
-
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
|
2540
|
-
*
|
|
2541
|
-
* @example
|
|
2542
|
-
*
|
|
2543
|
-
* ```js
|
|
2544
|
-
* async function getChildWindows() {
|
|
2545
|
-
* const app = await fin.Application.getCurrent();
|
|
2546
|
-
* return await app.getChildWindows();
|
|
2547
|
-
* }
|
|
2548
|
-
*
|
|
2549
|
-
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
|
2550
|
-
* ```
|
|
2551
|
-
*/
|
|
2552
|
-
getChildWindows() {
|
|
2553
|
-
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
|
2554
|
-
const identityList = [];
|
|
2555
|
-
payload.data.forEach((winName) => {
|
|
2556
|
-
identityList.push({ uuid: this.identity.uuid, name: winName });
|
|
2557
|
-
});
|
|
2558
|
-
return this.windowListFromIdentityList(identityList);
|
|
2559
|
-
});
|
|
2560
|
-
}
|
|
2561
|
-
/**
|
|
2562
|
-
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
|
2563
|
-
* if the application was not created from a manifest.
|
|
2564
|
-
*
|
|
2565
|
-
* @example
|
|
2566
|
-
*
|
|
2567
|
-
* ```js
|
|
2568
|
-
* async function getManifest() {
|
|
2569
|
-
* const app = await fin.Application.getCurrent();
|
|
2570
|
-
* return await app.getManifest();
|
|
2571
|
-
* }
|
|
2572
|
-
*
|
|
2573
|
-
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
|
2574
|
-
* ```
|
|
2575
|
-
*/
|
|
2576
|
-
getManifest() {
|
|
2577
|
-
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
|
2578
|
-
}
|
|
2579
|
-
/**
|
|
2580
|
-
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
|
2581
|
-
* if the application was created from a manifest.
|
|
2582
|
-
*
|
|
2583
|
-
* @example
|
|
2584
|
-
*
|
|
2585
|
-
* ```js
|
|
2586
|
-
* async function getParentUuid() {
|
|
2587
|
-
* const app = await fin.Application.start({
|
|
2588
|
-
* uuid: 'app-1',
|
|
2589
|
-
* name: 'myApp',
|
|
2590
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
|
2591
|
-
* autoShow: true
|
|
2592
|
-
* });
|
|
2593
|
-
* return await app.getParentUuid();
|
|
2594
|
-
* }
|
|
2595
|
-
*
|
|
2596
|
-
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
|
2597
|
-
* ```
|
|
2598
|
-
*/
|
|
2599
|
-
getParentUuid() {
|
|
2600
|
-
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
|
2601
|
-
}
|
|
2602
|
-
/**
|
|
2603
|
-
* Retrieves current application's shortcut configuration.
|
|
2604
|
-
*
|
|
2605
|
-
* @example
|
|
2606
|
-
*
|
|
2607
|
-
* ```js
|
|
2608
|
-
* async function getShortcuts() {
|
|
2609
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
2610
|
-
* return await app.getShortcuts();
|
|
2611
|
-
* }
|
|
2612
|
-
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
|
2613
|
-
* ```
|
|
2614
|
-
*/
|
|
2615
|
-
getShortcuts() {
|
|
2616
|
-
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
|
2617
|
-
}
|
|
2618
|
-
/**
|
|
2619
|
-
* Retrieves current application's views.
|
|
2620
|
-
* @experimental
|
|
2621
|
-
*
|
|
2622
|
-
* @example
|
|
2623
|
-
*
|
|
2624
|
-
* ```js
|
|
2625
|
-
* async function getViews() {
|
|
2626
|
-
* const app = await fin.Application.getCurrent();
|
|
2627
|
-
* return await app.getViews();
|
|
2628
|
-
* }
|
|
2629
|
-
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
|
2630
|
-
* ```
|
|
2631
|
-
*/
|
|
2632
|
-
async getViews() {
|
|
2633
|
-
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
|
2634
|
-
return payload.data.map((id) => new view_1.View(this.wire, id));
|
|
2635
|
-
}
|
|
2636
|
-
/**
|
|
2637
|
-
* Returns the current zoom level of the application.
|
|
2638
|
-
*
|
|
2639
|
-
* @example
|
|
2640
|
-
*
|
|
2641
|
-
* ```js
|
|
2642
|
-
* async function getZoomLevel() {
|
|
2643
|
-
* const app = await fin.Application.getCurrent();
|
|
2644
|
-
* return await app.getZoomLevel();
|
|
2645
|
-
* }
|
|
2646
|
-
*
|
|
2647
|
-
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
2648
|
-
* ```
|
|
2649
|
-
*/
|
|
2650
|
-
getZoomLevel() {
|
|
2651
|
-
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
2652
|
-
}
|
|
2653
|
-
/**
|
|
2654
|
-
* Returns an instance of the main Window of the application
|
|
2655
|
-
*
|
|
2656
|
-
* @example
|
|
2657
|
-
*
|
|
2658
|
-
* ```js
|
|
2659
|
-
* async function getWindow() {
|
|
2660
|
-
* const app = await fin.Application.start({
|
|
2661
|
-
* uuid: 'app-1',
|
|
2662
|
-
* name: 'myApp',
|
|
2663
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
|
2664
|
-
* autoShow: true
|
|
2665
|
-
* });
|
|
2666
|
-
* return await app.getWindow();
|
|
2667
|
-
* }
|
|
2668
|
-
*
|
|
2669
|
-
* getWindow().then(win => {
|
|
2670
|
-
* win.showAt(0, 400);
|
|
2671
|
-
* win.flash();
|
|
2672
|
-
* }).catch(err => console.log(err));
|
|
2673
|
-
* ```
|
|
2674
|
-
*/
|
|
2675
|
-
getWindow() {
|
|
2676
|
-
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
|
2677
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2678
|
-
});
|
|
2679
|
-
return Promise.resolve(this.window);
|
|
2680
|
-
}
|
|
2681
|
-
/**
|
|
2682
|
-
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
|
2683
|
-
* @param userName - username to be passed to the RVM.
|
|
2684
|
-
* @param appName - app name to be passed to the RVM.
|
|
2685
|
-
*
|
|
2686
|
-
* @example
|
|
2687
|
-
*
|
|
2688
|
-
* ```js
|
|
2689
|
-
* async function registerUser() {
|
|
2690
|
-
* const app = await fin.Application.getCurrent();
|
|
2691
|
-
* return await app.registerUser('user', 'myApp');
|
|
2692
|
-
* }
|
|
2693
|
-
*
|
|
2694
|
-
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
|
2695
|
-
* ```
|
|
2696
|
-
*/
|
|
2697
|
-
registerUser(userName, appName) {
|
|
2698
|
-
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
|
2699
|
-
}
|
|
2700
|
-
/**
|
|
2701
|
-
* Removes the application’s icon from the tray.
|
|
2702
|
-
*
|
|
2703
|
-
* @example
|
|
2704
|
-
*
|
|
2705
|
-
* ```js
|
|
2706
|
-
* async function removeTrayIcon() {
|
|
2707
|
-
* const app = await fin.Application.getCurrent();
|
|
2708
|
-
* return await app.removeTrayIcon();
|
|
2709
|
-
* }
|
|
2710
|
-
*
|
|
2711
|
-
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
|
2712
|
-
* ```
|
|
2713
|
-
*/
|
|
2714
|
-
removeTrayIcon() {
|
|
2715
|
-
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
|
2716
|
-
}
|
|
2717
|
-
/**
|
|
2718
|
-
* Restarts the application.
|
|
2719
|
-
*
|
|
2720
|
-
* @example
|
|
2721
|
-
*
|
|
2722
|
-
* ```js
|
|
2723
|
-
* async function restartApp() {
|
|
2724
|
-
* const app = await fin.Application.getCurrent();
|
|
2725
|
-
* return await app.restart();
|
|
2726
|
-
* }
|
|
2727
|
-
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
|
2728
|
-
* ```
|
|
2729
|
-
*/
|
|
2730
|
-
restart() {
|
|
2731
|
-
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
|
2732
|
-
}
|
|
2733
|
-
/**
|
|
2734
|
-
* DEPRECATED method to run the application.
|
|
2735
|
-
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
|
2736
|
-
*
|
|
2737
|
-
* @example
|
|
2738
|
-
*
|
|
2739
|
-
* ```js
|
|
2740
|
-
* async function run() {
|
|
2741
|
-
* const app = await fin.Application.create({
|
|
2742
|
-
* name: 'myApp',
|
|
2743
|
-
* uuid: 'app-1',
|
|
2744
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
|
2745
|
-
* autoShow: true
|
|
2746
|
-
* });
|
|
2747
|
-
* await app.run();
|
|
2748
|
-
* }
|
|
2749
|
-
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
2750
|
-
* ```
|
|
2751
|
-
*
|
|
2752
|
-
* @ignore
|
|
2753
|
-
*/
|
|
2754
|
-
run() {
|
|
2755
|
-
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
|
2756
|
-
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
|
2757
|
-
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2758
|
-
});
|
|
2759
|
-
return this._run();
|
|
2760
|
-
}
|
|
2761
|
-
_run(opts = {}) {
|
|
2762
|
-
return this.wire
|
|
2763
|
-
.sendAction('run-application', {
|
|
2764
|
-
manifestUrl: this._manifestUrl,
|
|
2765
|
-
opts,
|
|
2766
|
-
...this.identity
|
|
2767
|
-
})
|
|
2768
|
-
.then(() => undefined);
|
|
2769
|
-
}
|
|
2770
|
-
/**
|
|
2771
|
-
* Instructs the RVM to schedule one restart of the application.
|
|
2772
|
-
*
|
|
2773
|
-
* @example
|
|
2774
|
-
*
|
|
2775
|
-
* ```js
|
|
2776
|
-
* async function scheduleRestart() {
|
|
2777
|
-
* const app = await fin.Application.getCurrent();
|
|
2778
|
-
* return await app.scheduleRestart();
|
|
2779
|
-
* }
|
|
2780
|
-
*
|
|
2781
|
-
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
|
2782
|
-
* ```
|
|
2783
|
-
*/
|
|
2784
|
-
scheduleRestart() {
|
|
2785
|
-
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
|
2786
|
-
}
|
|
2787
|
-
/**
|
|
2788
|
-
* Sends a message to the RVM to upload the application's logs. On success,
|
|
2789
|
-
* an object containing logId is returned.
|
|
2790
|
-
*
|
|
2791
|
-
* @example
|
|
2792
|
-
*
|
|
2793
|
-
* ```js
|
|
2794
|
-
* async function sendLog() {
|
|
2795
|
-
* const app = await fin.Application.getCurrent();
|
|
2796
|
-
* return await app.sendApplicationLog();
|
|
2797
|
-
* }
|
|
2798
|
-
*
|
|
2799
|
-
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
|
2800
|
-
* ```
|
|
2801
|
-
*/
|
|
2802
|
-
async sendApplicationLog() {
|
|
2803
|
-
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
|
2804
|
-
return payload.data;
|
|
2805
|
-
}
|
|
2806
|
-
/**
|
|
2807
|
-
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
|
2808
|
-
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
2809
|
-
*
|
|
2810
|
-
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
2811
|
-
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
|
2812
|
-
*
|
|
2813
|
-
*
|
|
2814
|
-
* @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).
|
|
2815
|
-
*
|
|
2816
|
-
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
|
2817
|
-
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
|
2818
|
-
*
|
|
2819
|
-
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
2820
|
-
*
|
|
2821
|
-
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
|
2822
|
-
* uuid or shortcut.name is changed.
|
|
2823
|
-
*
|
|
2824
|
-
* @example
|
|
2825
|
-
*
|
|
2826
|
-
* ```js
|
|
2827
|
-
* const app = fin.Application.getCurrentSync();
|
|
2828
|
-
* const appName = 'My App';
|
|
2829
|
-
* const jumpListConfig = [ // array of JumpList categories
|
|
2830
|
-
* {
|
|
2831
|
-
* // has no name and no type so `type` is assumed to be "tasks"
|
|
2832
|
-
* items: [ // array of JumpList items
|
|
2833
|
-
* {
|
|
2834
|
-
* type: 'task',
|
|
2835
|
-
* title: `Launch ${appName}`,
|
|
2836
|
-
* description: `Runs ${appName} with the default configuration`,
|
|
2837
|
-
* deepLink: 'fins://path.to/app/manifest.json',
|
|
2838
|
-
* iconPath: 'https://path.to/app/icon.ico',
|
|
2839
|
-
* iconIndex: 0
|
|
2840
|
-
* },
|
|
2841
|
-
* { type: 'separator' },
|
|
2842
|
-
* {
|
|
2843
|
-
* type: 'task',
|
|
2844
|
-
* title: `Restore ${appName}`,
|
|
2845
|
-
* description: 'Restore to last configuration',
|
|
2846
|
-
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
|
2847
|
-
* iconPath: 'https://path.to/app/icon.ico',
|
|
2848
|
-
* iconIndex: 0
|
|
2849
|
-
* },
|
|
2850
|
-
* ]
|
|
2851
|
-
* },
|
|
2852
|
-
* {
|
|
2853
|
-
* name: 'Tools',
|
|
2854
|
-
* items: [ // array of JumpList items
|
|
2855
|
-
* {
|
|
2856
|
-
* type: 'task',
|
|
2857
|
-
* title: 'Tool A',
|
|
2858
|
-
* description: 'Runs Tool A',
|
|
2859
|
-
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
|
2860
|
-
* iconPath: 'https://path.to/tool-a/icon.ico',
|
|
2861
|
-
* iconIndex: 0
|
|
2862
|
-
* },
|
|
2863
|
-
* {
|
|
2864
|
-
* type: 'task',
|
|
2865
|
-
* title: 'Tool B',
|
|
2866
|
-
* description: 'Runs Tool B',
|
|
2867
|
-
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
|
2868
|
-
* iconPath: 'https://path.to/tool-b/icon.ico',
|
|
2869
|
-
* iconIndex: 0
|
|
2870
|
-
* }]
|
|
2871
|
-
* }
|
|
2872
|
-
* ];
|
|
2873
|
-
*
|
|
2874
|
-
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
|
2875
|
-
* ```
|
|
2876
|
-
*
|
|
2877
|
-
* To handle deeplink args:
|
|
2878
|
-
* ```js
|
|
2879
|
-
* function handleUseLastConfiguration() {
|
|
2880
|
-
* // this handler is called when the app is being launched
|
|
2881
|
-
* app.on('run-requested', event => {
|
|
2882
|
-
* if(event.userAppConfigArgs['use-last-configuration']) {
|
|
2883
|
-
* // your logic here
|
|
2884
|
-
* }
|
|
2885
|
-
* });
|
|
2886
|
-
* // this handler is called when the app was already running when the launch was requested
|
|
2887
|
-
* fin.desktop.main(function(args) {
|
|
2888
|
-
* if(args && args['use-last-configuration']) {
|
|
2889
|
-
* // your logic here
|
|
2890
|
-
* }
|
|
2891
|
-
* });
|
|
2892
|
-
* }
|
|
2893
|
-
* ```
|
|
2894
|
-
*/
|
|
2895
|
-
async setJumpList(jumpListCategories) {
|
|
2896
|
-
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
|
2897
|
-
}
|
|
2898
|
-
/**
|
|
2899
|
-
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
|
2900
|
-
* @param icon Image URL or base64 encoded string to be used as the icon
|
|
2901
|
-
*
|
|
2902
|
-
* @example
|
|
2903
|
-
*
|
|
2904
|
-
* ```js
|
|
2905
|
-
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
2906
|
-
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
|
2907
|
-
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
|
2908
|
-
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
|
2909
|
-
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
|
2910
|
-
*
|
|
2911
|
-
* async function setTrayIcon(icon) {
|
|
2912
|
-
* const app = await fin.Application.getCurrent();
|
|
2913
|
-
* return await app.setTrayIcon(icon);
|
|
2914
|
-
* }
|
|
2915
|
-
*
|
|
2916
|
-
* // use image url to set tray icon
|
|
2917
|
-
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2918
|
-
*
|
|
2919
|
-
* // use base64 encoded string to set tray icon
|
|
2920
|
-
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2921
|
-
*
|
|
2922
|
-
* // use a dataURL to set tray icon
|
|
2923
|
-
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2924
|
-
* ```
|
|
2925
|
-
*/
|
|
2926
|
-
setTrayIcon(icon) {
|
|
2927
|
-
return this.wire
|
|
2928
|
-
.sendAction('set-tray-icon', {
|
|
2929
|
-
enabledIcon: icon,
|
|
2930
|
-
...this.identity
|
|
2931
|
-
})
|
|
2932
|
-
.then(() => undefined);
|
|
2933
|
-
}
|
|
2934
|
-
/**
|
|
2935
|
-
* Set hover text for this application's system tray icon.
|
|
2936
|
-
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
|
2937
|
-
* @param toolTip
|
|
2938
|
-
*
|
|
2939
|
-
* @example
|
|
2940
|
-
*
|
|
2941
|
-
* ```js
|
|
2942
|
-
* const app = fin.Application.getCurrentSync();
|
|
2943
|
-
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
2944
|
-
*
|
|
2945
|
-
* await app.setTrayIcon(iconUrl);
|
|
2946
|
-
*
|
|
2947
|
-
* await app.setTrayIconToolTip('My Application');
|
|
2948
|
-
* ```
|
|
2949
|
-
*/
|
|
2950
|
-
async setTrayIconToolTip(toolTip) {
|
|
2951
|
-
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
|
2952
|
-
}
|
|
2953
|
-
/**
|
|
2954
|
-
* Sets new application's shortcut configuration. Windows only.
|
|
2955
|
-
* @param config New application's shortcut configuration.
|
|
2956
|
-
*
|
|
2957
|
-
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
|
2958
|
-
* to be able to change shortcut states.
|
|
2959
|
-
*
|
|
2960
|
-
* @example
|
|
2961
|
-
*
|
|
2962
|
-
* ```js
|
|
2963
|
-
* async function setShortcuts(config) {
|
|
2964
|
-
* const app = await fin.Application.getCurrent();
|
|
2965
|
-
* return app.setShortcuts(config);
|
|
2966
|
-
* }
|
|
2967
|
-
*
|
|
2968
|
-
* setShortcuts({
|
|
2969
|
-
* desktop: true,
|
|
2970
|
-
* startMenu: false,
|
|
2971
|
-
* systemStartup: true
|
|
2972
|
-
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
|
2973
|
-
* ```
|
|
2974
|
-
*/
|
|
2975
|
-
setShortcuts(config) {
|
|
2976
|
-
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
|
2977
|
-
}
|
|
2978
|
-
/**
|
|
2979
|
-
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
|
2980
|
-
* @param queryString The new query string for this app's shortcuts.
|
|
2981
|
-
*
|
|
2982
|
-
* @example
|
|
2983
|
-
*
|
|
2984
|
-
* ```js
|
|
2985
|
-
* const newQueryArgs = 'arg=true&arg2=false';
|
|
2986
|
-
* const app = await fin.Application.getCurrent();
|
|
2987
|
-
* try {
|
|
2988
|
-
* await app.setShortcutQueryParams(newQueryArgs);
|
|
2989
|
-
* } catch(err) {
|
|
2990
|
-
* console.error(err)
|
|
2991
|
-
* }
|
|
2992
|
-
* ```
|
|
2993
|
-
*/
|
|
2994
|
-
async setShortcutQueryParams(queryString) {
|
|
2995
|
-
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
|
2996
|
-
}
|
|
2997
|
-
/**
|
|
2998
|
-
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
|
2999
|
-
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
|
3000
|
-
* @param level The zoom level
|
|
3001
|
-
*
|
|
3002
|
-
* @example
|
|
3003
|
-
*
|
|
3004
|
-
* ```js
|
|
3005
|
-
* async function setZoomLevel(number) {
|
|
3006
|
-
* const app = await fin.Application.getCurrent();
|
|
3007
|
-
* return await app.setZoomLevel(number);
|
|
3008
|
-
* }
|
|
3009
|
-
*
|
|
3010
|
-
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
3011
|
-
* ```
|
|
3012
|
-
*/
|
|
3013
|
-
setZoomLevel(level) {
|
|
3014
|
-
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
|
3015
|
-
}
|
|
3016
|
-
/**
|
|
3017
|
-
* Sets a username to correlate with App Log Management.
|
|
3018
|
-
* @param username Username to correlate with App's Log.
|
|
3019
|
-
*
|
|
3020
|
-
* @example
|
|
3021
|
-
*
|
|
3022
|
-
* ```js
|
|
3023
|
-
* async function setAppLogUser() {
|
|
3024
|
-
* const app = await fin.Application.getCurrent();
|
|
3025
|
-
* return await app.setAppLogUsername('username');
|
|
3026
|
-
* }
|
|
3027
|
-
*
|
|
3028
|
-
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
|
3029
|
-
*
|
|
3030
|
-
* ```
|
|
3031
|
-
*/
|
|
3032
|
-
async setAppLogUsername(username) {
|
|
3033
|
-
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
|
3034
|
-
}
|
|
3035
|
-
/**
|
|
3036
|
-
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
|
3037
|
-
* @remarks The only information currently returned is the position and dimensions.
|
|
3038
|
-
*
|
|
3039
|
-
* @example
|
|
3040
|
-
*
|
|
3041
|
-
* ```js
|
|
3042
|
-
* async function getTrayIconInfo() {
|
|
3043
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3044
|
-
* return await app.getTrayIconInfo();
|
|
3045
|
-
* }
|
|
3046
|
-
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3047
|
-
* ```
|
|
3048
|
-
*/
|
|
3049
|
-
getTrayIconInfo() {
|
|
3050
|
-
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
3051
|
-
}
|
|
3052
|
-
/**
|
|
3053
|
-
* Checks if the application has an associated tray icon.
|
|
3054
|
-
*
|
|
3055
|
-
* @example
|
|
3056
|
-
*
|
|
3057
|
-
* ```js
|
|
3058
|
-
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3059
|
-
* const hasTrayIcon = await app.hasTrayIcon();
|
|
3060
|
-
* console.log(hasTrayIcon);
|
|
3061
|
-
* ```
|
|
3062
|
-
*/
|
|
3063
|
-
hasTrayIcon() {
|
|
3064
|
-
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
3065
|
-
}
|
|
3066
|
-
/**
|
|
3067
|
-
* Closes the application by terminating its process.
|
|
3068
|
-
*
|
|
3069
|
-
* @example
|
|
3070
|
-
*
|
|
3071
|
-
* ```js
|
|
3072
|
-
* async function terminateApp() {
|
|
3073
|
-
* const app = await fin.Application.getCurrent();
|
|
3074
|
-
* return await app.terminate();
|
|
3075
|
-
* }
|
|
3076
|
-
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
|
3077
|
-
* ```
|
|
3078
|
-
*/
|
|
3079
|
-
terminate() {
|
|
3080
|
-
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
|
3081
|
-
}
|
|
3082
|
-
/**
|
|
3083
|
-
* Waits for a hanging application. This method can be called in response to an application
|
|
3084
|
-
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
|
3085
|
-
* message after a certain period of time.
|
|
3086
|
-
*
|
|
3087
|
-
* @ignore
|
|
3088
|
-
*/
|
|
3089
|
-
wait() {
|
|
3090
|
-
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
|
3091
|
-
}
|
|
3092
|
-
/**
|
|
3093
|
-
* Retrieves information about the application.
|
|
3094
|
-
*
|
|
3095
|
-
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
|
3096
|
-
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
|
3097
|
-
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
|
3098
|
-
*
|
|
3099
|
-
* @example
|
|
3100
|
-
*
|
|
3101
|
-
* ```js
|
|
3102
|
-
* async function getInfo() {
|
|
3103
|
-
* const app = await fin.Application.getCurrent();
|
|
3104
|
-
* return await app.getInfo();
|
|
3105
|
-
* }
|
|
3106
|
-
*
|
|
3107
|
-
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3108
|
-
* ```
|
|
3109
|
-
*/
|
|
3110
|
-
getInfo() {
|
|
3111
|
-
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
|
3112
|
-
}
|
|
3113
|
-
/**
|
|
3114
|
-
* Retrieves all process information for entities (windows and views) associated with an application.
|
|
3115
|
-
*
|
|
3116
|
-
* @example
|
|
3117
|
-
* ```js
|
|
3118
|
-
* const app = await fin.Application.getCurrent();
|
|
3119
|
-
* const processInfo = await app.getProcessInfo();
|
|
3120
|
-
* ```
|
|
3121
|
-
* @experimental
|
|
3122
|
-
*/
|
|
3123
|
-
async getProcessInfo() {
|
|
3124
|
-
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
|
3125
|
-
return data;
|
|
3126
|
-
}
|
|
3127
|
-
/**
|
|
3128
|
-
* Sets file auto download location. It's only allowed in the same application.
|
|
3129
|
-
*
|
|
3130
|
-
* Note: This method is restricted by default and must be enabled via
|
|
3131
|
-
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
3132
|
-
* @param downloadLocation file auto download location
|
|
3133
|
-
*
|
|
3134
|
-
* @throws if setting file auto download location on different applications.
|
|
3135
|
-
* @example
|
|
3136
|
-
*
|
|
3137
|
-
* ```js
|
|
3138
|
-
* const downloadLocation = 'C:\\dev\\temp';
|
|
3139
|
-
* const app = await fin.Application.getCurrent();
|
|
3140
|
-
* try {
|
|
3141
|
-
* await app.setFileDownloadLocation(downloadLocation);
|
|
3142
|
-
* console.log('File download location is set');
|
|
3143
|
-
* } catch(err) {
|
|
3144
|
-
* console.error(err)
|
|
3145
|
-
* }
|
|
3146
|
-
* ```
|
|
3147
|
-
*/
|
|
3148
|
-
async setFileDownloadLocation(downloadLocation) {
|
|
3149
|
-
const { name } = this.wire.me;
|
|
3150
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3151
|
-
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
3152
|
-
}
|
|
3153
|
-
/**
|
|
3154
|
-
* 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.
|
|
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
|
-
*
|
|
3159
|
-
* @throws if getting file auto download location on different applications.
|
|
3160
|
-
* @example
|
|
3161
|
-
*
|
|
3162
|
-
* ```js
|
|
3163
|
-
* const app = await fin.Application.getCurrent();
|
|
3164
|
-
* const fileDownloadDir = await app.getFileDownloadLocation();
|
|
3165
|
-
* ```
|
|
3166
|
-
*/
|
|
3167
|
-
async getFileDownloadLocation() {
|
|
3168
|
-
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
3169
|
-
return data;
|
|
3170
|
-
}
|
|
3171
|
-
/**
|
|
3172
|
-
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
|
3173
|
-
* @param options
|
|
3174
|
-
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
|
3175
|
-
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
|
3176
|
-
* of all possible data shapes for the entire menu, and the click handler should process
|
|
3177
|
-
* these with a "reducer" pattern.
|
|
3178
|
-
* @throws if the application has no tray icon set
|
|
3179
|
-
* @throws if the system tray is currently hidden
|
|
3180
|
-
* @example
|
|
3181
|
-
*
|
|
3182
|
-
* ```js
|
|
3183
|
-
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
|
3184
|
-
* const app = fin.Application.getCurrentSync();
|
|
3185
|
-
*
|
|
3186
|
-
* await app.setTrayIcon(iconUrl);
|
|
3187
|
-
*
|
|
3188
|
-
* const template = [
|
|
3189
|
-
* {
|
|
3190
|
-
* label: 'Menu Item 1',
|
|
3191
|
-
* data: 'hello from item 1'
|
|
3192
|
-
* },
|
|
3193
|
-
* { type: 'separator' },
|
|
3194
|
-
* {
|
|
3195
|
-
* label: 'Menu Item 2',
|
|
3196
|
-
* type: 'checkbox',
|
|
3197
|
-
* checked: true,
|
|
3198
|
-
* data: 'The user clicked the checkbox'
|
|
3199
|
-
* },
|
|
3200
|
-
* {
|
|
3201
|
-
* label: 'see more',
|
|
3202
|
-
* enabled: false,
|
|
3203
|
-
* submenu: [
|
|
3204
|
-
* { label: 'submenu 1', data: 'hello from submenu' }
|
|
3205
|
-
* ]
|
|
3206
|
-
* }
|
|
3207
|
-
* ];
|
|
3208
|
-
*
|
|
3209
|
-
* app.addListener('tray-icon-clicked', (event) => {
|
|
3210
|
-
* // right-click
|
|
3211
|
-
* if (event.button === 2) {
|
|
3212
|
-
* app.showTrayIconPopupMenu({ template }).then(r => {
|
|
3213
|
-
* if (r.result === 'closed') {
|
|
3214
|
-
* console.log('nothing happened');
|
|
3215
|
-
* } else {
|
|
3216
|
-
* console.log(r.data);
|
|
3217
|
-
* }
|
|
3218
|
-
* });
|
|
3219
|
-
* }
|
|
3220
|
-
* });
|
|
3221
|
-
* ```
|
|
3222
|
-
*/
|
|
3223
|
-
async showTrayIconPopupMenu(options) {
|
|
3224
|
-
const { name } = this.wire.me;
|
|
3225
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3226
|
-
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
|
3227
|
-
return payload.data;
|
|
3228
|
-
}
|
|
3229
|
-
/**
|
|
3230
|
-
* Closes the tray icon menu.
|
|
3231
|
-
*
|
|
3232
|
-
* @throws if the application has no tray icon set
|
|
3233
|
-
* @example
|
|
3234
|
-
*
|
|
3235
|
-
* ```js
|
|
3236
|
-
* const app = fin.Application.getCurrentSync();
|
|
3237
|
-
*
|
|
3238
|
-
* await app.closeTrayIconPopupMenu();
|
|
3239
|
-
* ```
|
|
3240
|
-
*/
|
|
3241
|
-
async closeTrayIconPopupMenu() {
|
|
3242
|
-
const { name } = this.wire.me;
|
|
3243
|
-
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3244
|
-
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
3245
|
-
}
|
|
3246
|
-
}
|
|
3247
|
-
Instance$6.Application = Application;
|
|
2425
|
+
var hasRequiredInstance$1;
|
|
3248
2426
|
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
2427
|
+
function requireInstance$1 () {
|
|
2428
|
+
if (hasRequiredInstance$1) return Instance$6;
|
|
2429
|
+
hasRequiredInstance$1 = 1;
|
|
2430
|
+
Object.defineProperty(Instance$6, "__esModule", { value: true });
|
|
2431
|
+
Instance$6.Application = void 0;
|
|
2432
|
+
/* eslint-disable import/prefer-default-export */
|
|
2433
|
+
const base_1 = base;
|
|
2434
|
+
const window_1 = requireWindow();
|
|
2435
|
+
const view_1 = requireView();
|
|
2436
|
+
/**
|
|
2437
|
+
* An object representing an application. Allows the developer to create,
|
|
2438
|
+
* execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
|
|
2439
|
+
*/
|
|
2440
|
+
class Application extends base_1.EmitterBase {
|
|
2441
|
+
/**
|
|
2442
|
+
* @internal
|
|
2443
|
+
*/
|
|
2444
|
+
constructor(wire, identity) {
|
|
2445
|
+
super(wire, 'application', identity.uuid);
|
|
2446
|
+
this.identity = identity;
|
|
2447
|
+
this.window = new window_1._Window(this.wire, {
|
|
2448
|
+
uuid: this.identity.uuid,
|
|
2449
|
+
name: this.identity.uuid
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
windowListFromIdentityList(identityList) {
|
|
2453
|
+
const windowList = [];
|
|
2454
|
+
identityList.forEach((identity) => {
|
|
2455
|
+
windowList.push(new window_1._Window(this.wire, {
|
|
2456
|
+
uuid: identity.uuid,
|
|
2457
|
+
name: identity.name
|
|
2458
|
+
}));
|
|
2459
|
+
});
|
|
2460
|
+
return windowList;
|
|
2461
|
+
}
|
|
2462
|
+
/**
|
|
2463
|
+
* Determines if the application is currently running.
|
|
2464
|
+
*
|
|
2465
|
+
* @example
|
|
2466
|
+
*
|
|
2467
|
+
* ```js
|
|
2468
|
+
* async function isAppRunning() {
|
|
2469
|
+
* const app = await fin.Application.getCurrent();
|
|
2470
|
+
* return await app.isRunning();
|
|
2471
|
+
* }
|
|
2472
|
+
* isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
|
|
2473
|
+
* ```
|
|
2474
|
+
*/
|
|
2475
|
+
isRunning() {
|
|
2476
|
+
return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
|
|
2477
|
+
}
|
|
2478
|
+
/**
|
|
2479
|
+
* Closes the application and any child windows created by the application.
|
|
2480
|
+
* Cleans the application from state so it is no longer found in getAllApplications.
|
|
2481
|
+
* @param force Close will be prevented from closing when force is false and
|
|
2482
|
+
* ‘close-requested’ has been subscribed to for application’s main window.
|
|
2483
|
+
*
|
|
2484
|
+
* @example
|
|
2485
|
+
*
|
|
2486
|
+
* ```js
|
|
2487
|
+
* async function closeApp() {
|
|
2488
|
+
* const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
|
|
2489
|
+
* const app = await fin.Application.wrap({uuid: 'app2'});
|
|
2490
|
+
* await app.quit();
|
|
2491
|
+
* const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
|
|
2492
|
+
*
|
|
2493
|
+
* }
|
|
2494
|
+
* closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
|
|
2495
|
+
* ```
|
|
2496
|
+
*/
|
|
2497
|
+
async quit(force = false) {
|
|
2498
|
+
try {
|
|
2499
|
+
await this._close(force);
|
|
2500
|
+
await this.wire.sendAction('destroy-application', { force, ...this.identity });
|
|
2501
|
+
}
|
|
2502
|
+
catch (error) {
|
|
2503
|
+
const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
|
|
2504
|
+
if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
|
|
2505
|
+
throw error;
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
async _close(force = false) {
|
|
2510
|
+
try {
|
|
2511
|
+
await this.wire.sendAction('close-application', { force, ...this.identity });
|
|
2512
|
+
}
|
|
2513
|
+
catch (error) {
|
|
2514
|
+
if (!error.message.includes('Remote connection has closed')) {
|
|
2515
|
+
throw error;
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
/**
|
|
2520
|
+
* @deprecated use Application.quit instead
|
|
2521
|
+
* Closes the application and any child windows created by the application.
|
|
2522
|
+
* @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
|
|
2523
|
+
* @param callback - called if the method succeeds.
|
|
2524
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
2525
|
+
*
|
|
2526
|
+
* @example
|
|
2527
|
+
*
|
|
2528
|
+
* ```js
|
|
2529
|
+
* async function closeApp() {
|
|
2530
|
+
* const app = await fin.Application.getCurrent();
|
|
2531
|
+
* return await app.close();
|
|
2532
|
+
* }
|
|
2533
|
+
* closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
|
|
2534
|
+
* ```
|
|
2535
|
+
*/
|
|
2536
|
+
close(force = false) {
|
|
2537
|
+
console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
|
|
2538
|
+
this.wire.sendAction('application-close', this.identity).catch((e) => {
|
|
2539
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2540
|
+
});
|
|
2541
|
+
return this._close(force);
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
|
|
2545
|
+
*
|
|
2546
|
+
* @example
|
|
2547
|
+
*
|
|
2548
|
+
* ```js
|
|
2549
|
+
* async function getChildWindows() {
|
|
2550
|
+
* const app = await fin.Application.getCurrent();
|
|
2551
|
+
* return await app.getChildWindows();
|
|
2552
|
+
* }
|
|
2553
|
+
*
|
|
2554
|
+
* getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
|
|
2555
|
+
* ```
|
|
2556
|
+
*/
|
|
2557
|
+
getChildWindows() {
|
|
2558
|
+
return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
|
|
2559
|
+
const identityList = [];
|
|
2560
|
+
payload.data.forEach((winName) => {
|
|
2561
|
+
identityList.push({ uuid: this.identity.uuid, name: winName });
|
|
2562
|
+
});
|
|
2563
|
+
return this.windowListFromIdentityList(identityList);
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
/**
|
|
2567
|
+
* Retrieves the JSON manifest that was used to create the application. Invokes the error callback
|
|
2568
|
+
* if the application was not created from a manifest.
|
|
2569
|
+
*
|
|
2570
|
+
* @example
|
|
2571
|
+
*
|
|
2572
|
+
* ```js
|
|
2573
|
+
* async function getManifest() {
|
|
2574
|
+
* const app = await fin.Application.getCurrent();
|
|
2575
|
+
* return await app.getManifest();
|
|
2576
|
+
* }
|
|
2577
|
+
*
|
|
2578
|
+
* getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
|
|
2579
|
+
* ```
|
|
2580
|
+
*/
|
|
2581
|
+
getManifest() {
|
|
2582
|
+
return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
|
|
2583
|
+
}
|
|
2584
|
+
/**
|
|
2585
|
+
* Retrieves UUID of the application that launches this application. Invokes the error callback
|
|
2586
|
+
* if the application was created from a manifest.
|
|
2587
|
+
*
|
|
2588
|
+
* @example
|
|
2589
|
+
*
|
|
2590
|
+
* ```js
|
|
2591
|
+
* async function getParentUuid() {
|
|
2592
|
+
* const app = await fin.Application.start({
|
|
2593
|
+
* uuid: 'app-1',
|
|
2594
|
+
* name: 'myApp',
|
|
2595
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
|
|
2596
|
+
* autoShow: true
|
|
2597
|
+
* });
|
|
2598
|
+
* return await app.getParentUuid();
|
|
2599
|
+
* }
|
|
2600
|
+
*
|
|
2601
|
+
* getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
|
|
2602
|
+
* ```
|
|
2603
|
+
*/
|
|
2604
|
+
getParentUuid() {
|
|
2605
|
+
return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
|
|
2606
|
+
}
|
|
2607
|
+
/**
|
|
2608
|
+
* Retrieves current application's shortcut configuration.
|
|
2609
|
+
*
|
|
2610
|
+
* @example
|
|
2611
|
+
*
|
|
2612
|
+
* ```js
|
|
2613
|
+
* async function getShortcuts() {
|
|
2614
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
2615
|
+
* return await app.getShortcuts();
|
|
2616
|
+
* }
|
|
2617
|
+
* getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
|
|
2618
|
+
* ```
|
|
2619
|
+
*/
|
|
2620
|
+
getShortcuts() {
|
|
2621
|
+
return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
|
|
2622
|
+
}
|
|
2623
|
+
/**
|
|
2624
|
+
* Retrieves current application's views.
|
|
2625
|
+
* @experimental
|
|
2626
|
+
*
|
|
2627
|
+
* @example
|
|
2628
|
+
*
|
|
2629
|
+
* ```js
|
|
2630
|
+
* async function getViews() {
|
|
2631
|
+
* const app = await fin.Application.getCurrent();
|
|
2632
|
+
* return await app.getViews();
|
|
2633
|
+
* }
|
|
2634
|
+
* getViews().then(views => console.log(views)).catch(err => console.log(err));
|
|
2635
|
+
* ```
|
|
2636
|
+
*/
|
|
2637
|
+
async getViews() {
|
|
2638
|
+
const { payload } = await this.wire.sendAction('application-get-views', this.identity);
|
|
2639
|
+
return payload.data.map((id) => new view_1.View(this.wire, id));
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* Returns the current zoom level of the application.
|
|
2643
|
+
*
|
|
2644
|
+
* @example
|
|
2645
|
+
*
|
|
2646
|
+
* ```js
|
|
2647
|
+
* async function getZoomLevel() {
|
|
2648
|
+
* const app = await fin.Application.getCurrent();
|
|
2649
|
+
* return await app.getZoomLevel();
|
|
2650
|
+
* }
|
|
2651
|
+
*
|
|
2652
|
+
* getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
|
|
2653
|
+
* ```
|
|
2654
|
+
*/
|
|
2655
|
+
getZoomLevel() {
|
|
2656
|
+
return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
|
|
2657
|
+
}
|
|
2658
|
+
/**
|
|
2659
|
+
* Returns an instance of the main Window of the application
|
|
2660
|
+
*
|
|
2661
|
+
* @example
|
|
2662
|
+
*
|
|
2663
|
+
* ```js
|
|
2664
|
+
* async function getWindow() {
|
|
2665
|
+
* const app = await fin.Application.start({
|
|
2666
|
+
* uuid: 'app-1',
|
|
2667
|
+
* name: 'myApp',
|
|
2668
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
|
|
2669
|
+
* autoShow: true
|
|
2670
|
+
* });
|
|
2671
|
+
* return await app.getWindow();
|
|
2672
|
+
* }
|
|
2673
|
+
*
|
|
2674
|
+
* getWindow().then(win => {
|
|
2675
|
+
* win.showAt(0, 400);
|
|
2676
|
+
* win.flash();
|
|
2677
|
+
* }).catch(err => console.log(err));
|
|
2678
|
+
* ```
|
|
2679
|
+
*/
|
|
2680
|
+
getWindow() {
|
|
2681
|
+
this.wire.sendAction('application-get-window', this.identity).catch((e) => {
|
|
2682
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2683
|
+
});
|
|
2684
|
+
return Promise.resolve(this.window);
|
|
2685
|
+
}
|
|
2686
|
+
/**
|
|
2687
|
+
* Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
|
|
2688
|
+
* @param userName - username to be passed to the RVM.
|
|
2689
|
+
* @param appName - app name to be passed to the RVM.
|
|
2690
|
+
*
|
|
2691
|
+
* @example
|
|
2692
|
+
*
|
|
2693
|
+
* ```js
|
|
2694
|
+
* async function registerUser() {
|
|
2695
|
+
* const app = await fin.Application.getCurrent();
|
|
2696
|
+
* return await app.registerUser('user', 'myApp');
|
|
2697
|
+
* }
|
|
2698
|
+
*
|
|
2699
|
+
* registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
|
|
2700
|
+
* ```
|
|
2701
|
+
*/
|
|
2702
|
+
registerUser(userName, appName) {
|
|
2703
|
+
return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
|
|
2704
|
+
}
|
|
2705
|
+
/**
|
|
2706
|
+
* Removes the application’s icon from the tray.
|
|
2707
|
+
*
|
|
2708
|
+
* @example
|
|
2709
|
+
*
|
|
2710
|
+
* ```js
|
|
2711
|
+
* async function removeTrayIcon() {
|
|
2712
|
+
* const app = await fin.Application.getCurrent();
|
|
2713
|
+
* return await app.removeTrayIcon();
|
|
2714
|
+
* }
|
|
2715
|
+
*
|
|
2716
|
+
* removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
|
|
2717
|
+
* ```
|
|
2718
|
+
*/
|
|
2719
|
+
removeTrayIcon() {
|
|
2720
|
+
return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* Restarts the application.
|
|
2724
|
+
*
|
|
2725
|
+
* @example
|
|
2726
|
+
*
|
|
2727
|
+
* ```js
|
|
2728
|
+
* async function restartApp() {
|
|
2729
|
+
* const app = await fin.Application.getCurrent();
|
|
2730
|
+
* return await app.restart();
|
|
2731
|
+
* }
|
|
2732
|
+
* restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
|
|
2733
|
+
* ```
|
|
2734
|
+
*/
|
|
2735
|
+
restart() {
|
|
2736
|
+
return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
|
|
2737
|
+
}
|
|
2738
|
+
/**
|
|
2739
|
+
* DEPRECATED method to run the application.
|
|
2740
|
+
* Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
|
|
2741
|
+
*
|
|
2742
|
+
* @example
|
|
2743
|
+
*
|
|
2744
|
+
* ```js
|
|
2745
|
+
* async function run() {
|
|
2746
|
+
* const app = await fin.Application.create({
|
|
2747
|
+
* name: 'myApp',
|
|
2748
|
+
* uuid: 'app-1',
|
|
2749
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
|
|
2750
|
+
* autoShow: true
|
|
2751
|
+
* });
|
|
2752
|
+
* await app.run();
|
|
2753
|
+
* }
|
|
2754
|
+
* run().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
2755
|
+
* ```
|
|
2756
|
+
*
|
|
2757
|
+
* @ignore
|
|
2758
|
+
*/
|
|
2759
|
+
run() {
|
|
2760
|
+
console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
|
|
2761
|
+
this.wire.sendAction('application-run', this.identity).catch((e) => {
|
|
2762
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2763
|
+
});
|
|
2764
|
+
return this._run();
|
|
2765
|
+
}
|
|
2766
|
+
_run(opts = {}) {
|
|
2767
|
+
return this.wire
|
|
2768
|
+
.sendAction('run-application', {
|
|
2769
|
+
manifestUrl: this._manifestUrl,
|
|
2770
|
+
opts,
|
|
2771
|
+
...this.identity
|
|
2772
|
+
})
|
|
2773
|
+
.then(() => undefined);
|
|
2774
|
+
}
|
|
2775
|
+
/**
|
|
2776
|
+
* Instructs the RVM to schedule one restart of the application.
|
|
2777
|
+
*
|
|
2778
|
+
* @example
|
|
2779
|
+
*
|
|
2780
|
+
* ```js
|
|
2781
|
+
* async function scheduleRestart() {
|
|
2782
|
+
* const app = await fin.Application.getCurrent();
|
|
2783
|
+
* return await app.scheduleRestart();
|
|
2784
|
+
* }
|
|
2785
|
+
*
|
|
2786
|
+
* scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
|
|
2787
|
+
* ```
|
|
2788
|
+
*/
|
|
2789
|
+
scheduleRestart() {
|
|
2790
|
+
return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
|
|
2791
|
+
}
|
|
2792
|
+
/**
|
|
2793
|
+
* Sends a message to the RVM to upload the application's logs. On success,
|
|
2794
|
+
* an object containing logId is returned.
|
|
2795
|
+
*
|
|
2796
|
+
* @example
|
|
2797
|
+
*
|
|
2798
|
+
* ```js
|
|
2799
|
+
* async function sendLog() {
|
|
2800
|
+
* const app = await fin.Application.getCurrent();
|
|
2801
|
+
* return await app.sendApplicationLog();
|
|
2802
|
+
* }
|
|
2803
|
+
*
|
|
2804
|
+
* sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
|
|
2805
|
+
* ```
|
|
2806
|
+
*/
|
|
2807
|
+
async sendApplicationLog() {
|
|
2808
|
+
const { payload } = await this.wire.sendAction('send-application-log', this.identity);
|
|
2809
|
+
return payload.data;
|
|
2810
|
+
}
|
|
2811
|
+
/**
|
|
2812
|
+
* Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
|
|
2813
|
+
* If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
|
|
2814
|
+
*
|
|
2815
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
2816
|
+
* @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
|
|
2817
|
+
*
|
|
2818
|
+
*
|
|
2819
|
+
* @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).
|
|
2820
|
+
*
|
|
2821
|
+
* The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
|
|
2822
|
+
* **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
|
|
2823
|
+
*
|
|
2824
|
+
* Note: If the "name" property is omitted it defaults to "tasks".
|
|
2825
|
+
*
|
|
2826
|
+
* Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
|
|
2827
|
+
* uuid or shortcut.name is changed.
|
|
2828
|
+
*
|
|
2829
|
+
* @example
|
|
2830
|
+
*
|
|
2831
|
+
* ```js
|
|
2832
|
+
* const app = fin.Application.getCurrentSync();
|
|
2833
|
+
* const appName = 'My App';
|
|
2834
|
+
* const jumpListConfig = [ // array of JumpList categories
|
|
2835
|
+
* {
|
|
2836
|
+
* // has no name and no type so `type` is assumed to be "tasks"
|
|
2837
|
+
* items: [ // array of JumpList items
|
|
2838
|
+
* {
|
|
2839
|
+
* type: 'task',
|
|
2840
|
+
* title: `Launch ${appName}`,
|
|
2841
|
+
* description: `Runs ${appName} with the default configuration`,
|
|
2842
|
+
* deepLink: 'fins://path.to/app/manifest.json',
|
|
2843
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
2844
|
+
* iconIndex: 0
|
|
2845
|
+
* },
|
|
2846
|
+
* { type: 'separator' },
|
|
2847
|
+
* {
|
|
2848
|
+
* type: 'task',
|
|
2849
|
+
* title: `Restore ${appName}`,
|
|
2850
|
+
* description: 'Restore to last configuration',
|
|
2851
|
+
* deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
|
|
2852
|
+
* iconPath: 'https://path.to/app/icon.ico',
|
|
2853
|
+
* iconIndex: 0
|
|
2854
|
+
* },
|
|
2855
|
+
* ]
|
|
2856
|
+
* },
|
|
2857
|
+
* {
|
|
2858
|
+
* name: 'Tools',
|
|
2859
|
+
* items: [ // array of JumpList items
|
|
2860
|
+
* {
|
|
2861
|
+
* type: 'task',
|
|
2862
|
+
* title: 'Tool A',
|
|
2863
|
+
* description: 'Runs Tool A',
|
|
2864
|
+
* deepLink: 'fins://path.to/tool-a/manifest.json',
|
|
2865
|
+
* iconPath: 'https://path.to/tool-a/icon.ico',
|
|
2866
|
+
* iconIndex: 0
|
|
2867
|
+
* },
|
|
2868
|
+
* {
|
|
2869
|
+
* type: 'task',
|
|
2870
|
+
* title: 'Tool B',
|
|
2871
|
+
* description: 'Runs Tool B',
|
|
2872
|
+
* deepLink: 'fins://path.to/tool-b/manifest.json',
|
|
2873
|
+
* iconPath: 'https://path.to/tool-b/icon.ico',
|
|
2874
|
+
* iconIndex: 0
|
|
2875
|
+
* }]
|
|
2876
|
+
* }
|
|
2877
|
+
* ];
|
|
2878
|
+
*
|
|
2879
|
+
* app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
|
|
2880
|
+
* ```
|
|
2881
|
+
*
|
|
2882
|
+
* To handle deeplink args:
|
|
2883
|
+
* ```js
|
|
2884
|
+
* function handleUseLastConfiguration() {
|
|
2885
|
+
* // this handler is called when the app is being launched
|
|
2886
|
+
* app.on('run-requested', event => {
|
|
2887
|
+
* if(event.userAppConfigArgs['use-last-configuration']) {
|
|
2888
|
+
* // your logic here
|
|
2889
|
+
* }
|
|
2890
|
+
* });
|
|
2891
|
+
* // this handler is called when the app was already running when the launch was requested
|
|
2892
|
+
* fin.desktop.main(function(args) {
|
|
2893
|
+
* if(args && args['use-last-configuration']) {
|
|
2894
|
+
* // your logic here
|
|
2895
|
+
* }
|
|
2896
|
+
* });
|
|
2897
|
+
* }
|
|
2898
|
+
* ```
|
|
2899
|
+
*/
|
|
2900
|
+
async setJumpList(jumpListCategories) {
|
|
2901
|
+
await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
|
|
2902
|
+
}
|
|
2903
|
+
/**
|
|
2904
|
+
* Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
|
|
2905
|
+
* @param icon Image URL or base64 encoded string to be used as the icon
|
|
2906
|
+
*
|
|
2907
|
+
* @example
|
|
2908
|
+
*
|
|
2909
|
+
* ```js
|
|
2910
|
+
* const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
2911
|
+
* const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
|
|
2912
|
+
* ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
|
|
2913
|
+
* const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
|
|
2914
|
+
* xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
|
2915
|
+
*
|
|
2916
|
+
* async function setTrayIcon(icon) {
|
|
2917
|
+
* const app = await fin.Application.getCurrent();
|
|
2918
|
+
* return await app.setTrayIcon(icon);
|
|
2919
|
+
* }
|
|
2920
|
+
*
|
|
2921
|
+
* // use image url to set tray icon
|
|
2922
|
+
* setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2923
|
+
*
|
|
2924
|
+
* // use base64 encoded string to set tray icon
|
|
2925
|
+
* setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2926
|
+
*
|
|
2927
|
+
* // use a dataURL to set tray icon
|
|
2928
|
+
* setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
|
|
2929
|
+
* ```
|
|
2930
|
+
*/
|
|
2931
|
+
setTrayIcon(icon) {
|
|
2932
|
+
return this.wire
|
|
2933
|
+
.sendAction('set-tray-icon', {
|
|
2934
|
+
enabledIcon: icon,
|
|
2935
|
+
...this.identity
|
|
2936
|
+
})
|
|
2937
|
+
.then(() => undefined);
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* Set hover text for this application's system tray icon.
|
|
2941
|
+
* Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
|
|
2942
|
+
* @param toolTip
|
|
2943
|
+
*
|
|
2944
|
+
* @example
|
|
2945
|
+
*
|
|
2946
|
+
* ```js
|
|
2947
|
+
* const app = fin.Application.getCurrentSync();
|
|
2948
|
+
* const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
|
|
2949
|
+
*
|
|
2950
|
+
* await app.setTrayIcon(iconUrl);
|
|
2951
|
+
*
|
|
2952
|
+
* await app.setTrayIconToolTip('My Application');
|
|
2953
|
+
* ```
|
|
2954
|
+
*/
|
|
2955
|
+
async setTrayIconToolTip(toolTip) {
|
|
2956
|
+
await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
|
|
2957
|
+
}
|
|
2958
|
+
/**
|
|
2959
|
+
* Sets new application's shortcut configuration. Windows only.
|
|
2960
|
+
* @param config New application's shortcut configuration.
|
|
2961
|
+
*
|
|
2962
|
+
* @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
|
|
2963
|
+
* to be able to change shortcut states.
|
|
2964
|
+
*
|
|
2965
|
+
* @example
|
|
2966
|
+
*
|
|
2967
|
+
* ```js
|
|
2968
|
+
* async function setShortcuts(config) {
|
|
2969
|
+
* const app = await fin.Application.getCurrent();
|
|
2970
|
+
* return app.setShortcuts(config);
|
|
2971
|
+
* }
|
|
2972
|
+
*
|
|
2973
|
+
* setShortcuts({
|
|
2974
|
+
* desktop: true,
|
|
2975
|
+
* startMenu: false,
|
|
2976
|
+
* systemStartup: true
|
|
2977
|
+
* }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
|
|
2978
|
+
* ```
|
|
2979
|
+
*/
|
|
2980
|
+
setShortcuts(config) {
|
|
2981
|
+
return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
|
|
2982
|
+
}
|
|
2983
|
+
/**
|
|
2984
|
+
* Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
|
|
2985
|
+
* @param queryString The new query string for this app's shortcuts.
|
|
2986
|
+
*
|
|
2987
|
+
* @example
|
|
2988
|
+
*
|
|
2989
|
+
* ```js
|
|
2990
|
+
* const newQueryArgs = 'arg=true&arg2=false';
|
|
2991
|
+
* const app = await fin.Application.getCurrent();
|
|
2992
|
+
* try {
|
|
2993
|
+
* await app.setShortcutQueryParams(newQueryArgs);
|
|
2994
|
+
* } catch(err) {
|
|
2995
|
+
* console.error(err)
|
|
2996
|
+
* }
|
|
2997
|
+
* ```
|
|
2998
|
+
*/
|
|
2999
|
+
async setShortcutQueryParams(queryString) {
|
|
3000
|
+
await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
|
|
3001
|
+
}
|
|
3002
|
+
/**
|
|
3003
|
+
* Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
|
|
3004
|
+
* larger or smaller to default limits of 300% and 50% of original size, respectively.
|
|
3005
|
+
* @param level The zoom level
|
|
3006
|
+
*
|
|
3007
|
+
* @example
|
|
3008
|
+
*
|
|
3009
|
+
* ```js
|
|
3010
|
+
* async function setZoomLevel(number) {
|
|
3011
|
+
* const app = await fin.Application.getCurrent();
|
|
3012
|
+
* return await app.setZoomLevel(number);
|
|
3013
|
+
* }
|
|
3014
|
+
*
|
|
3015
|
+
* setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
|
|
3016
|
+
* ```
|
|
3017
|
+
*/
|
|
3018
|
+
setZoomLevel(level) {
|
|
3019
|
+
return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* Sets a username to correlate with App Log Management.
|
|
3023
|
+
* @param username Username to correlate with App's Log.
|
|
3024
|
+
*
|
|
3025
|
+
* @example
|
|
3026
|
+
*
|
|
3027
|
+
* ```js
|
|
3028
|
+
* async function setAppLogUser() {
|
|
3029
|
+
* const app = await fin.Application.getCurrent();
|
|
3030
|
+
* return await app.setAppLogUsername('username');
|
|
3031
|
+
* }
|
|
3032
|
+
*
|
|
3033
|
+
* setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
|
|
3034
|
+
*
|
|
3035
|
+
* ```
|
|
3036
|
+
*/
|
|
3037
|
+
async setAppLogUsername(username) {
|
|
3038
|
+
await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
|
|
3039
|
+
}
|
|
3040
|
+
/**
|
|
3041
|
+
* Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
|
|
3042
|
+
* @remarks The only information currently returned is the position and dimensions.
|
|
3043
|
+
*
|
|
3044
|
+
* @example
|
|
3045
|
+
*
|
|
3046
|
+
* ```js
|
|
3047
|
+
* async function getTrayIconInfo() {
|
|
3048
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3049
|
+
* return await app.getTrayIconInfo();
|
|
3050
|
+
* }
|
|
3051
|
+
* getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3052
|
+
* ```
|
|
3053
|
+
*/
|
|
3054
|
+
getTrayIconInfo() {
|
|
3055
|
+
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
3056
|
+
}
|
|
3057
|
+
/**
|
|
3058
|
+
* Checks if the application has an associated tray icon.
|
|
3059
|
+
*
|
|
3060
|
+
* @example
|
|
3061
|
+
*
|
|
3062
|
+
* ```js
|
|
3063
|
+
* const app = await fin.Application.wrap({ uuid: 'testapp' });
|
|
3064
|
+
* const hasTrayIcon = await app.hasTrayIcon();
|
|
3065
|
+
* console.log(hasTrayIcon);
|
|
3066
|
+
* ```
|
|
3067
|
+
*/
|
|
3068
|
+
hasTrayIcon() {
|
|
3069
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
3070
|
+
}
|
|
3071
|
+
/**
|
|
3072
|
+
* Closes the application by terminating its process.
|
|
3073
|
+
*
|
|
3074
|
+
* @example
|
|
3075
|
+
*
|
|
3076
|
+
* ```js
|
|
3077
|
+
* async function terminateApp() {
|
|
3078
|
+
* const app = await fin.Application.getCurrent();
|
|
3079
|
+
* return await app.terminate();
|
|
3080
|
+
* }
|
|
3081
|
+
* terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
|
|
3082
|
+
* ```
|
|
3083
|
+
*/
|
|
3084
|
+
terminate() {
|
|
3085
|
+
return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
|
|
3086
|
+
}
|
|
3087
|
+
/**
|
|
3088
|
+
* Waits for a hanging application. This method can be called in response to an application
|
|
3089
|
+
* "not-responding" to allow the application to continue and to generate another "not-responding"
|
|
3090
|
+
* message after a certain period of time.
|
|
3091
|
+
*
|
|
3092
|
+
* @ignore
|
|
3093
|
+
*/
|
|
3094
|
+
wait() {
|
|
3095
|
+
return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
|
|
3096
|
+
}
|
|
3097
|
+
/**
|
|
3098
|
+
* Retrieves information about the application.
|
|
3099
|
+
*
|
|
3100
|
+
* @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
|
|
3101
|
+
* and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
|
|
3102
|
+
* if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
|
|
3103
|
+
*
|
|
3104
|
+
* @example
|
|
3105
|
+
*
|
|
3106
|
+
* ```js
|
|
3107
|
+
* async function getInfo() {
|
|
3108
|
+
* const app = await fin.Application.getCurrent();
|
|
3109
|
+
* return await app.getInfo();
|
|
3110
|
+
* }
|
|
3111
|
+
*
|
|
3112
|
+
* getInfo().then(info => console.log(info)).catch(err => console.log(err));
|
|
3113
|
+
* ```
|
|
3114
|
+
*/
|
|
3115
|
+
getInfo() {
|
|
3116
|
+
return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
|
|
3117
|
+
}
|
|
3118
|
+
/**
|
|
3119
|
+
* Retrieves all process information for entities (windows and views) associated with an application.
|
|
3120
|
+
*
|
|
3121
|
+
* @example
|
|
3122
|
+
* ```js
|
|
3123
|
+
* const app = await fin.Application.getCurrent();
|
|
3124
|
+
* const processInfo = await app.getProcessInfo();
|
|
3125
|
+
* ```
|
|
3126
|
+
* @experimental
|
|
3127
|
+
*/
|
|
3128
|
+
async getProcessInfo() {
|
|
3129
|
+
const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
|
|
3130
|
+
return data;
|
|
3131
|
+
}
|
|
3132
|
+
/**
|
|
3133
|
+
* Sets file auto download location. It's only allowed in the same application.
|
|
3134
|
+
*
|
|
3135
|
+
* Note: This method is restricted by default and must be enabled via
|
|
3136
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
3137
|
+
* @param downloadLocation file auto download location
|
|
3138
|
+
*
|
|
3139
|
+
* @throws if setting file auto download location on different applications.
|
|
3140
|
+
* @example
|
|
3141
|
+
*
|
|
3142
|
+
* ```js
|
|
3143
|
+
* const downloadLocation = 'C:\\dev\\temp';
|
|
3144
|
+
* const app = await fin.Application.getCurrent();
|
|
3145
|
+
* try {
|
|
3146
|
+
* await app.setFileDownloadLocation(downloadLocation);
|
|
3147
|
+
* console.log('File download location is set');
|
|
3148
|
+
* } catch(err) {
|
|
3149
|
+
* console.error(err)
|
|
3150
|
+
* }
|
|
3151
|
+
* ```
|
|
3152
|
+
*/
|
|
3153
|
+
async setFileDownloadLocation(downloadLocation) {
|
|
3154
|
+
const { name } = this.wire.me;
|
|
3155
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3156
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
3157
|
+
}
|
|
3158
|
+
/**
|
|
3159
|
+
* 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.
|
|
3160
|
+
*
|
|
3161
|
+
* Note: This method is restricted by default and must be enabled via
|
|
3162
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
3163
|
+
*
|
|
3164
|
+
* @throws if getting file auto download location on different applications.
|
|
3165
|
+
* @example
|
|
3166
|
+
*
|
|
3167
|
+
* ```js
|
|
3168
|
+
* const app = await fin.Application.getCurrent();
|
|
3169
|
+
* const fileDownloadDir = await app.getFileDownloadLocation();
|
|
3170
|
+
* ```
|
|
3171
|
+
*/
|
|
3172
|
+
async getFileDownloadLocation() {
|
|
3173
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
3174
|
+
return data;
|
|
3175
|
+
}
|
|
3176
|
+
/**
|
|
3177
|
+
* Shows a menu on the tray icon. Use with tray-icon-clicked event.
|
|
3178
|
+
* @param options
|
|
3179
|
+
* @typeParam Data User-defined shape for data returned upon menu item click. Should be a
|
|
3180
|
+
* [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
|
|
3181
|
+
* of all possible data shapes for the entire menu, and the click handler should process
|
|
3182
|
+
* these with a "reducer" pattern.
|
|
3183
|
+
* @throws if the application has no tray icon set
|
|
3184
|
+
* @throws if the system tray is currently hidden
|
|
3185
|
+
* @example
|
|
3186
|
+
*
|
|
3187
|
+
* ```js
|
|
3188
|
+
* const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
|
|
3189
|
+
* const app = fin.Application.getCurrentSync();
|
|
3190
|
+
*
|
|
3191
|
+
* await app.setTrayIcon(iconUrl);
|
|
3192
|
+
*
|
|
3193
|
+
* const template = [
|
|
3194
|
+
* {
|
|
3195
|
+
* label: 'Menu Item 1',
|
|
3196
|
+
* data: 'hello from item 1'
|
|
3197
|
+
* },
|
|
3198
|
+
* { type: 'separator' },
|
|
3199
|
+
* {
|
|
3200
|
+
* label: 'Menu Item 2',
|
|
3201
|
+
* type: 'checkbox',
|
|
3202
|
+
* checked: true,
|
|
3203
|
+
* data: 'The user clicked the checkbox'
|
|
3204
|
+
* },
|
|
3205
|
+
* {
|
|
3206
|
+
* label: 'see more',
|
|
3207
|
+
* enabled: false,
|
|
3208
|
+
* submenu: [
|
|
3209
|
+
* { label: 'submenu 1', data: 'hello from submenu' }
|
|
3210
|
+
* ]
|
|
3211
|
+
* }
|
|
3212
|
+
* ];
|
|
3213
|
+
*
|
|
3214
|
+
* app.addListener('tray-icon-clicked', (event) => {
|
|
3215
|
+
* // right-click
|
|
3216
|
+
* if (event.button === 2) {
|
|
3217
|
+
* app.showTrayIconPopupMenu({ template }).then(r => {
|
|
3218
|
+
* if (r.result === 'closed') {
|
|
3219
|
+
* console.log('nothing happened');
|
|
3220
|
+
* } else {
|
|
3221
|
+
* console.log(r.data);
|
|
3222
|
+
* }
|
|
3223
|
+
* });
|
|
3224
|
+
* }
|
|
3225
|
+
* });
|
|
3226
|
+
* ```
|
|
3227
|
+
*/
|
|
3228
|
+
async showTrayIconPopupMenu(options) {
|
|
3229
|
+
const { name } = this.wire.me;
|
|
3230
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3231
|
+
const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
|
|
3232
|
+
return payload.data;
|
|
3233
|
+
}
|
|
3234
|
+
/**
|
|
3235
|
+
* Closes the tray icon menu.
|
|
3236
|
+
*
|
|
3237
|
+
* @throws if the application has no tray icon set
|
|
3238
|
+
* @example
|
|
3239
|
+
*
|
|
3240
|
+
* ```js
|
|
3241
|
+
* const app = fin.Application.getCurrentSync();
|
|
3242
|
+
*
|
|
3243
|
+
* await app.closeTrayIconPopupMenu();
|
|
3244
|
+
* ```
|
|
3245
|
+
*/
|
|
3246
|
+
async closeTrayIconPopupMenu() {
|
|
3247
|
+
const { name } = this.wire.me;
|
|
3248
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
3249
|
+
await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
|
|
3250
|
+
}
|
|
3251
|
+
}
|
|
3252
|
+
Instance$6.Application = Application;
|
|
3253
|
+
return Instance$6;
|
|
3519
3254
|
}
|
|
3520
|
-
Factory$7.ApplicationModule = ApplicationModule;
|
|
3521
3255
|
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
o[k2] = m[k];
|
|
3533
|
-
}));
|
|
3534
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
3535
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3536
|
-
};
|
|
3537
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3256
|
+
var hasRequiredFactory$1;
|
|
3257
|
+
|
|
3258
|
+
function requireFactory$1 () {
|
|
3259
|
+
if (hasRequiredFactory$1) return Factory$7;
|
|
3260
|
+
hasRequiredFactory$1 = 1;
|
|
3261
|
+
Object.defineProperty(Factory$7, "__esModule", { value: true });
|
|
3262
|
+
Factory$7.ApplicationModule = void 0;
|
|
3263
|
+
const base_1 = base;
|
|
3264
|
+
const validate_1 = validate;
|
|
3265
|
+
const Instance_1 = requireInstance$1();
|
|
3538
3266
|
/**
|
|
3539
|
-
*
|
|
3540
|
-
*
|
|
3541
|
-
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
|
3542
|
-
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
|
3543
|
-
*
|
|
3544
|
-
* 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),
|
|
3545
|
-
* both of these were documented on the same page.
|
|
3546
|
-
*
|
|
3547
|
-
* @packageDocumentation
|
|
3267
|
+
* Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
|
|
3548
3268
|
*/
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3269
|
+
class ApplicationModule extends base_1.Base {
|
|
3270
|
+
/**
|
|
3271
|
+
* Asynchronously returns an API handle for the given Application identity.
|
|
3272
|
+
*
|
|
3273
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
3274
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
3275
|
+
* for an Application throughout its entire lifecycle.
|
|
3276
|
+
*
|
|
3277
|
+
* @example
|
|
3278
|
+
*
|
|
3279
|
+
* ```js
|
|
3280
|
+
* fin.Application.wrap({ uuid: 'testapp' })
|
|
3281
|
+
* .then(app => app.isRunning())
|
|
3282
|
+
* .then(running => console.log('Application is running: ' + running))
|
|
3283
|
+
* .catch(err => console.log(err));
|
|
3284
|
+
* ```
|
|
3285
|
+
*
|
|
3286
|
+
*/
|
|
3287
|
+
async wrap(identity) {
|
|
3288
|
+
this.wire.sendAction('wrap-application').catch((e) => {
|
|
3289
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3290
|
+
});
|
|
3291
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
3292
|
+
if (errorMsg) {
|
|
3293
|
+
throw new Error(errorMsg);
|
|
3294
|
+
}
|
|
3295
|
+
return new Instance_1.Application(this.wire, identity);
|
|
3296
|
+
}
|
|
3297
|
+
/**
|
|
3298
|
+
* Synchronously returns an API handle for the given Application identity.
|
|
3299
|
+
*
|
|
3300
|
+
* @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
|
|
3301
|
+
* returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
|
|
3302
|
+
* for an Aplication throughout its entire lifecycle.
|
|
3303
|
+
*
|
|
3304
|
+
* @example
|
|
3305
|
+
*
|
|
3306
|
+
* ```js
|
|
3307
|
+
* const app = fin.Application.wrapSync({ uuid: 'testapp' });
|
|
3308
|
+
* await app.close();
|
|
3309
|
+
* ```
|
|
3310
|
+
*
|
|
3311
|
+
*/
|
|
3312
|
+
wrapSync(identity) {
|
|
3313
|
+
this.wire.sendAction('wrap-application-sync').catch((e) => {
|
|
3314
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3315
|
+
});
|
|
3316
|
+
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
3317
|
+
if (errorMsg) {
|
|
3318
|
+
throw new Error(errorMsg);
|
|
3319
|
+
}
|
|
3320
|
+
return new Instance_1.Application(this.wire, identity);
|
|
3321
|
+
}
|
|
3322
|
+
async _create(appOptions) {
|
|
3323
|
+
// set defaults:
|
|
3324
|
+
if (appOptions.waitForPageLoad === undefined) {
|
|
3325
|
+
appOptions.waitForPageLoad = false;
|
|
3326
|
+
}
|
|
3327
|
+
if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
|
|
3328
|
+
appOptions.autoShow = true;
|
|
3329
|
+
}
|
|
3330
|
+
await this.wire.sendAction('create-application', appOptions);
|
|
3331
|
+
return this.wrap({ uuid: appOptions.uuid });
|
|
3332
|
+
}
|
|
3333
|
+
/**
|
|
3334
|
+
* DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
|
|
3335
|
+
*
|
|
3336
|
+
* @example
|
|
3337
|
+
*
|
|
3338
|
+
* ```js
|
|
3339
|
+
* async function createApp() {
|
|
3340
|
+
* const app = await fin.Application.create({
|
|
3341
|
+
* name: 'myApp',
|
|
3342
|
+
* uuid: 'app-3',
|
|
3343
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
|
|
3344
|
+
* autoShow: true
|
|
3345
|
+
* });
|
|
3346
|
+
* await app.run();
|
|
3347
|
+
* }
|
|
3348
|
+
*
|
|
3349
|
+
* createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
|
|
3350
|
+
* ```
|
|
3351
|
+
*
|
|
3352
|
+
* @ignore
|
|
3353
|
+
*/
|
|
3354
|
+
create(appOptions) {
|
|
3355
|
+
console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
|
|
3356
|
+
this.wire.sendAction('application-create').catch((e) => {
|
|
3357
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3358
|
+
});
|
|
3359
|
+
return this._create(appOptions);
|
|
3360
|
+
}
|
|
3361
|
+
/**
|
|
3362
|
+
* Creates and starts a new Application.
|
|
3363
|
+
*
|
|
3364
|
+
* @example
|
|
3365
|
+
*
|
|
3366
|
+
* ```js
|
|
3367
|
+
* async function start() {
|
|
3368
|
+
* return fin.Application.start({
|
|
3369
|
+
* name: 'app-1',
|
|
3370
|
+
* uuid: 'app-1',
|
|
3371
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
|
|
3372
|
+
* autoShow: true
|
|
3373
|
+
* });
|
|
3374
|
+
* }
|
|
3375
|
+
* start().then(() => console.log('Application is running')).catch(err => console.log(err));
|
|
3376
|
+
* ```
|
|
3377
|
+
*
|
|
3378
|
+
*/
|
|
3379
|
+
async start(appOptions) {
|
|
3380
|
+
this.wire.sendAction('start-application').catch((e) => {
|
|
3381
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3382
|
+
});
|
|
3383
|
+
const app = await this._create(appOptions);
|
|
3384
|
+
await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
|
|
3385
|
+
return app;
|
|
3386
|
+
}
|
|
3387
|
+
/**
|
|
3388
|
+
* Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
|
|
3389
|
+
* Returns once the RVM is finished attempting to launch the applications.
|
|
3390
|
+
* @param opts - Parameters that the RVM will use.
|
|
3391
|
+
*
|
|
3392
|
+
* @example
|
|
3393
|
+
*
|
|
3394
|
+
* ```js
|
|
3395
|
+
*
|
|
3396
|
+
* const applicationInfoArray = [
|
|
3397
|
+
* {
|
|
3398
|
+
* "uuid": 'App-1',
|
|
3399
|
+
* "manifestUrl": 'http://localhost:5555/app1.json',
|
|
3400
|
+
* },
|
|
3401
|
+
* {
|
|
3402
|
+
* "uuid": 'App-2',
|
|
3403
|
+
* "manifestUrl": 'http://localhost:5555/app2.json',
|
|
3404
|
+
* },
|
|
3405
|
+
* {
|
|
3406
|
+
* "uuid": 'App-3',
|
|
3407
|
+
* "manifestUrl": 'http://localhost:5555/app3.json',
|
|
3408
|
+
* }
|
|
3409
|
+
* ]
|
|
3410
|
+
*
|
|
3411
|
+
* fin.Application.startManyManifests(applicationInfoArray)
|
|
3412
|
+
* .then(() => {
|
|
3413
|
+
* console.log('RVM has finished launching the application list.');
|
|
3414
|
+
* })
|
|
3415
|
+
* .catch((err) => {
|
|
3416
|
+
* console.log(err);
|
|
3417
|
+
* })
|
|
3418
|
+
* ```
|
|
3419
|
+
*
|
|
3420
|
+
* @experimental
|
|
3421
|
+
*/
|
|
3422
|
+
async startManyManifests(applications, opts) {
|
|
3423
|
+
return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
|
|
3424
|
+
}
|
|
3425
|
+
/**
|
|
3426
|
+
* Asynchronously returns an Application object that represents the current application
|
|
3427
|
+
*
|
|
3428
|
+
* @example
|
|
3429
|
+
*
|
|
3430
|
+
* ```js
|
|
3431
|
+
* async function isCurrentAppRunning () {
|
|
3432
|
+
* const app = await fin.Application.getCurrent();
|
|
3433
|
+
* return app.isRunning();
|
|
3434
|
+
* }
|
|
3435
|
+
*
|
|
3436
|
+
* isCurrentAppRunning().then(running => {
|
|
3437
|
+
* console.log(`Current app is running: ${running}`);
|
|
3438
|
+
* }).catch(err => {
|
|
3439
|
+
* console.error(err);
|
|
3440
|
+
* });
|
|
3441
|
+
*
|
|
3442
|
+
* ```
|
|
3443
|
+
*/
|
|
3444
|
+
getCurrent() {
|
|
3445
|
+
this.wire.sendAction('get-current-application').catch((e) => {
|
|
3446
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3447
|
+
});
|
|
3448
|
+
return this.wrap({ uuid: this.wire.me.uuid });
|
|
3449
|
+
}
|
|
3450
|
+
/**
|
|
3451
|
+
* Synchronously returns an Application object that represents the current application
|
|
3452
|
+
*
|
|
3453
|
+
* @example
|
|
3454
|
+
*
|
|
3455
|
+
* ```js
|
|
3456
|
+
* async function isCurrentAppRunning () {
|
|
3457
|
+
* const app = fin.Application.getCurrentSync();
|
|
3458
|
+
* return app.isRunning();
|
|
3459
|
+
* }
|
|
3460
|
+
*
|
|
3461
|
+
* isCurrentAppRunning().then(running => {
|
|
3462
|
+
* console.log(`Current app is running: ${running}`);
|
|
3463
|
+
* }).catch(err => {
|
|
3464
|
+
* console.error(err);
|
|
3465
|
+
* });
|
|
3466
|
+
*
|
|
3467
|
+
* ```
|
|
3468
|
+
*/
|
|
3469
|
+
getCurrentSync() {
|
|
3470
|
+
this.wire.sendAction('get-current-application-sync').catch((e) => {
|
|
3471
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3472
|
+
});
|
|
3473
|
+
return this.wrapSync({ uuid: this.wire.me.uuid });
|
|
3474
|
+
}
|
|
3475
|
+
/**
|
|
3476
|
+
* Retrieves application's manifest and returns a running instance of the application.
|
|
3477
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
3478
|
+
* @param opts - Parameters that the RVM will use.
|
|
3479
|
+
*
|
|
3480
|
+
* @example
|
|
3481
|
+
*
|
|
3482
|
+
* ```js
|
|
3483
|
+
* fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
3484
|
+
*
|
|
3485
|
+
* // For a local manifest file:
|
|
3486
|
+
* fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
|
|
3487
|
+
* ```
|
|
3488
|
+
*/
|
|
3489
|
+
async startFromManifest(manifestUrl, opts) {
|
|
3490
|
+
this.wire.sendAction('application-start-from-manifest').catch((e) => {
|
|
3491
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3492
|
+
});
|
|
3493
|
+
const app = await this._createFromManifest(manifestUrl);
|
|
3494
|
+
// @ts-expect-error using private method without warning.
|
|
3495
|
+
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
3496
|
+
return app;
|
|
3497
|
+
}
|
|
3498
|
+
/**
|
|
3499
|
+
* @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
|
|
3500
|
+
* Retrieves application's manifest and returns a wrapped application.
|
|
3501
|
+
* @param manifestUrl - The URL of app's manifest.
|
|
3502
|
+
* @param callback - called if the method succeeds.
|
|
3503
|
+
* @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
|
|
3504
|
+
*
|
|
3505
|
+
* @example
|
|
3506
|
+
*
|
|
3507
|
+
* ```js
|
|
3508
|
+
* fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
|
|
3509
|
+
* ```
|
|
3510
|
+
* @ignore
|
|
3511
|
+
*/
|
|
3512
|
+
createFromManifest(manifestUrl) {
|
|
3513
|
+
console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
|
|
3514
|
+
this.wire.sendAction('application-create-from-manifest').catch((e) => {
|
|
3515
|
+
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
3516
|
+
});
|
|
3517
|
+
return this._createFromManifest(manifestUrl);
|
|
3518
|
+
}
|
|
3519
|
+
_createFromManifest(manifestUrl) {
|
|
3520
|
+
return this.wire
|
|
3521
|
+
.sendAction('get-application-manifest', { manifestUrl })
|
|
3522
|
+
.then(({ payload }) => {
|
|
3523
|
+
const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
|
|
3524
|
+
return this.wrap({ uuid });
|
|
3525
|
+
})
|
|
3526
|
+
.then((app) => {
|
|
3527
|
+
app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
|
|
3528
|
+
return app;
|
|
3529
|
+
});
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
Factory$7.ApplicationModule = ApplicationModule;
|
|
3533
|
+
return Factory$7;
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
var hasRequiredApplication;
|
|
3537
|
+
|
|
3538
|
+
function requireApplication () {
|
|
3539
|
+
if (hasRequiredApplication) return application;
|
|
3540
|
+
hasRequiredApplication = 1;
|
|
3541
|
+
(function (exports) {
|
|
3542
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3543
|
+
if (k2 === undefined) k2 = k;
|
|
3544
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3545
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3546
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
3547
|
+
}
|
|
3548
|
+
Object.defineProperty(o, k2, desc);
|
|
3549
|
+
}) : (function(o, m, k, k2) {
|
|
3550
|
+
if (k2 === undefined) k2 = k;
|
|
3551
|
+
o[k2] = m[k];
|
|
3552
|
+
}));
|
|
3553
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
3554
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3555
|
+
};
|
|
3556
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3557
|
+
/**
|
|
3558
|
+
* Entry points for the OpenFin `Application` API (`fin.Application`).
|
|
3559
|
+
*
|
|
3560
|
+
* * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
|
|
3561
|
+
* * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
|
|
3562
|
+
*
|
|
3563
|
+
* 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),
|
|
3564
|
+
* both of these were documented on the same page.
|
|
3565
|
+
*
|
|
3566
|
+
* @packageDocumentation
|
|
3567
|
+
*/
|
|
3568
|
+
__exportStar(requireFactory$1(), exports);
|
|
3569
|
+
__exportStar(requireInstance$1(), exports);
|
|
3570
|
+
} (application));
|
|
3571
|
+
return application;
|
|
3572
|
+
}
|
|
3552
3573
|
|
|
3553
3574
|
var promisifySubscription$1 = {};
|
|
3554
3575
|
|
|
@@ -3592,7 +3613,7 @@ function requireInstance () {
|
|
|
3592
3613
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3593
3614
|
/* eslint-disable no-console */
|
|
3594
3615
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
3595
|
-
const application_1 =
|
|
3616
|
+
const application_1 = requireApplication();
|
|
3596
3617
|
const main_1 = main;
|
|
3597
3618
|
const view_1 = requireView();
|
|
3598
3619
|
const warnings_1 = warnings;
|
|
@@ -4870,6 +4891,38 @@ function requireInstance () {
|
|
|
4870
4891
|
return undefined;
|
|
4871
4892
|
}
|
|
4872
4893
|
}
|
|
4894
|
+
/**
|
|
4895
|
+
* Displays the download bubble UI. If an anchor is provided, the bubble
|
|
4896
|
+
* will be positioned according to the specified rectangle and anchor point.
|
|
4897
|
+
*
|
|
4898
|
+
* @param {OpenFin.Anchor} options
|
|
4899
|
+
* Anchor configuration used to position the download bubble. This includes
|
|
4900
|
+
* the bounding rectangle and the anchor location within that rectangle.
|
|
4901
|
+
*
|
|
4902
|
+
* @returns {Promise<void>}
|
|
4903
|
+
* A promise that resolves once the request to show the download bubble
|
|
4904
|
+
* has been processed.
|
|
4905
|
+
*/
|
|
4906
|
+
async showDownloadBubble(options) {
|
|
4907
|
+
return this.wire.sendAction('show-download-bubble', { ...this.identity, options }).then(() => undefined);
|
|
4908
|
+
}
|
|
4909
|
+
/**
|
|
4910
|
+
* Updates the anchor used for positioning the download bubble. This allows
|
|
4911
|
+
* moving the bubble reactively—for example, in response to window resizes,
|
|
4912
|
+
* layout changes, or DOM element repositioning.
|
|
4913
|
+
*
|
|
4914
|
+
* @param {OpenFin.Anchor} options
|
|
4915
|
+
* New anchor configuration describing the updated position and anchor
|
|
4916
|
+
* location for the download bubble.
|
|
4917
|
+
*
|
|
4918
|
+
* @returns {Promise<void>}
|
|
4919
|
+
* A promise that resolves once the anchor update has been applied.
|
|
4920
|
+
*/
|
|
4921
|
+
async updateDownloadBubbleAnchor(options) {
|
|
4922
|
+
return this.wire
|
|
4923
|
+
.sendAction('update-download-bubble-anchor', { ...this.identity, options })
|
|
4924
|
+
.then(() => undefined);
|
|
4925
|
+
}
|
|
4873
4926
|
}
|
|
4874
4927
|
Instance$7._Window = _Window;
|
|
4875
4928
|
return Instance$7;
|
|
@@ -5955,14 +6008,15 @@ class System extends base_1$m.EmitterBase {
|
|
|
5955
6008
|
* Writes the passed message into both the log file and the console.
|
|
5956
6009
|
* @param level The log level for the entry. Can be either "info", "warning" or "error"
|
|
5957
6010
|
* @param message The log message text
|
|
6011
|
+
* @param target.type Optional. The the log stream this message will be sent to, defaults to 'debug.log'. Specify 'app.log' to log to the app log of the sending View / Window. Note, when using `app.log`, it will always log to app.log irrespective of the `enableAppLogging` setting for the sender. This is particularly useful if you wish to log certain things from a View / Window but ignore generic console logs.
|
|
5958
6012
|
*
|
|
5959
6013
|
* @example
|
|
5960
6014
|
* ```js
|
|
5961
|
-
* fin.System.log("info", "An example log message").then(() => console.log('Log info message')).catch(err => console.log(err));
|
|
6015
|
+
* fin.System.log("info", "An example log message", { type: 'debug.log' }).then(() => console.log('Log info message')).catch(err => console.log(err));
|
|
5962
6016
|
* ```
|
|
5963
6017
|
*/
|
|
5964
|
-
log(level, message) {
|
|
5965
|
-
return this.wire.sendAction('write-to-log', { level, message }).then(() => undefined);
|
|
6018
|
+
log(level, message, { type = 'debug.log' } = {}) {
|
|
6019
|
+
return this.wire.sendAction('write-to-log', { level, message, target: { type } }).then(() => undefined);
|
|
5966
6020
|
}
|
|
5967
6021
|
/**
|
|
5968
6022
|
* Opens the passed URL in the default web browser.
|
|
@@ -6978,6 +7032,88 @@ class System extends base_1$m.EmitterBase {
|
|
|
6978
7032
|
async serveAsset(options) {
|
|
6979
7033
|
return (await this.wire.sendAction('serve-asset', { options })).payload.data;
|
|
6980
7034
|
}
|
|
7035
|
+
/**
|
|
7036
|
+
* Get's the native theme preferences for the current runtime.
|
|
7037
|
+
* Prefer css media-queries wherever possible, but this can be useful to see if the system setting has been overridden.
|
|
7038
|
+
* See @link OpenFin.NativeTheme for more information.
|
|
7039
|
+
* @example Theme selector menu
|
|
7040
|
+
* ```ts
|
|
7041
|
+
async function handleThemeMenu(e: React.MouseEvent<HTMLDivElement>) {
|
|
7042
|
+
const currentTheme = await fin.System.getThemePreferences();
|
|
7043
|
+
const result = await (fin.me as OpenFin.Window).showPopupMenu({
|
|
7044
|
+
x: e.clientX,
|
|
7045
|
+
y: e.clientY,
|
|
7046
|
+
template: [
|
|
7047
|
+
{
|
|
7048
|
+
label: 'Light',
|
|
7049
|
+
type: 'checkbox',
|
|
7050
|
+
checked: currentTheme.themeSource === 'light',
|
|
7051
|
+
data: { themeSource: 'light' } as const
|
|
7052
|
+
},
|
|
7053
|
+
{
|
|
7054
|
+
label: 'Dark',
|
|
7055
|
+
type: 'checkbox',
|
|
7056
|
+
checked: currentTheme.themeSource === 'dark',
|
|
7057
|
+
data: { themeSource: 'dark' } as const
|
|
7058
|
+
},
|
|
7059
|
+
{
|
|
7060
|
+
label: 'System',
|
|
7061
|
+
type: 'checkbox',
|
|
7062
|
+
checked: currentTheme.themeSource === 'system',
|
|
7063
|
+
data: { themeSource: 'system' } as const
|
|
7064
|
+
}
|
|
7065
|
+
]
|
|
7066
|
+
});
|
|
7067
|
+
if (result.result === 'clicked') {
|
|
7068
|
+
await fin.System.setThemePreferences(result.data);
|
|
7069
|
+
}
|
|
7070
|
+
}
|
|
7071
|
+
```
|
|
7072
|
+
*/
|
|
7073
|
+
async getThemePreferences() {
|
|
7074
|
+
return (await this.wire.sendAction('get-theme-preferences')).payload.data;
|
|
7075
|
+
}
|
|
7076
|
+
/**
|
|
7077
|
+
* Sets the native theme preferences for the current runtime.
|
|
7078
|
+
* Can be used to force runtime-wide light or dark mode.
|
|
7079
|
+
* @important Due to this impacting all applications on a runtime, this method is only usable if a security realm has been set.
|
|
7080
|
+
* @example Theme selector menu
|
|
7081
|
+
* ```ts
|
|
7082
|
+
async function handleThemeMenu(e: React.MouseEvent<HTMLDivElement>) {
|
|
7083
|
+
const currentTheme = await fin.System.getThemePreferences();
|
|
7084
|
+
const result = await (fin.me as OpenFin.Window).showPopupMenu({
|
|
7085
|
+
x: e.clientX,
|
|
7086
|
+
y: e.clientY,
|
|
7087
|
+
template: [
|
|
7088
|
+
{
|
|
7089
|
+
label: 'Light',
|
|
7090
|
+
type: 'checkbox',
|
|
7091
|
+
checked: currentTheme.themeSource === 'light',
|
|
7092
|
+
data: { themeSource: 'light' } as const
|
|
7093
|
+
},
|
|
7094
|
+
{
|
|
7095
|
+
label: 'Dark',
|
|
7096
|
+
type: 'checkbox',
|
|
7097
|
+
checked: currentTheme.themeSource === 'dark',
|
|
7098
|
+
data: { themeSource: 'dark' } as const
|
|
7099
|
+
},
|
|
7100
|
+
{
|
|
7101
|
+
label: 'System',
|
|
7102
|
+
type: 'checkbox',
|
|
7103
|
+
checked: currentTheme.themeSource === 'system',
|
|
7104
|
+
data: { themeSource: 'system' } as const
|
|
7105
|
+
}
|
|
7106
|
+
]
|
|
7107
|
+
});
|
|
7108
|
+
if (result.result === 'clicked') {
|
|
7109
|
+
await fin.System.setThemePreferences(result.data);
|
|
7110
|
+
}
|
|
7111
|
+
}
|
|
7112
|
+
```
|
|
7113
|
+
*/
|
|
7114
|
+
async setThemePreferences(preferences) {
|
|
7115
|
+
return (await this.wire.sendAction('set-theme-preferences', { preferences })).payload.data;
|
|
7116
|
+
}
|
|
6981
7117
|
/**
|
|
6982
7118
|
* Launches the Log Uploader. Full documentation can be found [here](https://resources.here.io/docs/core/develop/debug/log-uploader/).
|
|
6983
7119
|
* @experimental
|
|
@@ -6985,6 +7121,21 @@ class System extends base_1$m.EmitterBase {
|
|
|
6985
7121
|
async launchLogUploader(options) {
|
|
6986
7122
|
return (await this.wire.sendAction('launch-log-uploader', { options })).payload.data;
|
|
6987
7123
|
}
|
|
7124
|
+
/**
|
|
7125
|
+
* Overrides original Chromium theme color providers matching key (currently except high contrast ones). Only colors passed in the map will be overridden.
|
|
7126
|
+
* @param overrides - Array of ColorProviderOverrides objects
|
|
7127
|
+
*/
|
|
7128
|
+
async setThemePalette(themePalette) {
|
|
7129
|
+
return (await this.wire.sendAction('set-theme-palette', { themePalette })).payload.data;
|
|
7130
|
+
}
|
|
7131
|
+
/**
|
|
7132
|
+
* Retrieves currently used color overrides
|
|
7133
|
+
* @returns Array of ColorProviderOverrides objects
|
|
7134
|
+
*/
|
|
7135
|
+
async getThemePalette() {
|
|
7136
|
+
const { payload } = await this.wire.sendAction('get-theme-palette');
|
|
7137
|
+
return payload.data;
|
|
7138
|
+
}
|
|
6988
7139
|
}
|
|
6989
7140
|
system.System = System;
|
|
6990
7141
|
|
|
@@ -11379,7 +11530,7 @@ class LayoutNode {
|
|
|
11379
11530
|
* Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
|
|
11380
11531
|
* during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
11381
11532
|
* This means the views you pass to createAdjacentStack() may not render in the order given by the array.
|
|
11382
|
-
*
|
|
11533
|
+
* Note: This issue does not occur when using `tabOverflowBehavior: 'scroll'` in the layout configuration.
|
|
11383
11534
|
*
|
|
11384
11535
|
* @param views The views that will populate the new TabStack.
|
|
11385
11536
|
* @param options Additional options that control new TabStack creation.
|
|
@@ -11515,6 +11666,7 @@ class TabStack extends LayoutNode {
|
|
|
11515
11666
|
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
11516
11667
|
* If that happens and then getViews() is called, it will return the identities in a different order than
|
|
11517
11668
|
* than the currently rendered tab order.
|
|
11669
|
+
* Note: This issue does not occur when using `tabOverflowBehavior: 'scroll'` in the layout configuration.
|
|
11518
11670
|
*
|
|
11519
11671
|
*
|
|
11520
11672
|
* @throws If the {@link TabStack} has been destroyed.
|
|
@@ -11539,6 +11691,7 @@ class TabStack extends LayoutNode {
|
|
|
11539
11691
|
*
|
|
11540
11692
|
* @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active
|
|
11541
11693
|
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
11694
|
+
* Note: This issue does not occur when using `tabOverflowBehavior: 'scroll'` in the layout configuration.
|
|
11542
11695
|
*
|
|
11543
11696
|
* @param view The identity of an existing view to add, or options to create a view.
|
|
11544
11697
|
* @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
|
|
@@ -17189,7 +17342,7 @@ const events_1$3 = require$$0;
|
|
|
17189
17342
|
// Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
|
|
17190
17343
|
const index_1 = system;
|
|
17191
17344
|
const index_2 = requireWindow();
|
|
17192
|
-
const index_3 =
|
|
17345
|
+
const index_3 = requireApplication();
|
|
17193
17346
|
const index_4 = interappbus;
|
|
17194
17347
|
const index_5 = clipboard;
|
|
17195
17348
|
const index_6 = externalApplication;
|
|
@@ -18003,7 +18156,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
|
|
|
18003
18156
|
};
|
|
18004
18157
|
}
|
|
18005
18158
|
getAdapterVersionSync() {
|
|
18006
|
-
return "43.100.
|
|
18159
|
+
return "43.100.105";
|
|
18007
18160
|
}
|
|
18008
18161
|
observeBounds(element, onChange) {
|
|
18009
18162
|
throw new Error('Method not implemented.');
|