11"use strict" ;
2- const electron_1 = require ( "electron" ) ;
3- let browserViews = [ ] ;
4- let browserView , electronSocket ;
5- module . exports = ( socket ) => {
2+ var __assign = ( this && this . __assign ) || function ( ) {
3+ __assign = Object . assign || function ( t ) {
4+ for ( var s , i = 1 , n = arguments . length ; i < n ; i ++ ) {
5+ s = arguments [ i ] ;
6+ for ( var p in s ) if ( Object . prototype . hasOwnProperty . call ( s , p ) )
7+ t [ p ] = s [ p ] ;
8+ }
9+ return t ;
10+ } ;
11+ return __assign . apply ( this , arguments ) ;
12+ } ;
13+ var electron_1 = require ( "electron" ) ;
14+ var browserViews = ( global [ 'browserViews' ] = global [ 'browserViews' ] || [ ] ) ;
15+ var browserView , electronSocket ;
16+ module . exports = function ( socket ) {
617 electronSocket = socket ;
7- socket . on ( 'createBrowserView' , ( options ) => {
18+ socket . on ( 'createBrowserView' , function ( options ) {
819 if ( ! hasOwnChildreen ( options , 'webPreferences' , 'nodeIntegration' ) ) {
9- options = { ... options , webPreferences : { nodeIntegration : true } } ;
20+ options = __assign ( __assign ( { } , options ) , { webPreferences : { nodeIntegration : true } } ) ;
1021 }
1122 browserView = new electron_1 . BrowserView ( options ) ;
1223 browserViews . push ( browserView ) ;
1324 electronSocket . emit ( 'BrowserViewCreated' , browserView . id ) ;
1425 } ) ;
15- socket . on ( 'browserView-isDestroyed' , ( id ) => {
16- const isDestroyed = getBrowserViewById ( id ) . isDestroyed ( ) ;
26+ socket . on ( 'browserView-isDestroyed' , function ( id ) {
27+ var isDestroyed = getBrowserViewById ( id ) . isDestroyed ( ) ;
1728 electronSocket . emit ( 'browserView-isDestroyed-reply' , isDestroyed ) ;
1829 } ) ;
19- socket . on ( 'browserView-getBounds' , ( id ) => {
20- const bounds = getBrowserViewById ( id ) . getBounds ( ) ;
30+ socket . on ( 'browserView-getBounds' , function ( id ) {
31+ var bounds = getBrowserViewById ( id ) . getBounds ( ) ;
2132 electronSocket . emit ( 'browserView-getBounds-reply' , bounds ) ;
2233 } ) ;
23- socket . on ( 'browserView-setBounds' , ( id , bounds ) => {
34+ socket . on ( 'browserView-setBounds' , function ( id , bounds ) {
2435 getBrowserViewById ( id ) . setBounds ( bounds ) ;
2536 } ) ;
26- socket . on ( 'browserView-destroy' , ( id ) => {
27- const browserViewIndex = browserViews . findIndex ( b => b . id === id ) ;
37+ socket . on ( 'browserView-destroy' , function ( id ) {
38+ var browserViewIndex = browserViews . findIndex ( function ( b ) { return b . id === id ; } ) ;
2839 getBrowserViewById ( id ) . destroy ( ) ;
2940 browserViews . splice ( browserViewIndex , 1 ) ;
3041 } ) ;
31- socket . on ( 'browserView-setAutoResize' , ( id , options ) => {
42+ socket . on ( 'browserView-setAutoResize' , function ( id , options ) {
3243 getBrowserViewById ( id ) . setAutoResize ( options ) ;
3344 } ) ;
34- socket . on ( 'browserView-setBackgroundColor' , ( id , color ) => {
45+ socket . on ( 'browserView-setBackgroundColor' , function ( id , color ) {
3546 getBrowserViewById ( id ) . setBackgroundColor ( color ) ;
3647 } ) ;
37- function hasOwnChildreen ( obj , ...childNames ) {
38- for ( let i = 0 ; i < childNames . length ; i ++ ) {
48+ function hasOwnChildreen ( obj ) {
49+ var childNames = [ ] ;
50+ for ( var _i = 1 ; _i < arguments . length ; _i ++ ) {
51+ childNames [ _i - 1 ] = arguments [ _i ] ;
52+ }
53+ for ( var i = 0 ; i < childNames . length ; i ++ ) {
3954 if ( ! obj || ! obj . hasOwnProperty ( childNames [ i ] ) ) {
4055 return false ;
4156 }
@@ -44,12 +59,11 @@ module.exports = (socket) => {
4459 return true ;
4560 }
4661 function getBrowserViewById ( id ) {
47- for ( let index = 0 ; index < browserViews . length ; index ++ ) {
48- const browserViewItem = browserViews [ index ] ;
62+ for ( var index = 0 ; index < browserViews . length ; index ++ ) {
63+ var browserViewItem = browserViews [ index ] ;
4964 if ( browserViewItem . id === id ) {
5065 return browserViewItem ;
5166 }
5267 }
5368 }
5469} ;
55- //# sourceMappingURL=browserView.js.map
0 commit comments