@openfin/node-adapter 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.
@@ -17470,7 +17470,7 @@ declare type WillResizeEvent = WillMoveOrResizeEvent & {
|
|
17470
17470
|
*/
|
17471
17471
|
declare class _Window extends WebContents<OpenFin.WindowEvent> {
|
17472
17472
|
/* Excluded from this release type: __constructor */
|
17473
|
-
|
17473
|
+
createWindow(options: OpenFin.WindowCreationOptions): Promise<OpenFin.Window>;
|
17474
17474
|
/**
|
17475
17475
|
* Retrieves an array of frame info objects representing the main frame and any
|
17476
17476
|
* iframes that are currently on the page.
|
@@ -17470,7 +17470,7 @@ declare type WillResizeEvent = WillMoveOrResizeEvent & {
|
|
17470
17470
|
*/
|
17471
17471
|
declare class _Window extends WebContents<OpenFin.WindowEvent> {
|
17472
17472
|
/* Excluded from this release type: __constructor */
|
17473
|
-
|
17473
|
+
createWindow(options: OpenFin.WindowCreationOptions): Promise<OpenFin.Window>;
|
17474
17474
|
/**
|
17475
17475
|
* Retrieves an array of frame info objects representing the main frame and any
|
17476
17476
|
* iframes that are currently on the page.
|
@@ -17470,7 +17470,7 @@ declare type WillResizeEvent = WillMoveOrResizeEvent & {
|
|
17470
17470
|
*/
|
17471
17471
|
declare class _Window extends WebContents<OpenFin.WindowEvent> {
|
17472
17472
|
/* Excluded from this release type: __constructor */
|
17473
|
-
|
17473
|
+
createWindow(options: OpenFin.WindowCreationOptions): Promise<OpenFin.Window>;
|
17474
17474
|
/**
|
17475
17475
|
* Retrieves an array of frame info objects representing the main frame and any
|
17476
17476
|
* iframes that are currently on the page.
|
package/out/node-adapter.d.ts
CHANGED
@@ -17934,10 +17934,6 @@ declare class _Window extends WebContents<OpenFin.WindowEvent> {
|
|
17934
17934
|
* @internal
|
17935
17935
|
*/
|
17936
17936
|
constructor(wire: Transport, identity: OpenFin.Identity);
|
17937
|
-
/**
|
17938
|
-
* create a new window
|
17939
|
-
* @internal
|
17940
|
-
*/
|
17941
17937
|
createWindow(options: OpenFin.WindowCreationOptions): Promise<OpenFin.Window>;
|
17942
17938
|
/**
|
17943
17939
|
* Retrieves an array of frame info objects representing the main frame and any
|
package/out/node-adapter.js
CHANGED
@@ -4122,6 +4122,37 @@ function requireApplication () {
|
|
4122
4122
|
return application$1;
|
4123
4123
|
}
|
4124
4124
|
|
4125
|
+
var promisifySubscription$1 = {};
|
4126
|
+
|
4127
|
+
Object.defineProperty(promisifySubscription$1, "__esModule", { value: true });
|
4128
|
+
promisifySubscription$1.promisifySubscription = void 0;
|
4129
|
+
const promisifySubscription = async (emitter, eventName, predicate = () => true, timeout) => {
|
4130
|
+
let resolve;
|
4131
|
+
let reject;
|
4132
|
+
let timer;
|
4133
|
+
const valuePromise = new Promise((y, n) => {
|
4134
|
+
resolve = y;
|
4135
|
+
reject = n;
|
4136
|
+
});
|
4137
|
+
const listener = (e) => {
|
4138
|
+
if (predicate(e)) {
|
4139
|
+
clearTimeout(timer);
|
4140
|
+
resolve(e);
|
4141
|
+
}
|
4142
|
+
};
|
4143
|
+
await emitter.on(eventName, listener);
|
4144
|
+
if (timeout) {
|
4145
|
+
timer = setTimeout(() => reject(new Error('event timed out')), timeout);
|
4146
|
+
}
|
4147
|
+
valuePromise.finally(() => {
|
4148
|
+
emitter.removeListener(eventName, listener).catch(() => null);
|
4149
|
+
});
|
4150
|
+
return {
|
4151
|
+
getValue: () => valuePromise
|
4152
|
+
};
|
4153
|
+
};
|
4154
|
+
promisifySubscription$1.promisifySubscription = promisifySubscription;
|
4155
|
+
|
4125
4156
|
var hasRequiredInstance;
|
4126
4157
|
|
4127
4158
|
function requireInstance () {
|
@@ -4137,6 +4168,7 @@ function requireInstance () {
|
|
4137
4168
|
const main_1 = main;
|
4138
4169
|
const view_1 = requireView();
|
4139
4170
|
const warnings_1 = warnings;
|
4171
|
+
const promisifySubscription_1 = promisifySubscription$1;
|
4140
4172
|
/**
|
4141
4173
|
* A basic window that wraps a native HTML window. Provides more fine-grained
|
4142
4174
|
* control over the window state such as the ability to minimize, maximize, restore, etc.
|
@@ -4152,79 +4184,60 @@ function requireInstance () {
|
|
4152
4184
|
constructor(wire, identity) {
|
4153
4185
|
super(wire, identity, 'window');
|
4154
4186
|
}
|
4155
|
-
|
4156
|
-
* create a new window
|
4157
|
-
* @internal
|
4158
|
-
*/
|
4159
|
-
createWindow(options) {
|
4187
|
+
async createWindow(options) {
|
4160
4188
|
this.wire.sendAction('window-create-window', this.identity).catch((e) => {
|
4161
4189
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
4162
4190
|
});
|
4163
|
-
|
4164
|
-
|
4165
|
-
|
4166
|
-
|
4167
|
-
|
4168
|
-
|
4169
|
-
|
4170
|
-
|
4171
|
-
|
4172
|
-
|
4173
|
-
|
4174
|
-
|
4175
|
-
|
4176
|
-
|
4177
|
-
|
4178
|
-
|
4179
|
-
|
4180
|
-
|
4181
|
-
|
4182
|
-
|
4183
|
-
|
4184
|
-
|
4185
|
-
|
4186
|
-
|
4187
|
-
|
4188
|
-
|
4189
|
-
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
4193
|
-
|
4194
|
-
|
4195
|
-
|
4196
|
-
|
4197
|
-
|
4198
|
-
|
4199
|
-
|
4200
|
-
|
4201
|
-
|
4202
|
-
|
4203
|
-
|
4204
|
-
|
4205
|
-
|
4206
|
-
|
4207
|
-
|
4208
|
-
|
4209
|
-
|
4210
|
-
|
4211
|
-
|
4212
|
-
|
4213
|
-
try {
|
4214
|
-
// this is to enforce a 5.0 contract that the child's main function
|
4215
|
-
// will not fire before the parent's success callback on creation.
|
4216
|
-
// if the child window is not accessible (CORS) this contract does
|
4217
|
-
// not hold.
|
4218
|
-
const webWindow = this.getWebWindow();
|
4219
|
-
webWindow.fin.__internal_.openerSuccessCBCalled();
|
4220
|
-
}
|
4221
|
-
catch (e) {
|
4222
|
-
// common for main windows, we do not want to expose this error. here just to have a debug target.
|
4223
|
-
// console.error(e);
|
4224
|
-
}
|
4225
|
-
})
|
4226
|
-
.catch(reject);
|
4227
|
-
});
|
4191
|
+
const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
|
4192
|
+
const responseSubscription = await (0, promisifySubscription_1.promisifySubscription)(this, CONSTRUCTOR_CB_TOPIC);
|
4193
|
+
// set defaults:
|
4194
|
+
if (options.waitForPageLoad === undefined) {
|
4195
|
+
options.waitForPageLoad = false;
|
4196
|
+
}
|
4197
|
+
if (options.autoShow === undefined) {
|
4198
|
+
options.autoShow = true;
|
4199
|
+
}
|
4200
|
+
(0, warnings_1.handleDeprecatedWarnings)(options);
|
4201
|
+
const windowCreation = this.wire.environment.createChildContent({ entityType: 'window', options });
|
4202
|
+
const [response] = await Promise.all([responseSubscription.getValue(), windowCreation]);
|
4203
|
+
let cbPayload;
|
4204
|
+
const { success } = response;
|
4205
|
+
const responseData = response.data;
|
4206
|
+
const { message } = responseData;
|
4207
|
+
if (success) {
|
4208
|
+
cbPayload = {
|
4209
|
+
httpResponseCode: responseData.httpResponseCode,
|
4210
|
+
apiInjected: responseData.apiInjected
|
4211
|
+
};
|
4212
|
+
}
|
4213
|
+
else {
|
4214
|
+
cbPayload = {
|
4215
|
+
message: responseData.message,
|
4216
|
+
networkErrorCode: responseData.networkErrorCode,
|
4217
|
+
stack: responseData.stack
|
4218
|
+
};
|
4219
|
+
}
|
4220
|
+
const pageResolve = {
|
4221
|
+
message,
|
4222
|
+
cbPayload,
|
4223
|
+
success
|
4224
|
+
};
|
4225
|
+
try {
|
4226
|
+
// this is to enforce a 5.0 contract that the child's main function
|
4227
|
+
// will not fire before the parent's success callback on creation.
|
4228
|
+
// if the child window is not accessible (CORS) this contract does
|
4229
|
+
// not hold.
|
4230
|
+
const webWindow = this.getWebWindow();
|
4231
|
+
webWindow.fin.__internal_.openerSuccessCBCalled();
|
4232
|
+
}
|
4233
|
+
catch (e) {
|
4234
|
+
// common for main windows, we do not want to expose this error. here just to have a debug target.
|
4235
|
+
// console.error(e);
|
4236
|
+
}
|
4237
|
+
if (pageResolve.success) {
|
4238
|
+
return this;
|
4239
|
+
}
|
4240
|
+
return Promise.reject(pageResolve);
|
4228
4241
|
}
|
4229
4242
|
/**
|
4230
4243
|
* Retrieves an array of frame info objects representing the main frame and any
|