@openfin/core 36.80.8 → 36.80.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/mock-alpha.d.ts +1 -1
- package/out/mock-beta.d.ts +1 -1
- package/out/mock-public.d.ts +1 -1
- package/out/mock.d.ts +0 -4
- package/out/mock.js +84 -71
- package/package.json +1 -1
package/out/mock-alpha.d.ts
CHANGED
@@ -17460,7 +17460,7 @@ declare type WillResizeEvent = WillMoveOrResizeEvent & {
|
|
17460
17460
|
*/
|
17461
17461
|
declare class _Window extends WebContents<OpenFin_2.WindowEvent> {
|
17462
17462
|
/* Excluded from this release type: __constructor */
|
17463
|
-
|
17463
|
+
createWindow(options: OpenFin_2.WindowCreationOptions): Promise<OpenFin_2.Window>;
|
17464
17464
|
/**
|
17465
17465
|
* Retrieves an array of frame info objects representing the main frame and any
|
17466
17466
|
* iframes that are currently on the page.
|
package/out/mock-beta.d.ts
CHANGED
@@ -17460,7 +17460,7 @@ declare type WillResizeEvent = WillMoveOrResizeEvent & {
|
|
17460
17460
|
*/
|
17461
17461
|
declare class _Window extends WebContents<OpenFin_2.WindowEvent> {
|
17462
17462
|
/* Excluded from this release type: __constructor */
|
17463
|
-
|
17463
|
+
createWindow(options: OpenFin_2.WindowCreationOptions): Promise<OpenFin_2.Window>;
|
17464
17464
|
/**
|
17465
17465
|
* Retrieves an array of frame info objects representing the main frame and any
|
17466
17466
|
* iframes that are currently on the page.
|
package/out/mock-public.d.ts
CHANGED
@@ -17460,7 +17460,7 @@ declare type WillResizeEvent = WillMoveOrResizeEvent & {
|
|
17460
17460
|
*/
|
17461
17461
|
declare class _Window extends WebContents<OpenFin_2.WindowEvent> {
|
17462
17462
|
/* Excluded from this release type: __constructor */
|
17463
|
-
|
17463
|
+
createWindow(options: OpenFin_2.WindowCreationOptions): Promise<OpenFin_2.Window>;
|
17464
17464
|
/**
|
17465
17465
|
* Retrieves an array of frame info objects representing the main frame and any
|
17466
17466
|
* iframes that are currently on the page.
|
package/out/mock.d.ts
CHANGED
@@ -17902,10 +17902,6 @@ declare class _Window extends WebContents<OpenFin_2.WindowEvent> {
|
|
17902
17902
|
* @internal
|
17903
17903
|
*/
|
17904
17904
|
constructor(wire: Transport, identity: OpenFin_2.Identity);
|
17905
|
-
/**
|
17906
|
-
* create a new window
|
17907
|
-
* @internal
|
17908
|
-
*/
|
17909
17905
|
createWindow(options: OpenFin_2.WindowCreationOptions): Promise<OpenFin_2.Window>;
|
17910
17906
|
/**
|
17911
17907
|
* Retrieves an array of frame info objects representing the main frame and any
|
package/out/mock.js
CHANGED
@@ -4349,6 +4349,37 @@ function requireApplication () {
|
|
4349
4349
|
return application;
|
4350
4350
|
}
|
4351
4351
|
|
4352
|
+
var promisifySubscription$1 = {};
|
4353
|
+
|
4354
|
+
Object.defineProperty(promisifySubscription$1, "__esModule", { value: true });
|
4355
|
+
promisifySubscription$1.promisifySubscription = void 0;
|
4356
|
+
const promisifySubscription = async (emitter, eventName, predicate = () => true, timeout) => {
|
4357
|
+
let resolve;
|
4358
|
+
let reject;
|
4359
|
+
let timer;
|
4360
|
+
const valuePromise = new Promise((y, n) => {
|
4361
|
+
resolve = y;
|
4362
|
+
reject = n;
|
4363
|
+
});
|
4364
|
+
const listener = (e) => {
|
4365
|
+
if (predicate(e)) {
|
4366
|
+
clearTimeout(timer);
|
4367
|
+
resolve(e);
|
4368
|
+
}
|
4369
|
+
};
|
4370
|
+
await emitter.on(eventName, listener);
|
4371
|
+
if (timeout) {
|
4372
|
+
timer = setTimeout(() => reject(new Error('event timed out')), timeout);
|
4373
|
+
}
|
4374
|
+
valuePromise.finally(() => {
|
4375
|
+
emitter.removeListener(eventName, listener).catch(() => null);
|
4376
|
+
});
|
4377
|
+
return {
|
4378
|
+
getValue: () => valuePromise
|
4379
|
+
};
|
4380
|
+
};
|
4381
|
+
promisifySubscription$1.promisifySubscription = promisifySubscription;
|
4382
|
+
|
4352
4383
|
var hasRequiredInstance;
|
4353
4384
|
|
4354
4385
|
function requireInstance () {
|
@@ -4364,6 +4395,7 @@ function requireInstance () {
|
|
4364
4395
|
const main_1 = main;
|
4365
4396
|
const view_1 = requireView();
|
4366
4397
|
const warnings_1 = warnings;
|
4398
|
+
const promisifySubscription_1 = promisifySubscription$1;
|
4367
4399
|
/**
|
4368
4400
|
* A basic window that wraps a native HTML window. Provides more fine-grained
|
4369
4401
|
* control over the window state such as the ability to minimize, maximize, restore, etc.
|
@@ -4379,79 +4411,60 @@ function requireInstance () {
|
|
4379
4411
|
constructor(wire, identity) {
|
4380
4412
|
super(wire, identity, 'window');
|
4381
4413
|
}
|
4382
|
-
|
4383
|
-
* create a new window
|
4384
|
-
* @internal
|
4385
|
-
*/
|
4386
|
-
createWindow(options) {
|
4414
|
+
async createWindow(options) {
|
4387
4415
|
this.wire.sendAction('window-create-window', this.identity).catch((e) => {
|
4388
4416
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
4389
4417
|
});
|
4390
|
-
|
4391
|
-
|
4392
|
-
|
4393
|
-
|
4394
|
-
|
4395
|
-
|
4396
|
-
|
4397
|
-
|
4398
|
-
|
4399
|
-
|
4400
|
-
|
4401
|
-
|
4402
|
-
|
4403
|
-
|
4404
|
-
|
4405
|
-
|
4406
|
-
|
4407
|
-
|
4408
|
-
|
4409
|
-
|
4410
|
-
|
4411
|
-
|
4412
|
-
|
4413
|
-
|
4414
|
-
|
4415
|
-
|
4416
|
-
|
4417
|
-
|
4418
|
-
|
4419
|
-
|
4420
|
-
|
4421
|
-
|
4422
|
-
|
4423
|
-
|
4424
|
-
|
4425
|
-
|
4426
|
-
|
4427
|
-
|
4428
|
-
|
4429
|
-
|
4430
|
-
|
4431
|
-
|
4432
|
-
|
4433
|
-
|
4434
|
-
|
4435
|
-
|
4436
|
-
|
4437
|
-
|
4438
|
-
|
4439
|
-
|
4440
|
-
try {
|
4441
|
-
// this is to enforce a 5.0 contract that the child's main function
|
4442
|
-
// will not fire before the parent's success callback on creation.
|
4443
|
-
// if the child window is not accessible (CORS) this contract does
|
4444
|
-
// not hold.
|
4445
|
-
const webWindow = this.getWebWindow();
|
4446
|
-
webWindow.fin.__internal_.openerSuccessCBCalled();
|
4447
|
-
}
|
4448
|
-
catch (e) {
|
4449
|
-
// common for main windows, we do not want to expose this error. here just to have a debug target.
|
4450
|
-
// console.error(e);
|
4451
|
-
}
|
4452
|
-
})
|
4453
|
-
.catch(reject);
|
4454
|
-
});
|
4418
|
+
const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
|
4419
|
+
const responseSubscription = await (0, promisifySubscription_1.promisifySubscription)(this, CONSTRUCTOR_CB_TOPIC);
|
4420
|
+
// set defaults:
|
4421
|
+
if (options.waitForPageLoad === undefined) {
|
4422
|
+
options.waitForPageLoad = false;
|
4423
|
+
}
|
4424
|
+
if (options.autoShow === undefined) {
|
4425
|
+
options.autoShow = true;
|
4426
|
+
}
|
4427
|
+
(0, warnings_1.handleDeprecatedWarnings)(options);
|
4428
|
+
const windowCreation = this.wire.environment.createChildContent({ entityType: 'window', options });
|
4429
|
+
const [response] = await Promise.all([responseSubscription.getValue(), windowCreation]);
|
4430
|
+
let cbPayload;
|
4431
|
+
const { success } = response;
|
4432
|
+
const responseData = response.data;
|
4433
|
+
const { message } = responseData;
|
4434
|
+
if (success) {
|
4435
|
+
cbPayload = {
|
4436
|
+
httpResponseCode: responseData.httpResponseCode,
|
4437
|
+
apiInjected: responseData.apiInjected
|
4438
|
+
};
|
4439
|
+
}
|
4440
|
+
else {
|
4441
|
+
cbPayload = {
|
4442
|
+
message: responseData.message,
|
4443
|
+
networkErrorCode: responseData.networkErrorCode,
|
4444
|
+
stack: responseData.stack
|
4445
|
+
};
|
4446
|
+
}
|
4447
|
+
const pageResolve = {
|
4448
|
+
message,
|
4449
|
+
cbPayload,
|
4450
|
+
success
|
4451
|
+
};
|
4452
|
+
try {
|
4453
|
+
// this is to enforce a 5.0 contract that the child's main function
|
4454
|
+
// will not fire before the parent's success callback on creation.
|
4455
|
+
// if the child window is not accessible (CORS) this contract does
|
4456
|
+
// not hold.
|
4457
|
+
const webWindow = this.getWebWindow();
|
4458
|
+
webWindow.fin.__internal_.openerSuccessCBCalled();
|
4459
|
+
}
|
4460
|
+
catch (e) {
|
4461
|
+
// common for main windows, we do not want to expose this error. here just to have a debug target.
|
4462
|
+
// console.error(e);
|
4463
|
+
}
|
4464
|
+
if (pageResolve.success) {
|
4465
|
+
return this;
|
4466
|
+
}
|
4467
|
+
return Promise.reject(pageResolve);
|
4455
4468
|
}
|
4456
4469
|
/**
|
4457
4470
|
* Retrieves an array of frame info objects representing the main frame and any
|
@@ -16037,7 +16050,7 @@ class MockEnvironment {
|
|
16037
16050
|
throw new Error(me_1.environmentUnsupportedMessage);
|
16038
16051
|
}
|
16039
16052
|
getNextMessageId() {
|
16040
|
-
|
16053
|
+
return `mock-message-id-${Math.random()}`;
|
16041
16054
|
}
|
16042
16055
|
getRandomId() {
|
16043
16056
|
throw new Error(me_1.environmentUnsupportedMessage);
|