File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
static/show-me/webcontentsview Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export const SHOW_ME_TEMPLATES: Templates = {
2929 Tray : 'Tray' ,
3030 utilityProcess : 'utilityProcess' ,
3131 WebContents : 'WebContents' ,
32+ WebContentsView : 'WebContentsView' ,
3233 WebFrame : 'WebFrame' ,
3334 } ,
3435} ;
Original file line number Diff line number Diff line change 1+ // A View that displays a WebContents.
2+ //
3+ // For more info, see:
4+ // https://electronjs.org/docs/api/web-contents-view
5+
6+ // In the main process.
7+ const { app, BaseWindow, WebContentsView } = require ( 'electron' )
8+
9+ app . whenReady ( ) . then ( ( ) => {
10+ const win = new BaseWindow ( { width : 800 , height : 400 } )
11+
12+ const view1 = new WebContentsView ( )
13+ win . contentView . addChildView ( view1 )
14+ view1 . setBounds ( { x : 0 , y : 0 , width : 400 , height : 400 } )
15+ view1 . webContents . loadURL ( 'https://www.electronjs.org' )
16+
17+ const view2 = new WebContentsView ( )
18+ win . contentView . addChildView ( view2 )
19+ view2 . setBounds ( { x : 400 , y : 0 , width : 400 , height : 400 } )
20+ view2 . webContents . loadURL ( 'https://www.electronjs.org/fiddle' )
21+ } )
You can’t perform that action at this time.
0 commit comments