@openfin/core 33.76.31 → 33.76.36
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/openfin-core-33.76.36.tgz +0 -0
- package/package.json +1 -1
- package/src/OpenFin.d.ts +27 -16
- package/src/api/application/Factory.d.ts +148 -100
- package/src/api/application/Factory.js +148 -100
- package/src/api/application/Instance.d.ts +477 -106
- package/src/api/application/Instance.js +474 -106
- package/src/api/application/index.d.ts +9 -0
- package/src/api/application/index.js +9 -0
- package/src/api/base.d.ts +69 -0
- package/src/api/base.js +69 -0
- package/src/api/clipboard/index.d.ts +111 -31
- package/src/api/clipboard/index.js +111 -31
- package/src/api/events/application.d.ts +12 -0
- package/src/api/events/application.js +12 -0
- package/src/api/events/channel.d.ts +5 -0
- package/src/api/events/channel.js +5 -0
- package/src/api/events/externalApplication.d.ts +5 -0
- package/src/api/events/externalApplication.js +5 -0
- package/src/api/events/frame.d.ts +5 -0
- package/src/api/events/globalHotkey.d.ts +5 -0
- package/src/api/events/platform.d.ts +9 -1
- package/src/api/events/platform.js +8 -0
- package/src/api/events/system.d.ts +13 -0
- package/src/api/events/system.js +13 -0
- package/src/api/events/view.d.ts +19 -9
- package/src/api/events/view.js +10 -0
- package/src/api/events/webcontents.d.ts +21 -10
- package/src/api/events/webcontents.js +11 -0
- package/src/api/events/window.d.ts +70 -1
- package/src/api/events/window.js +10 -0
- package/src/api/external-application/Factory.d.ts +16 -9
- package/src/api/external-application/Factory.js +16 -9
- package/src/api/external-application/Instance.d.ts +40 -32
- package/src/api/external-application/Instance.js +40 -32
- package/src/api/external-application/index.d.ts +9 -0
- package/src/api/external-application/index.js +9 -0
- package/src/api/fin.d.ts +3 -0
- package/src/api/fin.js +3 -0
- package/src/api/frame/Factory.d.ts +30 -13
- package/src/api/frame/Factory.js +30 -13
- package/src/api/frame/Instance.d.ts +51 -38
- package/src/api/frame/Instance.js +51 -38
- package/src/api/frame/index.d.ts +11 -0
- package/src/api/frame/index.js +11 -0
- package/src/api/global-hotkey/index.d.ts +81 -13
- package/src/api/global-hotkey/index.js +81 -13
- package/src/api/interappbus/channel/channel.d.ts +257 -0
- package/src/api/interappbus/channel/channel.js +257 -0
- package/src/api/interappbus/channel/channels-docs.d.ts +59 -57
- package/src/api/interappbus/channel/channels-docs.js +71 -68
- package/src/api/interappbus/channel/client.d.ts +93 -0
- package/src/api/interappbus/channel/client.js +93 -1
- package/src/api/interappbus/channel/index.d.ts +164 -0
- package/src/api/interappbus/channel/index.js +165 -1
- package/src/api/interappbus/channel/provider.d.ts +172 -0
- package/src/api/interappbus/channel/provider.js +172 -0
- package/src/api/interappbus/index.d.ts +55 -20
- package/src/api/interappbus/index.js +55 -20
- package/src/api/interop/Factory.d.ts +30 -10
- package/src/api/interop/Factory.js +30 -10
- package/src/api/interop/InteropBroker.d.ts +298 -70
- package/src/api/interop/InteropBroker.js +298 -70
- package/src/api/interop/InteropClient.d.ts +286 -62
- package/src/api/interop/InteropClient.js +286 -62
- package/src/api/interop/SessionContextGroupClient.d.ts +2 -2
- package/src/api/interop/SessionContextGroupClient.js +2 -2
- package/src/api/interop/fdc3/documentationStub.d.ts +14 -0
- package/src/api/interop/fdc3/documentationStub.js +17 -0
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +31 -34
- package/src/api/interop/fdc3/fdc3-1.2.js +31 -34
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +48 -51
- package/src/api/interop/fdc3/fdc3-2.0.js +48 -51
- package/src/api/interop/index.d.ts +8 -0
- package/src/api/interop/index.js +8 -0
- package/src/api/platform/Factory.d.ts +121 -65
- package/src/api/platform/Factory.js +122 -66
- package/src/api/platform/Instance.d.ts +551 -48
- package/src/api/platform/Instance.js +551 -49
- package/src/api/platform/index.d.ts +9 -0
- package/src/api/platform/index.js +9 -0
- package/src/api/platform/layout/Factory.d.ts +53 -76
- package/src/api/platform/layout/Factory.js +53 -76
- package/src/api/platform/layout/Instance.d.ts +158 -23
- package/src/api/platform/layout/Instance.js +118 -20
- package/src/api/platform/layout/entities/layout-entities.d.ts +222 -30
- package/src/api/platform/layout/entities/layout-entities.js +222 -30
- package/src/api/platform/layout/index.d.ts +9 -0
- package/src/api/platform/layout/index.js +9 -0
- package/src/api/platform/provider.d.ts +398 -51
- package/src/api/snapshot-source/Factory.d.ts +33 -18
- package/src/api/snapshot-source/Factory.js +33 -18
- package/src/api/snapshot-source/Instance.d.ts +30 -8
- package/src/api/snapshot-source/Instance.js +30 -8
- package/src/api/snapshot-source/index.d.ts +9 -0
- package/src/api/snapshot-source/index.js +9 -0
- package/src/api/system/index.d.ts +1137 -186
- package/src/api/system/index.js +1142 -186
- package/src/api/view/Factory.d.ts +54 -16
- package/src/api/view/Factory.js +54 -16
- package/src/api/view/Instance.d.ts +330 -216
- package/src/api/view/Instance.js +331 -217
- package/src/api/view/index.d.ts +9 -0
- package/src/api/view/index.js +9 -0
- package/src/api/webcontents/main.d.ts +890 -0
- package/src/api/webcontents/main.js +890 -0
- package/src/api/window/Factory.d.ts +67 -16
- package/src/api/window/Factory.js +67 -16
- package/src/api/window/Instance.d.ts +824 -316
- package/src/api/window/Instance.js +822 -320
- package/src/api/window/index.d.ts +11 -0
- package/src/api/window/index.js +11 -0
- package/src/namespaces.d.ts +1 -0
- package/src/namespaces.js +3 -1
- package/src/shapes/protocol.d.ts +4 -0
- package/openfin-core-33.76.31.tgz +0 -0
package/src/api/view/Instance.js
CHANGED
|
@@ -177,19 +177,19 @@ const window_1 = require("../window");
|
|
|
177
177
|
* really no need to provide it.
|
|
178
178
|
*/
|
|
179
179
|
/**
|
|
180
|
-
*
|
|
180
|
+
* A View can be used to embed additional web content into a Window.
|
|
181
181
|
* It is like a child window, except it is positioned relative to its owning window.
|
|
182
|
-
* It has the ability to listen for
|
|
182
|
+
* It has the ability to listen for {@link OpenFin.ViewEvents View-specific events}.
|
|
183
183
|
*
|
|
184
184
|
* By default, a View will try to share the same renderer process as other Views owned by its parent Application.
|
|
185
|
-
* To change that behavior, see the processAffinity {@link
|
|
185
|
+
* To change that behavior, see the processAffinity {@link OpenFin.ViewOptions view option}.
|
|
186
186
|
*
|
|
187
187
|
* A View's lifecycle is tied to its owning window and can be re-attached to a different window at any point during its lifecycle.
|
|
188
|
-
* @class
|
|
189
|
-
* @alias View
|
|
190
|
-
* @hideconstructor
|
|
191
188
|
*/
|
|
192
189
|
class View extends main_1.WebContents {
|
|
190
|
+
/**
|
|
191
|
+
* @internal
|
|
192
|
+
*/
|
|
193
193
|
constructor(wire, identity) {
|
|
194
194
|
super(wire, identity, 'view');
|
|
195
195
|
this.identity = identity;
|
|
@@ -198,170 +198,46 @@ class View extends main_1.WebContents {
|
|
|
198
198
|
return platform.getClient();
|
|
199
199
|
}));
|
|
200
200
|
/**
|
|
201
|
-
*
|
|
202
|
-
* @function getZoomLevel
|
|
203
|
-
* @memberOf View
|
|
204
|
-
* @instance
|
|
205
|
-
* @return {Promise.<number>}
|
|
206
|
-
* @tutorial View.getZoomLevel
|
|
207
|
-
*/
|
|
208
|
-
/**
|
|
209
|
-
* Sets the zoom level of the view.
|
|
210
|
-
* @param { number } level The zoom level
|
|
211
|
-
* @function setZoomLevel
|
|
212
|
-
* @memberOf View
|
|
213
|
-
* @instance
|
|
214
|
-
* @return {Promise.<void>}
|
|
215
|
-
* @tutorial View.setZoomLevel
|
|
216
|
-
*/
|
|
217
|
-
/**
|
|
218
|
-
* Find and highlight text on a page.
|
|
219
|
-
* @param { string } searchTerm Term to find in page
|
|
220
|
-
* @param { FindInPageOptions } options Search options
|
|
221
|
-
* @function findInPage
|
|
222
|
-
* @memberOf View
|
|
223
|
-
* @instance
|
|
224
|
-
* @return {Promise.<number>}
|
|
225
|
-
* @tutorial View.findInPage
|
|
226
|
-
*/
|
|
227
|
-
/**
|
|
228
|
-
* Stops any findInPage call with the provided action.
|
|
229
|
-
* @param {string} action
|
|
230
|
-
* Action to execute when stopping a find in page:<br>
|
|
231
|
-
* "clearSelection" - Clear the selection.<br>
|
|
232
|
-
* "keepSelection" - Translate the selection into a normal selection.<br>
|
|
233
|
-
* "activateSelection" - Focus and click the selection node.<br>
|
|
234
|
-
* @function stopFindInPage
|
|
235
|
-
* @memberOf View
|
|
236
|
-
* @instance
|
|
237
|
-
* @return {Promise.<void>}
|
|
238
|
-
* @tutorial View.stopFindInPage
|
|
239
|
-
*/
|
|
240
|
-
/**
|
|
241
|
-
* Navigates the view to a specified URL. The url must contain the protocol prefix such as http:// or https://.
|
|
242
|
-
* @param { string } url - The URL to navigate the view to.
|
|
243
|
-
* @return {Promise.<void>}
|
|
244
|
-
* @function navigate
|
|
245
|
-
* @memberof View
|
|
246
|
-
* @instance
|
|
247
|
-
* @tutorial View.navigate
|
|
248
|
-
* @experimental
|
|
249
|
-
*/
|
|
250
|
-
/**
|
|
251
|
-
* Navigates the view back one page.
|
|
252
|
-
* @function navigateBack
|
|
253
|
-
* @memberOf View
|
|
254
|
-
* @instance
|
|
255
|
-
* @return {Promise.<void>}
|
|
256
|
-
* @tutorial View.navigateBack
|
|
257
|
-
*/
|
|
258
|
-
/**
|
|
259
|
-
* Navigates the view forward one page.
|
|
260
|
-
* @function navigateForward
|
|
261
|
-
* @memberOf View
|
|
262
|
-
* @instance
|
|
263
|
-
* @return {Promise.<void>}
|
|
264
|
-
* @tutorial View.navigateForward
|
|
265
|
-
*/
|
|
266
|
-
/**
|
|
267
|
-
* Stops any current navigation the view is performing.
|
|
268
|
-
* @function stopNavigation
|
|
269
|
-
* @memberOf View
|
|
270
|
-
* @instance
|
|
271
|
-
* @return {Promise.<void>}
|
|
272
|
-
* @tutorial View.stopNavigation
|
|
273
|
-
*/
|
|
274
|
-
/**
|
|
275
|
-
* Reloads the view current page
|
|
276
|
-
* @function reload
|
|
277
|
-
* @memberOf View
|
|
278
|
-
* @instance
|
|
279
|
-
* @return {Promise.<void>}
|
|
280
|
-
* @tutorial View.reload
|
|
281
|
-
*/
|
|
282
|
-
/**
|
|
283
|
-
* Prints the view's web page
|
|
284
|
-
* @param { PrintOptions } [options] Printer Options
|
|
285
|
-
* @function print
|
|
286
|
-
* @memberOf View
|
|
287
|
-
* @instance
|
|
288
|
-
* @return {Promise.<void>}
|
|
289
|
-
* @tutorial View.print
|
|
290
|
-
*/
|
|
291
|
-
/**
|
|
292
|
-
* Returns an array with all system printers
|
|
293
|
-
* @deprecated use System.getPrinters instead
|
|
294
|
-
* @function getPrinters
|
|
295
|
-
* @memberOf View
|
|
296
|
-
* @instance
|
|
297
|
-
* @return { Promise.Array.<PrinterInfo> }
|
|
298
|
-
* @tutorial View.getPrinters
|
|
299
|
-
*/
|
|
300
|
-
/**
|
|
301
|
-
* Shows the Chromium Developer Tools
|
|
302
|
-
* @function showDeveloperTools
|
|
303
|
-
* @memberOf View
|
|
304
|
-
* @instance
|
|
305
|
-
* @return {Promise.<void>}
|
|
306
|
-
* @tutorial View.showDeveloperTools
|
|
307
|
-
*/
|
|
308
|
-
/**
|
|
309
|
-
* Retrieves the process information associated with a view.
|
|
310
|
-
* @function getProcessInfo
|
|
311
|
-
* @memberOf View
|
|
312
|
-
* @instance
|
|
313
|
-
* @return {Promise.<EntityProcessDetails>}
|
|
314
|
-
* @tutorial View.getProcessInfo
|
|
315
|
-
*/
|
|
316
|
-
/**
|
|
317
|
-
* Retrieves information on all Shared Workers.
|
|
318
|
-
* @function getSharedWorkers
|
|
319
|
-
* @memberOf View
|
|
320
|
-
* @instance
|
|
321
|
-
* @return {Promise.Array.<SharedWorkerInfo>}
|
|
322
|
-
* @tutorial View.getSharedWorkers
|
|
323
|
-
*/
|
|
324
|
-
/**
|
|
325
|
-
* Opens the developer tools for the shared worker context.
|
|
326
|
-
* @function inspectSharedWorker
|
|
327
|
-
* @memberOf View
|
|
328
|
-
* @instance
|
|
329
|
-
* @return {Promise.<void>}
|
|
330
|
-
* @tutorial View.inspectSharedWorker
|
|
331
|
-
*/
|
|
332
|
-
/**
|
|
333
|
-
* Inspects the shared worker based on its ID.
|
|
334
|
-
* @param { string } workerId - The id of the shared worker.
|
|
335
|
-
* @function inspectSharedWorkerById
|
|
336
|
-
* @memberOf View
|
|
337
|
-
* @instance
|
|
338
|
-
* @return {Promise.<void>}
|
|
339
|
-
* @tutorial View.inspectSharedWorkerById
|
|
340
|
-
*/
|
|
341
|
-
/**
|
|
342
|
-
* Opens the developer tools for the service worker context.
|
|
343
|
-
* @function inspectServiceWorker
|
|
344
|
-
* @memberOf View
|
|
345
|
-
* @instance
|
|
346
|
-
* @return {Promise.<void>}
|
|
347
|
-
* @tutorial View.inspectServiceWorker
|
|
348
|
-
*/
|
|
349
|
-
/**
|
|
350
|
-
* Shows a popup window. If the window this view is currently attached to has a popup open, closes it.
|
|
351
|
-
* @function showPopupWindow
|
|
352
|
-
* @memberOf View
|
|
353
|
-
* @instance
|
|
354
|
-
* @param {PopupOptions} options
|
|
355
|
-
* @return {Promise<PopupResult>}
|
|
356
|
-
* @tutorial View.showPopupWindow
|
|
357
|
-
*/
|
|
358
|
-
/**
|
|
359
|
-
* Attaches the current view to a the given window identity.
|
|
201
|
+
* Attaches the current view to the given window identity.
|
|
360
202
|
* Identity must be the identity of a window in the same application.
|
|
361
203
|
* This detaches the view from its current window, and sets the view to be destroyed when its new window closes.
|
|
362
204
|
* @param target {Identity}
|
|
363
|
-
*
|
|
364
|
-
* @
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```js
|
|
208
|
+
* let view;
|
|
209
|
+
* async function createView() {
|
|
210
|
+
* const me = await fin.Window.getCurrent();
|
|
211
|
+
* return fin.View.create({
|
|
212
|
+
* name: 'viewNameAttach',
|
|
213
|
+
* target: me.identity,
|
|
214
|
+
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
215
|
+
* });
|
|
216
|
+
* }
|
|
217
|
+
*
|
|
218
|
+
* async function attachView() {
|
|
219
|
+
* view = await createView();
|
|
220
|
+
* console.log('View created.');
|
|
221
|
+
*
|
|
222
|
+
* await view.navigate('https://google.com');
|
|
223
|
+
* console.log('View navigated to given url.');
|
|
224
|
+
*
|
|
225
|
+
* const winOption = {
|
|
226
|
+
* name:'winOptionName',
|
|
227
|
+
* defaultWidth: 300,
|
|
228
|
+
* defaultHeight: 300,
|
|
229
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.create.html',
|
|
230
|
+
* frame: true,
|
|
231
|
+
* autoShow: true
|
|
232
|
+
* };
|
|
233
|
+
* const newWindow = await fin.Window.create(winOption);
|
|
234
|
+
* view.attach(newWindow.identity);
|
|
235
|
+
* }
|
|
236
|
+
*
|
|
237
|
+
* attachView()
|
|
238
|
+
* .then(() => console.log('View attached to new window.'))
|
|
239
|
+
* .catch(err => console.log(err));
|
|
240
|
+
* ```
|
|
365
241
|
* @experimental
|
|
366
242
|
*/
|
|
367
243
|
this.attach = async (target) => {
|
|
@@ -369,8 +245,12 @@ class View extends main_1.WebContents {
|
|
|
369
245
|
};
|
|
370
246
|
/**
|
|
371
247
|
* Destroys the current view
|
|
372
|
-
*
|
|
373
|
-
* @
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```js
|
|
251
|
+
* const view = fin.View.wrapSync({ uuid: 'viewUuid', name: 'viewName' });
|
|
252
|
+
* view.destroy();
|
|
253
|
+
* ```
|
|
374
254
|
* @experimental
|
|
375
255
|
*/
|
|
376
256
|
this.destroy = async () => {
|
|
@@ -378,8 +258,37 @@ class View extends main_1.WebContents {
|
|
|
378
258
|
};
|
|
379
259
|
/**
|
|
380
260
|
* Shows the current view if it is currently hidden.
|
|
381
|
-
*
|
|
382
|
-
* @
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```js
|
|
264
|
+
* let view;
|
|
265
|
+
* async function createView() {
|
|
266
|
+
* const me = await fin.Window.getCurrent();
|
|
267
|
+
* return fin.View.create({
|
|
268
|
+
* name: 'viewNameShow',
|
|
269
|
+
* target: me.identity,
|
|
270
|
+
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
271
|
+
* });
|
|
272
|
+
* }
|
|
273
|
+
*
|
|
274
|
+
* async function hideAndShowView() {
|
|
275
|
+
* view = await createView();
|
|
276
|
+
* console.log('View created.');
|
|
277
|
+
*
|
|
278
|
+
* await view.navigate('https://google.com');
|
|
279
|
+
* console.log('View navigated to given url option.');
|
|
280
|
+
*
|
|
281
|
+
* await view.hide();
|
|
282
|
+
* console.log("View hidden.");
|
|
283
|
+
*
|
|
284
|
+
* view.show();
|
|
285
|
+
* console.log("View shown.");
|
|
286
|
+
* }
|
|
287
|
+
*
|
|
288
|
+
* hideAndShowView()
|
|
289
|
+
* .then(() => console.log('View hidden and shown.'))
|
|
290
|
+
* .catch(err => console.log(err));
|
|
291
|
+
* ```
|
|
383
292
|
* @experimental
|
|
384
293
|
*/
|
|
385
294
|
this.show = async () => {
|
|
@@ -387,8 +296,33 @@ class View extends main_1.WebContents {
|
|
|
387
296
|
};
|
|
388
297
|
/**
|
|
389
298
|
* Hides the current view if it is currently visible.
|
|
390
|
-
*
|
|
391
|
-
* @
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```js
|
|
302
|
+
* let view;
|
|
303
|
+
* async function createView() {
|
|
304
|
+
* const me = await fin.Window.getCurrent();
|
|
305
|
+
* return fin.View.create({
|
|
306
|
+
* name: 'viewNameHide',
|
|
307
|
+
* target: me.identity,
|
|
308
|
+
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
309
|
+
* });
|
|
310
|
+
* }
|
|
311
|
+
*
|
|
312
|
+
* async function hideView() {
|
|
313
|
+
* view = await createView();
|
|
314
|
+
* console.log('View created.');
|
|
315
|
+
*
|
|
316
|
+
* await view.navigate('https://google.com');
|
|
317
|
+
* console.log('View navigated to given url.');
|
|
318
|
+
*
|
|
319
|
+
* await view.hide();
|
|
320
|
+
* }
|
|
321
|
+
*
|
|
322
|
+
* hideView()
|
|
323
|
+
* .then(() => console.log('View hidden.'))
|
|
324
|
+
* .catch(err => console.log(err));
|
|
325
|
+
* ```
|
|
392
326
|
* @experimental
|
|
393
327
|
*/
|
|
394
328
|
this.hide = async () => {
|
|
@@ -397,8 +331,41 @@ class View extends main_1.WebContents {
|
|
|
397
331
|
/**
|
|
398
332
|
* Sets the bounds (top, left, width, height) of the view relative to its window.
|
|
399
333
|
* @param bounds {ViewBounds}
|
|
400
|
-
*
|
|
401
|
-
* @
|
|
334
|
+
*
|
|
335
|
+
* @remarks View position is relative to the bounds of the window.
|
|
336
|
+
* ({top: 0, left: 0} represents the top left corner of the window)
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```js
|
|
340
|
+
* let view;
|
|
341
|
+
* async function createView() {
|
|
342
|
+
* const me = await fin.Window.getCurrent();
|
|
343
|
+
* return fin.View.create({
|
|
344
|
+
* name: 'viewNameSetBounds',
|
|
345
|
+
* target: me.identity,
|
|
346
|
+
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
347
|
+
* });
|
|
348
|
+
* }
|
|
349
|
+
*
|
|
350
|
+
* async function setViewBounds() {
|
|
351
|
+
* view = await createView();
|
|
352
|
+
* console.log('View created.');
|
|
353
|
+
*
|
|
354
|
+
* await view.navigate('https://google.com');
|
|
355
|
+
* console.log('View navigated to given url.');
|
|
356
|
+
*
|
|
357
|
+
* await view.setBounds({
|
|
358
|
+
* top: 100,
|
|
359
|
+
* left: 100,
|
|
360
|
+
* width: 300,
|
|
361
|
+
* height: 300
|
|
362
|
+
* });
|
|
363
|
+
* }
|
|
364
|
+
*
|
|
365
|
+
* setViewBounds()
|
|
366
|
+
* .then(() => console.log('View set to new bounds.'))
|
|
367
|
+
* .catch(err => console.log(err));
|
|
368
|
+
* ```
|
|
402
369
|
* @experimental
|
|
403
370
|
*/
|
|
404
371
|
this.setBounds = async (bounds) => {
|
|
@@ -406,8 +373,29 @@ class View extends main_1.WebContents {
|
|
|
406
373
|
};
|
|
407
374
|
/**
|
|
408
375
|
* Gets the bounds (top, left, width, height) of the view relative to its window.
|
|
409
|
-
*
|
|
410
|
-
* @
|
|
376
|
+
*
|
|
377
|
+
* @remarks View position is relative to the bounds of the window.
|
|
378
|
+
* ({top: 0, left: 0} represents the top left corner of the window)
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```js
|
|
382
|
+
* const view = await fin.View.create({
|
|
383
|
+
* name: 'viewNameSetBounds',
|
|
384
|
+
* target: fin.me.identity,
|
|
385
|
+
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
386
|
+
* });
|
|
387
|
+
*
|
|
388
|
+
* await view.navigate('https://google.com');
|
|
389
|
+
*
|
|
390
|
+
* await view.setBounds({
|
|
391
|
+
* top: 100,
|
|
392
|
+
* left: 100,
|
|
393
|
+
* width: 300,
|
|
394
|
+
* height: 300
|
|
395
|
+
* });
|
|
396
|
+
*
|
|
397
|
+
* console.log(await view.getBounds());
|
|
398
|
+
* ```
|
|
411
399
|
* @experimental
|
|
412
400
|
*/
|
|
413
401
|
this.getBounds = async () => {
|
|
@@ -416,8 +404,33 @@ class View extends main_1.WebContents {
|
|
|
416
404
|
};
|
|
417
405
|
/**
|
|
418
406
|
* Gets the View's info.
|
|
419
|
-
*
|
|
420
|
-
* @
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```js
|
|
410
|
+
* let view;
|
|
411
|
+
* async function createView() {
|
|
412
|
+
* const me = await fin.Window.getCurrent();
|
|
413
|
+
* return fin.View.create({
|
|
414
|
+
* name: 'viewNameGetInfo',
|
|
415
|
+
* target: me.identity,
|
|
416
|
+
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
417
|
+
* });
|
|
418
|
+
* }
|
|
419
|
+
*
|
|
420
|
+
* async function getViewInfo() {
|
|
421
|
+
* view = await createView();
|
|
422
|
+
* console.log('View created.');
|
|
423
|
+
*
|
|
424
|
+
* await view.navigate('https://google.com');
|
|
425
|
+
* console.log('View navigated to given url.');
|
|
426
|
+
*
|
|
427
|
+
* return view.getInfo();
|
|
428
|
+
* }
|
|
429
|
+
*
|
|
430
|
+
* getViewInfo()
|
|
431
|
+
* .then((info) => console.log('View info fetched.', info))
|
|
432
|
+
* .catch(err => console.log(err));
|
|
433
|
+
* ```
|
|
421
434
|
* @experimental
|
|
422
435
|
*/
|
|
423
436
|
this.getInfo = async () => {
|
|
@@ -426,8 +439,15 @@ class View extends main_1.WebContents {
|
|
|
426
439
|
};
|
|
427
440
|
/**
|
|
428
441
|
* Retrieves the layout for the window the view is attached to.
|
|
429
|
-
*
|
|
430
|
-
* @
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```js
|
|
445
|
+
* //get the current View
|
|
446
|
+
* const view = await fin.View.getCurrent();
|
|
447
|
+
*
|
|
448
|
+
* //get a reference to the Layout for the Window the view is part of
|
|
449
|
+
* const layout = await view.getParentLayout();
|
|
450
|
+
* ```
|
|
431
451
|
* @experimental
|
|
432
452
|
*/
|
|
433
453
|
this.getParentLayout = async () => {
|
|
@@ -439,8 +459,35 @@ class View extends main_1.WebContents {
|
|
|
439
459
|
};
|
|
440
460
|
/**
|
|
441
461
|
* Gets the View's options.
|
|
442
|
-
*
|
|
443
|
-
* @
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```js
|
|
465
|
+
* let view;
|
|
466
|
+
* async function createView() {
|
|
467
|
+
* const me = await fin.Window.getCurrent();
|
|
468
|
+
* return fin.View.create({
|
|
469
|
+
* name: 'viewNameGetOptions',
|
|
470
|
+
* target: me.identity,
|
|
471
|
+
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
472
|
+
* });
|
|
473
|
+
* }
|
|
474
|
+
*
|
|
475
|
+
* async function getViewOptions() {
|
|
476
|
+
* view = await createView();
|
|
477
|
+
* console.log('View created.');
|
|
478
|
+
*
|
|
479
|
+
* await view.navigate('https://google.com');
|
|
480
|
+
* console.log('View navigated to given url.');
|
|
481
|
+
*
|
|
482
|
+
* const me = await fin.Window.getCurrent();
|
|
483
|
+
* view = fin.View.wrapSync({ uuid: me.identity.uuid, name: 'viewNameGetOptions' });
|
|
484
|
+
* return view.getOptions();
|
|
485
|
+
* }
|
|
486
|
+
*
|
|
487
|
+
* getViewOptions()
|
|
488
|
+
* .then((info) => console.log('View options fetched.', info))
|
|
489
|
+
* .catch(err => console.log(err));
|
|
490
|
+
* ```
|
|
444
491
|
* @experimental
|
|
445
492
|
*/
|
|
446
493
|
this.getOptions = async () => {
|
|
@@ -448,9 +495,39 @@ class View extends main_1.WebContents {
|
|
|
448
495
|
};
|
|
449
496
|
/**
|
|
450
497
|
* Updates the view's options.
|
|
451
|
-
* @param
|
|
452
|
-
*
|
|
453
|
-
* @
|
|
498
|
+
* @param options
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* ```js
|
|
502
|
+
* let view;
|
|
503
|
+
* async function createView() {
|
|
504
|
+
* const me = await fin.Window.getCurrent();
|
|
505
|
+
* return fin.View.create({
|
|
506
|
+
* url: 'https://google.com',
|
|
507
|
+
* name: 'viewNameUpdateOptions',
|
|
508
|
+
* target: me.identity,
|
|
509
|
+
* bounds: {top: 10, left: 10, width: 200, height: 200}
|
|
510
|
+
* });
|
|
511
|
+
* }
|
|
512
|
+
*
|
|
513
|
+
* async function updateViewOptions() {
|
|
514
|
+
* view = await createView();
|
|
515
|
+
* console.log('View created.');
|
|
516
|
+
*
|
|
517
|
+
* await view.navigate('https://google.com');
|
|
518
|
+
* console.log('View navigated to given url option.');
|
|
519
|
+
*
|
|
520
|
+
* const newOptions = { autoResize: {
|
|
521
|
+
* width: true,
|
|
522
|
+
* horizontal: true
|
|
523
|
+
* }};
|
|
524
|
+
* return view.updateOptions(newOptions);
|
|
525
|
+
* }
|
|
526
|
+
*
|
|
527
|
+
* updateViewOptions()
|
|
528
|
+
* .then(payload => console.log('View options updated: ', payload))
|
|
529
|
+
* .catch(err => console.log(err));
|
|
530
|
+
* ```
|
|
454
531
|
* @experimental
|
|
455
532
|
*/
|
|
456
533
|
this.updateOptions = async (options) => {
|
|
@@ -458,17 +535,37 @@ class View extends main_1.WebContents {
|
|
|
458
535
|
};
|
|
459
536
|
/**
|
|
460
537
|
* Retrieves the window the view is currently attached to.
|
|
461
|
-
*
|
|
538
|
+
*
|
|
462
539
|
* @experimental
|
|
540
|
+
* @example
|
|
541
|
+
* ```js
|
|
542
|
+
* const view = fin.View.wrapSync({ uuid: 'viewUuid', name: 'viewName' });
|
|
543
|
+
* view.getCurrentWindow()
|
|
544
|
+
* .then(win => console.log('current window', win))
|
|
545
|
+
* .catch(err => console.log(err));)
|
|
546
|
+
* ```
|
|
463
547
|
*/
|
|
464
548
|
this.getCurrentWindow = async () => {
|
|
465
549
|
const { payload: { data } } = await this.wire.sendAction('get-view-window', { ...this.identity });
|
|
466
550
|
return new window_1._Window(this.wire, data);
|
|
467
551
|
};
|
|
468
552
|
/**
|
|
469
|
-
* Retrieves the current {@link TabStack} of the view if it belongs to one.
|
|
470
|
-
* @
|
|
553
|
+
* Retrieves the current {@link OpenFin.TabStack} of the view if it belongs to one.
|
|
554
|
+
* @returns this view belongs to.
|
|
471
555
|
* @throws if this view does not belong to a TabStack or if the window has been destroyed.
|
|
556
|
+
* @example
|
|
557
|
+
* ```js
|
|
558
|
+
* if (!fin.me.isView) {
|
|
559
|
+
* throw new Error('Not running in a platform View.');
|
|
560
|
+
* }
|
|
561
|
+
*
|
|
562
|
+
* const stack = await fin.me.getCurrentStack();
|
|
563
|
+
* // Alternatively, you can wrap any view and get the stack from there
|
|
564
|
+
* // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
|
|
565
|
+
* // const stack = await viewFromSomewhere.getCurrentStack();
|
|
566
|
+
* const views = await stack.getViews();
|
|
567
|
+
* console.log(`Stack contains ${views.length} view(s)`);
|
|
568
|
+
* ```
|
|
472
569
|
*/
|
|
473
570
|
this.getCurrentStack = async () => {
|
|
474
571
|
this.wire.sendAction('view-get-current-stack').catch(() => {
|
|
@@ -486,10 +583,21 @@ class View extends main_1.WebContents {
|
|
|
486
583
|
}
|
|
487
584
|
};
|
|
488
585
|
/**
|
|
489
|
-
* Triggers the before-unload handler for the View, if one is set.
|
|
490
|
-
*
|
|
491
|
-
* @
|
|
492
|
-
*
|
|
586
|
+
* Triggers the before-unload handler for the View, if one is set.
|
|
587
|
+
*
|
|
588
|
+
* @remarks Returns `true` if the handler is trying to prevent the View from unloading, and `false` if it isn't.
|
|
589
|
+
* Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will
|
|
590
|
+
* always return false.
|
|
591
|
+
*
|
|
592
|
+
* This method is used internally by the Platform Provider to determine the status of each before unload handler in Views when closing the Window.
|
|
593
|
+
*
|
|
594
|
+
* @example
|
|
595
|
+
*
|
|
596
|
+
* ```js
|
|
597
|
+
* // from inside a View context
|
|
598
|
+
* const unloadPrevented = await fin.me.triggerBeforeUnload();
|
|
599
|
+
* ```
|
|
600
|
+
*
|
|
493
601
|
* @experimental
|
|
494
602
|
*/
|
|
495
603
|
this.triggerBeforeUnload = async () => {
|
|
@@ -504,11 +612,31 @@ class View extends main_1.WebContents {
|
|
|
504
612
|
*
|
|
505
613
|
* **Known issue**: When View.bindToElement is used on a element that takes up the entire page in a platform window, the bound view will not respond responsively when the window is resized to be smaller.
|
|
506
614
|
*
|
|
507
|
-
* @param
|
|
508
|
-
* @
|
|
615
|
+
* @param element - HTML element to attach the view to.
|
|
616
|
+
* @returns - Cleanup function that will disconnect the element resize observer.
|
|
509
617
|
* @internal
|
|
510
618
|
* @experimental
|
|
511
|
-
* @
|
|
619
|
+
* @remarks View will resize accordingly when the element is resized. If the element is repositioned in the DOM the view will not be repositioned, to handle this case call `bindToElement` again once the element changes position.
|
|
620
|
+
*
|
|
621
|
+
* @example
|
|
622
|
+
* ```html
|
|
623
|
+
* <div id="view-container"></div>
|
|
624
|
+
* <script>
|
|
625
|
+
* async function createAndAttachView() {
|
|
626
|
+
* const url = 'https://example.com';
|
|
627
|
+
* const elementId = 'view-container';
|
|
628
|
+
* const element = document.getElementById(elementId);
|
|
629
|
+
* const view = await fin.View.create({
|
|
630
|
+
* name: 'my-view',
|
|
631
|
+
* url,
|
|
632
|
+
* target: fin.me.identity
|
|
633
|
+
* });
|
|
634
|
+
* await view.navigate(url);
|
|
635
|
+
* await view.bindToElement(element);
|
|
636
|
+
* }
|
|
637
|
+
* createAndAttachView().catch(console.error);
|
|
638
|
+
* </script>
|
|
639
|
+
* ```
|
|
512
640
|
*/
|
|
513
641
|
this.bindToElement = async (element) => {
|
|
514
642
|
if (!element) {
|
|
@@ -518,33 +646,19 @@ class View extends main_1.WebContents {
|
|
|
518
646
|
return this.wire.environment.observeBounds(element, onChange);
|
|
519
647
|
};
|
|
520
648
|
}
|
|
521
|
-
/**
|
|
522
|
-
* Gets a base64 encoded image of the view or a part of it.
|
|
523
|
-
* @function capturePage
|
|
524
|
-
* @param { CapturePageOptions } [options] Options for the capturePage call.
|
|
525
|
-
* @memberOf View
|
|
526
|
-
* @instance
|
|
527
|
-
* @return {Promise.<string>}
|
|
528
|
-
* @tutorial View.capturePage
|
|
529
|
-
*/
|
|
530
|
-
/**
|
|
531
|
-
* Executes Javascript on the view, restricted to contents you own or contents owned by
|
|
532
|
-
* applications you have created.
|
|
533
|
-
* @param { string } code JavaScript code to be executed on the view.
|
|
534
|
-
* @function executeJavaScript
|
|
535
|
-
* @memberOf View
|
|
536
|
-
* @instance
|
|
537
|
-
* @return {Promise.<void>}
|
|
538
|
-
* @tutorial View.executeJavaScript
|
|
539
|
-
*/
|
|
540
649
|
/**
|
|
541
650
|
* Focuses the view
|
|
542
|
-
*
|
|
651
|
+
*
|
|
543
652
|
* @function focus
|
|
544
653
|
* @memberof View
|
|
545
654
|
* @emits focused
|
|
546
655
|
* @instance
|
|
547
|
-
* @
|
|
656
|
+
* @example
|
|
657
|
+
* ```js
|
|
658
|
+
* const view = fin.View.wrapSync({ uuid: 'viewUuid', name: 'viewName' });
|
|
659
|
+
* await view.focus();
|
|
660
|
+
* // do things with the focused view
|
|
661
|
+
* ```
|
|
548
662
|
* @experimental
|
|
549
663
|
*/
|
|
550
664
|
async focus({ emitSynthFocused } = { emitSynthFocused: true }) {
|
package/src/api/view/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for the OpenFin View namespace.
|
|
3
|
+
*
|
|
4
|
+
* Because TypeDoc does not currently support multiple modules with the same name, the module alias "ViewModule" is used for
|
|
5
|
+
* the module containing static members of the `View` namespace (available under `fin.View`), while `View` documents
|
|
6
|
+
* instances of the OpenFin `View` class.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
1
10
|
import ViewModule from './Factory';
|
|
2
11
|
export default ViewModule;
|
|
3
12
|
export * from './Instance';
|