You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

electron.d.ts 950KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575
  1. // Type definitions for Electron 31.2.1
  2. // Project: http://electronjs.org/
  3. // Definitions by: The Electron Team <https://github.com/electron/electron>
  4. // Definitions: https://github.com/electron/typescript-definitions
  5. /// <reference types="node" />
  6. type DOMEvent = Event;
  7. type GlobalResponse = Response;
  8. type GlobalRequest = Request;
  9. declare namespace Electron {
  10. const NodeEventEmitter: typeof import('events').EventEmitter;
  11. type Accelerator = string;
  12. type Event<Params extends object = {}> = {
  13. preventDefault: () => void;
  14. readonly defaultPrevented: boolean;
  15. } & Params;
  16. interface App extends NodeJS.EventEmitter {
  17. // Docs: https://electronjs.org/docs/api/app
  18. /**
  19. * Emitted when Chrome's accessibility support changes. This event fires when
  20. * assistive technologies, such as screen readers, are enabled or disabled. See
  21. * https://www.chromium.org/developers/design-documents/accessibility for more
  22. * details.
  23. *
  24. * @platform darwin,win32
  25. */
  26. on(event: 'accessibility-support-changed', listener: (event: Event,
  27. /**
  28. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  29. */
  30. accessibilitySupportEnabled: boolean) => void): this;
  31. /**
  32. * @platform darwin,win32
  33. */
  34. off(event: 'accessibility-support-changed', listener: (event: Event,
  35. /**
  36. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  37. */
  38. accessibilitySupportEnabled: boolean) => void): this;
  39. /**
  40. * @platform darwin,win32
  41. */
  42. once(event: 'accessibility-support-changed', listener: (event: Event,
  43. /**
  44. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  45. */
  46. accessibilitySupportEnabled: boolean) => void): this;
  47. /**
  48. * @platform darwin,win32
  49. */
  50. addListener(event: 'accessibility-support-changed', listener: (event: Event,
  51. /**
  52. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  53. */
  54. accessibilitySupportEnabled: boolean) => void): this;
  55. /**
  56. * @platform darwin,win32
  57. */
  58. removeListener(event: 'accessibility-support-changed', listener: (event: Event,
  59. /**
  60. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  61. */
  62. accessibilitySupportEnabled: boolean) => void): this;
  63. /**
  64. * Emitted when the application is activated. Various actions can trigger this
  65. * event, such as launching the application for the first time, attempting to
  66. * re-launch the application when it's already running, or clicking on the
  67. * application's dock or taskbar icon.
  68. *
  69. * @platform darwin
  70. */
  71. on(event: 'activate', listener: (event: Event,
  72. hasVisibleWindows: boolean) => void): this;
  73. /**
  74. * @platform darwin
  75. */
  76. off(event: 'activate', listener: (event: Event,
  77. hasVisibleWindows: boolean) => void): this;
  78. /**
  79. * @platform darwin
  80. */
  81. once(event: 'activate', listener: (event: Event,
  82. hasVisibleWindows: boolean) => void): this;
  83. /**
  84. * @platform darwin
  85. */
  86. addListener(event: 'activate', listener: (event: Event,
  87. hasVisibleWindows: boolean) => void): this;
  88. /**
  89. * @platform darwin
  90. */
  91. removeListener(event: 'activate', listener: (event: Event,
  92. hasVisibleWindows: boolean) => void): this;
  93. /**
  94. * Emitted during Handoff after an activity from this device was successfully
  95. * resumed on another one.
  96. *
  97. * @platform darwin
  98. */
  99. on(event: 'activity-was-continued', listener: (event: Event,
  100. /**
  101. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  102. */
  103. type: string,
  104. /**
  105. * Contains app-specific state stored by the activity.
  106. */
  107. userInfo: unknown) => void): this;
  108. /**
  109. * @platform darwin
  110. */
  111. off(event: 'activity-was-continued', listener: (event: Event,
  112. /**
  113. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  114. */
  115. type: string,
  116. /**
  117. * Contains app-specific state stored by the activity.
  118. */
  119. userInfo: unknown) => void): this;
  120. /**
  121. * @platform darwin
  122. */
  123. once(event: 'activity-was-continued', listener: (event: Event,
  124. /**
  125. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  126. */
  127. type: string,
  128. /**
  129. * Contains app-specific state stored by the activity.
  130. */
  131. userInfo: unknown) => void): this;
  132. /**
  133. * @platform darwin
  134. */
  135. addListener(event: 'activity-was-continued', listener: (event: Event,
  136. /**
  137. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  138. */
  139. type: string,
  140. /**
  141. * Contains app-specific state stored by the activity.
  142. */
  143. userInfo: unknown) => void): this;
  144. /**
  145. * @platform darwin
  146. */
  147. removeListener(event: 'activity-was-continued', listener: (event: Event,
  148. /**
  149. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  150. */
  151. type: string,
  152. /**
  153. * Contains app-specific state stored by the activity.
  154. */
  155. userInfo: unknown) => void): this;
  156. /**
  157. * Emitted before the application starts closing its windows. Calling
  158. * `event.preventDefault()` will prevent the default behavior, which is terminating
  159. * the application.
  160. *
  161. * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
  162. * then `before-quit` is emitted _after_ emitting `close` event on all windows and
  163. * closing them.
  164. *
  165. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  166. * a shutdown/restart of the system or a user logout.
  167. */
  168. on(event: 'before-quit', listener: (event: Event) => void): this;
  169. off(event: 'before-quit', listener: (event: Event) => void): this;
  170. once(event: 'before-quit', listener: (event: Event) => void): this;
  171. addListener(event: 'before-quit', listener: (event: Event) => void): this;
  172. removeListener(event: 'before-quit', listener: (event: Event) => void): this;
  173. /**
  174. * Emitted when a browserWindow gets blurred.
  175. */
  176. on(event: 'browser-window-blur', listener: (event: Event,
  177. window: BrowserWindow) => void): this;
  178. off(event: 'browser-window-blur', listener: (event: Event,
  179. window: BrowserWindow) => void): this;
  180. once(event: 'browser-window-blur', listener: (event: Event,
  181. window: BrowserWindow) => void): this;
  182. addListener(event: 'browser-window-blur', listener: (event: Event,
  183. window: BrowserWindow) => void): this;
  184. removeListener(event: 'browser-window-blur', listener: (event: Event,
  185. window: BrowserWindow) => void): this;
  186. /**
  187. * Emitted when a new browserWindow is created.
  188. */
  189. on(event: 'browser-window-created', listener: (event: Event,
  190. window: BrowserWindow) => void): this;
  191. off(event: 'browser-window-created', listener: (event: Event,
  192. window: BrowserWindow) => void): this;
  193. once(event: 'browser-window-created', listener: (event: Event,
  194. window: BrowserWindow) => void): this;
  195. addListener(event: 'browser-window-created', listener: (event: Event,
  196. window: BrowserWindow) => void): this;
  197. removeListener(event: 'browser-window-created', listener: (event: Event,
  198. window: BrowserWindow) => void): this;
  199. /**
  200. * Emitted when a browserWindow gets focused.
  201. */
  202. on(event: 'browser-window-focus', listener: (event: Event,
  203. window: BrowserWindow) => void): this;
  204. off(event: 'browser-window-focus', listener: (event: Event,
  205. window: BrowserWindow) => void): this;
  206. once(event: 'browser-window-focus', listener: (event: Event,
  207. window: BrowserWindow) => void): this;
  208. addListener(event: 'browser-window-focus', listener: (event: Event,
  209. window: BrowserWindow) => void): this;
  210. removeListener(event: 'browser-window-focus', listener: (event: Event,
  211. window: BrowserWindow) => void): this;
  212. /**
  213. * Emitted when failed to verify the `certificate` for `url`, to trust the
  214. * certificate you should prevent the default behavior with
  215. * `event.preventDefault()` and call `callback(true)`.
  216. */
  217. on(event: 'certificate-error', listener: (event: Event,
  218. webContents: WebContents,
  219. url: string,
  220. /**
  221. * The error code
  222. */
  223. error: string,
  224. certificate: Certificate,
  225. callback: (isTrusted: boolean) => void,
  226. isMainFrame: boolean) => void): this;
  227. off(event: 'certificate-error', listener: (event: Event,
  228. webContents: WebContents,
  229. url: string,
  230. /**
  231. * The error code
  232. */
  233. error: string,
  234. certificate: Certificate,
  235. callback: (isTrusted: boolean) => void,
  236. isMainFrame: boolean) => void): this;
  237. once(event: 'certificate-error', listener: (event: Event,
  238. webContents: WebContents,
  239. url: string,
  240. /**
  241. * The error code
  242. */
  243. error: string,
  244. certificate: Certificate,
  245. callback: (isTrusted: boolean) => void,
  246. isMainFrame: boolean) => void): this;
  247. addListener(event: 'certificate-error', listener: (event: Event,
  248. webContents: WebContents,
  249. url: string,
  250. /**
  251. * The error code
  252. */
  253. error: string,
  254. certificate: Certificate,
  255. callback: (isTrusted: boolean) => void,
  256. isMainFrame: boolean) => void): this;
  257. removeListener(event: 'certificate-error', listener: (event: Event,
  258. webContents: WebContents,
  259. url: string,
  260. /**
  261. * The error code
  262. */
  263. error: string,
  264. certificate: Certificate,
  265. callback: (isTrusted: boolean) => void,
  266. isMainFrame: boolean) => void): this;
  267. /**
  268. * Emitted when the child process unexpectedly disappears. This is normally because
  269. * it was crashed or killed. It does not include renderer processes.
  270. */
  271. on(event: 'child-process-gone', listener: (event: Event,
  272. details: Details) => void): this;
  273. off(event: 'child-process-gone', listener: (event: Event,
  274. details: Details) => void): this;
  275. once(event: 'child-process-gone', listener: (event: Event,
  276. details: Details) => void): this;
  277. addListener(event: 'child-process-gone', listener: (event: Event,
  278. details: Details) => void): this;
  279. removeListener(event: 'child-process-gone', listener: (event: Event,
  280. details: Details) => void): this;
  281. /**
  282. * Emitted during Handoff when an activity from a different device wants to be
  283. * resumed. You should call `event.preventDefault()` if you want to handle this
  284. * event.
  285. *
  286. * A user activity can be continued only in an app that has the same developer Team
  287. * ID as the activity's source app and that supports the activity's type. Supported
  288. * activity types are specified in the app's `Info.plist` under the
  289. * `NSUserActivityTypes` key.
  290. *
  291. * @platform darwin
  292. */
  293. on(event: 'continue-activity', listener: (event: Event,
  294. /**
  295. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  296. */
  297. type: string,
  298. /**
  299. * Contains app-specific state stored by the activity on another device.
  300. */
  301. userInfo: unknown,
  302. details: ContinueActivityDetails) => void): this;
  303. /**
  304. * @platform darwin
  305. */
  306. off(event: 'continue-activity', listener: (event: Event,
  307. /**
  308. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  309. */
  310. type: string,
  311. /**
  312. * Contains app-specific state stored by the activity on another device.
  313. */
  314. userInfo: unknown,
  315. details: ContinueActivityDetails) => void): this;
  316. /**
  317. * @platform darwin
  318. */
  319. once(event: 'continue-activity', listener: (event: Event,
  320. /**
  321. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  322. */
  323. type: string,
  324. /**
  325. * Contains app-specific state stored by the activity on another device.
  326. */
  327. userInfo: unknown,
  328. details: ContinueActivityDetails) => void): this;
  329. /**
  330. * @platform darwin
  331. */
  332. addListener(event: 'continue-activity', listener: (event: Event,
  333. /**
  334. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  335. */
  336. type: string,
  337. /**
  338. * Contains app-specific state stored by the activity on another device.
  339. */
  340. userInfo: unknown,
  341. details: ContinueActivityDetails) => void): this;
  342. /**
  343. * @platform darwin
  344. */
  345. removeListener(event: 'continue-activity', listener: (event: Event,
  346. /**
  347. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  348. */
  349. type: string,
  350. /**
  351. * Contains app-specific state stored by the activity on another device.
  352. */
  353. userInfo: unknown,
  354. details: ContinueActivityDetails) => void): this;
  355. /**
  356. * Emitted during Handoff when an activity from a different device fails to be
  357. * resumed.
  358. *
  359. * @platform darwin
  360. */
  361. on(event: 'continue-activity-error', listener: (event: Event,
  362. /**
  363. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  364. */
  365. type: string,
  366. /**
  367. * A string with the error's localized description.
  368. */
  369. error: string) => void): this;
  370. /**
  371. * @platform darwin
  372. */
  373. off(event: 'continue-activity-error', listener: (event: Event,
  374. /**
  375. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  376. */
  377. type: string,
  378. /**
  379. * A string with the error's localized description.
  380. */
  381. error: string) => void): this;
  382. /**
  383. * @platform darwin
  384. */
  385. once(event: 'continue-activity-error', listener: (event: Event,
  386. /**
  387. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  388. */
  389. type: string,
  390. /**
  391. * A string with the error's localized description.
  392. */
  393. error: string) => void): this;
  394. /**
  395. * @platform darwin
  396. */
  397. addListener(event: 'continue-activity-error', listener: (event: Event,
  398. /**
  399. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  400. */
  401. type: string,
  402. /**
  403. * A string with the error's localized description.
  404. */
  405. error: string) => void): this;
  406. /**
  407. * @platform darwin
  408. */
  409. removeListener(event: 'continue-activity-error', listener: (event: Event,
  410. /**
  411. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  412. */
  413. type: string,
  414. /**
  415. * A string with the error's localized description.
  416. */
  417. error: string) => void): this;
  418. /**
  419. * Emitted when the application becomes active. This differs from the `activate`
  420. * event in that `did-become-active` is emitted every time the app becomes active,
  421. * not only when Dock icon is clicked or application is re-launched. It is also
  422. * emitted when a user switches to the app via the macOS App Switcher.
  423. *
  424. * @platform darwin
  425. */
  426. on(event: 'did-become-active', listener: (event: Event) => void): this;
  427. /**
  428. * @platform darwin
  429. */
  430. off(event: 'did-become-active', listener: (event: Event) => void): this;
  431. /**
  432. * @platform darwin
  433. */
  434. once(event: 'did-become-active', listener: (event: Event) => void): this;
  435. /**
  436. * @platform darwin
  437. */
  438. addListener(event: 'did-become-active', listener: (event: Event) => void): this;
  439. /**
  440. * @platform darwin
  441. */
  442. removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
  443. /**
  444. * Emitted when the app is no longer active and doesn’t have focus. This can be
  445. * triggered, for example, by clicking on another application or by using the macOS
  446. * App Switcher to switch to another application.
  447. *
  448. * @platform darwin
  449. */
  450. on(event: 'did-resign-active', listener: (event: Event) => void): this;
  451. /**
  452. * @platform darwin
  453. */
  454. off(event: 'did-resign-active', listener: (event: Event) => void): this;
  455. /**
  456. * @platform darwin
  457. */
  458. once(event: 'did-resign-active', listener: (event: Event) => void): this;
  459. /**
  460. * @platform darwin
  461. */
  462. addListener(event: 'did-resign-active', listener: (event: Event) => void): this;
  463. /**
  464. * @platform darwin
  465. */
  466. removeListener(event: 'did-resign-active', listener: (event: Event) => void): this;
  467. /**
  468. * Emitted whenever there is a GPU info update.
  469. */
  470. on(event: 'gpu-info-update', listener: Function): this;
  471. off(event: 'gpu-info-update', listener: Function): this;
  472. once(event: 'gpu-info-update', listener: Function): this;
  473. addListener(event: 'gpu-info-update', listener: Function): this;
  474. removeListener(event: 'gpu-info-update', listener: Function): this;
  475. /**
  476. * Emitted when `webContents` wants to do basic auth.
  477. *
  478. * The default behavior is to cancel all authentications. To override this you
  479. * should prevent the default behavior with `event.preventDefault()` and call
  480. * `callback(username, password)` with the credentials.
  481. *
  482. * If `callback` is called without a username or password, the authentication
  483. * request will be cancelled and the authentication error will be returned to the
  484. * page.
  485. */
  486. on(event: 'login', listener: (event: Event,
  487. webContents: WebContents,
  488. authenticationResponseDetails: AuthenticationResponseDetails,
  489. authInfo: AuthInfo,
  490. callback: (username?: string, password?: string) => void) => void): this;
  491. off(event: 'login', listener: (event: Event,
  492. webContents: WebContents,
  493. authenticationResponseDetails: AuthenticationResponseDetails,
  494. authInfo: AuthInfo,
  495. callback: (username?: string, password?: string) => void) => void): this;
  496. once(event: 'login', listener: (event: Event,
  497. webContents: WebContents,
  498. authenticationResponseDetails: AuthenticationResponseDetails,
  499. authInfo: AuthInfo,
  500. callback: (username?: string, password?: string) => void) => void): this;
  501. addListener(event: 'login', listener: (event: Event,
  502. webContents: WebContents,
  503. authenticationResponseDetails: AuthenticationResponseDetails,
  504. authInfo: AuthInfo,
  505. callback: (username?: string, password?: string) => void) => void): this;
  506. removeListener(event: 'login', listener: (event: Event,
  507. webContents: WebContents,
  508. authenticationResponseDetails: AuthenticationResponseDetails,
  509. authInfo: AuthInfo,
  510. callback: (username?: string, password?: string) => void) => void): this;
  511. /**
  512. * Emitted when the user clicks the native macOS new tab button. The new tab button
  513. * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
  514. *
  515. * @platform darwin
  516. */
  517. on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  518. /**
  519. * @platform darwin
  520. */
  521. off(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  522. /**
  523. * @platform darwin
  524. */
  525. once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  526. /**
  527. * @platform darwin
  528. */
  529. addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  530. /**
  531. * @platform darwin
  532. */
  533. removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  534. /**
  535. * Emitted when the user wants to open a file with the application. The `open-file`
  536. * event is usually emitted when the application is already open and the OS wants
  537. * to reuse the application to open the file. `open-file` is also emitted when a
  538. * file is dropped onto the dock and the application is not yet running. Make sure
  539. * to listen for the `open-file` event very early in your application startup to
  540. * handle this case (even before the `ready` event is emitted).
  541. *
  542. * You should call `event.preventDefault()` if you want to handle this event.
  543. *
  544. * On Windows, you have to parse `process.argv` (in the main process) to get the
  545. * filepath.
  546. *
  547. * @platform darwin
  548. */
  549. on(event: 'open-file', listener: (event: Event,
  550. path: string) => void): this;
  551. /**
  552. * @platform darwin
  553. */
  554. off(event: 'open-file', listener: (event: Event,
  555. path: string) => void): this;
  556. /**
  557. * @platform darwin
  558. */
  559. once(event: 'open-file', listener: (event: Event,
  560. path: string) => void): this;
  561. /**
  562. * @platform darwin
  563. */
  564. addListener(event: 'open-file', listener: (event: Event,
  565. path: string) => void): this;
  566. /**
  567. * @platform darwin
  568. */
  569. removeListener(event: 'open-file', listener: (event: Event,
  570. path: string) => void): this;
  571. /**
  572. * Emitted when the user wants to open a URL with the application. Your
  573. * application's `Info.plist` file must define the URL scheme within the
  574. * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
  575. *
  576. * As with the `open-file` event, be sure to register a listener for the `open-url`
  577. * event early in your application startup to detect if the application is being
  578. * opened to handle a URL. If you register the listener in response to a `ready`
  579. * event, you'll miss URLs that trigger the launch of your application.
  580. *
  581. * @platform darwin
  582. */
  583. on(event: 'open-url', listener: (event: Event,
  584. url: string) => void): this;
  585. /**
  586. * @platform darwin
  587. */
  588. off(event: 'open-url', listener: (event: Event,
  589. url: string) => void): this;
  590. /**
  591. * @platform darwin
  592. */
  593. once(event: 'open-url', listener: (event: Event,
  594. url: string) => void): this;
  595. /**
  596. * @platform darwin
  597. */
  598. addListener(event: 'open-url', listener: (event: Event,
  599. url: string) => void): this;
  600. /**
  601. * @platform darwin
  602. */
  603. removeListener(event: 'open-url', listener: (event: Event,
  604. url: string) => void): this;
  605. /**
  606. * Emitted when the application is quitting.
  607. *
  608. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  609. * a shutdown/restart of the system or a user logout.
  610. */
  611. on(event: 'quit', listener: (event: Event,
  612. exitCode: number) => void): this;
  613. off(event: 'quit', listener: (event: Event,
  614. exitCode: number) => void): this;
  615. once(event: 'quit', listener: (event: Event,
  616. exitCode: number) => void): this;
  617. addListener(event: 'quit', listener: (event: Event,
  618. exitCode: number) => void): this;
  619. removeListener(event: 'quit', listener: (event: Event,
  620. exitCode: number) => void): this;
  621. /**
  622. * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
  623. * holds the `userInfo` of the `NSUserNotification` or information from
  624. * `UNNotificationResponse` that was used to open the application, if it was
  625. * launched from Notification Center. You can also call `app.isReady()` to check if
  626. * this event has already fired and `app.whenReady()` to get a Promise that is
  627. * fulfilled when Electron is initialized.
  628. *
  629. * **Note**: The `ready` event is only fired after the main process has finished
  630. * running the first tick of the event loop. If an Electron API needs to be called
  631. * before the `ready` event, ensure that it is called synchronously in the
  632. * top-level context of the main process.
  633. */
  634. on(event: 'ready', listener: (event: Event,
  635. /**
  636. * @platform darwin
  637. */
  638. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  639. off(event: 'ready', listener: (event: Event,
  640. /**
  641. * @platform darwin
  642. */
  643. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  644. once(event: 'ready', listener: (event: Event,
  645. /**
  646. * @platform darwin
  647. */
  648. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  649. addListener(event: 'ready', listener: (event: Event,
  650. /**
  651. * @platform darwin
  652. */
  653. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  654. removeListener(event: 'ready', listener: (event: Event,
  655. /**
  656. * @platform darwin
  657. */
  658. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  659. /**
  660. * Emitted when the renderer process unexpectedly disappears. This is normally
  661. * because it was crashed or killed.
  662. */
  663. on(event: 'render-process-gone', listener: (event: Event,
  664. webContents: WebContents,
  665. details: RenderProcessGoneDetails) => void): this;
  666. off(event: 'render-process-gone', listener: (event: Event,
  667. webContents: WebContents,
  668. details: RenderProcessGoneDetails) => void): this;
  669. once(event: 'render-process-gone', listener: (event: Event,
  670. webContents: WebContents,
  671. details: RenderProcessGoneDetails) => void): this;
  672. addListener(event: 'render-process-gone', listener: (event: Event,
  673. webContents: WebContents,
  674. details: RenderProcessGoneDetails) => void): this;
  675. removeListener(event: 'render-process-gone', listener: (event: Event,
  676. webContents: WebContents,
  677. details: RenderProcessGoneDetails) => void): this;
  678. /**
  679. * This event will be emitted inside the primary instance of your application when
  680. * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
  681. *
  682. * `argv` is an Array of the second instance's command line arguments, and
  683. * `workingDirectory` is its current working directory. Usually applications
  684. * respond to this by making their primary window focused and non-minimized.
  685. *
  686. * **Note:** `argv` will not be exactly the same list of arguments as those passed
  687. * to the second instance. The order might change and additional arguments might be
  688. * appended. If you need to maintain the exact same arguments, it's advised to use
  689. * `additionalData` instead.
  690. *
  691. * **Note:** If the second instance is started by a different user than the first,
  692. * the `argv` array will not include the arguments.
  693. *
  694. * This event is guaranteed to be emitted after the `ready` event of `app` gets
  695. * emitted.
  696. *
  697. * **Note:** Extra command line arguments might be added by Chromium, such as
  698. * `--original-process-start-time`.
  699. */
  700. on(event: 'second-instance', listener: (event: Event,
  701. /**
  702. * An array of the second instance's command line arguments
  703. */
  704. argv: string[],
  705. /**
  706. * The second instance's working directory
  707. */
  708. workingDirectory: string,
  709. /**
  710. * A JSON object of additional data passed from the second instance
  711. */
  712. additionalData: unknown) => void): this;
  713. off(event: 'second-instance', listener: (event: Event,
  714. /**
  715. * An array of the second instance's command line arguments
  716. */
  717. argv: string[],
  718. /**
  719. * The second instance's working directory
  720. */
  721. workingDirectory: string,
  722. /**
  723. * A JSON object of additional data passed from the second instance
  724. */
  725. additionalData: unknown) => void): this;
  726. once(event: 'second-instance', listener: (event: Event,
  727. /**
  728. * An array of the second instance's command line arguments
  729. */
  730. argv: string[],
  731. /**
  732. * The second instance's working directory
  733. */
  734. workingDirectory: string,
  735. /**
  736. * A JSON object of additional data passed from the second instance
  737. */
  738. additionalData: unknown) => void): this;
  739. addListener(event: 'second-instance', listener: (event: Event,
  740. /**
  741. * An array of the second instance's command line arguments
  742. */
  743. argv: string[],
  744. /**
  745. * The second instance's working directory
  746. */
  747. workingDirectory: string,
  748. /**
  749. * A JSON object of additional data passed from the second instance
  750. */
  751. additionalData: unknown) => void): this;
  752. removeListener(event: 'second-instance', listener: (event: Event,
  753. /**
  754. * An array of the second instance's command line arguments
  755. */
  756. argv: string[],
  757. /**
  758. * The second instance's working directory
  759. */
  760. workingDirectory: string,
  761. /**
  762. * A JSON object of additional data passed from the second instance
  763. */
  764. additionalData: unknown) => void): this;
  765. /**
  766. * Emitted when a client certificate is requested.
  767. *
  768. * The `url` corresponds to the navigation entry requesting the client certificate
  769. * and `callback` can be called with an entry filtered from the list. Using
  770. * `event.preventDefault()` prevents the application from using the first
  771. * certificate from the store.
  772. */
  773. on(event: 'select-client-certificate', listener: (event: Event,
  774. webContents: WebContents,
  775. url: string,
  776. certificateList: Certificate[],
  777. callback: (certificate?: Certificate) => void) => void): this;
  778. off(event: 'select-client-certificate', listener: (event: Event,
  779. webContents: WebContents,
  780. url: string,
  781. certificateList: Certificate[],
  782. callback: (certificate?: Certificate) => void) => void): this;
  783. once(event: 'select-client-certificate', listener: (event: Event,
  784. webContents: WebContents,
  785. url: string,
  786. certificateList: Certificate[],
  787. callback: (certificate?: Certificate) => void) => void): this;
  788. addListener(event: 'select-client-certificate', listener: (event: Event,
  789. webContents: WebContents,
  790. url: string,
  791. certificateList: Certificate[],
  792. callback: (certificate?: Certificate) => void) => void): this;
  793. removeListener(event: 'select-client-certificate', listener: (event: Event,
  794. webContents: WebContents,
  795. url: string,
  796. certificateList: Certificate[],
  797. callback: (certificate?: Certificate) => void) => void): this;
  798. /**
  799. * Emitted when Electron has created a new `session`.
  800. */
  801. on(event: 'session-created', listener: (session: Session) => void): this;
  802. off(event: 'session-created', listener: (session: Session) => void): this;
  803. once(event: 'session-created', listener: (session: Session) => void): this;
  804. addListener(event: 'session-created', listener: (session: Session) => void): this;
  805. removeListener(event: 'session-created', listener: (session: Session) => void): this;
  806. /**
  807. * Emitted when Handoff is about to be resumed on another device. If you need to
  808. * update the state to be transferred, you should call `event.preventDefault()`
  809. * immediately, construct a new `userInfo` dictionary and call
  810. * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
  811. * fail and `continue-activity-error` will be called.
  812. *
  813. * @platform darwin
  814. */
  815. on(event: 'update-activity-state', listener: (event: Event,
  816. /**
  817. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  818. */
  819. type: string,
  820. /**
  821. * Contains app-specific state stored by the activity.
  822. */
  823. userInfo: unknown) => void): this;
  824. /**
  825. * @platform darwin
  826. */
  827. off(event: 'update-activity-state', listener: (event: Event,
  828. /**
  829. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  830. */
  831. type: string,
  832. /**
  833. * Contains app-specific state stored by the activity.
  834. */
  835. userInfo: unknown) => void): this;
  836. /**
  837. * @platform darwin
  838. */
  839. once(event: 'update-activity-state', listener: (event: Event,
  840. /**
  841. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  842. */
  843. type: string,
  844. /**
  845. * Contains app-specific state stored by the activity.
  846. */
  847. userInfo: unknown) => void): this;
  848. /**
  849. * @platform darwin
  850. */
  851. addListener(event: 'update-activity-state', listener: (event: Event,
  852. /**
  853. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  854. */
  855. type: string,
  856. /**
  857. * Contains app-specific state stored by the activity.
  858. */
  859. userInfo: unknown) => void): this;
  860. /**
  861. * @platform darwin
  862. */
  863. removeListener(event: 'update-activity-state', listener: (event: Event,
  864. /**
  865. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  866. */
  867. type: string,
  868. /**
  869. * Contains app-specific state stored by the activity.
  870. */
  871. userInfo: unknown) => void): this;
  872. /**
  873. * Emitted when a new webContents is created.
  874. */
  875. on(event: 'web-contents-created', listener: (event: Event,
  876. webContents: WebContents) => void): this;
  877. off(event: 'web-contents-created', listener: (event: Event,
  878. webContents: WebContents) => void): this;
  879. once(event: 'web-contents-created', listener: (event: Event,
  880. webContents: WebContents) => void): this;
  881. addListener(event: 'web-contents-created', listener: (event: Event,
  882. webContents: WebContents) => void): this;
  883. removeListener(event: 'web-contents-created', listener: (event: Event,
  884. webContents: WebContents) => void): this;
  885. /**
  886. * Emitted during Handoff before an activity from a different device wants to be
  887. * resumed. You should call `event.preventDefault()` if you want to handle this
  888. * event.
  889. *
  890. * @platform darwin
  891. */
  892. on(event: 'will-continue-activity', listener: (event: Event,
  893. /**
  894. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  895. */
  896. type: string) => void): this;
  897. /**
  898. * @platform darwin
  899. */
  900. off(event: 'will-continue-activity', listener: (event: Event,
  901. /**
  902. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  903. */
  904. type: string) => void): this;
  905. /**
  906. * @platform darwin
  907. */
  908. once(event: 'will-continue-activity', listener: (event: Event,
  909. /**
  910. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  911. */
  912. type: string) => void): this;
  913. /**
  914. * @platform darwin
  915. */
  916. addListener(event: 'will-continue-activity', listener: (event: Event,
  917. /**
  918. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  919. */
  920. type: string) => void): this;
  921. /**
  922. * @platform darwin
  923. */
  924. removeListener(event: 'will-continue-activity', listener: (event: Event,
  925. /**
  926. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  927. */
  928. type: string) => void): this;
  929. /**
  930. * Emitted when the application has finished basic startup. On Windows and Linux,
  931. * the `will-finish-launching` event is the same as the `ready` event; on macOS,
  932. * this event represents the `applicationWillFinishLaunching` notification of
  933. * `NSApplication`.
  934. *
  935. * In most cases, you should do everything in the `ready` event handler.
  936. */
  937. on(event: 'will-finish-launching', listener: Function): this;
  938. off(event: 'will-finish-launching', listener: Function): this;
  939. once(event: 'will-finish-launching', listener: Function): this;
  940. addListener(event: 'will-finish-launching', listener: Function): this;
  941. removeListener(event: 'will-finish-launching', listener: Function): this;
  942. /**
  943. * Emitted when all windows have been closed and the application will quit. Calling
  944. * `event.preventDefault()` will prevent the default behavior, which is terminating
  945. * the application.
  946. *
  947. * See the description of the `window-all-closed` event for the differences between
  948. * the `will-quit` and `window-all-closed` events.
  949. *
  950. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  951. * a shutdown/restart of the system or a user logout.
  952. */
  953. on(event: 'will-quit', listener: (event: Event) => void): this;
  954. off(event: 'will-quit', listener: (event: Event) => void): this;
  955. once(event: 'will-quit', listener: (event: Event) => void): this;
  956. addListener(event: 'will-quit', listener: (event: Event) => void): this;
  957. removeListener(event: 'will-quit', listener: (event: Event) => void): this;
  958. /**
  959. * Emitted when all windows have been closed.
  960. *
  961. * If you do not subscribe to this event and all windows are closed, the default
  962. * behavior is to quit the app; however, if you subscribe, you control whether the
  963. * app quits or not. If the user pressed `Cmd + Q`, or the developer called
  964. * `app.quit()`, Electron will first try to close all the windows and then emit the
  965. * `will-quit` event, and in this case the `window-all-closed` event would not be
  966. * emitted.
  967. */
  968. on(event: 'window-all-closed', listener: Function): this;
  969. off(event: 'window-all-closed', listener: Function): this;
  970. once(event: 'window-all-closed', listener: Function): this;
  971. addListener(event: 'window-all-closed', listener: Function): this;
  972. removeListener(event: 'window-all-closed', listener: Function): this;
  973. /**
  974. * Adds `path` to the recent documents list.
  975. *
  976. * This list is managed by the OS. On Windows, you can visit the list from the task
  977. * bar, and on macOS, you can visit it from dock menu.
  978. *
  979. * @platform darwin,win32
  980. */
  981. addRecentDocument(path: string): void;
  982. /**
  983. * Clears the recent documents list.
  984. *
  985. * @platform darwin,win32
  986. */
  987. clearRecentDocuments(): void;
  988. /**
  989. * Configures host resolution (DNS and DNS-over-HTTPS). By default, the following
  990. * resolvers will be used, in order:
  991. *
  992. * * DNS-over-HTTPS, if the DNS provider supports it, then
  993. * * the built-in resolver (enabled on macOS only by default), then
  994. * * the system's resolver (e.g. `getaddrinfo`).
  995. *
  996. * This can be configured to either restrict usage of non-encrypted DNS
  997. * (`secureDnsMode: "secure"`), or disable DNS-over-HTTPS (`secureDnsMode: "off"`).
  998. * It is also possible to enable or disable the built-in resolver.
  999. *
  1000. * To disable insecure DNS, you can specify a `secureDnsMode` of `"secure"`. If you
  1001. * do so, you should make sure to provide a list of DNS-over-HTTPS servers to use,
  1002. * in case the user's DNS configuration does not include a provider that supports
  1003. * DoH.
  1004. *
  1005. * This API must be called after the `ready` event is emitted.
  1006. */
  1007. configureHostResolver(options: ConfigureHostResolverOptions): void;
  1008. /**
  1009. * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
  1010. * basis if the GPU processes crashes too frequently. This function disables that
  1011. * behavior.
  1012. *
  1013. * This method can only be called before app is ready.
  1014. */
  1015. disableDomainBlockingFor3DAPIs(): void;
  1016. /**
  1017. * Disables hardware acceleration for current app.
  1018. *
  1019. * This method can only be called before app is ready.
  1020. */
  1021. disableHardwareAcceleration(): void;
  1022. /**
  1023. * Enables full sandbox mode on the app. This means that all renderers will be
  1024. * launched sandboxed, regardless of the value of the `sandbox` flag in
  1025. * `WebPreferences`.
  1026. *
  1027. * This method can only be called before app is ready.
  1028. */
  1029. enableSandbox(): void;
  1030. /**
  1031. * Exits immediately with `exitCode`. `exitCode` defaults to 0.
  1032. *
  1033. * All windows will be closed immediately without asking the user, and the
  1034. * `before-quit` and `will-quit` events will not be emitted.
  1035. */
  1036. exit(exitCode?: number): void;
  1037. /**
  1038. * On Linux, focuses on the first visible window. On macOS, makes the application
  1039. * the active app. On Windows, focuses on the application's first window.
  1040. *
  1041. * You should seek to use the `steal` option as sparingly as possible.
  1042. */
  1043. focus(options?: FocusOptions): void;
  1044. /**
  1045. * Resolve with an object containing the following:
  1046. *
  1047. * * `icon` NativeImage - the display icon of the app handling the protocol.
  1048. * * `path` string - installation path of the app handling the protocol.
  1049. * * `name` string - display name of the app handling the protocol.
  1050. *
  1051. * This method returns a promise that contains the application name, icon and path
  1052. * of the default handler for the protocol (aka URI scheme) of a URL.
  1053. *
  1054. * @platform darwin,win32
  1055. */
  1056. getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
  1057. /**
  1058. * Name of the application handling the protocol, or an empty string if there is no
  1059. * handler. For instance, if Electron is the default handler of the URL, this could
  1060. * be `Electron` on Windows and Mac. However, don't rely on the precise format
  1061. * which is not guaranteed to remain unchanged. Expect a different format on Linux,
  1062. * possibly with a `.desktop` suffix.
  1063. *
  1064. * This method returns the application name of the default handler for the protocol
  1065. * (aka URI scheme) of a URL.
  1066. */
  1067. getApplicationNameForProtocol(url: string): string;
  1068. /**
  1069. * Array of `ProcessMetric` objects that correspond to memory and CPU usage
  1070. * statistics of all the processes associated with the app.
  1071. */
  1072. getAppMetrics(): ProcessMetric[];
  1073. /**
  1074. * The current application directory.
  1075. */
  1076. getAppPath(): string;
  1077. /**
  1078. * The current value displayed in the counter badge.
  1079. *
  1080. * @platform linux,darwin
  1081. */
  1082. getBadgeCount(): number;
  1083. /**
  1084. * The type of the currently running activity.
  1085. *
  1086. * @platform darwin
  1087. */
  1088. getCurrentActivityType(): string;
  1089. /**
  1090. * fulfilled with the app's icon, which is a NativeImage.
  1091. *
  1092. * Fetches a path's associated icon.
  1093. *
  1094. * On _Windows_, there a 2 kinds of icons:
  1095. *
  1096. * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
  1097. * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
  1098. *
  1099. * On _Linux_ and _macOS_, icons depend on the application associated with file
  1100. * mime type.
  1101. */
  1102. getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
  1103. /**
  1104. * The Graphics Feature Status from `chrome://gpu/`.
  1105. *
  1106. * **Note:** This information is only usable after the `gpu-info-update` event is
  1107. * emitted.
  1108. */
  1109. getGPUFeatureStatus(): GPUFeatureStatus;
  1110. /**
  1111. * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
  1112. * containing all the GPU Information as in chromium's GPUInfo object. This
  1113. * includes the version and driver information that's shown on `chrome://gpu` page.
  1114. *
  1115. * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
  1116. * fewer attributes than when requested with `complete`. Here's an example of basic
  1117. * response:
  1118. *
  1119. * Using `basic` should be preferred if only basic information like `vendorId` or
  1120. * `deviceId` is needed.
  1121. */
  1122. getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
  1123. /**
  1124. * * `minItems` Integer - The minimum number of items that will be shown in the
  1125. * Jump List (for a more detailed description of this value see the MSDN docs).
  1126. * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
  1127. * correspond to items that the user has explicitly removed from custom categories
  1128. * in the Jump List. These items must not be re-added to the Jump List in the
  1129. * **next** call to `app.setJumpList()`, Windows will not display any custom
  1130. * category that contains any of the removed items.
  1131. *
  1132. * @platform win32
  1133. */
  1134. getJumpListSettings(): JumpListSettings;
  1135. /**
  1136. * The current application locale, fetched using Chromium's `l10n_util` library.
  1137. * Possible return values are documented here.
  1138. *
  1139. * To set the locale, you'll want to use a command line switch at app startup,
  1140. * which may be found here.
  1141. *
  1142. * **Note:** When distributing your packaged app, you have to also ship the
  1143. * `locales` folder.
  1144. *
  1145. * **Note:** This API must be called after the `ready` event is emitted.
  1146. *
  1147. * **Note:** To see example return values of this API compared to other locale and
  1148. * language APIs, see `app.getPreferredSystemLanguages()`.
  1149. */
  1150. getLocale(): string;
  1151. /**
  1152. * User operating system's locale two-letter ISO 3166 country code. The value is
  1153. * taken from native OS APIs.
  1154. *
  1155. * **Note:** When unable to detect locale country code, it returns empty string.
  1156. */
  1157. getLocaleCountryCode(): string;
  1158. /**
  1159. * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
  1160. * you need to pass the same arguments here for `openAtLogin` to be set correctly.
  1161. *
  1162. *
  1163. * * `openAtLogin` boolean - `true` if the app is set to open at login.
  1164. * * `openAsHidden` boolean _macOS_ _Deprecated_ - `true` if the app is set to open
  1165. * as hidden at login. This does not work on macOS 13 and up.
  1166. * * `wasOpenedAtLogin` boolean _macOS_ - `true` if the app was opened at login
  1167. * automatically.
  1168. * * `wasOpenedAsHidden` boolean _macOS_ _Deprecated_ - `true` if the app was
  1169. * opened as a hidden login item. This indicates that the app should not open any
  1170. * windows at startup. This setting is not available on MAS builds or on macOS 13
  1171. * and up.
  1172. * * `restoreState` boolean _macOS_ _Deprecated_ - `true` if the app was opened as
  1173. * a login item that should restore the state from the previous session. This
  1174. * indicates that the app should restore the windows that were open the last time
  1175. * the app was closed. This setting is not available on MAS builds or on macOS 13
  1176. * and up.
  1177. * * `status` string _macOS_ - can be one of `not-registered`, `enabled`,
  1178. * `requires-approval`, or `not-found`.
  1179. * * `executableWillLaunchAtLogin` boolean _Windows_ - `true` if app is set to open
  1180. * at login and its run key is not deactivated. This differs from `openAtLogin` as
  1181. * it ignores the `args` option, this property will be true if the given executable
  1182. * would be launched at login with **any** arguments.
  1183. * * `launchItems` Object[] _Windows_
  1184. * * `name` string _Windows_ - name value of a registry entry.
  1185. * * `path` string _Windows_ - The executable to an app that corresponds to a
  1186. * registry entry.
  1187. * * `args` string[] _Windows_ - the command-line arguments to pass to the
  1188. * executable.
  1189. * * `scope` string _Windows_ - one of `user` or `machine`. Indicates whether the
  1190. * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  1191. * * `enabled` boolean _Windows_ - `true` if the app registry key is startup
  1192. * approved and therefore shows as `enabled` in Task Manager and Windows settings.
  1193. *
  1194. * @platform darwin,win32
  1195. */
  1196. getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
  1197. /**
  1198. * The current application's name, which is the name in the application's
  1199. * `package.json` file.
  1200. *
  1201. * Usually the `name` field of `package.json` is a short lowercase name, according
  1202. * to the npm modules spec. You should usually also specify a `productName` field,
  1203. * which is your application's full capitalized name, and which will be preferred
  1204. * over `name` by Electron.
  1205. */
  1206. getName(): string;
  1207. /**
  1208. * A path to a special directory or file associated with `name`. On failure, an
  1209. * `Error` is thrown.
  1210. *
  1211. * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
  1212. * called first, a default log directory will be created equivalent to calling
  1213. * `app.setAppLogsPath()` without a `path` parameter.
  1214. */
  1215. getPath(name: 'home' | 'appData' | 'userData' | 'sessionData' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps'): string;
  1216. /**
  1217. * The user's preferred system languages from most preferred to least preferred,
  1218. * including the country codes if applicable. A user can modify and add to this
  1219. * list on Windows or macOS through the Language and Region settings.
  1220. *
  1221. * The API uses `GlobalizationPreferences` (with a fallback to
  1222. * `GetSystemPreferredUILanguages`) on Windows, `\[NSLocale preferredLanguages\]`
  1223. * on macOS, and `g_get_language_names` on Linux.
  1224. *
  1225. * This API can be used for purposes such as deciding what language to present the
  1226. * application in.
  1227. *
  1228. * Here are some examples of return values of the various language and locale APIs
  1229. * with different configurations:
  1230. *
  1231. * On Windows, given application locale is German, the regional format is Finnish
  1232. * (Finland), and the preferred system languages from most to least preferred are
  1233. * French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish
  1234. * (Latin America):
  1235. *
  1236. * On macOS, given the application locale is German, the region is Finland, and the
  1237. * preferred system languages from most to least preferred are French (Canada),
  1238. * English (US), Simplified Chinese, and Spanish (Latin America):
  1239. *
  1240. * Both the available languages and regions and the possible return values differ
  1241. * between the two operating systems.
  1242. *
  1243. * As can be seen with the example above, on Windows, it is possible that a
  1244. * preferred system language has no country code, and that one of the preferred
  1245. * system languages corresponds with the language used for the regional format. On
  1246. * macOS, the region serves more as a default country code: the user doesn't need
  1247. * to have Finnish as a preferred language to use Finland as the region,and the
  1248. * country code `FI` is used as the country code for preferred system languages
  1249. * that do not have associated countries in the language name.
  1250. */
  1251. getPreferredSystemLanguages(): string[];
  1252. /**
  1253. * The current system locale. On Windows and Linux, it is fetched using Chromium's
  1254. * `i18n` library. On macOS, `[NSLocale currentLocale]` is used instead. To get the
  1255. * user's current system language, which is not always the same as the locale, it
  1256. * is better to use `app.getPreferredSystemLanguages()`.
  1257. *
  1258. * Different operating systems also use the regional data differently:
  1259. *
  1260. * * Windows 11 uses the regional format for numbers, dates, and times.
  1261. * * macOS Monterey uses the region for formatting numbers, dates, times, and for
  1262. * selecting the currency symbol to use.
  1263. *
  1264. * Therefore, this API can be used for purposes such as choosing a format for
  1265. * rendering dates and times in a calendar app, especially when the developer wants
  1266. * the format to be consistent with the OS.
  1267. *
  1268. * **Note:** This API must be called after the `ready` event is emitted.
  1269. *
  1270. * **Note:** To see example return values of this API compared to other locale and
  1271. * language APIs, see `app.getPreferredSystemLanguages()`.
  1272. */
  1273. getSystemLocale(): string;
  1274. /**
  1275. * The version of the loaded application. If no version is found in the
  1276. * application's `package.json` file, the version of the current bundle or
  1277. * executable is returned.
  1278. */
  1279. getVersion(): string;
  1280. /**
  1281. * This method returns whether or not this instance of your app is currently
  1282. * holding the single instance lock. You can request the lock with
  1283. * `app.requestSingleInstanceLock()` and release with
  1284. * `app.releaseSingleInstanceLock()`
  1285. */
  1286. hasSingleInstanceLock(): boolean;
  1287. /**
  1288. * Hides all application windows without minimizing them.
  1289. *
  1290. * @platform darwin
  1291. */
  1292. hide(): void;
  1293. /**
  1294. * Imports the certificate in pkcs12 format into the platform certificate store.
  1295. * `callback` is called with the `result` of import operation, a value of `0`
  1296. * indicates success while any other value indicates failure according to Chromium
  1297. * net_error_list.
  1298. *
  1299. * @platform linux
  1300. */
  1301. importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
  1302. /**
  1303. * Invalidates the current Handoff user activity.
  1304. *
  1305. * @platform darwin
  1306. */
  1307. invalidateCurrentActivity(): void;
  1308. /**
  1309. * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
  1310. * will return `true` if the use of assistive technologies, such as screen readers,
  1311. * has been detected. See
  1312. * https://www.chromium.org/developers/design-documents/accessibility for more
  1313. * details.
  1314. *
  1315. * @platform darwin,win32
  1316. */
  1317. isAccessibilitySupportEnabled(): boolean;
  1318. /**
  1319. * Whether the current executable is the default handler for a protocol (aka URI
  1320. * scheme).
  1321. *
  1322. * **Note:** On macOS, you can use this method to check if the app has been
  1323. * registered as the default protocol handler for a protocol. You can also verify
  1324. * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
  1325. * macOS machine. Please refer to Apple's documentation for details.
  1326. *
  1327. * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
  1328. * internally.
  1329. */
  1330. isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1331. /**
  1332. * whether or not the current OS version allows for native emoji pickers.
  1333. */
  1334. isEmojiPanelSupported(): boolean;
  1335. /**
  1336. * `true` if the application—including all of its windows—is hidden (e.g. with
  1337. * `Command-H`), `false` otherwise.
  1338. *
  1339. * @platform darwin
  1340. */
  1341. isHidden(): boolean;
  1342. /**
  1343. * Whether the application is currently running from the systems Application
  1344. * folder. Use in combination with `app.moveToApplicationsFolder()`
  1345. *
  1346. * @platform darwin
  1347. */
  1348. isInApplicationsFolder(): boolean;
  1349. /**
  1350. * `true` if Electron has finished initializing, `false` otherwise. See also
  1351. * `app.whenReady()`.
  1352. */
  1353. isReady(): boolean;
  1354. /**
  1355. * whether `Secure Keyboard Entry` is enabled.
  1356. *
  1357. * By default this API will return `false`.
  1358. *
  1359. * @platform darwin
  1360. */
  1361. isSecureKeyboardEntryEnabled(): boolean;
  1362. /**
  1363. * Whether the current desktop environment is Unity launcher.
  1364. *
  1365. * @platform linux
  1366. */
  1367. isUnityRunning(): boolean;
  1368. /**
  1369. * Whether the move was successful. Please note that if the move is successful,
  1370. * your application will quit and relaunch.
  1371. *
  1372. * No confirmation dialog will be presented by default. If you wish to allow the
  1373. * user to confirm the operation, you may do so using the `dialog` API.
  1374. *
  1375. * **NOTE:** This method throws errors if anything other than the user causes the
  1376. * move to fail. For instance if the user cancels the authorization dialog, this
  1377. * method returns false. If we fail to perform the copy, then this method will
  1378. * throw an error. The message in the error should be informative and tell you
  1379. * exactly what went wrong.
  1380. *
  1381. * By default, if an app of the same name as the one being moved exists in the
  1382. * Applications directory and is _not_ running, the existing app will be trashed
  1383. * and the active app moved into its place. If it _is_ running, the preexisting
  1384. * running app will assume focus and the previously active app will quit itself.
  1385. * This behavior can be changed by providing the optional conflict handler, where
  1386. * the boolean returned by the handler determines whether or not the move conflict
  1387. * is resolved with default behavior. i.e. returning `false` will ensure no
  1388. * further action is taken, returning `true` will result in the default behavior
  1389. * and the method continuing.
  1390. *
  1391. * For example:
  1392. *
  1393. * Would mean that if an app already exists in the user directory, if the user
  1394. * chooses to 'Continue Move' then the function would continue with its default
  1395. * behavior and the existing app will be trashed and the active app moved into its
  1396. * place.
  1397. *
  1398. * @platform darwin
  1399. */
  1400. moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
  1401. /**
  1402. * Try to close all windows. The `before-quit` event will be emitted first. If all
  1403. * windows are successfully closed, the `will-quit` event will be emitted and by
  1404. * default the application will terminate.
  1405. *
  1406. * This method guarantees that all `beforeunload` and `unload` event handlers are
  1407. * correctly executed. It is possible that a window cancels the quitting by
  1408. * returning `false` in the `beforeunload` event handler.
  1409. */
  1410. quit(): void;
  1411. /**
  1412. * Relaunches the app when current instance exits.
  1413. *
  1414. * By default, the new instance will use the same working directory and command
  1415. * line arguments with current instance. When `args` is specified, the `args` will
  1416. * be passed as command line arguments instead. When `execPath` is specified, the
  1417. * `execPath` will be executed for relaunch instead of current app.
  1418. *
  1419. * Note that this method does not quit the app when executed, you have to call
  1420. * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
  1421. *
  1422. * When `app.relaunch` is called for multiple times, multiple instances will be
  1423. * started after current instance exited.
  1424. *
  1425. * An example of restarting current instance immediately and adding a new command
  1426. * line argument to the new instance:
  1427. */
  1428. relaunch(options?: RelaunchOptions): void;
  1429. /**
  1430. * Releases all locks that were created by `requestSingleInstanceLock`. This will
  1431. * allow multiple instances of the application to once again run side by side.
  1432. */
  1433. releaseSingleInstanceLock(): void;
  1434. /**
  1435. * Whether the call succeeded.
  1436. *
  1437. * This method checks if the current executable as the default handler for a
  1438. * protocol (aka URI scheme). If so, it will remove the app as the default handler.
  1439. *
  1440. * @platform darwin,win32
  1441. */
  1442. removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1443. /**
  1444. * The return value of this method indicates whether or not this instance of your
  1445. * application successfully obtained the lock. If it failed to obtain the lock,
  1446. * you can assume that another instance of your application is already running with
  1447. * the lock and exit immediately.
  1448. *
  1449. * I.e. This method returns `true` if your process is the primary instance of your
  1450. * application and your app should continue loading. It returns `false` if your
  1451. * process should immediately quit as it has sent its parameters to another
  1452. * instance that has already acquired the lock.
  1453. *
  1454. * On macOS, the system enforces single instance automatically when users try to
  1455. * open a second instance of your app in Finder, and the `open-file` and `open-url`
  1456. * events will be emitted for that. However when users start your app in command
  1457. * line, the system's single instance mechanism will be bypassed, and you have to
  1458. * use this method to ensure single instance.
  1459. *
  1460. * An example of activating the window of primary instance when a second instance
  1461. * starts:
  1462. */
  1463. requestSingleInstanceLock(additionalData?: Record<any, any>): boolean;
  1464. /**
  1465. * Marks the current Handoff user activity as inactive without invalidating it.
  1466. *
  1467. * @platform darwin
  1468. */
  1469. resignCurrentActivity(): void;
  1470. /**
  1471. * Resolves with the proxy information for `url` that will be used when attempting
  1472. * to make requests using Net in the utility process.
  1473. */
  1474. resolveProxy(url: string): Promise<string>;
  1475. /**
  1476. * Set the about panel options. This will override the values defined in the app's
  1477. * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
  1478. * must be set in order to be shown; there are no defaults.
  1479. *
  1480. * If you do not set `credits` but still wish to surface them in your app, AppKit
  1481. * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
  1482. * that order, in the bundle returned by the NSBundle class method main. The first
  1483. * file found is used, and if none is found, the info area is left blank. See Apple
  1484. * documentation for more information.
  1485. */
  1486. setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
  1487. /**
  1488. * Manually enables Chrome's accessibility support, allowing to expose
  1489. * accessibility switch to users in application settings. See Chromium's
  1490. * accessibility docs for more details. Disabled by default.
  1491. *
  1492. * This API must be called after the `ready` event is emitted.
  1493. *
  1494. * **Note:** Rendering accessibility tree can significantly affect the performance
  1495. * of your app. It should not be enabled by default.
  1496. *
  1497. * @platform darwin,win32
  1498. */
  1499. setAccessibilitySupportEnabled(enabled: boolean): void;
  1500. /**
  1501. * Sets the activation policy for a given app.
  1502. *
  1503. * Activation policy types:
  1504. *
  1505. * * 'regular' - The application is an ordinary app that appears in the Dock and
  1506. * may have a user interface.
  1507. * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
  1508. * menu bar, but it may be activated programmatically or by clicking on one of its
  1509. * windows.
  1510. * * 'prohibited' - The application doesn’t appear in the Dock and may not create
  1511. * windows or be activated.
  1512. *
  1513. * @platform darwin
  1514. */
  1515. setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
  1516. /**
  1517. * Sets or creates a directory your app's logs which can then be manipulated with
  1518. * `app.getPath()` or `app.setPath(pathName, newPath)`.
  1519. *
  1520. * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
  1521. * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
  1522. * `userData` directory on _Linux_ and _Windows_.
  1523. */
  1524. setAppLogsPath(path?: string): void;
  1525. /**
  1526. * Changes the Application User Model ID to `id`.
  1527. *
  1528. * @platform win32
  1529. */
  1530. setAppUserModelId(id: string): void;
  1531. /**
  1532. * Whether the call succeeded.
  1533. *
  1534. * Sets the current executable as the default handler for a protocol (aka URI
  1535. * scheme). It allows you to integrate your app deeper into the operating system.
  1536. * Once registered, all links with `your-protocol://` will be opened with the
  1537. * current executable. The whole link, including protocol, will be passed to your
  1538. * application as a parameter.
  1539. *
  1540. * **Note:** On macOS, you can only register protocols that have been added to your
  1541. * app's `info.plist`, which cannot be modified at runtime. However, you can change
  1542. * the file during build time via Electron Forge, Electron Packager, or by editing
  1543. * `info.plist` with a text editor. Please refer to Apple's documentation for
  1544. * details.
  1545. *
  1546. * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
  1547. * will return `true` for all calls but the registry key it sets won't be
  1548. * accessible by other applications. In order to register your Windows Store
  1549. * application as a default protocol handler you must declare the protocol in your
  1550. * manifest.
  1551. *
  1552. * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
  1553. * internally.
  1554. */
  1555. setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1556. /**
  1557. * Whether the call succeeded.
  1558. *
  1559. * Sets the counter badge for current app. Setting the count to `0` will hide the
  1560. * badge.
  1561. *
  1562. * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
  1563. *
  1564. * **Note:** Unity launcher requires a `.desktop` file to work. For more
  1565. * information, please read the Unity integration documentation.
  1566. *
  1567. * **Note:** On macOS, you need to ensure that your application has the permission
  1568. * to display notifications for this method to work.
  1569. *
  1570. * @platform linux,darwin
  1571. */
  1572. setBadgeCount(count?: number): boolean;
  1573. /**
  1574. * Sets or removes a custom Jump List for the application, and returns one of the
  1575. * following strings:
  1576. *
  1577. * * `ok` - Nothing went wrong.
  1578. * * `error` - One or more errors occurred, enable runtime logging to figure out
  1579. * the likely cause.
  1580. * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
  1581. * category in the Jump List. Separators are only allowed in the standard `Tasks`
  1582. * category.
  1583. * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
  1584. * Jump List for a file type the app isn't registered to handle.
  1585. * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
  1586. * Jump List due to user privacy or group policy settings.
  1587. *
  1588. * If `categories` is `null` the previously set custom Jump List (if any) will be
  1589. * replaced by the standard Jump List for the app (managed by Windows).
  1590. *
  1591. * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
  1592. * property set then its `type` is assumed to be `tasks`. If the `name` property is
  1593. * set but the `type` property is omitted then the `type` is assumed to be
  1594. * `custom`.
  1595. *
  1596. * **Note:** Users can remove items from custom categories, and Windows will not
  1597. * allow a removed item to be added back into a custom category until **after** the
  1598. * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
  1599. * removed item to a custom category earlier than that will result in the entire
  1600. * custom category being omitted from the Jump List. The list of removed items can
  1601. * be obtained using `app.getJumpListSettings()`.
  1602. *
  1603. * **Note:** The maximum length of a Jump List item's `description` property is 260
  1604. * characters. Beyond this limit, the item will not be added to the Jump List, nor
  1605. * will it be displayed.
  1606. *
  1607. * Here's a very simple example of creating a custom Jump List:
  1608. *
  1609. * @platform win32
  1610. */
  1611. setJumpList(categories: (JumpListCategory[]) | (null)): ('ok' | 'error' | 'invalidSeparatorError' | 'fileTypeRegistrationError' | 'customCategoryAccessDeniedError');
  1612. /**
  1613. * Set the app's login item settings.
  1614. *
  1615. * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
  1616. * want to set the launch path to Update.exe, and pass arguments that specify your
  1617. * application name. For example:
  1618. *
  1619. * For more information about setting different services as login items on macOS 13
  1620. * and up, see `SMAppService`.
  1621. *
  1622. * @platform darwin,win32
  1623. */
  1624. setLoginItemSettings(settings: Settings): void;
  1625. /**
  1626. * Overrides the current application's name.
  1627. *
  1628. * **Note:** This function overrides the name used internally by Electron; it does
  1629. * not affect the name that the OS uses.
  1630. */
  1631. setName(name: string): void;
  1632. /**
  1633. * Overrides the `path` to a special directory or file associated with `name`. If
  1634. * the path specifies a directory that does not exist, an `Error` is thrown. In
  1635. * that case, the directory should be created with `fs.mkdirSync` or similar.
  1636. *
  1637. * You can only override paths of a `name` defined in `app.getPath`.
  1638. *
  1639. * By default, web pages' cookies and caches will be stored under the `sessionData`
  1640. * directory. If you want to change this location, you have to override the
  1641. * `sessionData` path before the `ready` event of the `app` module is emitted.
  1642. */
  1643. setPath(name: string, path: string): void;
  1644. setProxy(config: ProxyConfig): void;
  1645. /**
  1646. * Set the `Secure Keyboard Entry` is enabled in your application.
  1647. *
  1648. * By using this API, important information such as password and other sensitive
  1649. * information can be prevented from being intercepted by other processes.
  1650. *
  1651. * See Apple's documentation for more details.
  1652. *
  1653. * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
  1654. * when it is no longer needed.
  1655. *
  1656. * @platform darwin
  1657. */
  1658. setSecureKeyboardEntryEnabled(enabled: boolean): void;
  1659. /**
  1660. * Creates an `NSUserActivity` and sets it as the current activity. The activity is
  1661. * eligible for Handoff to another device afterward.
  1662. *
  1663. * @platform darwin
  1664. */
  1665. setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
  1666. /**
  1667. * Adds `tasks` to the Tasks category of the Jump List on Windows.
  1668. *
  1669. * `tasks` is an array of `Task` objects.
  1670. *
  1671. * Whether the call succeeded.
  1672. *
  1673. * **Note:** If you'd like to customize the Jump List even more use
  1674. * `app.setJumpList(categories)` instead.
  1675. *
  1676. * @platform win32
  1677. */
  1678. setUserTasks(tasks: Task[]): boolean;
  1679. /**
  1680. * Shows application windows after they were hidden. Does not automatically focus
  1681. * them.
  1682. *
  1683. * @platform darwin
  1684. */
  1685. show(): void;
  1686. /**
  1687. * Show the app's about panel options. These options can be overridden with
  1688. * `app.setAboutPanelOptions(options)`. This function runs asynchronously.
  1689. */
  1690. showAboutPanel(): void;
  1691. /**
  1692. * Show the platform's native emoji picker.
  1693. *
  1694. * @platform darwin,win32
  1695. */
  1696. showEmojiPanel(): void;
  1697. /**
  1698. * This function **must** be called once you have finished accessing the security
  1699. * scoped file. If you do not remember to stop accessing the bookmark, kernel
  1700. * resources will be leaked and your app will lose its ability to reach outside the
  1701. * sandbox completely, until your app is restarted.
  1702. *
  1703. * Start accessing a security scoped resource. With this method Electron
  1704. * applications that are packaged for the Mac App Store may reach outside their
  1705. * sandbox to access files chosen by the user. See Apple's documentation for a
  1706. * description of how this system works.
  1707. *
  1708. * @platform mas
  1709. */
  1710. startAccessingSecurityScopedResource(bookmarkData: string): Function;
  1711. /**
  1712. * Updates the current activity if its type matches `type`, merging the entries
  1713. * from `userInfo` into its current `userInfo` dictionary.
  1714. *
  1715. * @platform darwin
  1716. */
  1717. updateCurrentActivity(type: string, userInfo: any): void;
  1718. /**
  1719. * fulfilled when Electron is initialized. May be used as a convenient alternative
  1720. * to checking `app.isReady()` and subscribing to the `ready` event if the app is
  1721. * not ready yet.
  1722. */
  1723. whenReady(): Promise<void>;
  1724. /**
  1725. * A `boolean` property that's `true` if Chrome's accessibility support is enabled,
  1726. * `false` otherwise. This property will be `true` if the use of assistive
  1727. * technologies, such as screen readers, has been detected. Setting this property
  1728. * to `true` manually enables Chrome's accessibility support, allowing developers
  1729. * to expose accessibility switch to users in application settings.
  1730. *
  1731. * See Chromium's accessibility docs for more details. Disabled by default.
  1732. *
  1733. * This API must be called after the `ready` event is emitted.
  1734. *
  1735. * **Note:** Rendering accessibility tree can significantly affect the performance
  1736. * of your app. It should not be enabled by default.
  1737. *
  1738. * @platform darwin,win32
  1739. */
  1740. accessibilitySupportEnabled: boolean;
  1741. /**
  1742. * A `Menu | null` property that returns `Menu` if one has been set and `null`
  1743. * otherwise. Users can pass a Menu to set this property.
  1744. */
  1745. applicationMenu: (Menu) | (null);
  1746. /**
  1747. * An `Integer` property that returns the badge count for current app. Setting the
  1748. * count to `0` will hide the badge.
  1749. *
  1750. * On macOS, setting this with any nonzero integer shows on the dock icon. On
  1751. * Linux, this property only works for Unity launcher.
  1752. *
  1753. * **Note:** Unity launcher requires a `.desktop` file to work. For more
  1754. * information, please read the Unity integration documentation.
  1755. *
  1756. * **Note:** On macOS, you need to ensure that your application has the permission
  1757. * to display notifications for this property to take effect.
  1758. *
  1759. * @platform linux,darwin
  1760. */
  1761. badgeCount: number;
  1762. /**
  1763. * A `CommandLine` object that allows you to read and manipulate the command line
  1764. * arguments that Chromium uses.
  1765. *
  1766. */
  1767. readonly commandLine: CommandLine;
  1768. /**
  1769. * A `Dock` `| undefined` object that allows you to perform actions on your app
  1770. * icon in the user's dock on macOS.
  1771. *
  1772. * @platform darwin
  1773. */
  1774. readonly dock: Dock;
  1775. /**
  1776. * A `boolean` property that returns `true` if the app is packaged, `false`
  1777. * otherwise. For many apps, this property can be used to distinguish development
  1778. * and production environments.
  1779. *
  1780. */
  1781. readonly isPackaged: boolean;
  1782. /**
  1783. * A `string` property that indicates the current application's name, which is the
  1784. * name in the application's `package.json` file.
  1785. *
  1786. * Usually the `name` field of `package.json` is a short lowercase name, according
  1787. * to the npm modules spec. You should usually also specify a `productName` field,
  1788. * which is your application's full capitalized name, and which will be preferred
  1789. * over `name` by Electron.
  1790. */
  1791. name: string;
  1792. /**
  1793. * A `boolean` which when `true` indicates that the app is currently running under
  1794. * an ARM64 translator (like the macOS Rosetta Translator Environment or Windows
  1795. * WOW).
  1796. *
  1797. * You can use this property to prompt users to download the arm64 version of your
  1798. * application when they are mistakenly running the x64 version under Rosetta or
  1799. * WOW.
  1800. *
  1801. * @platform darwin,win32
  1802. */
  1803. readonly runningUnderARM64Translation: boolean;
  1804. /**
  1805. * A `string` which is the user agent string Electron will use as a global
  1806. * fallback.
  1807. *
  1808. * This is the user agent that will be used when no user agent is set at the
  1809. * `webContents` or `session` level. It is useful for ensuring that your entire
  1810. * app has the same user agent. Set to a custom value as early as possible in your
  1811. * app's initialization to ensure that your overridden value is used.
  1812. */
  1813. userAgentFallback: string;
  1814. }
  1815. interface AutoUpdater extends NodeJS.EventEmitter {
  1816. // Docs: https://electronjs.org/docs/api/auto-updater
  1817. /**
  1818. * This event is emitted after a user calls `quitAndInstall()`.
  1819. *
  1820. * When this API is called, the `before-quit` event is not emitted before all
  1821. * windows are closed. As a result you should listen to this event if you wish to
  1822. * perform actions before the windows are closed while a process is quitting, as
  1823. * well as listening to `before-quit`.
  1824. */
  1825. on(event: 'before-quit-for-update', listener: Function): this;
  1826. off(event: 'before-quit-for-update', listener: Function): this;
  1827. once(event: 'before-quit-for-update', listener: Function): this;
  1828. addListener(event: 'before-quit-for-update', listener: Function): this;
  1829. removeListener(event: 'before-quit-for-update', listener: Function): this;
  1830. /**
  1831. * Emitted when checking if an update has started.
  1832. */
  1833. on(event: 'checking-for-update', listener: Function): this;
  1834. off(event: 'checking-for-update', listener: Function): this;
  1835. once(event: 'checking-for-update', listener: Function): this;
  1836. addListener(event: 'checking-for-update', listener: Function): this;
  1837. removeListener(event: 'checking-for-update', listener: Function): this;
  1838. /**
  1839. * Emitted when there is an error while updating.
  1840. */
  1841. on(event: 'error', listener: (error: Error) => void): this;
  1842. off(event: 'error', listener: (error: Error) => void): this;
  1843. once(event: 'error', listener: (error: Error) => void): this;
  1844. addListener(event: 'error', listener: (error: Error) => void): this;
  1845. removeListener(event: 'error', listener: (error: Error) => void): this;
  1846. /**
  1847. * Emitted when there is an available update. The update is downloaded
  1848. * automatically.
  1849. */
  1850. on(event: 'update-available', listener: Function): this;
  1851. off(event: 'update-available', listener: Function): this;
  1852. once(event: 'update-available', listener: Function): this;
  1853. addListener(event: 'update-available', listener: Function): this;
  1854. removeListener(event: 'update-available', listener: Function): this;
  1855. /**
  1856. * Emitted when an update has been downloaded.
  1857. *
  1858. * On Windows only `releaseName` is available.
  1859. *
  1860. * **Note:** It is not strictly necessary to handle this event. A successfully
  1861. * downloaded update will still be applied the next time the application starts.
  1862. */
  1863. on(event: 'update-downloaded', listener: (event: Event,
  1864. releaseNotes: string,
  1865. releaseName: string,
  1866. releaseDate: Date,
  1867. updateURL: string) => void): this;
  1868. off(event: 'update-downloaded', listener: (event: Event,
  1869. releaseNotes: string,
  1870. releaseName: string,
  1871. releaseDate: Date,
  1872. updateURL: string) => void): this;
  1873. once(event: 'update-downloaded', listener: (event: Event,
  1874. releaseNotes: string,
  1875. releaseName: string,
  1876. releaseDate: Date,
  1877. updateURL: string) => void): this;
  1878. addListener(event: 'update-downloaded', listener: (event: Event,
  1879. releaseNotes: string,
  1880. releaseName: string,
  1881. releaseDate: Date,
  1882. updateURL: string) => void): this;
  1883. removeListener(event: 'update-downloaded', listener: (event: Event,
  1884. releaseNotes: string,
  1885. releaseName: string,
  1886. releaseDate: Date,
  1887. updateURL: string) => void): this;
  1888. /**
  1889. * Emitted when there is no available update.
  1890. */
  1891. on(event: 'update-not-available', listener: Function): this;
  1892. off(event: 'update-not-available', listener: Function): this;
  1893. once(event: 'update-not-available', listener: Function): this;
  1894. addListener(event: 'update-not-available', listener: Function): this;
  1895. removeListener(event: 'update-not-available', listener: Function): this;
  1896. /**
  1897. * Asks the server whether there is an update. You must call `setFeedURL` before
  1898. * using this API.
  1899. *
  1900. * **Note:** If an update is available it will be downloaded automatically. Calling
  1901. * `autoUpdater.checkForUpdates()` twice will download the update two times.
  1902. */
  1903. checkForUpdates(): void;
  1904. /**
  1905. * The current update feed URL.
  1906. */
  1907. getFeedURL(): string;
  1908. /**
  1909. * Restarts the app and installs the update after it has been downloaded. It should
  1910. * only be called after `update-downloaded` has been emitted.
  1911. *
  1912. * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
  1913. * windows first, and automatically call `app.quit()` after all windows have been
  1914. * closed.
  1915. *
  1916. * **Note:** It is not strictly necessary to call this function to apply an update,
  1917. * as a successfully downloaded update will always be applied the next time the
  1918. * application starts.
  1919. */
  1920. quitAndInstall(): void;
  1921. /**
  1922. * Sets the `url` and initialize the auto updater.
  1923. */
  1924. setFeedURL(options: FeedURLOptions): void;
  1925. }
  1926. class BaseWindow extends NodeEventEmitter {
  1927. // Docs: https://electronjs.org/docs/api/base-window
  1928. /**
  1929. * Emitted when the window is set or unset to show always on top of other windows.
  1930. */
  1931. on(event: 'always-on-top-changed', listener: (event: Event,
  1932. isAlwaysOnTop: boolean) => void): this;
  1933. off(event: 'always-on-top-changed', listener: (event: Event,
  1934. isAlwaysOnTop: boolean) => void): this;
  1935. once(event: 'always-on-top-changed', listener: (event: Event,
  1936. isAlwaysOnTop: boolean) => void): this;
  1937. addListener(event: 'always-on-top-changed', listener: (event: Event,
  1938. isAlwaysOnTop: boolean) => void): this;
  1939. removeListener(event: 'always-on-top-changed', listener: (event: Event,
  1940. isAlwaysOnTop: boolean) => void): this;
  1941. /**
  1942. * Emitted when an App Command is invoked. These are typically related to keyboard
  1943. * media keys or browser commands, as well as the "Back" button built into some
  1944. * mice on Windows.
  1945. *
  1946. * Commands are lowercased, underscores are replaced with hyphens, and the
  1947. * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
  1948. * emitted as `browser-backward`.
  1949. *
  1950. * The following app commands are explicitly supported on Linux:
  1951. *
  1952. * * `browser-backward`
  1953. * * `browser-forward`
  1954. *
  1955. * @platform win32,linux
  1956. */
  1957. on(event: 'app-command', listener: (event: Event,
  1958. command: string) => void): this;
  1959. /**
  1960. * @platform win32,linux
  1961. */
  1962. off(event: 'app-command', listener: (event: Event,
  1963. command: string) => void): this;
  1964. /**
  1965. * @platform win32,linux
  1966. */
  1967. once(event: 'app-command', listener: (event: Event,
  1968. command: string) => void): this;
  1969. /**
  1970. * @platform win32,linux
  1971. */
  1972. addListener(event: 'app-command', listener: (event: Event,
  1973. command: string) => void): this;
  1974. /**
  1975. * @platform win32,linux
  1976. */
  1977. removeListener(event: 'app-command', listener: (event: Event,
  1978. command: string) => void): this;
  1979. /**
  1980. * Emitted when the window loses focus.
  1981. */
  1982. on(event: 'blur', listener: Function): this;
  1983. off(event: 'blur', listener: Function): this;
  1984. once(event: 'blur', listener: Function): this;
  1985. addListener(event: 'blur', listener: Function): this;
  1986. removeListener(event: 'blur', listener: Function): this;
  1987. /**
  1988. * Emitted when the window is going to be closed. It's emitted before the
  1989. * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
  1990. * will cancel the close.
  1991. *
  1992. * Usually you would want to use the `beforeunload` handler to decide whether the
  1993. * window should be closed, which will also be called when the window is reloaded.
  1994. * In Electron, returning any value other than `undefined` would cancel the close.
  1995. * For example:
  1996. *
  1997. * _**Note**: There is a subtle difference between the behaviors of
  1998. * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
  1999. * handler)`. It is recommended to always set the `event.returnValue` explicitly,
  2000. * instead of only returning a value, as the former works more consistently within
  2001. * Electron._
  2002. */
  2003. on(event: 'close', listener: (event: Event) => void): this;
  2004. off(event: 'close', listener: (event: Event) => void): this;
  2005. once(event: 'close', listener: (event: Event) => void): this;
  2006. addListener(event: 'close', listener: (event: Event) => void): this;
  2007. removeListener(event: 'close', listener: (event: Event) => void): this;
  2008. /**
  2009. * Emitted when the window is closed. After you have received this event you should
  2010. * remove the reference to the window and avoid using it any more.
  2011. */
  2012. on(event: 'closed', listener: Function): this;
  2013. off(event: 'closed', listener: Function): this;
  2014. once(event: 'closed', listener: Function): this;
  2015. addListener(event: 'closed', listener: Function): this;
  2016. removeListener(event: 'closed', listener: Function): this;
  2017. /**
  2018. * Emitted when the window enters a full-screen state.
  2019. */
  2020. on(event: 'enter-full-screen', listener: Function): this;
  2021. off(event: 'enter-full-screen', listener: Function): this;
  2022. once(event: 'enter-full-screen', listener: Function): this;
  2023. addListener(event: 'enter-full-screen', listener: Function): this;
  2024. removeListener(event: 'enter-full-screen', listener: Function): this;
  2025. /**
  2026. * Emitted when the window gains focus.
  2027. */
  2028. on(event: 'focus', listener: Function): this;
  2029. off(event: 'focus', listener: Function): this;
  2030. once(event: 'focus', listener: Function): this;
  2031. addListener(event: 'focus', listener: Function): this;
  2032. removeListener(event: 'focus', listener: Function): this;
  2033. /**
  2034. * Emitted when the window is hidden.
  2035. */
  2036. on(event: 'hide', listener: Function): this;
  2037. off(event: 'hide', listener: Function): this;
  2038. once(event: 'hide', listener: Function): this;
  2039. addListener(event: 'hide', listener: Function): this;
  2040. removeListener(event: 'hide', listener: Function): this;
  2041. /**
  2042. * Emitted when the window leaves a full-screen state.
  2043. */
  2044. on(event: 'leave-full-screen', listener: Function): this;
  2045. off(event: 'leave-full-screen', listener: Function): this;
  2046. once(event: 'leave-full-screen', listener: Function): this;
  2047. addListener(event: 'leave-full-screen', listener: Function): this;
  2048. removeListener(event: 'leave-full-screen', listener: Function): this;
  2049. /**
  2050. * Emitted when window is maximized.
  2051. */
  2052. on(event: 'maximize', listener: Function): this;
  2053. off(event: 'maximize', listener: Function): this;
  2054. once(event: 'maximize', listener: Function): this;
  2055. addListener(event: 'maximize', listener: Function): this;
  2056. removeListener(event: 'maximize', listener: Function): this;
  2057. /**
  2058. * Emitted when the window is minimized.
  2059. */
  2060. on(event: 'minimize', listener: Function): this;
  2061. off(event: 'minimize', listener: Function): this;
  2062. once(event: 'minimize', listener: Function): this;
  2063. addListener(event: 'minimize', listener: Function): this;
  2064. removeListener(event: 'minimize', listener: Function): this;
  2065. /**
  2066. * Emitted when the window is being moved to a new position.
  2067. */
  2068. on(event: 'move', listener: Function): this;
  2069. off(event: 'move', listener: Function): this;
  2070. once(event: 'move', listener: Function): this;
  2071. addListener(event: 'move', listener: Function): this;
  2072. removeListener(event: 'move', listener: Function): this;
  2073. /**
  2074. * Emitted once when the window is moved to a new position.
  2075. *
  2076. * **Note**: On macOS this event is an alias of `move`.
  2077. *
  2078. * @platform darwin,win32
  2079. */
  2080. on(event: 'moved', listener: Function): this;
  2081. /**
  2082. * @platform darwin,win32
  2083. */
  2084. off(event: 'moved', listener: Function): this;
  2085. /**
  2086. * @platform darwin,win32
  2087. */
  2088. once(event: 'moved', listener: Function): this;
  2089. /**
  2090. * @platform darwin,win32
  2091. */
  2092. addListener(event: 'moved', listener: Function): this;
  2093. /**
  2094. * @platform darwin,win32
  2095. */
  2096. removeListener(event: 'moved', listener: Function): this;
  2097. /**
  2098. * Emitted when the native new tab button is clicked.
  2099. *
  2100. * @platform darwin
  2101. */
  2102. on(event: 'new-window-for-tab', listener: Function): this;
  2103. /**
  2104. * @platform darwin
  2105. */
  2106. off(event: 'new-window-for-tab', listener: Function): this;
  2107. /**
  2108. * @platform darwin
  2109. */
  2110. once(event: 'new-window-for-tab', listener: Function): this;
  2111. /**
  2112. * @platform darwin
  2113. */
  2114. addListener(event: 'new-window-for-tab', listener: Function): this;
  2115. /**
  2116. * @platform darwin
  2117. */
  2118. removeListener(event: 'new-window-for-tab', listener: Function): this;
  2119. /**
  2120. * Emitted after the window has been resized.
  2121. */
  2122. on(event: 'resize', listener: Function): this;
  2123. off(event: 'resize', listener: Function): this;
  2124. once(event: 'resize', listener: Function): this;
  2125. addListener(event: 'resize', listener: Function): this;
  2126. removeListener(event: 'resize', listener: Function): this;
  2127. /**
  2128. * Emitted once when the window has finished being resized.
  2129. *
  2130. * This is usually emitted when the window has been resized manually. On macOS,
  2131. * resizing the window with `setBounds`/`setSize` and setting the `animate`
  2132. * parameter to `true` will also emit this event once resizing has finished.
  2133. *
  2134. * @platform darwin,win32
  2135. */
  2136. on(event: 'resized', listener: Function): this;
  2137. /**
  2138. * @platform darwin,win32
  2139. */
  2140. off(event: 'resized', listener: Function): this;
  2141. /**
  2142. * @platform darwin,win32
  2143. */
  2144. once(event: 'resized', listener: Function): this;
  2145. /**
  2146. * @platform darwin,win32
  2147. */
  2148. addListener(event: 'resized', listener: Function): this;
  2149. /**
  2150. * @platform darwin,win32
  2151. */
  2152. removeListener(event: 'resized', listener: Function): this;
  2153. /**
  2154. * Emitted when the window is restored from a minimized state.
  2155. */
  2156. on(event: 'restore', listener: Function): this;
  2157. off(event: 'restore', listener: Function): this;
  2158. once(event: 'restore', listener: Function): this;
  2159. addListener(event: 'restore', listener: Function): this;
  2160. removeListener(event: 'restore', listener: Function): this;
  2161. /**
  2162. * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
  2163. * is ended. The `rotation` value on each emission is the angle in degrees rotated
  2164. * since the last emission. The last emitted event upon a rotation gesture will
  2165. * always be of value `0`. Counter-clockwise rotation values are positive, while
  2166. * clockwise ones are negative.
  2167. *
  2168. * @platform darwin
  2169. */
  2170. on(event: 'rotate-gesture', listener: (event: Event,
  2171. rotation: number) => void): this;
  2172. /**
  2173. * @platform darwin
  2174. */
  2175. off(event: 'rotate-gesture', listener: (event: Event,
  2176. rotation: number) => void): this;
  2177. /**
  2178. * @platform darwin
  2179. */
  2180. once(event: 'rotate-gesture', listener: (event: Event,
  2181. rotation: number) => void): this;
  2182. /**
  2183. * @platform darwin
  2184. */
  2185. addListener(event: 'rotate-gesture', listener: (event: Event,
  2186. rotation: number) => void): this;
  2187. /**
  2188. * @platform darwin
  2189. */
  2190. removeListener(event: 'rotate-gesture', listener: (event: Event,
  2191. rotation: number) => void): this;
  2192. /**
  2193. * Emitted when window session is going to end due to force shutdown or machine
  2194. * restart or session log off.
  2195. *
  2196. * @platform win32
  2197. */
  2198. on(event: 'session-end', listener: Function): this;
  2199. /**
  2200. * @platform win32
  2201. */
  2202. off(event: 'session-end', listener: Function): this;
  2203. /**
  2204. * @platform win32
  2205. */
  2206. once(event: 'session-end', listener: Function): this;
  2207. /**
  2208. * @platform win32
  2209. */
  2210. addListener(event: 'session-end', listener: Function): this;
  2211. /**
  2212. * @platform win32
  2213. */
  2214. removeListener(event: 'session-end', listener: Function): this;
  2215. /**
  2216. * Emitted when the window opens a sheet.
  2217. *
  2218. * @platform darwin
  2219. */
  2220. on(event: 'sheet-begin', listener: Function): this;
  2221. /**
  2222. * @platform darwin
  2223. */
  2224. off(event: 'sheet-begin', listener: Function): this;
  2225. /**
  2226. * @platform darwin
  2227. */
  2228. once(event: 'sheet-begin', listener: Function): this;
  2229. /**
  2230. * @platform darwin
  2231. */
  2232. addListener(event: 'sheet-begin', listener: Function): this;
  2233. /**
  2234. * @platform darwin
  2235. */
  2236. removeListener(event: 'sheet-begin', listener: Function): this;
  2237. /**
  2238. * Emitted when the window has closed a sheet.
  2239. *
  2240. * @platform darwin
  2241. */
  2242. on(event: 'sheet-end', listener: Function): this;
  2243. /**
  2244. * @platform darwin
  2245. */
  2246. off(event: 'sheet-end', listener: Function): this;
  2247. /**
  2248. * @platform darwin
  2249. */
  2250. once(event: 'sheet-end', listener: Function): this;
  2251. /**
  2252. * @platform darwin
  2253. */
  2254. addListener(event: 'sheet-end', listener: Function): this;
  2255. /**
  2256. * @platform darwin
  2257. */
  2258. removeListener(event: 'sheet-end', listener: Function): this;
  2259. /**
  2260. * Emitted when the window is shown.
  2261. */
  2262. on(event: 'show', listener: Function): this;
  2263. off(event: 'show', listener: Function): this;
  2264. once(event: 'show', listener: Function): this;
  2265. addListener(event: 'show', listener: Function): this;
  2266. removeListener(event: 'show', listener: Function): this;
  2267. /**
  2268. * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
  2269. * `left`.
  2270. *
  2271. * The method underlying this event is built to handle older macOS-style trackpad
  2272. * swiping, where the content on the screen doesn't move with the swipe. Most macOS
  2273. * trackpads are not configured to allow this kind of swiping anymore, so in order
  2274. * for it to emit properly the 'Swipe between pages' preference in `System
  2275. * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
  2276. * fingers'.
  2277. *
  2278. * @platform darwin
  2279. */
  2280. on(event: 'swipe', listener: (event: Event,
  2281. direction: string) => void): this;
  2282. /**
  2283. * @platform darwin
  2284. */
  2285. off(event: 'swipe', listener: (event: Event,
  2286. direction: string) => void): this;
  2287. /**
  2288. * @platform darwin
  2289. */
  2290. once(event: 'swipe', listener: (event: Event,
  2291. direction: string) => void): this;
  2292. /**
  2293. * @platform darwin
  2294. */
  2295. addListener(event: 'swipe', listener: (event: Event,
  2296. direction: string) => void): this;
  2297. /**
  2298. * @platform darwin
  2299. */
  2300. removeListener(event: 'swipe', listener: (event: Event,
  2301. direction: string) => void): this;
  2302. /**
  2303. * Emitted when the system context menu is triggered on the window, this is
  2304. * normally only triggered when the user right clicks on the non-client area of
  2305. * your window. This is the window titlebar or any area you have declared as
  2306. * `-webkit-app-region: drag` in a frameless window.
  2307. *
  2308. * Calling `event.preventDefault()` will prevent the menu from being displayed.
  2309. *
  2310. * @platform win32
  2311. */
  2312. on(event: 'system-context-menu', listener: (event: Event,
  2313. /**
  2314. * The screen coordinates the context menu was triggered at
  2315. */
  2316. point: Point) => void): this;
  2317. /**
  2318. * @platform win32
  2319. */
  2320. off(event: 'system-context-menu', listener: (event: Event,
  2321. /**
  2322. * The screen coordinates the context menu was triggered at
  2323. */
  2324. point: Point) => void): this;
  2325. /**
  2326. * @platform win32
  2327. */
  2328. once(event: 'system-context-menu', listener: (event: Event,
  2329. /**
  2330. * The screen coordinates the context menu was triggered at
  2331. */
  2332. point: Point) => void): this;
  2333. /**
  2334. * @platform win32
  2335. */
  2336. addListener(event: 'system-context-menu', listener: (event: Event,
  2337. /**
  2338. * The screen coordinates the context menu was triggered at
  2339. */
  2340. point: Point) => void): this;
  2341. /**
  2342. * @platform win32
  2343. */
  2344. removeListener(event: 'system-context-menu', listener: (event: Event,
  2345. /**
  2346. * The screen coordinates the context menu was triggered at
  2347. */
  2348. point: Point) => void): this;
  2349. /**
  2350. * Emitted when the window exits from a maximized state.
  2351. */
  2352. on(event: 'unmaximize', listener: Function): this;
  2353. off(event: 'unmaximize', listener: Function): this;
  2354. once(event: 'unmaximize', listener: Function): this;
  2355. addListener(event: 'unmaximize', listener: Function): this;
  2356. removeListener(event: 'unmaximize', listener: Function): this;
  2357. /**
  2358. * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
  2359. * will prevent the window from being moved.
  2360. *
  2361. * Note that this is only emitted when the window is being moved manually. Moving
  2362. * the window with `setPosition`/`setBounds`/`center` will not emit this event.
  2363. *
  2364. * @platform darwin,win32
  2365. */
  2366. on(event: 'will-move', listener: (event: Event,
  2367. /**
  2368. * Location the window is being moved to.
  2369. */
  2370. newBounds: Rectangle) => void): this;
  2371. /**
  2372. * @platform darwin,win32
  2373. */
  2374. off(event: 'will-move', listener: (event: Event,
  2375. /**
  2376. * Location the window is being moved to.
  2377. */
  2378. newBounds: Rectangle) => void): this;
  2379. /**
  2380. * @platform darwin,win32
  2381. */
  2382. once(event: 'will-move', listener: (event: Event,
  2383. /**
  2384. * Location the window is being moved to.
  2385. */
  2386. newBounds: Rectangle) => void): this;
  2387. /**
  2388. * @platform darwin,win32
  2389. */
  2390. addListener(event: 'will-move', listener: (event: Event,
  2391. /**
  2392. * Location the window is being moved to.
  2393. */
  2394. newBounds: Rectangle) => void): this;
  2395. /**
  2396. * @platform darwin,win32
  2397. */
  2398. removeListener(event: 'will-move', listener: (event: Event,
  2399. /**
  2400. * Location the window is being moved to.
  2401. */
  2402. newBounds: Rectangle) => void): this;
  2403. /**
  2404. * Emitted before the window is resized. Calling `event.preventDefault()` will
  2405. * prevent the window from being resized.
  2406. *
  2407. * Note that this is only emitted when the window is being resized manually.
  2408. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2409. *
  2410. * The possible values and behaviors of the `edge` option are platform dependent.
  2411. * Possible values are:
  2412. *
  2413. * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
  2414. * `top-right`, `bottom-left`, `bottom-right`.
  2415. * * On macOS, possible values are `bottom` and `right`.
  2416. * * The value `bottom` is used to denote vertical resizing.
  2417. * * The value `right` is used to denote horizontal resizing.
  2418. *
  2419. * @platform darwin,win32
  2420. */
  2421. on(event: 'will-resize', listener: (event: Event,
  2422. /**
  2423. * Size the window is being resized to.
  2424. */
  2425. newBounds: Rectangle,
  2426. details: WillResizeDetails) => void): this;
  2427. /**
  2428. * @platform darwin,win32
  2429. */
  2430. off(event: 'will-resize', listener: (event: Event,
  2431. /**
  2432. * Size the window is being resized to.
  2433. */
  2434. newBounds: Rectangle,
  2435. details: WillResizeDetails) => void): this;
  2436. /**
  2437. * @platform darwin,win32
  2438. */
  2439. once(event: 'will-resize', listener: (event: Event,
  2440. /**
  2441. * Size the window is being resized to.
  2442. */
  2443. newBounds: Rectangle,
  2444. details: WillResizeDetails) => void): this;
  2445. /**
  2446. * @platform darwin,win32
  2447. */
  2448. addListener(event: 'will-resize', listener: (event: Event,
  2449. /**
  2450. * Size the window is being resized to.
  2451. */
  2452. newBounds: Rectangle,
  2453. details: WillResizeDetails) => void): this;
  2454. /**
  2455. * @platform darwin,win32
  2456. */
  2457. removeListener(event: 'will-resize', listener: (event: Event,
  2458. /**
  2459. * Size the window is being resized to.
  2460. */
  2461. newBounds: Rectangle,
  2462. details: WillResizeDetails) => void): this;
  2463. /**
  2464. * BaseWindow
  2465. */
  2466. constructor(options?: BaseWindowConstructorOptions);
  2467. /**
  2468. * The window with the given `id`.
  2469. */
  2470. static fromId(id: number): (BaseWindow) | (null);
  2471. /**
  2472. * An array of all opened browser windows.
  2473. */
  2474. static getAllWindows(): BaseWindow[];
  2475. /**
  2476. * The window that is focused in this application, otherwise returns `null`.
  2477. */
  2478. static getFocusedWindow(): (BaseWindow) | (null);
  2479. /**
  2480. * Adds a window as a tab on this window, after the tab for the window instance.
  2481. *
  2482. * @platform darwin
  2483. */
  2484. addTabbedWindow(baseWindow: BaseWindow): void;
  2485. /**
  2486. * Removes focus from the window.
  2487. */
  2488. blur(): void;
  2489. /**
  2490. * Moves window to the center of the screen.
  2491. */
  2492. center(): void;
  2493. /**
  2494. * Try to close the window. This has the same effect as a user manually clicking
  2495. * the close button of the window. The web page may cancel the close though. See
  2496. * the close event.
  2497. */
  2498. close(): void;
  2499. /**
  2500. * Closes the currently open Quick Look panel.
  2501. *
  2502. * @platform darwin
  2503. */
  2504. closeFilePreview(): void;
  2505. /**
  2506. * Force closing the window, the `unload` and `beforeunload` event won't be emitted
  2507. * for the web page, and `close` event will also not be emitted for this window,
  2508. * but it guarantees the `closed` event will be emitted.
  2509. */
  2510. destroy(): void;
  2511. /**
  2512. * Starts or stops flashing the window to attract user's attention.
  2513. */
  2514. flashFrame(flag: boolean): void;
  2515. /**
  2516. * Focuses on the window.
  2517. */
  2518. focus(): void;
  2519. /**
  2520. * Gets the background color of the window in Hex (`#RRGGBB`) format.
  2521. *
  2522. * See Setting `backgroundColor`.
  2523. *
  2524. * **Note:** The alpha value is _not_ returned alongside the red, green, and blue
  2525. * values.
  2526. */
  2527. getBackgroundColor(): string;
  2528. /**
  2529. * The `bounds` of the window as `Object`.
  2530. *
  2531. * **Note:** On macOS, the y-coordinate value returned will be at minimum the Tray
  2532. * height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height:
  2533. * 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x:
  2534. * 25, y: 38, width: 800, height: 600 }`.
  2535. */
  2536. getBounds(): Rectangle;
  2537. /**
  2538. * All child windows.
  2539. */
  2540. getChildWindows(): BaseWindow[];
  2541. /**
  2542. * The `bounds` of the window's client area as `Object`.
  2543. */
  2544. getContentBounds(): Rectangle;
  2545. /**
  2546. * Contains the window's client area's width and height.
  2547. */
  2548. getContentSize(): number[];
  2549. /**
  2550. * Returns View - The content view of the window.
  2551. */
  2552. getContentView(): void;
  2553. /**
  2554. * Contains the window's maximum width and height.
  2555. */
  2556. getMaximumSize(): number[];
  2557. /**
  2558. * Window id in the format of DesktopCapturerSource's id. For example
  2559. * "window:1324:0".
  2560. *
  2561. * More precisely the format is `window:id:other_id` where `id` is `HWND` on
  2562. * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
  2563. * Linux. `other_id` is used to identify web contents (tabs) so within the same top
  2564. * level window.
  2565. */
  2566. getMediaSourceId(): string;
  2567. /**
  2568. * Contains the window's minimum width and height.
  2569. */
  2570. getMinimumSize(): number[];
  2571. /**
  2572. * The platform-specific handle of the window.
  2573. *
  2574. * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
  2575. * `Window` (`unsigned long`) on Linux.
  2576. */
  2577. getNativeWindowHandle(): Buffer;
  2578. /**
  2579. * Contains the window bounds of the normal state
  2580. *
  2581. * **Note:** whatever the current state of the window : maximized, minimized or in
  2582. * fullscreen, this function always returns the position and size of the window in
  2583. * normal state. In normal state, getBounds and getNormalBounds returns the same
  2584. * `Rectangle`.
  2585. */
  2586. getNormalBounds(): Rectangle;
  2587. /**
  2588. * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
  2589. * 1.
  2590. */
  2591. getOpacity(): number;
  2592. /**
  2593. * The parent window or `null` if there is no parent.
  2594. */
  2595. getParentWindow(): (BaseWindow) | (null);
  2596. /**
  2597. * Contains the window's current position.
  2598. */
  2599. getPosition(): number[];
  2600. /**
  2601. * The pathname of the file the window represents.
  2602. *
  2603. * @platform darwin
  2604. */
  2605. getRepresentedFilename(): string;
  2606. /**
  2607. * Contains the window's width and height.
  2608. */
  2609. getSize(): number[];
  2610. /**
  2611. * The title of the native window.
  2612. *
  2613. * **Note:** The title of the web page can be different from the title of the
  2614. * native window.
  2615. */
  2616. getTitle(): string;
  2617. /**
  2618. * The custom position for the traffic light buttons in frameless window, `null`
  2619. * will be returned when there is no custom position.
  2620. *
  2621. * @platform darwin
  2622. */
  2623. getWindowButtonPosition(): (Point) | (null);
  2624. /**
  2625. * Whether the window has a shadow.
  2626. */
  2627. hasShadow(): boolean;
  2628. /**
  2629. * Hides the window.
  2630. */
  2631. hide(): void;
  2632. /**
  2633. * Hooks a windows message. The `callback` is called when the message is received
  2634. * in the WndProc.
  2635. *
  2636. * @platform win32
  2637. */
  2638. hookWindowMessage(message: number, callback: (wParam: Buffer, lParam: Buffer) => void): void;
  2639. /**
  2640. * Invalidates the window shadow so that it is recomputed based on the current
  2641. * window shape.
  2642. *
  2643. * `BaseWindow`s that are transparent can sometimes leave behind visual artifacts
  2644. * on macOS. This method can be used to clear these artifacts when, for example,
  2645. * performing an animation.
  2646. *
  2647. * @platform darwin
  2648. */
  2649. invalidateShadow(): void;
  2650. /**
  2651. * Whether the window is always on top of other windows.
  2652. */
  2653. isAlwaysOnTop(): boolean;
  2654. /**
  2655. * Whether the window can be manually closed by user.
  2656. *
  2657. * On Linux always returns `true`.
  2658. *
  2659. * @platform darwin,win32
  2660. */
  2661. isClosable(): boolean;
  2662. /**
  2663. * Whether the window is destroyed.
  2664. */
  2665. isDestroyed(): boolean;
  2666. /**
  2667. * Whether the window's document has been edited.
  2668. *
  2669. * @platform darwin
  2670. */
  2671. isDocumentEdited(): boolean;
  2672. /**
  2673. * whether the window is enabled.
  2674. */
  2675. isEnabled(): boolean;
  2676. /**
  2677. * Whether the window can be focused.
  2678. *
  2679. * @platform darwin,win32
  2680. */
  2681. isFocusable(): boolean;
  2682. /**
  2683. * Whether the window is focused.
  2684. */
  2685. isFocused(): boolean;
  2686. /**
  2687. * Whether the window is in fullscreen mode.
  2688. */
  2689. isFullScreen(): boolean;
  2690. /**
  2691. * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
  2692. * window.
  2693. */
  2694. isFullScreenable(): boolean;
  2695. /**
  2696. * Whether the window will be hidden when the user toggles into mission control.
  2697. *
  2698. * @platform darwin
  2699. */
  2700. isHiddenInMissionControl(): boolean;
  2701. /**
  2702. * Whether the window is in kiosk mode.
  2703. */
  2704. isKiosk(): boolean;
  2705. /**
  2706. * Whether the window can be manually maximized by user.
  2707. *
  2708. * On Linux always returns `true`.
  2709. *
  2710. * @platform darwin,win32
  2711. */
  2712. isMaximizable(): boolean;
  2713. /**
  2714. * Whether the window is maximized.
  2715. */
  2716. isMaximized(): boolean;
  2717. /**
  2718. * Whether menu bar automatically hides itself.
  2719. *
  2720. * @platform win32,linux
  2721. */
  2722. isMenuBarAutoHide(): boolean;
  2723. /**
  2724. * Whether the menu bar is visible.
  2725. *
  2726. * @platform win32,linux
  2727. */
  2728. isMenuBarVisible(): boolean;
  2729. /**
  2730. * Whether the window can be manually minimized by the user.
  2731. *
  2732. * On Linux always returns `true`.
  2733. *
  2734. * @platform darwin,win32
  2735. */
  2736. isMinimizable(): boolean;
  2737. /**
  2738. * Whether the window is minimized.
  2739. */
  2740. isMinimized(): boolean;
  2741. /**
  2742. * Whether current window is a modal window.
  2743. */
  2744. isModal(): boolean;
  2745. /**
  2746. * Whether the window can be moved by user.
  2747. *
  2748. * On Linux always returns `true`.
  2749. *
  2750. * @platform darwin,win32
  2751. */
  2752. isMovable(): boolean;
  2753. /**
  2754. * Whether the window is in normal state (not maximized, not minimized, not in
  2755. * fullscreen mode).
  2756. */
  2757. isNormal(): boolean;
  2758. /**
  2759. * Whether the window can be manually resized by the user.
  2760. */
  2761. isResizable(): boolean;
  2762. /**
  2763. * Whether the window is in simple (pre-Lion) fullscreen mode.
  2764. *
  2765. * @platform darwin
  2766. */
  2767. isSimpleFullScreen(): boolean;
  2768. /**
  2769. * Whether the window is in Windows 10 tablet mode.
  2770. *
  2771. * Since Windows 10 users can use their PC as tablet, under this mode apps can
  2772. * choose to optimize their UI for tablets, such as enlarging the titlebar and
  2773. * hiding titlebar buttons.
  2774. *
  2775. * This API returns whether the window is in tablet mode, and the `resize` event
  2776. * can be be used to listen to changes to tablet mode.
  2777. *
  2778. * @platform win32
  2779. */
  2780. isTabletMode(): boolean;
  2781. /**
  2782. * Whether the window is visible to the user in the foreground of the app.
  2783. */
  2784. isVisible(): boolean;
  2785. /**
  2786. * Whether the window is visible on all workspaces.
  2787. *
  2788. * **Note:** This API always returns false on Windows.
  2789. *
  2790. * @platform darwin,linux
  2791. */
  2792. isVisibleOnAllWorkspaces(): boolean;
  2793. /**
  2794. * `true` or `false` depending on whether the message is hooked.
  2795. *
  2796. * @platform win32
  2797. */
  2798. isWindowMessageHooked(message: number): boolean;
  2799. /**
  2800. * Maximizes the window. This will also show (but not focus) the window if it isn't
  2801. * being displayed already.
  2802. */
  2803. maximize(): void;
  2804. /**
  2805. * Merges all windows into one window with multiple tabs when native tabs are
  2806. * enabled and there is more than one open window.
  2807. *
  2808. * @platform darwin
  2809. */
  2810. mergeAllWindows(): void;
  2811. /**
  2812. * Minimizes the window. On some platforms the minimized window will be shown in
  2813. * the Dock.
  2814. */
  2815. minimize(): void;
  2816. /**
  2817. * Moves window above the source window in the sense of z-order. If the
  2818. * `mediaSourceId` is not of type window or if the window does not exist then this
  2819. * method throws an error.
  2820. */
  2821. moveAbove(mediaSourceId: string): void;
  2822. /**
  2823. * Moves the current tab into a new window if native tabs are enabled and there is
  2824. * more than one tab in the current window.
  2825. *
  2826. * @platform darwin
  2827. */
  2828. moveTabToNewWindow(): void;
  2829. /**
  2830. * Moves window to top(z-order) regardless of focus
  2831. */
  2832. moveTop(): void;
  2833. /**
  2834. * Uses Quick Look to preview a file at a given path.
  2835. *
  2836. * @platform darwin
  2837. */
  2838. previewFile(path: string, displayName?: string): void;
  2839. /**
  2840. * Remove the window's menu bar.
  2841. *
  2842. * @platform linux,win32
  2843. */
  2844. removeMenu(): void;
  2845. /**
  2846. * Restores the window from minimized state to its previous state.
  2847. */
  2848. restore(): void;
  2849. /**
  2850. * Selects the next tab when native tabs are enabled and there are other tabs in
  2851. * the window.
  2852. *
  2853. * @platform darwin
  2854. */
  2855. selectNextTab(): void;
  2856. /**
  2857. * Selects the previous tab when native tabs are enabled and there are other tabs
  2858. * in the window.
  2859. *
  2860. * @platform darwin
  2861. */
  2862. selectPreviousTab(): void;
  2863. /**
  2864. * Sets whether the window should show always on top of other windows. After
  2865. * setting this, the window is still a normal window, not a toolbox window which
  2866. * can not be focused on.
  2867. */
  2868. setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
  2869. /**
  2870. * Sets the properties for the window's taskbar button.
  2871. *
  2872. * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
  2873. * together. If one of those properties is not set, then neither will be used.
  2874. *
  2875. * @platform win32
  2876. */
  2877. setAppDetails(options: AppDetailsOptions): void;
  2878. /**
  2879. * This will make a window maintain an aspect ratio. The extra size allows a
  2880. * developer to have space, specified in pixels, not included within the aspect
  2881. * ratio calculations. This API already takes into account the difference between a
  2882. * window's size and its content size.
  2883. *
  2884. * Consider a normal window with an HD video player and associated controls.
  2885. * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
  2886. * on the right edge and 50 pixels of controls below the player. In order to
  2887. * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
  2888. * the player itself we would call this function with arguments of 16/9 and {
  2889. * width: 40, height: 50 }. The second argument doesn't care where the extra width
  2890. * and height are within the content view--only that they exist. Sum any extra
  2891. * width and height areas you have within the overall content view.
  2892. *
  2893. * The aspect ratio is not respected when window is resized programmatically with
  2894. * APIs like `win.setSize`.
  2895. *
  2896. * To reset an aspect ratio, pass 0 as the `aspectRatio` value:
  2897. * `win.setAspectRatio(0)`.
  2898. */
  2899. setAspectRatio(aspectRatio: number, extraSize?: Size): void;
  2900. /**
  2901. * Controls whether to hide cursor when typing.
  2902. *
  2903. * @platform darwin
  2904. */
  2905. setAutoHideCursor(autoHide: boolean): void;
  2906. /**
  2907. * Sets whether the window menu bar should hide itself automatically. Once set the
  2908. * menu bar will only show when users press the single `Alt` key.
  2909. *
  2910. * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
  2911. * hide it immediately.
  2912. *
  2913. * @platform win32,linux
  2914. */
  2915. setAutoHideMenuBar(hide: boolean): void;
  2916. /**
  2917. * Examples of valid `backgroundColor` values:
  2918. *
  2919. * * Hex
  2920. * * #fff (shorthand RGB)
  2921. * * #ffff (shorthand ARGB)
  2922. * * #ffffff (RGB)
  2923. * * #ffffffff (ARGB)
  2924. * * RGB
  2925. * * `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
  2926. * * e.g. rgb(255, 255, 255)
  2927. * * RGBA
  2928. * * `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
  2929. * * e.g. rgba(255, 255, 255, 1.0)
  2930. * * HSL
  2931. * * `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
  2932. * * e.g. hsl(200, 20%, 50%)
  2933. * * HSLA
  2934. * * `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
  2935. * * e.g. hsla(200, 20%, 50%, 0.5)
  2936. * * Color name
  2937. * * Options are listed in SkParseColor.cpp
  2938. * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
  2939. * * e.g. `blueviolet` or `red`
  2940. *
  2941. * Sets the background color of the window. See Setting `backgroundColor`.
  2942. */
  2943. setBackgroundColor(backgroundColor: string): void;
  2944. /**
  2945. * This method sets the browser window's system-drawn background material,
  2946. * including behind the non-client area.
  2947. *
  2948. * See the Windows documentation for more details.
  2949. *
  2950. * **Note:** This method is only supported on Windows 11 22H2 and up.
  2951. *
  2952. * @platform win32
  2953. */
  2954. setBackgroundMaterial(material: 'auto' | 'none' | 'mica' | 'acrylic' | 'tabbed'): void;
  2955. /**
  2956. * Resizes and moves the window to the supplied bounds. Any properties that are not
  2957. * supplied will default to their current values.
  2958. *
  2959. * **Note:** On macOS, the y-coordinate value cannot be smaller than the Tray
  2960. * height. The tray height has changed over time and depends on the operating
  2961. * system, but is between 20-40px. Passing a value lower than the tray height will
  2962. * result in a window that is flush to the tray.
  2963. */
  2964. setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
  2965. /**
  2966. * Sets whether the window can be manually closed by user. On Linux does nothing.
  2967. *
  2968. * @platform darwin,win32
  2969. */
  2970. setClosable(closable: boolean): void;
  2971. /**
  2972. * Resizes and moves the window's client area (e.g. the web page) to the supplied
  2973. * bounds.
  2974. */
  2975. setContentBounds(bounds: Rectangle, animate?: boolean): void;
  2976. /**
  2977. * Prevents the window contents from being captured by other apps.
  2978. *
  2979. * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
  2980. * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
  2981. * version 2004 and up the window will be removed from capture entirely, older
  2982. * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
  2983. *
  2984. * @platform darwin,win32
  2985. */
  2986. setContentProtection(enable: boolean): void;
  2987. /**
  2988. * Resizes the window's client area (e.g. the web page) to `width` and `height`.
  2989. */
  2990. setContentSize(width: number, height: number, animate?: boolean): void;
  2991. /**
  2992. * Sets the content view of the window.
  2993. */
  2994. setContentView(view: View): void;
  2995. /**
  2996. * Specifies whether the window’s document has been edited, and the icon in title
  2997. * bar will become gray when set to `true`.
  2998. *
  2999. * @platform darwin
  3000. */
  3001. setDocumentEdited(edited: boolean): void;
  3002. /**
  3003. * Disable or enable the window.
  3004. */
  3005. setEnabled(enable: boolean): void;
  3006. /**
  3007. * Changes whether the window can be focused.
  3008. *
  3009. * On macOS it does not remove the focus from the window.
  3010. *
  3011. * @platform darwin,win32
  3012. */
  3013. setFocusable(focusable: boolean): void;
  3014. /**
  3015. * Sets whether the window should be in fullscreen mode.
  3016. *
  3017. * **Note:** On macOS, fullscreen transitions take place asynchronously. If further
  3018. * actions depend on the fullscreen state, use the 'enter-full-screen' or
  3019. * 'leave-full-screen' events.
  3020. */
  3021. setFullScreen(flag: boolean): void;
  3022. /**
  3023. * Sets whether the maximize/zoom window button toggles fullscreen mode or
  3024. * maximizes the window.
  3025. */
  3026. setFullScreenable(fullscreenable: boolean): void;
  3027. /**
  3028. * Sets whether the window should have a shadow.
  3029. */
  3030. setHasShadow(hasShadow: boolean): void;
  3031. /**
  3032. * Sets whether the window will be hidden when the user toggles into mission
  3033. * control.
  3034. *
  3035. * @platform darwin
  3036. */
  3037. setHiddenInMissionControl(hidden: boolean): void;
  3038. /**
  3039. * Changes window icon.
  3040. *
  3041. * @platform win32,linux
  3042. */
  3043. setIcon(icon: (NativeImage) | (string)): void;
  3044. /**
  3045. * Makes the window ignore all mouse events.
  3046. *
  3047. * All mouse events happened in this window will be passed to the window below this
  3048. * window, but if this window has focus, it will still receive keyboard events.
  3049. */
  3050. setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
  3051. /**
  3052. * Enters or leaves kiosk mode.
  3053. */
  3054. setKiosk(flag: boolean): void;
  3055. /**
  3056. * Sets whether the window can be manually maximized by user. On Linux does
  3057. * nothing.
  3058. *
  3059. * @platform darwin,win32
  3060. */
  3061. setMaximizable(maximizable: boolean): void;
  3062. /**
  3063. * Sets the maximum size of window to `width` and `height`.
  3064. */
  3065. setMaximumSize(width: number, height: number): void;
  3066. /**
  3067. * Sets the `menu` as the window's menu bar.
  3068. *
  3069. * @platform linux,win32
  3070. */
  3071. setMenu(menu: (Menu) | (null)): void;
  3072. /**
  3073. * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
  3074. * can still bring up the menu bar by pressing the single `Alt` key.
  3075. *
  3076. * @platform win32,linux
  3077. */
  3078. setMenuBarVisibility(visible: boolean): void;
  3079. /**
  3080. * Sets whether the window can be manually minimized by user. On Linux does
  3081. * nothing.
  3082. *
  3083. * @platform darwin,win32
  3084. */
  3085. setMinimizable(minimizable: boolean): void;
  3086. /**
  3087. * Sets the minimum size of window to `width` and `height`.
  3088. */
  3089. setMinimumSize(width: number, height: number): void;
  3090. /**
  3091. * Sets whether the window can be moved by user. On Linux does nothing.
  3092. *
  3093. * @platform darwin,win32
  3094. */
  3095. setMovable(movable: boolean): void;
  3096. /**
  3097. * Sets the opacity of the window. On Linux, does nothing. Out of bound number
  3098. * values are clamped to the [0, 1] range.
  3099. *
  3100. * @platform win32,darwin
  3101. */
  3102. setOpacity(opacity: number): void;
  3103. /**
  3104. * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
  3105. * convey some sort of application status or to passively notify the user.
  3106. *
  3107. * @platform win32
  3108. */
  3109. setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
  3110. /**
  3111. * Sets `parent` as current window's parent window, passing `null` will turn
  3112. * current window into a top-level window.
  3113. */
  3114. setParentWindow(parent: (BaseWindow) | (null)): void;
  3115. /**
  3116. * Moves window to `x` and `y`.
  3117. */
  3118. setPosition(x: number, y: number, animate?: boolean): void;
  3119. /**
  3120. * Sets progress value in progress bar. Valid range is [0, 1.0].
  3121. *
  3122. * Remove progress bar when progress < 0; Change to indeterminate mode when
  3123. * progress > 1.
  3124. *
  3125. * On Linux platform, only supports Unity desktop environment, you need to specify
  3126. * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
  3127. * it will assume `{app.name}.desktop`.
  3128. *
  3129. * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
  3130. * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
  3131. * mode set (but with a value within the valid range), `normal` will be assumed.
  3132. */
  3133. setProgressBar(progress: number, options?: ProgressBarOptions): void;
  3134. /**
  3135. * Sets the pathname of the file the window represents, and the icon of the file
  3136. * will show in window's title bar.
  3137. *
  3138. * @platform darwin
  3139. */
  3140. setRepresentedFilename(filename: string): void;
  3141. /**
  3142. * Sets whether the window can be manually resized by the user.
  3143. */
  3144. setResizable(resizable: boolean): void;
  3145. /**
  3146. * Setting a window shape determines the area within the window where the system
  3147. * permits drawing and user interaction. Outside of the given region, no pixels
  3148. * will be drawn and no mouse events will be registered. Mouse events outside of
  3149. * the region will not be received by that window, but will fall through to
  3150. * whatever is behind the window.
  3151. *
  3152. * @experimental
  3153. * @platform win32,linux
  3154. */
  3155. setShape(rects: Rectangle[]): void;
  3156. /**
  3157. * Changes the attachment point for sheets on macOS. By default, sheets are
  3158. * attached just below the window frame, but you may want to display them beneath a
  3159. * HTML-rendered toolbar. For example:
  3160. *
  3161. * @platform darwin
  3162. */
  3163. setSheetOffset(offsetY: number, offsetX?: number): void;
  3164. /**
  3165. * Enters or leaves simple fullscreen mode.
  3166. *
  3167. * Simple fullscreen mode emulates the native fullscreen behavior found in versions
  3168. * of macOS prior to Lion (10.7).
  3169. *
  3170. * @platform darwin
  3171. */
  3172. setSimpleFullScreen(flag: boolean): void;
  3173. /**
  3174. * Resizes the window to `width` and `height`. If `width` or `height` are below any
  3175. * set minimum size constraints the window will snap to its minimum size.
  3176. */
  3177. setSize(width: number, height: number, animate?: boolean): void;
  3178. /**
  3179. * Makes the window not show in the taskbar.
  3180. *
  3181. * @platform darwin,win32
  3182. */
  3183. setSkipTaskbar(skip: boolean): void;
  3184. /**
  3185. * Whether the buttons were added successfully
  3186. *
  3187. * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
  3188. * of a window in a taskbar button layout. Returns a `boolean` object indicates
  3189. * whether the thumbnail has been added successfully.
  3190. *
  3191. * The number of buttons in thumbnail toolbar should be no greater than 7 due to
  3192. * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
  3193. * removed due to the platform's limitation. But you can call the API with an empty
  3194. * array to clean the buttons.
  3195. *
  3196. * The `buttons` is an array of `Button` objects:
  3197. *
  3198. * * `Button` Object
  3199. * * `icon` NativeImage - The icon showing in thumbnail toolbar.
  3200. * * `click` Function
  3201. * * `tooltip` string (optional) - The text of the button's tooltip.
  3202. * * `flags` string[] (optional) - Control specific states and behaviors of the
  3203. * button. By default, it is `['enabled']`.
  3204. *
  3205. * The `flags` is an array that can include following `string`s:
  3206. *
  3207. * * `enabled` - The button is active and available to the user.
  3208. * * `disabled` - The button is disabled. It is present, but has a visual state
  3209. * indicating it will not respond to user action.
  3210. * * `dismissonclick` - When the button is clicked, the thumbnail window closes
  3211. * immediately.
  3212. * * `nobackground` - Do not draw a button border, use only the image.
  3213. * * `hidden` - The button is not shown to the user.
  3214. * * `noninteractive` - The button is enabled but not interactive; no pressed
  3215. * button state is drawn. This value is intended for instances where the button is
  3216. * used in a notification.
  3217. *
  3218. * @platform win32
  3219. */
  3220. setThumbarButtons(buttons: ThumbarButton[]): boolean;
  3221. /**
  3222. * Sets the region of the window to show as the thumbnail image displayed when
  3223. * hovering over the window in the taskbar. You can reset the thumbnail to be the
  3224. * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
  3225. * }`.
  3226. *
  3227. * @platform win32
  3228. */
  3229. setThumbnailClip(region: Rectangle): void;
  3230. /**
  3231. * Sets the toolTip that is displayed when hovering over the window thumbnail in
  3232. * the taskbar.
  3233. *
  3234. * @platform win32
  3235. */
  3236. setThumbnailToolTip(toolTip: string): void;
  3237. /**
  3238. * Changes the title of native window to `title`.
  3239. */
  3240. setTitle(title: string): void;
  3241. /**
  3242. * On a Window with Window Controls Overlay already enabled, this method updates
  3243. * the style of the title bar overlay.
  3244. *
  3245. * On Linux, the `symbolColor` is automatically calculated to have minimum
  3246. * accessible contrast to the `color` if not explicitly set.
  3247. *
  3248. * @platform win32,linux
  3249. */
  3250. setTitleBarOverlay(options: TitleBarOverlayOptions): void;
  3251. /**
  3252. * Sets the touchBar layout for the current window. Specifying `null` or
  3253. * `undefined` clears the touch bar. This method only has an effect if the machine
  3254. * has a touch bar.
  3255. *
  3256. * **Note:** The TouchBar API is currently experimental and may change or be
  3257. * removed in future Electron releases.
  3258. *
  3259. * @platform darwin
  3260. */
  3261. setTouchBar(touchBar: (TouchBar) | (null)): void;
  3262. /**
  3263. * Adds a vibrancy effect to the window. Passing `null` or an empty string will
  3264. * remove the vibrancy effect on the window.
  3265. *
  3266. * @platform darwin
  3267. */
  3268. setVibrancy(type: (('titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
  3269. /**
  3270. * Sets whether the window should be visible on all workspaces.
  3271. *
  3272. * **Note:** This API does nothing on Windows.
  3273. *
  3274. * @platform darwin,linux
  3275. */
  3276. setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
  3277. /**
  3278. * Set a custom position for the traffic light buttons in frameless window. Passing
  3279. * `null` will reset the position to default.
  3280. *
  3281. * @platform darwin
  3282. */
  3283. setWindowButtonPosition(position: (Point) | (null)): void;
  3284. /**
  3285. * Sets whether the window traffic light buttons should be visible.
  3286. *
  3287. * @platform darwin
  3288. */
  3289. setWindowButtonVisibility(visible: boolean): void;
  3290. /**
  3291. * Shows and gives focus to the window.
  3292. */
  3293. show(): void;
  3294. /**
  3295. * Shows or hides the tab overview when native tabs are enabled.
  3296. *
  3297. * @platform darwin
  3298. */
  3299. showAllTabs(): void;
  3300. /**
  3301. * Shows the window but doesn't focus on it.
  3302. */
  3303. showInactive(): void;
  3304. /**
  3305. * Toggles the visibility of the tab bar if native tabs are enabled and there is
  3306. * only one tab in the current window.
  3307. *
  3308. * @platform darwin
  3309. */
  3310. toggleTabBar(): void;
  3311. /**
  3312. * Unhooks all of the window messages.
  3313. *
  3314. * @platform win32
  3315. */
  3316. unhookAllWindowMessages(): void;
  3317. /**
  3318. * Unhook the window message.
  3319. *
  3320. * @platform win32
  3321. */
  3322. unhookWindowMessage(message: number): void;
  3323. /**
  3324. * Unmaximizes the window.
  3325. */
  3326. unmaximize(): void;
  3327. /**
  3328. * A `string` property that defines an alternative title provided only to
  3329. * accessibility tools such as screen readers. This string is not directly visible
  3330. * to users.
  3331. */
  3332. accessibleTitle: string;
  3333. /**
  3334. * A `boolean` property that determines whether the window menu bar should hide
  3335. * itself automatically. Once set, the menu bar will only show when users press the
  3336. * single `Alt` key.
  3337. *
  3338. * If the menu bar is already visible, setting this property to `true` won't hide
  3339. * it immediately.
  3340. */
  3341. autoHideMenuBar: boolean;
  3342. /**
  3343. * A `boolean` property that determines whether the window can be manually closed
  3344. * by user.
  3345. *
  3346. * On Linux the setter is a no-op, although the getter returns `true`.
  3347. *
  3348. * @platform darwin,win32
  3349. */
  3350. closable: boolean;
  3351. /**
  3352. * A `View` property for the content view of the window.
  3353. */
  3354. contentView: View;
  3355. /**
  3356. * A `boolean` property that specifies whether the window’s document has been
  3357. * edited.
  3358. *
  3359. * The icon in title bar will become gray when set to `true`.
  3360. *
  3361. * @platform darwin
  3362. */
  3363. documentEdited: boolean;
  3364. /**
  3365. * A `boolean` property that determines whether the window is excluded from the
  3366. * application’s Windows menu. `false` by default.
  3367. *
  3368. * @platform darwin
  3369. */
  3370. excludedFromShownWindowsMenu: boolean;
  3371. /**
  3372. * A `boolean` property that determines whether the window is focusable.
  3373. *
  3374. * @platform win32,darwin
  3375. */
  3376. focusable: boolean;
  3377. /**
  3378. * A `boolean` property that determines whether the window is in fullscreen mode.
  3379. */
  3380. fullScreen: boolean;
  3381. /**
  3382. * A `boolean` property that determines whether the maximize/zoom window button
  3383. * toggles fullscreen mode or maximizes the window.
  3384. */
  3385. fullScreenable: boolean;
  3386. /**
  3387. * A `Integer` property representing the unique ID of the window. Each ID is unique
  3388. * among all `BaseWindow` instances of the entire Electron application.
  3389. *
  3390. */
  3391. readonly id: number;
  3392. /**
  3393. * A `boolean` property that determines whether the window is in kiosk mode.
  3394. */
  3395. kiosk: boolean;
  3396. /**
  3397. * A `boolean` property that determines whether the window can be manually
  3398. * maximized by user.
  3399. *
  3400. * On Linux the setter is a no-op, although the getter returns `true`.
  3401. *
  3402. * @platform darwin,win32
  3403. */
  3404. maximizable: boolean;
  3405. /**
  3406. * A `boolean` property that determines whether the menu bar should be visible.
  3407. *
  3408. * **Note:** If the menu bar is auto-hide, users can still bring up the menu bar by
  3409. * pressing the single `Alt` key.
  3410. *
  3411. * @platform win32,linux
  3412. */
  3413. menuBarVisible: boolean;
  3414. /**
  3415. * A `boolean` property that determines whether the window can be manually
  3416. * minimized by user.
  3417. *
  3418. * On Linux the setter is a no-op, although the getter returns `true`.
  3419. *
  3420. * @platform darwin,win32
  3421. */
  3422. minimizable: boolean;
  3423. /**
  3424. * A `boolean` property that determines Whether the window can be moved by user.
  3425. *
  3426. * On Linux the setter is a no-op, although the getter returns `true`.
  3427. *
  3428. * @platform darwin,win32
  3429. */
  3430. movable: boolean;
  3431. /**
  3432. * A `string` property that determines the pathname of the file the window
  3433. * represents, and the icon of the file will show in window's title bar.
  3434. *
  3435. * @platform darwin
  3436. */
  3437. representedFilename: string;
  3438. /**
  3439. * A `boolean` property that determines whether the window can be manually resized
  3440. * by user.
  3441. */
  3442. resizable: boolean;
  3443. /**
  3444. * A `boolean` property that determines whether the window has a shadow.
  3445. */
  3446. shadow: boolean;
  3447. /**
  3448. * A `boolean` property that determines whether the window is in simple (pre-Lion)
  3449. * fullscreen mode.
  3450. */
  3451. simpleFullScreen: boolean;
  3452. /**
  3453. * A `string` (optional) property that is equal to the `tabbingIdentifier` passed
  3454. * to the `BrowserWindow` constructor or `undefined` if none was set.
  3455. *
  3456. * @platform darwin
  3457. */
  3458. readonly tabbingIdentifier?: string;
  3459. /**
  3460. * A `string` property that determines the title of the native window.
  3461. *
  3462. * **Note:** The title of the web page can be different from the title of the
  3463. * native window.
  3464. */
  3465. title: string;
  3466. /**
  3467. * A `boolean` property that determines whether the window is visible on all
  3468. * workspaces.
  3469. *
  3470. * **Note:** Always returns false on Windows.
  3471. *
  3472. * @platform darwin,linux
  3473. */
  3474. visibleOnAllWorkspaces: boolean;
  3475. }
  3476. interface BaseWindowConstructorOptions {
  3477. // Docs: https://electronjs.org/docs/api/structures/base-window-options
  3478. /**
  3479. * Whether clicking an inactive window will also click through to the web contents.
  3480. * Default is `false` on macOS. This option is not configurable on other platforms.
  3481. *
  3482. * @platform darwin
  3483. */
  3484. acceptFirstMouse?: boolean;
  3485. /**
  3486. * Whether the window should always stay on top of other windows. Default is
  3487. * `false`.
  3488. */
  3489. alwaysOnTop?: boolean;
  3490. /**
  3491. * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
  3492. */
  3493. autoHideMenuBar?: boolean;
  3494. /**
  3495. * The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color
  3496. * format. Alpha in #AARRGGBB format is supported if `transparent` is set to
  3497. * `true`. Default is `#FFF` (white). See win.setBackgroundColor for more
  3498. * information.
  3499. */
  3500. backgroundColor?: string;
  3501. /**
  3502. * Set the window's system-drawn background material, including behind the
  3503. * non-client area. Can be `auto`, `none`, `mica`, `acrylic` or `tabbed`. See
  3504. * win.setBackgroundMaterial for more information.
  3505. *
  3506. * @platform win32
  3507. */
  3508. backgroundMaterial?: ('auto' | 'none' | 'mica' | 'acrylic' | 'tabbed');
  3509. /**
  3510. * Show window in the center of the screen. Default is `false`.
  3511. */
  3512. center?: boolean;
  3513. /**
  3514. * Whether window is closable. This is not implemented on Linux. Default is `true`.
  3515. *
  3516. * @platform darwin,win32
  3517. */
  3518. closable?: boolean;
  3519. /**
  3520. * Forces using dark theme for the window, only works on some GTK+3 desktop
  3521. * environments. Default is `false`.
  3522. */
  3523. darkTheme?: boolean;
  3524. /**
  3525. * Whether to hide cursor when typing. Default is `false`.
  3526. */
  3527. disableAutoHideCursor?: boolean;
  3528. /**
  3529. * Enable the window to be resized larger than screen. Only relevant for macOS, as
  3530. * other OSes allow larger-than-screen windows by default. Default is `false`.
  3531. *
  3532. * @platform darwin
  3533. */
  3534. enableLargerThanScreen?: boolean;
  3535. /**
  3536. * Whether the window can be focused. Default is `true`. On Windows setting
  3537. * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
  3538. * `focusable: false` makes the window stop interacting with wm, so the window will
  3539. * always stay on top in all workspaces.
  3540. */
  3541. focusable?: boolean;
  3542. /**
  3543. * Specify `false` to create a frameless window. Default is `true`.
  3544. */
  3545. frame?: boolean;
  3546. /**
  3547. * Whether the window should show in fullscreen. When explicitly set to `false` the
  3548. * fullscreen button will be hidden or disabled on macOS. Default is `false`.
  3549. */
  3550. fullscreen?: boolean;
  3551. /**
  3552. * Whether the window can be put into fullscreen mode. On macOS, also whether the
  3553. * maximize/zoom button should toggle full screen mode or maximize window. Default
  3554. * is `true`.
  3555. */
  3556. fullscreenable?: boolean;
  3557. /**
  3558. * Whether window should have a shadow. Default is `true`.
  3559. */
  3560. hasShadow?: boolean;
  3561. /**
  3562. * Window's height in pixels. Default is `600`.
  3563. */
  3564. height?: number;
  3565. /**
  3566. * Whether window should be hidden when the user toggles into mission control.
  3567. *
  3568. * @platform darwin
  3569. */
  3570. hiddenInMissionControl?: boolean;
  3571. /**
  3572. * The window icon. On Windows it is recommended to use `ICO` icons to get best
  3573. * visual effects, you can also leave it undefined so the executable's icon will be
  3574. * used.
  3575. */
  3576. icon?: (NativeImage) | (string);
  3577. /**
  3578. * Whether the window is in kiosk mode. Default is `false`.
  3579. */
  3580. kiosk?: boolean;
  3581. /**
  3582. * Window's maximum height. Default is no limit.
  3583. */
  3584. maxHeight?: number;
  3585. /**
  3586. * Whether window is maximizable. This is not implemented on Linux. Default is
  3587. * `true`.
  3588. *
  3589. * @platform darwin,win32
  3590. */
  3591. maximizable?: boolean;
  3592. /**
  3593. * Window's maximum width. Default is no limit.
  3594. */
  3595. maxWidth?: number;
  3596. /**
  3597. * Window's minimum height. Default is `0`.
  3598. */
  3599. minHeight?: number;
  3600. /**
  3601. * Whether window is minimizable. This is not implemented on Linux. Default is
  3602. * `true`.
  3603. *
  3604. * @platform darwin,win32
  3605. */
  3606. minimizable?: boolean;
  3607. /**
  3608. * Window's minimum width. Default is `0`.
  3609. */
  3610. minWidth?: number;
  3611. /**
  3612. * Whether this is a modal window. This only works when the window is a child
  3613. * window. Default is `false`.
  3614. */
  3615. modal?: boolean;
  3616. /**
  3617. * Whether window is movable. This is not implemented on Linux. Default is `true`.
  3618. *
  3619. * @platform darwin,win32
  3620. */
  3621. movable?: boolean;
  3622. /**
  3623. * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
  3624. * (fully opaque). This is only implemented on Windows and macOS.
  3625. *
  3626. * @platform darwin,win32
  3627. */
  3628. opacity?: number;
  3629. /**
  3630. * Specify parent window. Default is `null`.
  3631. */
  3632. parent?: BaseWindow;
  3633. /**
  3634. * Whether window is resizable. Default is `true`.
  3635. */
  3636. resizable?: boolean;
  3637. /**
  3638. * Whether frameless window should have rounded corners on macOS. Default is
  3639. * `true`. Setting this property to `false` will prevent the window from being
  3640. * fullscreenable.
  3641. *
  3642. * @platform darwin
  3643. */
  3644. roundedCorners?: boolean;
  3645. /**
  3646. * Whether window should be shown when created. Default is `true`.
  3647. */
  3648. show?: boolean;
  3649. /**
  3650. * Use pre-Lion fullscreen on macOS. Default is `false`.
  3651. *
  3652. * @platform darwin
  3653. */
  3654. simpleFullscreen?: boolean;
  3655. /**
  3656. * Whether to show the window in taskbar. Default is `false`.
  3657. *
  3658. * @platform darwin,win32
  3659. */
  3660. skipTaskbar?: boolean;
  3661. /**
  3662. * Tab group name, allows opening the window as a native tab. Windows with the same
  3663. * tabbing identifier will be grouped together. This also adds a native new tab
  3664. * button to your window's tab bar and allows your `app` and window to receive the
  3665. * `new-window-for-tab` event.
  3666. *
  3667. * @platform darwin
  3668. */
  3669. tabbingIdentifier?: string;
  3670. /**
  3671. * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
  3672. * window frame. Setting it to `false` will remove window shadow and window
  3673. * animations. Default is `true`.
  3674. */
  3675. thickFrame?: boolean;
  3676. /**
  3677. * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
  3678. * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
  3679. */
  3680. title?: string;
  3681. /**
  3682. * The style of window title bar. Default is `default`. Possible values are:
  3683. */
  3684. titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
  3685. /**
  3686. * Set a custom position for the traffic light buttons in frameless windows.
  3687. *
  3688. * @platform darwin
  3689. */
  3690. trafficLightPosition?: Point;
  3691. /**
  3692. * Makes the window transparent. Default is `false`. On Windows, does not work
  3693. * unless the window is frameless.
  3694. */
  3695. transparent?: boolean;
  3696. /**
  3697. * The type of window, default is normal window. See more about this below.
  3698. */
  3699. type?: string;
  3700. /**
  3701. * The `width` and `height` would be used as web page's size, which means the
  3702. * actual window's size will include window frame's size and be slightly larger.
  3703. * Default is `false`.
  3704. */
  3705. useContentSize?: boolean;
  3706. /**
  3707. * Add a type of vibrancy effect to the window, only on macOS. Can be
  3708. * `appearance-based`, `titlebar`, `selection`, `menu`, `popover`, `sidebar`,
  3709. * `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`,
  3710. * `under-window`, or `under-page`.
  3711. *
  3712. * @platform darwin
  3713. */
  3714. vibrancy?: ('appearance-based' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page');
  3715. /**
  3716. * Specify how the material appearance should reflect window activity state on
  3717. * macOS. Must be used with the `vibrancy` property. Possible values are:
  3718. *
  3719. * @platform darwin
  3720. */
  3721. visualEffectState?: ('followWindow' | 'active' | 'inactive');
  3722. /**
  3723. * Window's width in pixels. Default is `800`.
  3724. */
  3725. width?: number;
  3726. /**
  3727. * (**required** if y is used) Window's left offset from screen. Default is to
  3728. * center the window.
  3729. */
  3730. x?: number;
  3731. /**
  3732. * (**required** if x is used) Window's top offset from screen. Default is to
  3733. * center the window.
  3734. */
  3735. y?: number;
  3736. /**
  3737. * Controls the behavior on macOS when option-clicking the green stoplight button
  3738. * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
  3739. * will grow to the preferred width of the web page when zoomed, `false` will cause
  3740. * it to zoom to the width of the screen. This will also affect the behavior when
  3741. * calling `maximize()` directly. Default is `false`.
  3742. *
  3743. * @platform darwin
  3744. */
  3745. zoomToPageWidth?: boolean;
  3746. }
  3747. interface BluetoothDevice {
  3748. // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
  3749. deviceId: string;
  3750. deviceName: string;
  3751. }
  3752. class BrowserView {
  3753. // Docs: https://electronjs.org/docs/api/browser-view
  3754. /**
  3755. * BrowserView
  3756. */
  3757. constructor(options?: BrowserViewConstructorOptions);
  3758. /**
  3759. * The `bounds` of this BrowserView instance as `Object`.
  3760. *
  3761. * @experimental
  3762. * @deprecated
  3763. */
  3764. getBounds(): Rectangle;
  3765. /**
  3766. * @experimental
  3767. * @deprecated
  3768. */
  3769. setAutoResize(options: AutoResizeOptions): void;
  3770. /**
  3771. * Examples of valid `color` values:
  3772. *
  3773. * * Hex
  3774. * * `#fff` (RGB)
  3775. * * `#ffff` (ARGB)
  3776. * * `#ffffff` (RRGGBB)
  3777. * * `#ffffffff` (AARRGGBB)
  3778. * * RGB
  3779. * * `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
  3780. * * e.g. `rgb(255, 255, 255)`
  3781. * * RGBA
  3782. * * `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
  3783. * * e.g. `rgba(255, 255, 255, 1.0)`
  3784. * * HSL
  3785. * * `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
  3786. * * e.g. `hsl(200, 20%, 50%)`
  3787. * * HSLA
  3788. * * `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
  3789. * * e.g. `hsla(200, 20%, 50%, 0.5)`
  3790. * * Color name
  3791. * * Options are listed in SkParseColor.cpp
  3792. * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
  3793. * * e.g. `blueviolet` or `red`
  3794. *
  3795. * **Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or
  3796. * `RGB`.
  3797. *
  3798. * @experimental
  3799. * @deprecated
  3800. */
  3801. setBackgroundColor(color: string): void;
  3802. /**
  3803. * Resizes and moves the view to the supplied bounds relative to the window.
  3804. *
  3805. * @experimental
  3806. * @deprecated
  3807. */
  3808. setBounds(bounds: Rectangle): void;
  3809. /**
  3810. * A `WebContents` object owned by this view.
  3811. *
  3812. * @experimental
  3813. * @deprecated
  3814. */
  3815. webContents: WebContents;
  3816. }
  3817. class BrowserWindow extends BaseWindow {
  3818. // Docs: https://electronjs.org/docs/api/browser-window
  3819. /**
  3820. * Emitted when the window is set or unset to show always on top of other windows.
  3821. */
  3822. on(event: 'always-on-top-changed', listener: (event: Event,
  3823. isAlwaysOnTop: boolean) => void): this;
  3824. off(event: 'always-on-top-changed', listener: (event: Event,
  3825. isAlwaysOnTop: boolean) => void): this;
  3826. once(event: 'always-on-top-changed', listener: (event: Event,
  3827. isAlwaysOnTop: boolean) => void): this;
  3828. addListener(event: 'always-on-top-changed', listener: (event: Event,
  3829. isAlwaysOnTop: boolean) => void): this;
  3830. removeListener(event: 'always-on-top-changed', listener: (event: Event,
  3831. isAlwaysOnTop: boolean) => void): this;
  3832. /**
  3833. * Emitted when the window is set or unset to show always on top of other windows.
  3834. */
  3835. on(event: 'always-on-top-changed', listener: (event: Event,
  3836. isAlwaysOnTop: boolean) => void): this;
  3837. off(event: 'always-on-top-changed', listener: (event: Event,
  3838. isAlwaysOnTop: boolean) => void): this;
  3839. once(event: 'always-on-top-changed', listener: (event: Event,
  3840. isAlwaysOnTop: boolean) => void): this;
  3841. addListener(event: 'always-on-top-changed', listener: (event: Event,
  3842. isAlwaysOnTop: boolean) => void): this;
  3843. removeListener(event: 'always-on-top-changed', listener: (event: Event,
  3844. isAlwaysOnTop: boolean) => void): this;
  3845. /**
  3846. * Emitted when an App Command is invoked. These are typically related to keyboard
  3847. * media keys or browser commands, as well as the "Back" button built into some
  3848. * mice on Windows.
  3849. *
  3850. * Commands are lowercased, underscores are replaced with hyphens, and the
  3851. * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
  3852. * emitted as `browser-backward`.
  3853. *
  3854. * The following app commands are explicitly supported on Linux:
  3855. *
  3856. * * `browser-backward`
  3857. * * `browser-forward`
  3858. *
  3859. * @platform win32,linux
  3860. */
  3861. on(event: 'app-command', listener: (event: Event,
  3862. command: string) => void): this;
  3863. /**
  3864. * @platform win32,linux
  3865. */
  3866. off(event: 'app-command', listener: (event: Event,
  3867. command: string) => void): this;
  3868. /**
  3869. * @platform win32,linux
  3870. */
  3871. once(event: 'app-command', listener: (event: Event,
  3872. command: string) => void): this;
  3873. /**
  3874. * @platform win32,linux
  3875. */
  3876. addListener(event: 'app-command', listener: (event: Event,
  3877. command: string) => void): this;
  3878. /**
  3879. * @platform win32,linux
  3880. */
  3881. removeListener(event: 'app-command', listener: (event: Event,
  3882. command: string) => void): this;
  3883. /**
  3884. * Emitted when an App Command is invoked. These are typically related to keyboard
  3885. * media keys or browser commands, as well as the "Back" button built into some
  3886. * mice on Windows.
  3887. *
  3888. * Commands are lowercased, underscores are replaced with hyphens, and the
  3889. * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
  3890. * emitted as `browser-backward`.
  3891. *
  3892. * The following app commands are explicitly supported on Linux:
  3893. *
  3894. * * `browser-backward`
  3895. * * `browser-forward`
  3896. *
  3897. * @platform win32,linux
  3898. */
  3899. on(event: 'app-command', listener: (event: Event,
  3900. command: string) => void): this;
  3901. /**
  3902. * @platform win32,linux
  3903. */
  3904. off(event: 'app-command', listener: (event: Event,
  3905. command: string) => void): this;
  3906. /**
  3907. * @platform win32,linux
  3908. */
  3909. once(event: 'app-command', listener: (event: Event,
  3910. command: string) => void): this;
  3911. /**
  3912. * @platform win32,linux
  3913. */
  3914. addListener(event: 'app-command', listener: (event: Event,
  3915. command: string) => void): this;
  3916. /**
  3917. * @platform win32,linux
  3918. */
  3919. removeListener(event: 'app-command', listener: (event: Event,
  3920. command: string) => void): this;
  3921. /**
  3922. * Emitted when the window loses focus.
  3923. */
  3924. on(event: 'blur', listener: Function): this;
  3925. off(event: 'blur', listener: Function): this;
  3926. once(event: 'blur', listener: Function): this;
  3927. addListener(event: 'blur', listener: Function): this;
  3928. removeListener(event: 'blur', listener: Function): this;
  3929. /**
  3930. * Emitted when the window loses focus.
  3931. */
  3932. on(event: 'blur', listener: Function): this;
  3933. off(event: 'blur', listener: Function): this;
  3934. once(event: 'blur', listener: Function): this;
  3935. addListener(event: 'blur', listener: Function): this;
  3936. removeListener(event: 'blur', listener: Function): this;
  3937. /**
  3938. * Emitted when the window is going to be closed. It's emitted before the
  3939. * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
  3940. * will cancel the close.
  3941. *
  3942. * Usually you would want to use the `beforeunload` handler to decide whether the
  3943. * window should be closed, which will also be called when the window is reloaded.
  3944. * In Electron, returning any value other than `undefined` would cancel the close.
  3945. * For example:
  3946. *
  3947. * _**Note**: There is a subtle difference between the behaviors of
  3948. * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
  3949. * handler)`. It is recommended to always set the `event.returnValue` explicitly,
  3950. * instead of only returning a value, as the former works more consistently within
  3951. * Electron._
  3952. */
  3953. on(event: 'close', listener: (event: Event) => void): this;
  3954. off(event: 'close', listener: (event: Event) => void): this;
  3955. once(event: 'close', listener: (event: Event) => void): this;
  3956. addListener(event: 'close', listener: (event: Event) => void): this;
  3957. removeListener(event: 'close', listener: (event: Event) => void): this;
  3958. /**
  3959. * Emitted when the window is going to be closed. It's emitted before the
  3960. * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
  3961. * will cancel the close.
  3962. *
  3963. * Usually you would want to use the `beforeunload` handler to decide whether the
  3964. * window should be closed, which will also be called when the window is reloaded.
  3965. * In Electron, returning any value other than `undefined` would cancel the close.
  3966. * For example:
  3967. *
  3968. * _**Note**: There is a subtle difference between the behaviors of
  3969. * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
  3970. * handler)`. It is recommended to always set the `event.returnValue` explicitly,
  3971. * instead of only returning a value, as the former works more consistently within
  3972. * Electron._
  3973. */
  3974. on(event: 'close', listener: (event: Event) => void): this;
  3975. off(event: 'close', listener: (event: Event) => void): this;
  3976. once(event: 'close', listener: (event: Event) => void): this;
  3977. addListener(event: 'close', listener: (event: Event) => void): this;
  3978. removeListener(event: 'close', listener: (event: Event) => void): this;
  3979. /**
  3980. * Emitted when the window is closed. After you have received this event you should
  3981. * remove the reference to the window and avoid using it any more.
  3982. */
  3983. on(event: 'closed', listener: Function): this;
  3984. off(event: 'closed', listener: Function): this;
  3985. once(event: 'closed', listener: Function): this;
  3986. addListener(event: 'closed', listener: Function): this;
  3987. removeListener(event: 'closed', listener: Function): this;
  3988. /**
  3989. * Emitted when the window is closed. After you have received this event you should
  3990. * remove the reference to the window and avoid using it any more.
  3991. */
  3992. on(event: 'closed', listener: Function): this;
  3993. off(event: 'closed', listener: Function): this;
  3994. once(event: 'closed', listener: Function): this;
  3995. addListener(event: 'closed', listener: Function): this;
  3996. removeListener(event: 'closed', listener: Function): this;
  3997. /**
  3998. * Emitted when the window enters a full-screen state.
  3999. */
  4000. on(event: 'enter-full-screen', listener: Function): this;
  4001. off(event: 'enter-full-screen', listener: Function): this;
  4002. once(event: 'enter-full-screen', listener: Function): this;
  4003. addListener(event: 'enter-full-screen', listener: Function): this;
  4004. removeListener(event: 'enter-full-screen', listener: Function): this;
  4005. /**
  4006. * Emitted when the window enters a full-screen state.
  4007. */
  4008. on(event: 'enter-full-screen', listener: Function): this;
  4009. off(event: 'enter-full-screen', listener: Function): this;
  4010. once(event: 'enter-full-screen', listener: Function): this;
  4011. addListener(event: 'enter-full-screen', listener: Function): this;
  4012. removeListener(event: 'enter-full-screen', listener: Function): this;
  4013. /**
  4014. * Emitted when the window enters a full-screen state triggered by HTML API.
  4015. */
  4016. on(event: 'enter-html-full-screen', listener: Function): this;
  4017. off(event: 'enter-html-full-screen', listener: Function): this;
  4018. once(event: 'enter-html-full-screen', listener: Function): this;
  4019. addListener(event: 'enter-html-full-screen', listener: Function): this;
  4020. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  4021. /**
  4022. * Emitted when the window gains focus.
  4023. */
  4024. on(event: 'focus', listener: Function): this;
  4025. off(event: 'focus', listener: Function): this;
  4026. once(event: 'focus', listener: Function): this;
  4027. addListener(event: 'focus', listener: Function): this;
  4028. removeListener(event: 'focus', listener: Function): this;
  4029. /**
  4030. * Emitted when the window gains focus.
  4031. */
  4032. on(event: 'focus', listener: Function): this;
  4033. off(event: 'focus', listener: Function): this;
  4034. once(event: 'focus', listener: Function): this;
  4035. addListener(event: 'focus', listener: Function): this;
  4036. removeListener(event: 'focus', listener: Function): this;
  4037. /**
  4038. * Emitted when the window is hidden.
  4039. */
  4040. on(event: 'hide', listener: Function): this;
  4041. off(event: 'hide', listener: Function): this;
  4042. once(event: 'hide', listener: Function): this;
  4043. addListener(event: 'hide', listener: Function): this;
  4044. removeListener(event: 'hide', listener: Function): this;
  4045. /**
  4046. * Emitted when the window is hidden.
  4047. */
  4048. on(event: 'hide', listener: Function): this;
  4049. off(event: 'hide', listener: Function): this;
  4050. once(event: 'hide', listener: Function): this;
  4051. addListener(event: 'hide', listener: Function): this;
  4052. removeListener(event: 'hide', listener: Function): this;
  4053. /**
  4054. * Emitted when the window leaves a full-screen state.
  4055. */
  4056. on(event: 'leave-full-screen', listener: Function): this;
  4057. off(event: 'leave-full-screen', listener: Function): this;
  4058. once(event: 'leave-full-screen', listener: Function): this;
  4059. addListener(event: 'leave-full-screen', listener: Function): this;
  4060. removeListener(event: 'leave-full-screen', listener: Function): this;
  4061. /**
  4062. * Emitted when the window leaves a full-screen state.
  4063. */
  4064. on(event: 'leave-full-screen', listener: Function): this;
  4065. off(event: 'leave-full-screen', listener: Function): this;
  4066. once(event: 'leave-full-screen', listener: Function): this;
  4067. addListener(event: 'leave-full-screen', listener: Function): this;
  4068. removeListener(event: 'leave-full-screen', listener: Function): this;
  4069. /**
  4070. * Emitted when the window leaves a full-screen state triggered by HTML API.
  4071. */
  4072. on(event: 'leave-html-full-screen', listener: Function): this;
  4073. off(event: 'leave-html-full-screen', listener: Function): this;
  4074. once(event: 'leave-html-full-screen', listener: Function): this;
  4075. addListener(event: 'leave-html-full-screen', listener: Function): this;
  4076. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  4077. /**
  4078. * Emitted when window is maximized.
  4079. */
  4080. on(event: 'maximize', listener: Function): this;
  4081. off(event: 'maximize', listener: Function): this;
  4082. once(event: 'maximize', listener: Function): this;
  4083. addListener(event: 'maximize', listener: Function): this;
  4084. removeListener(event: 'maximize', listener: Function): this;
  4085. /**
  4086. * Emitted when window is maximized.
  4087. */
  4088. on(event: 'maximize', listener: Function): this;
  4089. off(event: 'maximize', listener: Function): this;
  4090. once(event: 'maximize', listener: Function): this;
  4091. addListener(event: 'maximize', listener: Function): this;
  4092. removeListener(event: 'maximize', listener: Function): this;
  4093. /**
  4094. * Emitted when the window is minimized.
  4095. */
  4096. on(event: 'minimize', listener: Function): this;
  4097. off(event: 'minimize', listener: Function): this;
  4098. once(event: 'minimize', listener: Function): this;
  4099. addListener(event: 'minimize', listener: Function): this;
  4100. removeListener(event: 'minimize', listener: Function): this;
  4101. /**
  4102. * Emitted when the window is minimized.
  4103. */
  4104. on(event: 'minimize', listener: Function): this;
  4105. off(event: 'minimize', listener: Function): this;
  4106. once(event: 'minimize', listener: Function): this;
  4107. addListener(event: 'minimize', listener: Function): this;
  4108. removeListener(event: 'minimize', listener: Function): this;
  4109. /**
  4110. * Emitted when the window is being moved to a new position.
  4111. */
  4112. on(event: 'move', listener: Function): this;
  4113. off(event: 'move', listener: Function): this;
  4114. once(event: 'move', listener: Function): this;
  4115. addListener(event: 'move', listener: Function): this;
  4116. removeListener(event: 'move', listener: Function): this;
  4117. /**
  4118. * Emitted when the window is being moved to a new position.
  4119. */
  4120. on(event: 'move', listener: Function): this;
  4121. off(event: 'move', listener: Function): this;
  4122. once(event: 'move', listener: Function): this;
  4123. addListener(event: 'move', listener: Function): this;
  4124. removeListener(event: 'move', listener: Function): this;
  4125. /**
  4126. * Emitted once when the window is moved to a new position.
  4127. *
  4128. * **Note**: On macOS this event is an alias of `move`.
  4129. *
  4130. * @platform darwin,win32
  4131. */
  4132. on(event: 'moved', listener: Function): this;
  4133. /**
  4134. * @platform darwin,win32
  4135. */
  4136. off(event: 'moved', listener: Function): this;
  4137. /**
  4138. * @platform darwin,win32
  4139. */
  4140. once(event: 'moved', listener: Function): this;
  4141. /**
  4142. * @platform darwin,win32
  4143. */
  4144. addListener(event: 'moved', listener: Function): this;
  4145. /**
  4146. * @platform darwin,win32
  4147. */
  4148. removeListener(event: 'moved', listener: Function): this;
  4149. /**
  4150. * Emitted once when the window is moved to a new position.
  4151. *
  4152. * **Note**: On macOS this event is an alias of `move`.
  4153. *
  4154. * @platform darwin,win32
  4155. */
  4156. on(event: 'moved', listener: Function): this;
  4157. /**
  4158. * @platform darwin,win32
  4159. */
  4160. off(event: 'moved', listener: Function): this;
  4161. /**
  4162. * @platform darwin,win32
  4163. */
  4164. once(event: 'moved', listener: Function): this;
  4165. /**
  4166. * @platform darwin,win32
  4167. */
  4168. addListener(event: 'moved', listener: Function): this;
  4169. /**
  4170. * @platform darwin,win32
  4171. */
  4172. removeListener(event: 'moved', listener: Function): this;
  4173. /**
  4174. * Emitted when the native new tab button is clicked.
  4175. *
  4176. * @platform darwin
  4177. */
  4178. on(event: 'new-window-for-tab', listener: Function): this;
  4179. /**
  4180. * @platform darwin
  4181. */
  4182. off(event: 'new-window-for-tab', listener: Function): this;
  4183. /**
  4184. * @platform darwin
  4185. */
  4186. once(event: 'new-window-for-tab', listener: Function): this;
  4187. /**
  4188. * @platform darwin
  4189. */
  4190. addListener(event: 'new-window-for-tab', listener: Function): this;
  4191. /**
  4192. * @platform darwin
  4193. */
  4194. removeListener(event: 'new-window-for-tab', listener: Function): this;
  4195. /**
  4196. * Emitted when the native new tab button is clicked.
  4197. *
  4198. * @platform darwin
  4199. */
  4200. on(event: 'new-window-for-tab', listener: Function): this;
  4201. /**
  4202. * @platform darwin
  4203. */
  4204. off(event: 'new-window-for-tab', listener: Function): this;
  4205. /**
  4206. * @platform darwin
  4207. */
  4208. once(event: 'new-window-for-tab', listener: Function): this;
  4209. /**
  4210. * @platform darwin
  4211. */
  4212. addListener(event: 'new-window-for-tab', listener: Function): this;
  4213. /**
  4214. * @platform darwin
  4215. */
  4216. removeListener(event: 'new-window-for-tab', listener: Function): this;
  4217. /**
  4218. * Emitted when the document changed its title, calling `event.preventDefault()`
  4219. * will prevent the native window's title from changing. `explicitSet` is false
  4220. * when title is synthesized from file URL.
  4221. */
  4222. on(event: 'page-title-updated', listener: (event: Event,
  4223. title: string,
  4224. explicitSet: boolean) => void): this;
  4225. off(event: 'page-title-updated', listener: (event: Event,
  4226. title: string,
  4227. explicitSet: boolean) => void): this;
  4228. once(event: 'page-title-updated', listener: (event: Event,
  4229. title: string,
  4230. explicitSet: boolean) => void): this;
  4231. addListener(event: 'page-title-updated', listener: (event: Event,
  4232. title: string,
  4233. explicitSet: boolean) => void): this;
  4234. removeListener(event: 'page-title-updated', listener: (event: Event,
  4235. title: string,
  4236. explicitSet: boolean) => void): this;
  4237. /**
  4238. * Emitted when the web page has been rendered (while not being shown) and window
  4239. * can be displayed without a visual flash.
  4240. *
  4241. * Please note that using this event implies that the renderer will be considered
  4242. * "visible" and paint even though `show` is false. This event will never fire if
  4243. * you use `paintWhenInitiallyHidden: false`
  4244. */
  4245. on(event: 'ready-to-show', listener: Function): this;
  4246. off(event: 'ready-to-show', listener: Function): this;
  4247. once(event: 'ready-to-show', listener: Function): this;
  4248. addListener(event: 'ready-to-show', listener: Function): this;
  4249. removeListener(event: 'ready-to-show', listener: Function): this;
  4250. /**
  4251. * Emitted after the window has been resized.
  4252. */
  4253. on(event: 'resize', listener: Function): this;
  4254. off(event: 'resize', listener: Function): this;
  4255. once(event: 'resize', listener: Function): this;
  4256. addListener(event: 'resize', listener: Function): this;
  4257. removeListener(event: 'resize', listener: Function): this;
  4258. /**
  4259. * Emitted after the window has been resized.
  4260. */
  4261. on(event: 'resize', listener: Function): this;
  4262. off(event: 'resize', listener: Function): this;
  4263. once(event: 'resize', listener: Function): this;
  4264. addListener(event: 'resize', listener: Function): this;
  4265. removeListener(event: 'resize', listener: Function): this;
  4266. /**
  4267. * Emitted once when the window has finished being resized.
  4268. *
  4269. * This is usually emitted when the window has been resized manually. On macOS,
  4270. * resizing the window with `setBounds`/`setSize` and setting the `animate`
  4271. * parameter to `true` will also emit this event once resizing has finished.
  4272. *
  4273. * @platform darwin,win32
  4274. */
  4275. on(event: 'resized', listener: Function): this;
  4276. /**
  4277. * @platform darwin,win32
  4278. */
  4279. off(event: 'resized', listener: Function): this;
  4280. /**
  4281. * @platform darwin,win32
  4282. */
  4283. once(event: 'resized', listener: Function): this;
  4284. /**
  4285. * @platform darwin,win32
  4286. */
  4287. addListener(event: 'resized', listener: Function): this;
  4288. /**
  4289. * @platform darwin,win32
  4290. */
  4291. removeListener(event: 'resized', listener: Function): this;
  4292. /**
  4293. * Emitted once when the window has finished being resized.
  4294. *
  4295. * This is usually emitted when the window has been resized manually. On macOS,
  4296. * resizing the window with `setBounds`/`setSize` and setting the `animate`
  4297. * parameter to `true` will also emit this event once resizing has finished.
  4298. *
  4299. * @platform darwin,win32
  4300. */
  4301. on(event: 'resized', listener: Function): this;
  4302. /**
  4303. * @platform darwin,win32
  4304. */
  4305. off(event: 'resized', listener: Function): this;
  4306. /**
  4307. * @platform darwin,win32
  4308. */
  4309. once(event: 'resized', listener: Function): this;
  4310. /**
  4311. * @platform darwin,win32
  4312. */
  4313. addListener(event: 'resized', listener: Function): this;
  4314. /**
  4315. * @platform darwin,win32
  4316. */
  4317. removeListener(event: 'resized', listener: Function): this;
  4318. /**
  4319. * Emitted when the unresponsive web page becomes responsive again.
  4320. */
  4321. on(event: 'responsive', listener: Function): this;
  4322. off(event: 'responsive', listener: Function): this;
  4323. once(event: 'responsive', listener: Function): this;
  4324. addListener(event: 'responsive', listener: Function): this;
  4325. removeListener(event: 'responsive', listener: Function): this;
  4326. /**
  4327. * Emitted when the window is restored from a minimized state.
  4328. */
  4329. on(event: 'restore', listener: Function): this;
  4330. off(event: 'restore', listener: Function): this;
  4331. once(event: 'restore', listener: Function): this;
  4332. addListener(event: 'restore', listener: Function): this;
  4333. removeListener(event: 'restore', listener: Function): this;
  4334. /**
  4335. * Emitted when the window is restored from a minimized state.
  4336. */
  4337. on(event: 'restore', listener: Function): this;
  4338. off(event: 'restore', listener: Function): this;
  4339. once(event: 'restore', listener: Function): this;
  4340. addListener(event: 'restore', listener: Function): this;
  4341. removeListener(event: 'restore', listener: Function): this;
  4342. /**
  4343. * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
  4344. * is ended. The `rotation` value on each emission is the angle in degrees rotated
  4345. * since the last emission. The last emitted event upon a rotation gesture will
  4346. * always be of value `0`. Counter-clockwise rotation values are positive, while
  4347. * clockwise ones are negative.
  4348. *
  4349. * @platform darwin
  4350. */
  4351. on(event: 'rotate-gesture', listener: (event: Event,
  4352. rotation: number) => void): this;
  4353. /**
  4354. * @platform darwin
  4355. */
  4356. off(event: 'rotate-gesture', listener: (event: Event,
  4357. rotation: number) => void): this;
  4358. /**
  4359. * @platform darwin
  4360. */
  4361. once(event: 'rotate-gesture', listener: (event: Event,
  4362. rotation: number) => void): this;
  4363. /**
  4364. * @platform darwin
  4365. */
  4366. addListener(event: 'rotate-gesture', listener: (event: Event,
  4367. rotation: number) => void): this;
  4368. /**
  4369. * @platform darwin
  4370. */
  4371. removeListener(event: 'rotate-gesture', listener: (event: Event,
  4372. rotation: number) => void): this;
  4373. /**
  4374. * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
  4375. * is ended. The `rotation` value on each emission is the angle in degrees rotated
  4376. * since the last emission. The last emitted event upon a rotation gesture will
  4377. * always be of value `0`. Counter-clockwise rotation values are positive, while
  4378. * clockwise ones are negative.
  4379. *
  4380. * @platform darwin
  4381. */
  4382. on(event: 'rotate-gesture', listener: (event: Event,
  4383. rotation: number) => void): this;
  4384. /**
  4385. * @platform darwin
  4386. */
  4387. off(event: 'rotate-gesture', listener: (event: Event,
  4388. rotation: number) => void): this;
  4389. /**
  4390. * @platform darwin
  4391. */
  4392. once(event: 'rotate-gesture', listener: (event: Event,
  4393. rotation: number) => void): this;
  4394. /**
  4395. * @platform darwin
  4396. */
  4397. addListener(event: 'rotate-gesture', listener: (event: Event,
  4398. rotation: number) => void): this;
  4399. /**
  4400. * @platform darwin
  4401. */
  4402. removeListener(event: 'rotate-gesture', listener: (event: Event,
  4403. rotation: number) => void): this;
  4404. /**
  4405. * Emitted when window session is going to end due to force shutdown or machine
  4406. * restart or session log off.
  4407. *
  4408. * @platform win32
  4409. */
  4410. on(event: 'session-end', listener: Function): this;
  4411. /**
  4412. * @platform win32
  4413. */
  4414. off(event: 'session-end', listener: Function): this;
  4415. /**
  4416. * @platform win32
  4417. */
  4418. once(event: 'session-end', listener: Function): this;
  4419. /**
  4420. * @platform win32
  4421. */
  4422. addListener(event: 'session-end', listener: Function): this;
  4423. /**
  4424. * @platform win32
  4425. */
  4426. removeListener(event: 'session-end', listener: Function): this;
  4427. /**
  4428. * Emitted when window session is going to end due to force shutdown or machine
  4429. * restart or session log off.
  4430. *
  4431. * @platform win32
  4432. */
  4433. on(event: 'session-end', listener: Function): this;
  4434. /**
  4435. * @platform win32
  4436. */
  4437. off(event: 'session-end', listener: Function): this;
  4438. /**
  4439. * @platform win32
  4440. */
  4441. once(event: 'session-end', listener: Function): this;
  4442. /**
  4443. * @platform win32
  4444. */
  4445. addListener(event: 'session-end', listener: Function): this;
  4446. /**
  4447. * @platform win32
  4448. */
  4449. removeListener(event: 'session-end', listener: Function): this;
  4450. /**
  4451. * Emitted when the window opens a sheet.
  4452. *
  4453. * @platform darwin
  4454. */
  4455. on(event: 'sheet-begin', listener: Function): this;
  4456. /**
  4457. * @platform darwin
  4458. */
  4459. off(event: 'sheet-begin', listener: Function): this;
  4460. /**
  4461. * @platform darwin
  4462. */
  4463. once(event: 'sheet-begin', listener: Function): this;
  4464. /**
  4465. * @platform darwin
  4466. */
  4467. addListener(event: 'sheet-begin', listener: Function): this;
  4468. /**
  4469. * @platform darwin
  4470. */
  4471. removeListener(event: 'sheet-begin', listener: Function): this;
  4472. /**
  4473. * Emitted when the window opens a sheet.
  4474. *
  4475. * @platform darwin
  4476. */
  4477. on(event: 'sheet-begin', listener: Function): this;
  4478. /**
  4479. * @platform darwin
  4480. */
  4481. off(event: 'sheet-begin', listener: Function): this;
  4482. /**
  4483. * @platform darwin
  4484. */
  4485. once(event: 'sheet-begin', listener: Function): this;
  4486. /**
  4487. * @platform darwin
  4488. */
  4489. addListener(event: 'sheet-begin', listener: Function): this;
  4490. /**
  4491. * @platform darwin
  4492. */
  4493. removeListener(event: 'sheet-begin', listener: Function): this;
  4494. /**
  4495. * Emitted when the window has closed a sheet.
  4496. *
  4497. * @platform darwin
  4498. */
  4499. on(event: 'sheet-end', listener: Function): this;
  4500. /**
  4501. * @platform darwin
  4502. */
  4503. off(event: 'sheet-end', listener: Function): this;
  4504. /**
  4505. * @platform darwin
  4506. */
  4507. once(event: 'sheet-end', listener: Function): this;
  4508. /**
  4509. * @platform darwin
  4510. */
  4511. addListener(event: 'sheet-end', listener: Function): this;
  4512. /**
  4513. * @platform darwin
  4514. */
  4515. removeListener(event: 'sheet-end', listener: Function): this;
  4516. /**
  4517. * Emitted when the window has closed a sheet.
  4518. *
  4519. * @platform darwin
  4520. */
  4521. on(event: 'sheet-end', listener: Function): this;
  4522. /**
  4523. * @platform darwin
  4524. */
  4525. off(event: 'sheet-end', listener: Function): this;
  4526. /**
  4527. * @platform darwin
  4528. */
  4529. once(event: 'sheet-end', listener: Function): this;
  4530. /**
  4531. * @platform darwin
  4532. */
  4533. addListener(event: 'sheet-end', listener: Function): this;
  4534. /**
  4535. * @platform darwin
  4536. */
  4537. removeListener(event: 'sheet-end', listener: Function): this;
  4538. /**
  4539. * Emitted when the window is shown.
  4540. */
  4541. on(event: 'show', listener: Function): this;
  4542. off(event: 'show', listener: Function): this;
  4543. once(event: 'show', listener: Function): this;
  4544. addListener(event: 'show', listener: Function): this;
  4545. removeListener(event: 'show', listener: Function): this;
  4546. /**
  4547. * Emitted when the window is shown.
  4548. */
  4549. on(event: 'show', listener: Function): this;
  4550. off(event: 'show', listener: Function): this;
  4551. once(event: 'show', listener: Function): this;
  4552. addListener(event: 'show', listener: Function): this;
  4553. removeListener(event: 'show', listener: Function): this;
  4554. /**
  4555. * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
  4556. * `left`.
  4557. *
  4558. * The method underlying this event is built to handle older macOS-style trackpad
  4559. * swiping, where the content on the screen doesn't move with the swipe. Most macOS
  4560. * trackpads are not configured to allow this kind of swiping anymore, so in order
  4561. * for it to emit properly the 'Swipe between pages' preference in `System
  4562. * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
  4563. * fingers'.
  4564. *
  4565. * @platform darwin
  4566. */
  4567. on(event: 'swipe', listener: (event: Event,
  4568. direction: string) => void): this;
  4569. /**
  4570. * @platform darwin
  4571. */
  4572. off(event: 'swipe', listener: (event: Event,
  4573. direction: string) => void): this;
  4574. /**
  4575. * @platform darwin
  4576. */
  4577. once(event: 'swipe', listener: (event: Event,
  4578. direction: string) => void): this;
  4579. /**
  4580. * @platform darwin
  4581. */
  4582. addListener(event: 'swipe', listener: (event: Event,
  4583. direction: string) => void): this;
  4584. /**
  4585. * @platform darwin
  4586. */
  4587. removeListener(event: 'swipe', listener: (event: Event,
  4588. direction: string) => void): this;
  4589. /**
  4590. * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
  4591. * `left`.
  4592. *
  4593. * The method underlying this event is built to handle older macOS-style trackpad
  4594. * swiping, where the content on the screen doesn't move with the swipe. Most macOS
  4595. * trackpads are not configured to allow this kind of swiping anymore, so in order
  4596. * for it to emit properly the 'Swipe between pages' preference in `System
  4597. * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
  4598. * fingers'.
  4599. *
  4600. * @platform darwin
  4601. */
  4602. on(event: 'swipe', listener: (event: Event,
  4603. direction: string) => void): this;
  4604. /**
  4605. * @platform darwin
  4606. */
  4607. off(event: 'swipe', listener: (event: Event,
  4608. direction: string) => void): this;
  4609. /**
  4610. * @platform darwin
  4611. */
  4612. once(event: 'swipe', listener: (event: Event,
  4613. direction: string) => void): this;
  4614. /**
  4615. * @platform darwin
  4616. */
  4617. addListener(event: 'swipe', listener: (event: Event,
  4618. direction: string) => void): this;
  4619. /**
  4620. * @platform darwin
  4621. */
  4622. removeListener(event: 'swipe', listener: (event: Event,
  4623. direction: string) => void): this;
  4624. /**
  4625. * Emitted when the system context menu is triggered on the window, this is
  4626. * normally only triggered when the user right clicks on the non-client area of
  4627. * your window. This is the window titlebar or any area you have declared as
  4628. * `-webkit-app-region: drag` in a frameless window.
  4629. *
  4630. * Calling `event.preventDefault()` will prevent the menu from being displayed.
  4631. *
  4632. * @platform win32
  4633. */
  4634. on(event: 'system-context-menu', listener: (event: Event,
  4635. /**
  4636. * The screen coordinates the context menu was triggered at
  4637. */
  4638. point: Point) => void): this;
  4639. /**
  4640. * @platform win32
  4641. */
  4642. off(event: 'system-context-menu', listener: (event: Event,
  4643. /**
  4644. * The screen coordinates the context menu was triggered at
  4645. */
  4646. point: Point) => void): this;
  4647. /**
  4648. * @platform win32
  4649. */
  4650. once(event: 'system-context-menu', listener: (event: Event,
  4651. /**
  4652. * The screen coordinates the context menu was triggered at
  4653. */
  4654. point: Point) => void): this;
  4655. /**
  4656. * @platform win32
  4657. */
  4658. addListener(event: 'system-context-menu', listener: (event: Event,
  4659. /**
  4660. * The screen coordinates the context menu was triggered at
  4661. */
  4662. point: Point) => void): this;
  4663. /**
  4664. * @platform win32
  4665. */
  4666. removeListener(event: 'system-context-menu', listener: (event: Event,
  4667. /**
  4668. * The screen coordinates the context menu was triggered at
  4669. */
  4670. point: Point) => void): this;
  4671. /**
  4672. * Emitted when the system context menu is triggered on the window, this is
  4673. * normally only triggered when the user right clicks on the non-client area of
  4674. * your window. This is the window titlebar or any area you have declared as
  4675. * `-webkit-app-region: drag` in a frameless window.
  4676. *
  4677. * Calling `event.preventDefault()` will prevent the menu from being displayed.
  4678. *
  4679. * @platform win32
  4680. */
  4681. on(event: 'system-context-menu', listener: (event: Event,
  4682. /**
  4683. * The screen coordinates the context menu was triggered at
  4684. */
  4685. point: Point) => void): this;
  4686. /**
  4687. * @platform win32
  4688. */
  4689. off(event: 'system-context-menu', listener: (event: Event,
  4690. /**
  4691. * The screen coordinates the context menu was triggered at
  4692. */
  4693. point: Point) => void): this;
  4694. /**
  4695. * @platform win32
  4696. */
  4697. once(event: 'system-context-menu', listener: (event: Event,
  4698. /**
  4699. * The screen coordinates the context menu was triggered at
  4700. */
  4701. point: Point) => void): this;
  4702. /**
  4703. * @platform win32
  4704. */
  4705. addListener(event: 'system-context-menu', listener: (event: Event,
  4706. /**
  4707. * The screen coordinates the context menu was triggered at
  4708. */
  4709. point: Point) => void): this;
  4710. /**
  4711. * @platform win32
  4712. */
  4713. removeListener(event: 'system-context-menu', listener: (event: Event,
  4714. /**
  4715. * The screen coordinates the context menu was triggered at
  4716. */
  4717. point: Point) => void): this;
  4718. /**
  4719. * Emitted when the window exits from a maximized state.
  4720. */
  4721. on(event: 'unmaximize', listener: Function): this;
  4722. off(event: 'unmaximize', listener: Function): this;
  4723. once(event: 'unmaximize', listener: Function): this;
  4724. addListener(event: 'unmaximize', listener: Function): this;
  4725. removeListener(event: 'unmaximize', listener: Function): this;
  4726. /**
  4727. * Emitted when the window exits from a maximized state.
  4728. */
  4729. on(event: 'unmaximize', listener: Function): this;
  4730. off(event: 'unmaximize', listener: Function): this;
  4731. once(event: 'unmaximize', listener: Function): this;
  4732. addListener(event: 'unmaximize', listener: Function): this;
  4733. removeListener(event: 'unmaximize', listener: Function): this;
  4734. /**
  4735. * Emitted when the web page becomes unresponsive.
  4736. */
  4737. on(event: 'unresponsive', listener: Function): this;
  4738. off(event: 'unresponsive', listener: Function): this;
  4739. once(event: 'unresponsive', listener: Function): this;
  4740. addListener(event: 'unresponsive', listener: Function): this;
  4741. removeListener(event: 'unresponsive', listener: Function): this;
  4742. /**
  4743. * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
  4744. * will prevent the window from being moved.
  4745. *
  4746. * Note that this is only emitted when the window is being moved manually. Moving
  4747. * the window with `setPosition`/`setBounds`/`center` will not emit this event.
  4748. *
  4749. * @platform darwin,win32
  4750. */
  4751. on(event: 'will-move', listener: (event: Event,
  4752. /**
  4753. * Location the window is being moved to.
  4754. */
  4755. newBounds: Rectangle) => void): this;
  4756. /**
  4757. * @platform darwin,win32
  4758. */
  4759. off(event: 'will-move', listener: (event: Event,
  4760. /**
  4761. * Location the window is being moved to.
  4762. */
  4763. newBounds: Rectangle) => void): this;
  4764. /**
  4765. * @platform darwin,win32
  4766. */
  4767. once(event: 'will-move', listener: (event: Event,
  4768. /**
  4769. * Location the window is being moved to.
  4770. */
  4771. newBounds: Rectangle) => void): this;
  4772. /**
  4773. * @platform darwin,win32
  4774. */
  4775. addListener(event: 'will-move', listener: (event: Event,
  4776. /**
  4777. * Location the window is being moved to.
  4778. */
  4779. newBounds: Rectangle) => void): this;
  4780. /**
  4781. * @platform darwin,win32
  4782. */
  4783. removeListener(event: 'will-move', listener: (event: Event,
  4784. /**
  4785. * Location the window is being moved to.
  4786. */
  4787. newBounds: Rectangle) => void): this;
  4788. /**
  4789. * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
  4790. * will prevent the window from being moved.
  4791. *
  4792. * Note that this is only emitted when the window is being moved manually. Moving
  4793. * the window with `setPosition`/`setBounds`/`center` will not emit this event.
  4794. *
  4795. * @platform darwin,win32
  4796. */
  4797. on(event: 'will-move', listener: (event: Event,
  4798. /**
  4799. * Location the window is being moved to.
  4800. */
  4801. newBounds: Rectangle) => void): this;
  4802. /**
  4803. * @platform darwin,win32
  4804. */
  4805. off(event: 'will-move', listener: (event: Event,
  4806. /**
  4807. * Location the window is being moved to.
  4808. */
  4809. newBounds: Rectangle) => void): this;
  4810. /**
  4811. * @platform darwin,win32
  4812. */
  4813. once(event: 'will-move', listener: (event: Event,
  4814. /**
  4815. * Location the window is being moved to.
  4816. */
  4817. newBounds: Rectangle) => void): this;
  4818. /**
  4819. * @platform darwin,win32
  4820. */
  4821. addListener(event: 'will-move', listener: (event: Event,
  4822. /**
  4823. * Location the window is being moved to.
  4824. */
  4825. newBounds: Rectangle) => void): this;
  4826. /**
  4827. * @platform darwin,win32
  4828. */
  4829. removeListener(event: 'will-move', listener: (event: Event,
  4830. /**
  4831. * Location the window is being moved to.
  4832. */
  4833. newBounds: Rectangle) => void): this;
  4834. /**
  4835. * Emitted before the window is resized. Calling `event.preventDefault()` will
  4836. * prevent the window from being resized.
  4837. *
  4838. * Note that this is only emitted when the window is being resized manually.
  4839. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  4840. *
  4841. * The possible values and behaviors of the `edge` option are platform dependent.
  4842. * Possible values are:
  4843. *
  4844. * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
  4845. * `top-right`, `bottom-left`, `bottom-right`.
  4846. * * On macOS, possible values are `bottom` and `right`.
  4847. * * The value `bottom` is used to denote vertical resizing.
  4848. * * The value `right` is used to denote horizontal resizing.
  4849. *
  4850. * @platform darwin,win32
  4851. */
  4852. on(event: 'will-resize', listener: (event: Event,
  4853. /**
  4854. * Size the window is being resized to.
  4855. */
  4856. newBounds: Rectangle,
  4857. details: WillResizeDetails) => void): this;
  4858. /**
  4859. * @platform darwin,win32
  4860. */
  4861. off(event: 'will-resize', listener: (event: Event,
  4862. /**
  4863. * Size the window is being resized to.
  4864. */
  4865. newBounds: Rectangle,
  4866. details: WillResizeDetails) => void): this;
  4867. /**
  4868. * @platform darwin,win32
  4869. */
  4870. once(event: 'will-resize', listener: (event: Event,
  4871. /**
  4872. * Size the window is being resized to.
  4873. */
  4874. newBounds: Rectangle,
  4875. details: WillResizeDetails) => void): this;
  4876. /**
  4877. * @platform darwin,win32
  4878. */
  4879. addListener(event: 'will-resize', listener: (event: Event,
  4880. /**
  4881. * Size the window is being resized to.
  4882. */
  4883. newBounds: Rectangle,
  4884. details: WillResizeDetails) => void): this;
  4885. /**
  4886. * @platform darwin,win32
  4887. */
  4888. removeListener(event: 'will-resize', listener: (event: Event,
  4889. /**
  4890. * Size the window is being resized to.
  4891. */
  4892. newBounds: Rectangle,
  4893. details: WillResizeDetails) => void): this;
  4894. /**
  4895. * Emitted before the window is resized. Calling `event.preventDefault()` will
  4896. * prevent the window from being resized.
  4897. *
  4898. * Note that this is only emitted when the window is being resized manually.
  4899. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  4900. *
  4901. * The possible values and behaviors of the `edge` option are platform dependent.
  4902. * Possible values are:
  4903. *
  4904. * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
  4905. * `top-right`, `bottom-left`, `bottom-right`.
  4906. * * On macOS, possible values are `bottom` and `right`.
  4907. * * The value `bottom` is used to denote vertical resizing.
  4908. * * The value `right` is used to denote horizontal resizing.
  4909. *
  4910. * @platform darwin,win32
  4911. */
  4912. on(event: 'will-resize', listener: (event: Event,
  4913. /**
  4914. * Size the window is being resized to.
  4915. */
  4916. newBounds: Rectangle,
  4917. details: WillResizeDetails) => void): this;
  4918. /**
  4919. * @platform darwin,win32
  4920. */
  4921. off(event: 'will-resize', listener: (event: Event,
  4922. /**
  4923. * Size the window is being resized to.
  4924. */
  4925. newBounds: Rectangle,
  4926. details: WillResizeDetails) => void): this;
  4927. /**
  4928. * @platform darwin,win32
  4929. */
  4930. once(event: 'will-resize', listener: (event: Event,
  4931. /**
  4932. * Size the window is being resized to.
  4933. */
  4934. newBounds: Rectangle,
  4935. details: WillResizeDetails) => void): this;
  4936. /**
  4937. * @platform darwin,win32
  4938. */
  4939. addListener(event: 'will-resize', listener: (event: Event,
  4940. /**
  4941. * Size the window is being resized to.
  4942. */
  4943. newBounds: Rectangle,
  4944. details: WillResizeDetails) => void): this;
  4945. /**
  4946. * @platform darwin,win32
  4947. */
  4948. removeListener(event: 'will-resize', listener: (event: Event,
  4949. /**
  4950. * Size the window is being resized to.
  4951. */
  4952. newBounds: Rectangle,
  4953. details: WillResizeDetails) => void): this;
  4954. /**
  4955. * BrowserWindow
  4956. */
  4957. constructor(options?: BrowserWindowConstructorOptions);
  4958. /**
  4959. * > **Note** The `BrowserView` class is deprecated, and replaced by the new
  4960. * `WebContentsView` class.
  4961. *
  4962. * The window that owns the given `browserView`. If the given view is not attached
  4963. * to any window, returns `null`.
  4964. *
  4965. * @deprecated
  4966. */
  4967. static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
  4968. /**
  4969. * The window with the given `id`.
  4970. */
  4971. static fromId(id: number): (BrowserWindow) | (null);
  4972. /**
  4973. * The window that owns the given `webContents` or `null` if the contents are not
  4974. * owned by a window.
  4975. */
  4976. static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
  4977. /**
  4978. * An array of all opened browser windows.
  4979. */
  4980. static getAllWindows(): BrowserWindow[];
  4981. /**
  4982. * The window that is focused in this application, otherwise returns `null`.
  4983. */
  4984. static getFocusedWindow(): (BrowserWindow) | (null);
  4985. /**
  4986. * Replacement API for setBrowserView supporting work with multi browser views.
  4987. *
  4988. * > **Note** The `BrowserView` class is deprecated, and replaced by the new
  4989. * `WebContentsView` class.
  4990. *
  4991. * @experimental
  4992. * @deprecated
  4993. */
  4994. addBrowserView(browserView: BrowserView): void;
  4995. /**
  4996. * Adds a window as a tab on this window, after the tab for the window instance.
  4997. *
  4998. * @platform darwin
  4999. */
  5000. addTabbedWindow(browserWindow: BrowserWindow): void;
  5001. /**
  5002. * Removes focus from the window.
  5003. */
  5004. blur(): void;
  5005. blurWebView(): void;
  5006. /**
  5007. * Resolves with a NativeImage
  5008. *
  5009. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  5010. * whole visible page. If the page is not visible, `rect` may be empty. The page is
  5011. * considered visible when its browser window is hidden and the capturer count is
  5012. * non-zero. If you would like the page to stay hidden, you should ensure that
  5013. * `stayHidden` is set to true.
  5014. */
  5015. capturePage(rect?: Rectangle, opts?: Opts): Promise<Electron.NativeImage>;
  5016. /**
  5017. * Moves window to the center of the screen.
  5018. */
  5019. center(): void;
  5020. /**
  5021. * Try to close the window. This has the same effect as a user manually clicking
  5022. * the close button of the window. The web page may cancel the close though. See
  5023. * the close event.
  5024. */
  5025. close(): void;
  5026. /**
  5027. * Closes the currently open Quick Look panel.
  5028. *
  5029. * @platform darwin
  5030. */
  5031. closeFilePreview(): void;
  5032. /**
  5033. * Force closing the window, the `unload` and `beforeunload` event won't be emitted
  5034. * for the web page, and `close` event will also not be emitted for this window,
  5035. * but it guarantees the `closed` event will be emitted.
  5036. */
  5037. destroy(): void;
  5038. /**
  5039. * Starts or stops flashing the window to attract user's attention.
  5040. */
  5041. flashFrame(flag: boolean): void;
  5042. /**
  5043. * Focuses on the window.
  5044. */
  5045. focus(): void;
  5046. focusOnWebView(): void;
  5047. /**
  5048. * Gets the background color of the window in Hex (`#RRGGBB`) format.
  5049. *
  5050. * See Setting `backgroundColor`.
  5051. *
  5052. * **Note:** The alpha value is _not_ returned alongside the red, green, and blue
  5053. * values.
  5054. */
  5055. getBackgroundColor(): string;
  5056. /**
  5057. * The `bounds` of the window as `Object`.
  5058. *
  5059. * **Note:** On macOS, the y-coordinate value returned will be at minimum the Tray
  5060. * height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height:
  5061. * 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x:
  5062. * 25, y: 38, width: 800, height: 600 }`.
  5063. */
  5064. getBounds(): Rectangle;
  5065. /**
  5066. * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
  5067. * Throws an error if multiple `BrowserView`s are attached.
  5068. *
  5069. * > **Note** The `BrowserView` class is deprecated, and replaced by the new
  5070. * `WebContentsView` class.
  5071. *
  5072. * @experimental
  5073. * @deprecated
  5074. */
  5075. getBrowserView(): (BrowserView) | (null);
  5076. /**
  5077. * a sorted by z-index array of all BrowserViews that have been attached with
  5078. * `addBrowserView` or `setBrowserView`. The top-most BrowserView is the last
  5079. * element of the array.
  5080. *
  5081. * > **Note** The `BrowserView` class is deprecated, and replaced by the new
  5082. * `WebContentsView` class.
  5083. *
  5084. * @experimental
  5085. * @deprecated
  5086. */
  5087. getBrowserViews(): BrowserView[];
  5088. /**
  5089. * All child windows.
  5090. */
  5091. getChildWindows(): BrowserWindow[];
  5092. /**
  5093. * The `bounds` of the window's client area as `Object`.
  5094. */
  5095. getContentBounds(): Rectangle;
  5096. /**
  5097. * Contains the window's client area's width and height.
  5098. */
  5099. getContentSize(): number[];
  5100. /**
  5101. * Contains the window's maximum width and height.
  5102. */
  5103. getMaximumSize(): number[];
  5104. /**
  5105. * Window id in the format of DesktopCapturerSource's id. For example
  5106. * "window:1324:0".
  5107. *
  5108. * More precisely the format is `window:id:other_id` where `id` is `HWND` on
  5109. * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
  5110. * Linux. `other_id` is used to identify web contents (tabs) so within the same top
  5111. * level window.
  5112. */
  5113. getMediaSourceId(): string;
  5114. /**
  5115. * Contains the window's minimum width and height.
  5116. */
  5117. getMinimumSize(): number[];
  5118. /**
  5119. * The platform-specific handle of the window.
  5120. *
  5121. * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
  5122. * `Window` (`unsigned long`) on Linux.
  5123. */
  5124. getNativeWindowHandle(): Buffer;
  5125. /**
  5126. * Contains the window bounds of the normal state
  5127. *
  5128. * **Note:** whatever the current state of the window : maximized, minimized or in
  5129. * fullscreen, this function always returns the position and size of the window in
  5130. * normal state. In normal state, getBounds and getNormalBounds returns the same
  5131. * `Rectangle`.
  5132. */
  5133. getNormalBounds(): Rectangle;
  5134. /**
  5135. * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
  5136. * 1.
  5137. */
  5138. getOpacity(): number;
  5139. /**
  5140. * The parent window or `null` if there is no parent.
  5141. */
  5142. getParentWindow(): (BrowserWindow) | (null);
  5143. /**
  5144. * Contains the window's current position.
  5145. */
  5146. getPosition(): number[];
  5147. /**
  5148. * The pathname of the file the window represents.
  5149. *
  5150. * @platform darwin
  5151. */
  5152. getRepresentedFilename(): string;
  5153. /**
  5154. * Contains the window's width and height.
  5155. */
  5156. getSize(): number[];
  5157. /**
  5158. * The title of the native window.
  5159. *
  5160. * **Note:** The title of the web page can be different from the title of the
  5161. * native window.
  5162. */
  5163. getTitle(): string;
  5164. /**
  5165. * The custom position for the traffic light buttons in frameless window, `null`
  5166. * will be returned when there is no custom position.
  5167. *
  5168. * @platform darwin
  5169. */
  5170. getWindowButtonPosition(): (Point) | (null);
  5171. /**
  5172. * Whether the window has a shadow.
  5173. */
  5174. hasShadow(): boolean;
  5175. /**
  5176. * Hides the window.
  5177. */
  5178. hide(): void;
  5179. /**
  5180. * Hooks a windows message. The `callback` is called when the message is received
  5181. * in the WndProc.
  5182. *
  5183. * @platform win32
  5184. */
  5185. hookWindowMessage(message: number, callback: (wParam: Buffer, lParam: Buffer) => void): void;
  5186. /**
  5187. * Invalidates the window shadow so that it is recomputed based on the current
  5188. * window shape.
  5189. *
  5190. * `BrowserWindows` that are transparent can sometimes leave behind visual
  5191. * artifacts on macOS. This method can be used to clear these artifacts when, for
  5192. * example, performing an animation.
  5193. *
  5194. * @platform darwin
  5195. */
  5196. invalidateShadow(): void;
  5197. /**
  5198. * Whether the window is always on top of other windows.
  5199. */
  5200. isAlwaysOnTop(): boolean;
  5201. /**
  5202. * Whether the window can be manually closed by user.
  5203. *
  5204. * On Linux always returns `true`.
  5205. *
  5206. * @platform darwin,win32
  5207. */
  5208. isClosable(): boolean;
  5209. /**
  5210. * Whether the window is destroyed.
  5211. */
  5212. isDestroyed(): boolean;
  5213. /**
  5214. * Whether the window's document has been edited.
  5215. *
  5216. * @platform darwin
  5217. */
  5218. isDocumentEdited(): boolean;
  5219. /**
  5220. * whether the window is enabled.
  5221. */
  5222. isEnabled(): boolean;
  5223. /**
  5224. * Whether the window can be focused.
  5225. *
  5226. * @platform darwin,win32
  5227. */
  5228. isFocusable(): boolean;
  5229. /**
  5230. * Whether the window is focused.
  5231. */
  5232. isFocused(): boolean;
  5233. /**
  5234. * Whether the window is in fullscreen mode.
  5235. */
  5236. isFullScreen(): boolean;
  5237. /**
  5238. * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
  5239. * window.
  5240. */
  5241. isFullScreenable(): boolean;
  5242. /**
  5243. * Whether the window will be hidden when the user toggles into mission control.
  5244. *
  5245. * @platform darwin
  5246. */
  5247. isHiddenInMissionControl(): boolean;
  5248. /**
  5249. * Whether the window is in kiosk mode.
  5250. */
  5251. isKiosk(): boolean;
  5252. /**
  5253. * Whether the window can be manually maximized by user.
  5254. *
  5255. * On Linux always returns `true`.
  5256. *
  5257. * @platform darwin,win32
  5258. */
  5259. isMaximizable(): boolean;
  5260. /**
  5261. * Whether the window is maximized.
  5262. */
  5263. isMaximized(): boolean;
  5264. /**
  5265. * Whether menu bar automatically hides itself.
  5266. *
  5267. * @platform win32,linux
  5268. */
  5269. isMenuBarAutoHide(): boolean;
  5270. /**
  5271. * Whether the menu bar is visible.
  5272. *
  5273. * @platform win32,linux
  5274. */
  5275. isMenuBarVisible(): boolean;
  5276. /**
  5277. * Whether the window can be manually minimized by the user.
  5278. *
  5279. * On Linux always returns `true`.
  5280. *
  5281. * @platform darwin,win32
  5282. */
  5283. isMinimizable(): boolean;
  5284. /**
  5285. * Whether the window is minimized.
  5286. */
  5287. isMinimized(): boolean;
  5288. /**
  5289. * Whether current window is a modal window.
  5290. */
  5291. isModal(): boolean;
  5292. /**
  5293. * Whether the window can be moved by user.
  5294. *
  5295. * On Linux always returns `true`.
  5296. *
  5297. * @platform darwin,win32
  5298. */
  5299. isMovable(): boolean;
  5300. /**
  5301. * Whether the window is in normal state (not maximized, not minimized, not in
  5302. * fullscreen mode).
  5303. */
  5304. isNormal(): boolean;
  5305. /**
  5306. * Whether the window can be manually resized by the user.
  5307. */
  5308. isResizable(): boolean;
  5309. /**
  5310. * Whether the window is in simple (pre-Lion) fullscreen mode.
  5311. *
  5312. * @platform darwin
  5313. */
  5314. isSimpleFullScreen(): boolean;
  5315. /**
  5316. * Whether the window is in Windows 10 tablet mode.
  5317. *
  5318. * Since Windows 10 users can use their PC as tablet, under this mode apps can
  5319. * choose to optimize their UI for tablets, such as enlarging the titlebar and
  5320. * hiding titlebar buttons.
  5321. *
  5322. * This API returns whether the window is in tablet mode, and the `resize` event
  5323. * can be be used to listen to changes to tablet mode.
  5324. *
  5325. * @platform win32
  5326. */
  5327. isTabletMode(): boolean;
  5328. /**
  5329. * Whether the window is visible to the user in the foreground of the app.
  5330. */
  5331. isVisible(): boolean;
  5332. /**
  5333. * Whether the window is visible on all workspaces.
  5334. *
  5335. * **Note:** This API always returns false on Windows.
  5336. *
  5337. * @platform darwin,linux
  5338. */
  5339. isVisibleOnAllWorkspaces(): boolean;
  5340. /**
  5341. * `true` or `false` depending on whether the message is hooked.
  5342. *
  5343. * @platform win32
  5344. */
  5345. isWindowMessageHooked(message: number): boolean;
  5346. /**
  5347. * the promise will resolve when the page has finished loading (see
  5348. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  5349. *
  5350. * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
  5351. * relative to the root of your application. See the `webContents` docs for more
  5352. * information.
  5353. */
  5354. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  5355. /**
  5356. * the promise will resolve when the page has finished loading (see
  5357. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  5358. *
  5359. * Same as `webContents.loadURL(url[, options])`.
  5360. *
  5361. * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
  5362. * file using the `file://` protocol.
  5363. *
  5364. * To ensure that file URLs are properly formatted, it is recommended to use Node's
  5365. * `url.format` method:
  5366. *
  5367. * You can load a URL using a `POST` request with URL-encoded data by doing the
  5368. * following:
  5369. */
  5370. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  5371. /**
  5372. * Maximizes the window. This will also show (but not focus) the window if it isn't
  5373. * being displayed already.
  5374. */
  5375. maximize(): void;
  5376. /**
  5377. * Merges all windows into one window with multiple tabs when native tabs are
  5378. * enabled and there is more than one open window.
  5379. *
  5380. * @platform darwin
  5381. */
  5382. mergeAllWindows(): void;
  5383. /**
  5384. * Minimizes the window. On some platforms the minimized window will be shown in
  5385. * the Dock.
  5386. */
  5387. minimize(): void;
  5388. /**
  5389. * Moves window above the source window in the sense of z-order. If the
  5390. * `mediaSourceId` is not of type window or if the window does not exist then this
  5391. * method throws an error.
  5392. */
  5393. moveAbove(mediaSourceId: string): void;
  5394. /**
  5395. * Moves the current tab into a new window if native tabs are enabled and there is
  5396. * more than one tab in the current window.
  5397. *
  5398. * @platform darwin
  5399. */
  5400. moveTabToNewWindow(): void;
  5401. /**
  5402. * Moves window to top(z-order) regardless of focus
  5403. */
  5404. moveTop(): void;
  5405. /**
  5406. * Uses Quick Look to preview a file at a given path.
  5407. *
  5408. * @platform darwin
  5409. */
  5410. previewFile(path: string, displayName?: string): void;
  5411. /**
  5412. * Same as `webContents.reload`.
  5413. */
  5414. reload(): void;
  5415. /**
  5416. * > **Note** The `BrowserView` class is deprecated, and replaced by the new
  5417. * `WebContentsView` class.
  5418. *
  5419. * @experimental
  5420. * @deprecated
  5421. */
  5422. removeBrowserView(browserView: BrowserView): void;
  5423. /**
  5424. * Remove the window's menu bar.
  5425. *
  5426. * @platform linux,win32
  5427. */
  5428. removeMenu(): void;
  5429. /**
  5430. * Restores the window from minimized state to its previous state.
  5431. */
  5432. restore(): void;
  5433. /**
  5434. * Selects the next tab when native tabs are enabled and there are other tabs in
  5435. * the window.
  5436. *
  5437. * @platform darwin
  5438. */
  5439. selectNextTab(): void;
  5440. /**
  5441. * Selects the previous tab when native tabs are enabled and there are other tabs
  5442. * in the window.
  5443. *
  5444. * @platform darwin
  5445. */
  5446. selectPreviousTab(): void;
  5447. /**
  5448. * Sets whether the window should show always on top of other windows. After
  5449. * setting this, the window is still a normal window, not a toolbox window which
  5450. * can not be focused on.
  5451. */
  5452. setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
  5453. /**
  5454. * Sets the properties for the window's taskbar button.
  5455. *
  5456. * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
  5457. * together. If one of those properties is not set, then neither will be used.
  5458. *
  5459. * @platform win32
  5460. */
  5461. setAppDetails(options: AppDetailsOptions): void;
  5462. /**
  5463. * This will make a window maintain an aspect ratio. The extra size allows a
  5464. * developer to have space, specified in pixels, not included within the aspect
  5465. * ratio calculations. This API already takes into account the difference between a
  5466. * window's size and its content size.
  5467. *
  5468. * Consider a normal window with an HD video player and associated controls.
  5469. * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
  5470. * on the right edge and 50 pixels of controls below the player. In order to
  5471. * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
  5472. * the player itself we would call this function with arguments of 16/9 and {
  5473. * width: 40, height: 50 }. The second argument doesn't care where the extra width
  5474. * and height are within the content view--only that they exist. Sum any extra
  5475. * width and height areas you have within the overall content view.
  5476. *
  5477. * The aspect ratio is not respected when window is resized programmatically with
  5478. * APIs like `win.setSize`.
  5479. *
  5480. * To reset an aspect ratio, pass 0 as the `aspectRatio` value:
  5481. * `win.setAspectRatio(0)`.
  5482. */
  5483. setAspectRatio(aspectRatio: number, extraSize?: Size): void;
  5484. /**
  5485. * Controls whether to hide cursor when typing.
  5486. *
  5487. * @platform darwin
  5488. */
  5489. setAutoHideCursor(autoHide: boolean): void;
  5490. /**
  5491. * Sets whether the window menu bar should hide itself automatically. Once set the
  5492. * menu bar will only show when users press the single `Alt` key.
  5493. *
  5494. * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
  5495. * hide it immediately.
  5496. *
  5497. * @platform win32,linux
  5498. */
  5499. setAutoHideMenuBar(hide: boolean): void;
  5500. /**
  5501. * Examples of valid `backgroundColor` values:
  5502. *
  5503. * * Hex
  5504. * * #fff (shorthand RGB)
  5505. * * #ffff (shorthand ARGB)
  5506. * * #ffffff (RGB)
  5507. * * #ffffffff (ARGB)
  5508. * * RGB
  5509. * * `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
  5510. * * e.g. rgb(255, 255, 255)
  5511. * * RGBA
  5512. * * `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
  5513. * * e.g. rgba(255, 255, 255, 1.0)
  5514. * * HSL
  5515. * * `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
  5516. * * e.g. hsl(200, 20%, 50%)
  5517. * * HSLA
  5518. * * `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
  5519. * * e.g. hsla(200, 20%, 50%, 0.5)
  5520. * * Color name
  5521. * * Options are listed in SkParseColor.cpp
  5522. * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
  5523. * * e.g. `blueviolet` or `red`
  5524. *
  5525. * Sets the background color of the window. See Setting `backgroundColor`.
  5526. */
  5527. setBackgroundColor(backgroundColor: string): void;
  5528. /**
  5529. * This method sets the browser window's system-drawn background material,
  5530. * including behind the non-client area.
  5531. *
  5532. * See the Windows documentation for more details.
  5533. *
  5534. * **Note:** This method is only supported on Windows 11 22H2 and up.
  5535. *
  5536. * @platform win32
  5537. */
  5538. setBackgroundMaterial(material: 'auto' | 'none' | 'mica' | 'acrylic' | 'tabbed'): void;
  5539. /**
  5540. * Resizes and moves the window to the supplied bounds. Any properties that are not
  5541. * supplied will default to their current values.
  5542. *
  5543. * **Note:** On macOS, the y-coordinate value cannot be smaller than the Tray
  5544. * height. The tray height has changed over time and depends on the operating
  5545. * system, but is between 20-40px. Passing a value lower than the tray height will
  5546. * result in a window that is flush to the tray.
  5547. */
  5548. setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
  5549. /**
  5550. * > **Note** The `BrowserView` class is deprecated, and replaced by the new
  5551. * `WebContentsView` class.
  5552. *
  5553. * @experimental
  5554. * @deprecated
  5555. */
  5556. setBrowserView(browserView: (BrowserView) | (null)): void;
  5557. /**
  5558. * Sets whether the window can be manually closed by user. On Linux does nothing.
  5559. *
  5560. * @platform darwin,win32
  5561. */
  5562. setClosable(closable: boolean): void;
  5563. /**
  5564. * Resizes and moves the window's client area (e.g. the web page) to the supplied
  5565. * bounds.
  5566. */
  5567. setContentBounds(bounds: Rectangle, animate?: boolean): void;
  5568. /**
  5569. * Prevents the window contents from being captured by other apps.
  5570. *
  5571. * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
  5572. * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
  5573. * version 2004 and up the window will be removed from capture entirely, older
  5574. * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
  5575. *
  5576. * @platform darwin,win32
  5577. */
  5578. setContentProtection(enable: boolean): void;
  5579. /**
  5580. * Resizes the window's client area (e.g. the web page) to `width` and `height`.
  5581. */
  5582. setContentSize(width: number, height: number, animate?: boolean): void;
  5583. /**
  5584. * Specifies whether the window’s document has been edited, and the icon in title
  5585. * bar will become gray when set to `true`.
  5586. *
  5587. * @platform darwin
  5588. */
  5589. setDocumentEdited(edited: boolean): void;
  5590. /**
  5591. * Disable or enable the window.
  5592. */
  5593. setEnabled(enable: boolean): void;
  5594. /**
  5595. * Changes whether the window can be focused.
  5596. *
  5597. * On macOS it does not remove the focus from the window.
  5598. *
  5599. * @platform darwin,win32
  5600. */
  5601. setFocusable(focusable: boolean): void;
  5602. /**
  5603. * Sets whether the window should be in fullscreen mode.
  5604. *
  5605. * **Note:** On macOS, fullscreen transitions take place asynchronously. If further
  5606. * actions depend on the fullscreen state, use the 'enter-full-screen' or
  5607. * 'leave-full-screen' events.
  5608. */
  5609. setFullScreen(flag: boolean): void;
  5610. /**
  5611. * Sets whether the maximize/zoom window button toggles fullscreen mode or
  5612. * maximizes the window.
  5613. */
  5614. setFullScreenable(fullscreenable: boolean): void;
  5615. /**
  5616. * Sets whether the window should have a shadow.
  5617. */
  5618. setHasShadow(hasShadow: boolean): void;
  5619. /**
  5620. * Sets whether the window will be hidden when the user toggles into mission
  5621. * control.
  5622. *
  5623. * @platform darwin
  5624. */
  5625. setHiddenInMissionControl(hidden: boolean): void;
  5626. /**
  5627. * Changes window icon.
  5628. *
  5629. * @platform win32,linux
  5630. */
  5631. setIcon(icon: (NativeImage) | (string)): void;
  5632. /**
  5633. * Makes the window ignore all mouse events.
  5634. *
  5635. * All mouse events happened in this window will be passed to the window below this
  5636. * window, but if this window has focus, it will still receive keyboard events.
  5637. */
  5638. setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
  5639. /**
  5640. * Enters or leaves kiosk mode.
  5641. */
  5642. setKiosk(flag: boolean): void;
  5643. /**
  5644. * Sets whether the window can be manually maximized by user. On Linux does
  5645. * nothing.
  5646. *
  5647. * @platform darwin,win32
  5648. */
  5649. setMaximizable(maximizable: boolean): void;
  5650. /**
  5651. * Sets the maximum size of window to `width` and `height`.
  5652. */
  5653. setMaximumSize(width: number, height: number): void;
  5654. /**
  5655. * Sets the `menu` as the window's menu bar.
  5656. *
  5657. * @platform linux,win32
  5658. */
  5659. setMenu(menu: (Menu) | (null)): void;
  5660. /**
  5661. * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
  5662. * can still bring up the menu bar by pressing the single `Alt` key.
  5663. *
  5664. * @platform win32,linux
  5665. */
  5666. setMenuBarVisibility(visible: boolean): void;
  5667. /**
  5668. * Sets whether the window can be manually minimized by user. On Linux does
  5669. * nothing.
  5670. *
  5671. * @platform darwin,win32
  5672. */
  5673. setMinimizable(minimizable: boolean): void;
  5674. /**
  5675. * Sets the minimum size of window to `width` and `height`.
  5676. */
  5677. setMinimumSize(width: number, height: number): void;
  5678. /**
  5679. * Sets whether the window can be moved by user. On Linux does nothing.
  5680. *
  5681. * @platform darwin,win32
  5682. */
  5683. setMovable(movable: boolean): void;
  5684. /**
  5685. * Sets the opacity of the window. On Linux, does nothing. Out of bound number
  5686. * values are clamped to the [0, 1] range.
  5687. *
  5688. * @platform win32,darwin
  5689. */
  5690. setOpacity(opacity: number): void;
  5691. /**
  5692. * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
  5693. * convey some sort of application status or to passively notify the user.
  5694. *
  5695. * @platform win32
  5696. */
  5697. setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
  5698. /**
  5699. * Sets `parent` as current window's parent window, passing `null` will turn
  5700. * current window into a top-level window.
  5701. */
  5702. setParentWindow(parent: (BrowserWindow) | (null)): void;
  5703. /**
  5704. * Moves window to `x` and `y`.
  5705. */
  5706. setPosition(x: number, y: number, animate?: boolean): void;
  5707. /**
  5708. * Sets progress value in progress bar. Valid range is [0, 1.0].
  5709. *
  5710. * Remove progress bar when progress < 0; Change to indeterminate mode when
  5711. * progress > 1.
  5712. *
  5713. * On Linux platform, only supports Unity desktop environment, you need to specify
  5714. * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
  5715. * it will assume `{app.name}.desktop`.
  5716. *
  5717. * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
  5718. * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
  5719. * mode set (but with a value within the valid range), `normal` will be assumed.
  5720. */
  5721. setProgressBar(progress: number, options?: ProgressBarOptions): void;
  5722. /**
  5723. * Sets the pathname of the file the window represents, and the icon of the file
  5724. * will show in window's title bar.
  5725. *
  5726. * @platform darwin
  5727. */
  5728. setRepresentedFilename(filename: string): void;
  5729. /**
  5730. * Sets whether the window can be manually resized by the user.
  5731. */
  5732. setResizable(resizable: boolean): void;
  5733. /**
  5734. * Setting a window shape determines the area within the window where the system
  5735. * permits drawing and user interaction. Outside of the given region, no pixels
  5736. * will be drawn and no mouse events will be registered. Mouse events outside of
  5737. * the region will not be received by that window, but will fall through to
  5738. * whatever is behind the window.
  5739. *
  5740. * @experimental
  5741. * @platform win32,linux
  5742. */
  5743. setShape(rects: Rectangle[]): void;
  5744. /**
  5745. * Changes the attachment point for sheets on macOS. By default, sheets are
  5746. * attached just below the window frame, but you may want to display them beneath a
  5747. * HTML-rendered toolbar. For example:
  5748. *
  5749. * @platform darwin
  5750. */
  5751. setSheetOffset(offsetY: number, offsetX?: number): void;
  5752. /**
  5753. * Enters or leaves simple fullscreen mode.
  5754. *
  5755. * Simple fullscreen mode emulates the native fullscreen behavior found in versions
  5756. * of macOS prior to Lion (10.7).
  5757. *
  5758. * @platform darwin
  5759. */
  5760. setSimpleFullScreen(flag: boolean): void;
  5761. /**
  5762. * Resizes the window to `width` and `height`. If `width` or `height` are below any
  5763. * set minimum size constraints the window will snap to its minimum size.
  5764. */
  5765. setSize(width: number, height: number, animate?: boolean): void;
  5766. /**
  5767. * Makes the window not show in the taskbar.
  5768. *
  5769. * @platform darwin,win32
  5770. */
  5771. setSkipTaskbar(skip: boolean): void;
  5772. /**
  5773. * Whether the buttons were added successfully
  5774. *
  5775. * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
  5776. * of a window in a taskbar button layout. Returns a `boolean` object indicates
  5777. * whether the thumbnail has been added successfully.
  5778. *
  5779. * The number of buttons in thumbnail toolbar should be no greater than 7 due to
  5780. * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
  5781. * removed due to the platform's limitation. But you can call the API with an empty
  5782. * array to clean the buttons.
  5783. *
  5784. * The `buttons` is an array of `Button` objects:
  5785. *
  5786. * * `Button` Object
  5787. * * `icon` NativeImage - The icon showing in thumbnail toolbar.
  5788. * * `click` Function
  5789. * * `tooltip` string (optional) - The text of the button's tooltip.
  5790. * * `flags` string[] (optional) - Control specific states and behaviors of the
  5791. * button. By default, it is `['enabled']`.
  5792. *
  5793. * The `flags` is an array that can include following `string`s:
  5794. *
  5795. * * `enabled` - The button is active and available to the user.
  5796. * * `disabled` - The button is disabled. It is present, but has a visual state
  5797. * indicating it will not respond to user action.
  5798. * * `dismissonclick` - When the button is clicked, the thumbnail window closes
  5799. * immediately.
  5800. * * `nobackground` - Do not draw a button border, use only the image.
  5801. * * `hidden` - The button is not shown to the user.
  5802. * * `noninteractive` - The button is enabled but not interactive; no pressed
  5803. * button state is drawn. This value is intended for instances where the button is
  5804. * used in a notification.
  5805. *
  5806. * @platform win32
  5807. */
  5808. setThumbarButtons(buttons: ThumbarButton[]): boolean;
  5809. /**
  5810. * Sets the region of the window to show as the thumbnail image displayed when
  5811. * hovering over the window in the taskbar. You can reset the thumbnail to be the
  5812. * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
  5813. * }`.
  5814. *
  5815. * @platform win32
  5816. */
  5817. setThumbnailClip(region: Rectangle): void;
  5818. /**
  5819. * Sets the toolTip that is displayed when hovering over the window thumbnail in
  5820. * the taskbar.
  5821. *
  5822. * @platform win32
  5823. */
  5824. setThumbnailToolTip(toolTip: string): void;
  5825. /**
  5826. * Changes the title of native window to `title`.
  5827. */
  5828. setTitle(title: string): void;
  5829. /**
  5830. * On a window with Window Controls Overlay already enabled, this method updates
  5831. * the style of the title bar overlay.
  5832. *
  5833. * On Linux, the `symbolColor` is automatically calculated to have minimum
  5834. * accessible contrast to the `color` if not explicitly set.
  5835. *
  5836. * @platform win32,linux
  5837. */
  5838. setTitleBarOverlay(options: TitleBarOverlayOptions): void;
  5839. /**
  5840. * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
  5841. * error if `browserView` is not attached to `win`.
  5842. *
  5843. * > **Note** The `BrowserView` class is deprecated, and replaced by the new
  5844. * `WebContentsView` class.
  5845. *
  5846. * @experimental
  5847. * @deprecated
  5848. */
  5849. setTopBrowserView(browserView: BrowserView): void;
  5850. /**
  5851. * Sets the touchBar layout for the current window. Specifying `null` or
  5852. * `undefined` clears the touch bar. This method only has an effect if the machine
  5853. * has a touch bar.
  5854. *
  5855. * **Note:** The TouchBar API is currently experimental and may change or be
  5856. * removed in future Electron releases.
  5857. *
  5858. * @platform darwin
  5859. */
  5860. setTouchBar(touchBar: (TouchBar) | (null)): void;
  5861. /**
  5862. * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
  5863. * will remove the vibrancy effect on the window.
  5864. *
  5865. * @platform darwin
  5866. */
  5867. setVibrancy(type: (('titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
  5868. /**
  5869. * Sets whether the window should be visible on all workspaces.
  5870. *
  5871. * **Note:** This API does nothing on Windows.
  5872. *
  5873. * @platform darwin,linux
  5874. */
  5875. setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
  5876. /**
  5877. * Set a custom position for the traffic light buttons in frameless window. Passing
  5878. * `null` will reset the position to default.
  5879. *
  5880. * @platform darwin
  5881. */
  5882. setWindowButtonPosition(position: (Point) | (null)): void;
  5883. /**
  5884. * Sets whether the window traffic light buttons should be visible.
  5885. *
  5886. * @platform darwin
  5887. */
  5888. setWindowButtonVisibility(visible: boolean): void;
  5889. /**
  5890. * Shows and gives focus to the window.
  5891. */
  5892. show(): void;
  5893. /**
  5894. * Shows or hides the tab overview when native tabs are enabled.
  5895. *
  5896. * @platform darwin
  5897. */
  5898. showAllTabs(): void;
  5899. /**
  5900. * Same as `webContents.showDefinitionForSelection()`.
  5901. *
  5902. * @platform darwin
  5903. */
  5904. showDefinitionForSelection(): void;
  5905. /**
  5906. * Shows the window but doesn't focus on it.
  5907. */
  5908. showInactive(): void;
  5909. /**
  5910. * Toggles the visibility of the tab bar if native tabs are enabled and there is
  5911. * only one tab in the current window.
  5912. *
  5913. * @platform darwin
  5914. */
  5915. toggleTabBar(): void;
  5916. /**
  5917. * Unhooks all of the window messages.
  5918. *
  5919. * @platform win32
  5920. */
  5921. unhookAllWindowMessages(): void;
  5922. /**
  5923. * Unhook the window message.
  5924. *
  5925. * @platform win32
  5926. */
  5927. unhookWindowMessage(message: number): void;
  5928. /**
  5929. * Unmaximizes the window.
  5930. */
  5931. unmaximize(): void;
  5932. /**
  5933. * A `string` property that defines an alternative title provided only to
  5934. * accessibility tools such as screen readers. This string is not directly visible
  5935. * to users.
  5936. */
  5937. accessibleTitle: string;
  5938. /**
  5939. * A `boolean` property that determines whether the window menu bar should hide
  5940. * itself automatically. Once set, the menu bar will only show when users press the
  5941. * single `Alt` key.
  5942. *
  5943. * If the menu bar is already visible, setting this property to `true` won't hide
  5944. * it immediately.
  5945. */
  5946. autoHideMenuBar: boolean;
  5947. /**
  5948. * A `boolean` property that determines whether the window can be manually closed
  5949. * by user.
  5950. *
  5951. * On Linux the setter is a no-op, although the getter returns `true`.
  5952. *
  5953. * @platform darwin,win32
  5954. */
  5955. closable: boolean;
  5956. /**
  5957. * A `boolean` property that specifies whether the window’s document has been
  5958. * edited.
  5959. *
  5960. * The icon in title bar will become gray when set to `true`.
  5961. *
  5962. * @platform darwin
  5963. */
  5964. documentEdited: boolean;
  5965. /**
  5966. * A `boolean` property that determines whether the window is excluded from the
  5967. * application’s Windows menu. `false` by default.
  5968. *
  5969. * @platform darwin
  5970. */
  5971. excludedFromShownWindowsMenu: boolean;
  5972. /**
  5973. * A `boolean` property that determines whether the window is focusable.
  5974. *
  5975. * @platform win32,darwin
  5976. */
  5977. focusable: boolean;
  5978. /**
  5979. * A `boolean` property that determines whether the window is in fullscreen mode.
  5980. */
  5981. fullScreen: boolean;
  5982. /**
  5983. * A `boolean` property that determines whether the maximize/zoom window button
  5984. * toggles fullscreen mode or maximizes the window.
  5985. */
  5986. fullScreenable: boolean;
  5987. /**
  5988. * A `Integer` property representing the unique ID of the window. Each ID is unique
  5989. * among all `BrowserWindow` instances of the entire Electron application.
  5990. *
  5991. */
  5992. readonly id: number;
  5993. /**
  5994. * A `boolean` property that determines whether the window is in kiosk mode.
  5995. */
  5996. kiosk: boolean;
  5997. /**
  5998. * A `boolean` property that determines whether the window can be manually
  5999. * maximized by user.
  6000. *
  6001. * On Linux the setter is a no-op, although the getter returns `true`.
  6002. *
  6003. * @platform darwin,win32
  6004. */
  6005. maximizable: boolean;
  6006. /**
  6007. * A `boolean` property that determines whether the menu bar should be visible.
  6008. *
  6009. * **Note:** If the menu bar is auto-hide, users can still bring up the menu bar by
  6010. * pressing the single `Alt` key.
  6011. *
  6012. * @platform win32,linux
  6013. */
  6014. menuBarVisible: boolean;
  6015. /**
  6016. * A `boolean` property that determines whether the window can be manually
  6017. * minimized by user.
  6018. *
  6019. * On Linux the setter is a no-op, although the getter returns `true`.
  6020. *
  6021. * @platform darwin,win32
  6022. */
  6023. minimizable: boolean;
  6024. /**
  6025. * A `boolean` property that determines Whether the window can be moved by user.
  6026. *
  6027. * On Linux the setter is a no-op, although the getter returns `true`.
  6028. *
  6029. * @platform darwin,win32
  6030. */
  6031. movable: boolean;
  6032. /**
  6033. * A `string` property that determines the pathname of the file the window
  6034. * represents, and the icon of the file will show in window's title bar.
  6035. *
  6036. * @platform darwin
  6037. */
  6038. representedFilename: string;
  6039. /**
  6040. * A `boolean` property that determines whether the window can be manually resized
  6041. * by user.
  6042. */
  6043. resizable: boolean;
  6044. /**
  6045. * A `boolean` property that determines whether the window has a shadow.
  6046. */
  6047. shadow: boolean;
  6048. /**
  6049. * A `boolean` property that determines whether the window is in simple (pre-Lion)
  6050. * fullscreen mode.
  6051. */
  6052. simpleFullScreen: boolean;
  6053. /**
  6054. * A `string` (optional) property that is equal to the `tabbingIdentifier` passed
  6055. * to the `BrowserWindow` constructor or `undefined` if none was set.
  6056. *
  6057. * @platform darwin
  6058. */
  6059. readonly tabbingIdentifier?: string;
  6060. /**
  6061. * A `string` property that determines the title of the native window.
  6062. *
  6063. * **Note:** The title of the web page can be different from the title of the
  6064. * native window.
  6065. */
  6066. title: string;
  6067. /**
  6068. * A `boolean` property that determines whether the window is visible on all
  6069. * workspaces.
  6070. *
  6071. * **Note:** Always returns false on Windows.
  6072. *
  6073. * @platform darwin,linux
  6074. */
  6075. visibleOnAllWorkspaces: boolean;
  6076. /**
  6077. * A `WebContents` object this window owns. All web page related events and
  6078. * operations will be done via it.
  6079. *
  6080. * See the `webContents` documentation for its methods and events.
  6081. *
  6082. */
  6083. readonly webContents: WebContents;
  6084. }
  6085. interface BrowserWindowConstructorOptions extends BaseWindowConstructorOptions {
  6086. // Docs: https://electronjs.org/docs/api/structures/browser-window-options
  6087. /**
  6088. * Whether the renderer should be active when `show` is `false` and it has just
  6089. * been created. In order for `document.visibilityState` to work correctly on
  6090. * first load with `show: false` you should set this to `false`. Setting this to
  6091. * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
  6092. */
  6093. paintWhenInitiallyHidden?: boolean;
  6094. /**
  6095. * When using a frameless window in conjunction with
  6096. * `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so
  6097. * that the standard window controls ("traffic lights" on macOS) are visible, this
  6098. * property enables the Window Controls Overlay JavaScript APIs and CSS Environment
  6099. * Variables. Specifying `true` will result in an overlay with default system
  6100. * colors. Default is `false`.
  6101. */
  6102. titleBarOverlay?: (TitleBarOverlay) | (boolean);
  6103. /**
  6104. * Settings of web page's features.
  6105. */
  6106. webPreferences?: WebPreferences;
  6107. }
  6108. interface Certificate {
  6109. // Docs: https://electronjs.org/docs/api/structures/certificate
  6110. /**
  6111. * PEM encoded data
  6112. */
  6113. data: string;
  6114. /**
  6115. * Fingerprint of the certificate
  6116. */
  6117. fingerprint: string;
  6118. /**
  6119. * Issuer principal
  6120. */
  6121. issuer: CertificatePrincipal;
  6122. /**
  6123. * Issuer certificate (if not self-signed)
  6124. */
  6125. issuerCert: Certificate;
  6126. /**
  6127. * Issuer's Common Name
  6128. */
  6129. issuerName: string;
  6130. /**
  6131. * Hex value represented string
  6132. */
  6133. serialNumber: string;
  6134. /**
  6135. * Subject principal
  6136. */
  6137. subject: CertificatePrincipal;
  6138. /**
  6139. * Subject's Common Name
  6140. */
  6141. subjectName: string;
  6142. /**
  6143. * End date of the certificate being valid in seconds
  6144. */
  6145. validExpiry: number;
  6146. /**
  6147. * Start date of the certificate being valid in seconds
  6148. */
  6149. validStart: number;
  6150. }
  6151. interface CertificatePrincipal {
  6152. // Docs: https://electronjs.org/docs/api/structures/certificate-principal
  6153. /**
  6154. * Common Name.
  6155. */
  6156. commonName: string;
  6157. /**
  6158. * Country or region.
  6159. */
  6160. country: string;
  6161. /**
  6162. * Locality.
  6163. */
  6164. locality: string;
  6165. /**
  6166. * Organization names.
  6167. */
  6168. organizations: string[];
  6169. /**
  6170. * Organization Unit names.
  6171. */
  6172. organizationUnits: string[];
  6173. /**
  6174. * State or province.
  6175. */
  6176. state: string;
  6177. }
  6178. class ClientRequest extends NodeEventEmitter {
  6179. // Docs: https://electronjs.org/docs/api/client-request
  6180. /**
  6181. * Emitted when the `request` is aborted. The `abort` event will not be fired if
  6182. * the `request` is already closed.
  6183. */
  6184. on(event: 'abort', listener: Function): this;
  6185. off(event: 'abort', listener: Function): this;
  6186. once(event: 'abort', listener: Function): this;
  6187. addListener(event: 'abort', listener: Function): this;
  6188. removeListener(event: 'abort', listener: Function): this;
  6189. /**
  6190. * Emitted as the last event in the HTTP request-response transaction. The `close`
  6191. * event indicates that no more events will be emitted on either the `request` or
  6192. * `response` objects.
  6193. */
  6194. on(event: 'close', listener: Function): this;
  6195. off(event: 'close', listener: Function): this;
  6196. once(event: 'close', listener: Function): this;
  6197. addListener(event: 'close', listener: Function): this;
  6198. removeListener(event: 'close', listener: Function): this;
  6199. /**
  6200. * Emitted when the `net` module fails to issue a network request. Typically when
  6201. * the `request` object emits an `error` event, a `close` event will subsequently
  6202. * follow and no response object will be provided.
  6203. */
  6204. on(event: 'error', listener: (
  6205. /**
  6206. * an error object providing some information about the failure.
  6207. */
  6208. error: Error) => void): this;
  6209. off(event: 'error', listener: (
  6210. /**
  6211. * an error object providing some information about the failure.
  6212. */
  6213. error: Error) => void): this;
  6214. once(event: 'error', listener: (
  6215. /**
  6216. * an error object providing some information about the failure.
  6217. */
  6218. error: Error) => void): this;
  6219. addListener(event: 'error', listener: (
  6220. /**
  6221. * an error object providing some information about the failure.
  6222. */
  6223. error: Error) => void): this;
  6224. removeListener(event: 'error', listener: (
  6225. /**
  6226. * an error object providing some information about the failure.
  6227. */
  6228. error: Error) => void): this;
  6229. /**
  6230. * Emitted just after the last chunk of the `request`'s data has been written into
  6231. * the `request` object.
  6232. */
  6233. on(event: 'finish', listener: Function): this;
  6234. off(event: 'finish', listener: Function): this;
  6235. once(event: 'finish', listener: Function): this;
  6236. addListener(event: 'finish', listener: Function): this;
  6237. removeListener(event: 'finish', listener: Function): this;
  6238. /**
  6239. * Emitted when an authenticating proxy is asking for user credentials.
  6240. *
  6241. * The `callback` function is expected to be called back with user credentials:
  6242. *
  6243. * * `username` string
  6244. * * `password` string
  6245. *
  6246. * Providing empty credentials will cancel the request and report an authentication
  6247. * error on the response object:
  6248. */
  6249. on(event: 'login', listener: (authInfo: AuthInfo,
  6250. callback: (username?: string, password?: string) => void) => void): this;
  6251. off(event: 'login', listener: (authInfo: AuthInfo,
  6252. callback: (username?: string, password?: string) => void) => void): this;
  6253. once(event: 'login', listener: (authInfo: AuthInfo,
  6254. callback: (username?: string, password?: string) => void) => void): this;
  6255. addListener(event: 'login', listener: (authInfo: AuthInfo,
  6256. callback: (username?: string, password?: string) => void) => void): this;
  6257. removeListener(event: 'login', listener: (authInfo: AuthInfo,
  6258. callback: (username?: string, password?: string) => void) => void): this;
  6259. /**
  6260. * Emitted when the server returns a redirect response (e.g. 301 Moved
  6261. * Permanently). Calling `request.followRedirect` will continue with the
  6262. * redirection. If this event is handled, `request.followRedirect` must be called
  6263. * **synchronously**, otherwise the request will be cancelled.
  6264. */
  6265. on(event: 'redirect', listener: (statusCode: number,
  6266. method: string,
  6267. redirectUrl: string,
  6268. responseHeaders: Record<string, string[]>) => void): this;
  6269. off(event: 'redirect', listener: (statusCode: number,
  6270. method: string,
  6271. redirectUrl: string,
  6272. responseHeaders: Record<string, string[]>) => void): this;
  6273. once(event: 'redirect', listener: (statusCode: number,
  6274. method: string,
  6275. redirectUrl: string,
  6276. responseHeaders: Record<string, string[]>) => void): this;
  6277. addListener(event: 'redirect', listener: (statusCode: number,
  6278. method: string,
  6279. redirectUrl: string,
  6280. responseHeaders: Record<string, string[]>) => void): this;
  6281. removeListener(event: 'redirect', listener: (statusCode: number,
  6282. method: string,
  6283. redirectUrl: string,
  6284. responseHeaders: Record<string, string[]>) => void): this;
  6285. on(event: 'response', listener: (
  6286. /**
  6287. * An object representing the HTTP response message.
  6288. */
  6289. response: IncomingMessage) => void): this;
  6290. off(event: 'response', listener: (
  6291. /**
  6292. * An object representing the HTTP response message.
  6293. */
  6294. response: IncomingMessage) => void): this;
  6295. once(event: 'response', listener: (
  6296. /**
  6297. * An object representing the HTTP response message.
  6298. */
  6299. response: IncomingMessage) => void): this;
  6300. addListener(event: 'response', listener: (
  6301. /**
  6302. * An object representing the HTTP response message.
  6303. */
  6304. response: IncomingMessage) => void): this;
  6305. removeListener(event: 'response', listener: (
  6306. /**
  6307. * An object representing the HTTP response message.
  6308. */
  6309. response: IncomingMessage) => void): this;
  6310. /**
  6311. * ClientRequest
  6312. */
  6313. constructor(options: (ClientRequestConstructorOptions) | (string));
  6314. /**
  6315. * Cancels an ongoing HTTP transaction. If the request has already emitted the
  6316. * `close` event, the abort operation will have no effect. Otherwise an ongoing
  6317. * event will emit `abort` and `close` events. Additionally, if there is an ongoing
  6318. * response object,it will emit the `aborted` event.
  6319. */
  6320. abort(): void;
  6321. /**
  6322. * Sends the last chunk of the request data. Subsequent write or end operations
  6323. * will not be allowed. The `finish` event is emitted just after the end operation.
  6324. */
  6325. end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): this;
  6326. /**
  6327. * Continues any pending redirection. Can only be called during a `'redirect'`
  6328. * event.
  6329. */
  6330. followRedirect(): void;
  6331. /**
  6332. * The value of a previously set extra header name.
  6333. */
  6334. getHeader(name: string): string;
  6335. /**
  6336. * * `active` boolean - Whether the request is currently active. If this is false
  6337. * no other properties will be set
  6338. * * `started` boolean - Whether the upload has started. If this is false both
  6339. * `current` and `total` will be set to 0.
  6340. * * `current` Integer - The number of bytes that have been uploaded so far
  6341. * * `total` Integer - The number of bytes that will be uploaded this request
  6342. *
  6343. * You can use this method in conjunction with `POST` requests to get the progress
  6344. * of a file upload or other data transfer.
  6345. */
  6346. getUploadProgress(): UploadProgress;
  6347. /**
  6348. * Removes a previously set extra header name. This method can be called only
  6349. * before first write. Trying to call it after the first write will throw an error.
  6350. */
  6351. removeHeader(name: string): void;
  6352. /**
  6353. * Adds an extra HTTP header. The header name will be issued as-is without
  6354. * lowercasing. It can be called only before first write. Calling this method after
  6355. * the first write will throw an error. If the passed value is not a `string`, its
  6356. * `toString()` method will be called to obtain the final value.
  6357. *
  6358. * Certain headers are restricted from being set by apps. These headers are listed
  6359. * below. More information on restricted headers can be found in Chromium's header
  6360. * utils.
  6361. *
  6362. * * `Content-Length`
  6363. * * `Host`
  6364. * * `Trailer` or `Te`
  6365. * * `Upgrade`
  6366. * * `Cookie2`
  6367. * * `Keep-Alive`
  6368. * * `Transfer-Encoding`
  6369. *
  6370. * Additionally, setting the `Connection` header to the value `upgrade` is also
  6371. * disallowed.
  6372. */
  6373. setHeader(name: string, value: string): void;
  6374. /**
  6375. * `callback` is essentially a dummy function introduced in the purpose of keeping
  6376. * similarity with the Node.js API. It is called asynchronously in the next tick
  6377. * after `chunk` content have been delivered to the Chromium networking layer.
  6378. * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
  6379. * content have been flushed on the wire before `callback` is called.
  6380. *
  6381. * Adds a chunk of data to the request body. The first write operation may cause
  6382. * the request headers to be issued on the wire. After the first write operation,
  6383. * it is not allowed to add or remove a custom header.
  6384. */
  6385. write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  6386. /**
  6387. * A `boolean` specifying whether the request will use HTTP chunked transfer
  6388. * encoding or not. Defaults to false. The property is readable and writable,
  6389. * however it can be set only before the first write operation as the HTTP headers
  6390. * are not yet put on the wire. Trying to set the `chunkedEncoding` property after
  6391. * the first write will throw an error.
  6392. *
  6393. * Using chunked encoding is strongly recommended if you need to send a large
  6394. * request body as data will be streamed in small chunks instead of being
  6395. * internally buffered inside Electron process memory.
  6396. */
  6397. chunkedEncoding: boolean;
  6398. }
  6399. interface Clipboard {
  6400. // Docs: https://electronjs.org/docs/api/clipboard
  6401. /**
  6402. * An array of supported formats for the clipboard `type`.
  6403. */
  6404. availableFormats(type?: 'selection' | 'clipboard'): string[];
  6405. /**
  6406. * Clears the clipboard content.
  6407. */
  6408. clear(type?: 'selection' | 'clipboard'): void;
  6409. /**
  6410. * Whether the clipboard supports the specified `format`.
  6411. *
  6412. * @experimental
  6413. */
  6414. has(format: string, type?: 'selection' | 'clipboard'): boolean;
  6415. /**
  6416. * Reads `format` type from the clipboard.
  6417. *
  6418. * `format` should contain valid ASCII characters and have `/` separator. `a/c`,
  6419. * `a/bc` are valid formats while `/abc`, `abc/`, `a/`, `/a`, `a` are not valid.
  6420. *
  6421. * @experimental
  6422. */
  6423. read(format: string): string;
  6424. /**
  6425. * * `title` string
  6426. * * `url` string
  6427. *
  6428. * Returns an Object containing `title` and `url` keys representing the bookmark in
  6429. * the clipboard. The `title` and `url` values will be empty strings when the
  6430. * bookmark is unavailable. The `title` value will always be empty on Windows.
  6431. *
  6432. * @platform darwin,win32
  6433. */
  6434. readBookmark(): ReadBookmark;
  6435. /**
  6436. * Reads `format` type from the clipboard.
  6437. *
  6438. * @experimental
  6439. */
  6440. readBuffer(format: string): Buffer;
  6441. /**
  6442. * The text on the find pasteboard, which is the pasteboard that holds information
  6443. * about the current state of the active application’s find panel.
  6444. *
  6445. * This method uses synchronous IPC when called from the renderer process. The
  6446. * cached value is reread from the find pasteboard whenever the application is
  6447. * activated.
  6448. *
  6449. * @platform darwin
  6450. */
  6451. readFindText(): string;
  6452. /**
  6453. * The content in the clipboard as markup.
  6454. */
  6455. readHTML(type?: 'selection' | 'clipboard'): string;
  6456. /**
  6457. * The image content in the clipboard.
  6458. */
  6459. readImage(type?: 'selection' | 'clipboard'): NativeImage;
  6460. /**
  6461. * The content in the clipboard as RTF.
  6462. */
  6463. readRTF(type?: 'selection' | 'clipboard'): string;
  6464. /**
  6465. * The content in the clipboard as plain text.
  6466. */
  6467. readText(type?: 'selection' | 'clipboard'): string;
  6468. /**
  6469. * Writes `data` to the clipboard.
  6470. */
  6471. write(data: Data, type?: 'selection' | 'clipboard'): void;
  6472. /**
  6473. * Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
  6474. *
  6475. * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
  6476. * can use `clipboard.write` to write both a bookmark and fallback text to the
  6477. * clipboard.
  6478. *
  6479. * @platform darwin,win32
  6480. */
  6481. writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
  6482. /**
  6483. * Writes the `buffer` into the clipboard as `format`.
  6484. *
  6485. * @experimental
  6486. */
  6487. writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
  6488. /**
  6489. * Writes the `text` into the find pasteboard (the pasteboard that holds
  6490. * information about the current state of the active application’s find panel) as
  6491. * plain text. This method uses synchronous IPC when called from the renderer
  6492. * process.
  6493. *
  6494. * @platform darwin
  6495. */
  6496. writeFindText(text: string): void;
  6497. /**
  6498. * Writes `markup` to the clipboard.
  6499. */
  6500. writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
  6501. /**
  6502. * Writes `image` to the clipboard.
  6503. */
  6504. writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
  6505. /**
  6506. * Writes the `text` into the clipboard in RTF.
  6507. */
  6508. writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
  6509. /**
  6510. * Writes the `text` into the clipboard as plain text.
  6511. */
  6512. writeText(text: string, type?: 'selection' | 'clipboard'): void;
  6513. }
  6514. class CommandLine {
  6515. // Docs: https://electronjs.org/docs/api/command-line
  6516. /**
  6517. * Append an argument to Chromium's command line. The argument will be quoted
  6518. * correctly. Switches will precede arguments regardless of appending order.
  6519. *
  6520. * If you're appending an argument like `--switch=value`, consider using
  6521. * `appendSwitch('switch', 'value')` instead.
  6522. *
  6523. * **Note:** This will not affect `process.argv`. The intended usage of this
  6524. * function is to control Chromium's behavior.
  6525. */
  6526. appendArgument(value: string): void;
  6527. /**
  6528. * Append a switch (with optional `value`) to Chromium's command line.
  6529. *
  6530. * **Note:** This will not affect `process.argv`. The intended usage of this
  6531. * function is to control Chromium's behavior.
  6532. */
  6533. appendSwitch(the_switch: string, value?: string): void;
  6534. /**
  6535. * The command-line switch value.
  6536. *
  6537. * **Note:** When the switch is not present or has no value, it returns empty
  6538. * string.
  6539. */
  6540. getSwitchValue(the_switch: string): string;
  6541. /**
  6542. * Whether the command-line switch is present.
  6543. */
  6544. hasSwitch(the_switch: string): boolean;
  6545. /**
  6546. * Removes the specified switch from Chromium's command line.
  6547. *
  6548. * **Note:** This will not affect `process.argv`. The intended usage of this
  6549. * function is to control Chromium's behavior.
  6550. */
  6551. removeSwitch(the_switch: string): void;
  6552. }
  6553. interface ContentTracing {
  6554. // Docs: https://electronjs.org/docs/api/content-tracing
  6555. /**
  6556. * resolves with an array of category groups once all child processes have
  6557. * acknowledged the `getCategories` request
  6558. *
  6559. * Get a set of category groups. The category groups can change as new code paths
  6560. * are reached. See also the list of built-in tracing categories.
  6561. *
  6562. * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
  6563. * This category can be used to capture Electron-specific tracing events.
  6564. */
  6565. getCategories(): Promise<string[]>;
  6566. /**
  6567. * Resolves with an object containing the `value` and `percentage` of trace buffer
  6568. * maximum usage
  6569. *
  6570. * * `value` number
  6571. * * `percentage` number
  6572. *
  6573. * Get the maximum usage across processes of trace buffer as a percentage of the
  6574. * full state.
  6575. */
  6576. getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
  6577. /**
  6578. * resolved once all child processes have acknowledged the `startRecording`
  6579. * request.
  6580. *
  6581. * Start recording on all processes.
  6582. *
  6583. * Recording begins immediately locally and asynchronously on child processes as
  6584. * soon as they receive the EnableRecording request.
  6585. *
  6586. * If a recording is already running, the promise will be immediately resolved, as
  6587. * only one trace operation can be in progress at a time.
  6588. */
  6589. startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
  6590. /**
  6591. * resolves with a path to a file that contains the traced data once all child
  6592. * processes have acknowledged the `stopRecording` request
  6593. *
  6594. * Stop recording on all processes.
  6595. *
  6596. * Child processes typically cache trace data and only rarely flush and send trace
  6597. * data back to the main process. This helps to minimize the runtime overhead of
  6598. * tracing since sending trace data over IPC can be an expensive operation. So, to
  6599. * end tracing, Chromium asynchronously asks all child processes to flush any
  6600. * pending trace data.
  6601. *
  6602. * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
  6603. * or not provided, trace data will be written to a temporary file, and the path
  6604. * will be returned in the promise.
  6605. */
  6606. stopRecording(resultFilePath?: string): Promise<string>;
  6607. }
  6608. interface ContextBridge {
  6609. // Docs: https://electronjs.org/docs/api/context-bridge
  6610. exposeInIsolatedWorld(worldId: number, apiKey: string, api: any): void;
  6611. exposeInMainWorld(apiKey: string, api: any): void;
  6612. }
  6613. interface Cookie {
  6614. // Docs: https://electronjs.org/docs/api/structures/cookie
  6615. /**
  6616. * The domain of the cookie; this will be normalized with a preceding dot so that
  6617. * it's also valid for subdomains.
  6618. */
  6619. domain?: string;
  6620. /**
  6621. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  6622. * Not provided for session cookies.
  6623. */
  6624. expirationDate?: number;
  6625. /**
  6626. * Whether the cookie is a host-only cookie; this will only be `true` if no domain
  6627. * was passed.
  6628. */
  6629. hostOnly?: boolean;
  6630. /**
  6631. * Whether the cookie is marked as HTTP only.
  6632. */
  6633. httpOnly?: boolean;
  6634. /**
  6635. * The name of the cookie.
  6636. */
  6637. name: string;
  6638. /**
  6639. * The path of the cookie.
  6640. */
  6641. path?: string;
  6642. /**
  6643. * The Same Site policy applied to this cookie. Can be `unspecified`,
  6644. * `no_restriction`, `lax` or `strict`.
  6645. */
  6646. sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  6647. /**
  6648. * Whether the cookie is marked as secure.
  6649. */
  6650. secure?: boolean;
  6651. /**
  6652. * Whether the cookie is a session cookie or a persistent cookie with an expiration
  6653. * date.
  6654. */
  6655. session?: boolean;
  6656. /**
  6657. * The value of the cookie.
  6658. */
  6659. value: string;
  6660. }
  6661. class Cookies extends NodeEventEmitter {
  6662. // Docs: https://electronjs.org/docs/api/cookies
  6663. /**
  6664. * Emitted when a cookie is changed because it was added, edited, removed, or
  6665. * expired.
  6666. */
  6667. on(event: 'changed', listener: (event: Event,
  6668. /**
  6669. * The cookie that was changed.
  6670. */
  6671. cookie: Cookie,
  6672. /**
  6673. * The cause of the change with one of the following values:
  6674. */
  6675. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  6676. /**
  6677. * `true` if the cookie was removed, `false` otherwise.
  6678. */
  6679. removed: boolean) => void): this;
  6680. off(event: 'changed', listener: (event: Event,
  6681. /**
  6682. * The cookie that was changed.
  6683. */
  6684. cookie: Cookie,
  6685. /**
  6686. * The cause of the change with one of the following values:
  6687. */
  6688. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  6689. /**
  6690. * `true` if the cookie was removed, `false` otherwise.
  6691. */
  6692. removed: boolean) => void): this;
  6693. once(event: 'changed', listener: (event: Event,
  6694. /**
  6695. * The cookie that was changed.
  6696. */
  6697. cookie: Cookie,
  6698. /**
  6699. * The cause of the change with one of the following values:
  6700. */
  6701. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  6702. /**
  6703. * `true` if the cookie was removed, `false` otherwise.
  6704. */
  6705. removed: boolean) => void): this;
  6706. addListener(event: 'changed', listener: (event: Event,
  6707. /**
  6708. * The cookie that was changed.
  6709. */
  6710. cookie: Cookie,
  6711. /**
  6712. * The cause of the change with one of the following values:
  6713. */
  6714. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  6715. /**
  6716. * `true` if the cookie was removed, `false` otherwise.
  6717. */
  6718. removed: boolean) => void): this;
  6719. removeListener(event: 'changed', listener: (event: Event,
  6720. /**
  6721. * The cookie that was changed.
  6722. */
  6723. cookie: Cookie,
  6724. /**
  6725. * The cause of the change with one of the following values:
  6726. */
  6727. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  6728. /**
  6729. * `true` if the cookie was removed, `false` otherwise.
  6730. */
  6731. removed: boolean) => void): this;
  6732. /**
  6733. * A promise which resolves when the cookie store has been flushed
  6734. *
  6735. * Writes any unwritten cookies data to disk
  6736. *
  6737. * Cookies written by any method will not be written to disk immediately, but will
  6738. * be written every 30 seconds or 512 operations
  6739. *
  6740. * Calling this method can cause the cookie to be written to disk immediately.
  6741. */
  6742. flushStore(): Promise<void>;
  6743. /**
  6744. * A promise which resolves an array of cookie objects.
  6745. *
  6746. * Sends a request to get all cookies matching `filter`, and resolves a promise
  6747. * with the response.
  6748. */
  6749. get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
  6750. /**
  6751. * A promise which resolves when the cookie has been removed
  6752. *
  6753. * Removes the cookies matching `url` and `name`
  6754. */
  6755. remove(url: string, name: string): Promise<void>;
  6756. /**
  6757. * A promise which resolves when the cookie has been set
  6758. *
  6759. * Sets a cookie with `details`.
  6760. */
  6761. set(details: CookiesSetDetails): Promise<void>;
  6762. }
  6763. interface CPUUsage {
  6764. // Docs: https://electronjs.org/docs/api/structures/cpu-usage
  6765. /**
  6766. * The number of average idle CPU wakeups per second since the last call to
  6767. * getCPUUsage. First call returns 0. Will always return 0 on Windows.
  6768. */
  6769. idleWakeupsPerSecond: number;
  6770. /**
  6771. * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
  6772. */
  6773. percentCPUUsage: number;
  6774. }
  6775. interface CrashReport {
  6776. // Docs: https://electronjs.org/docs/api/structures/crash-report
  6777. date: Date;
  6778. id: string;
  6779. }
  6780. interface CrashReporter {
  6781. // Docs: https://electronjs.org/docs/api/crash-reporter
  6782. /**
  6783. * Set an extra parameter to be sent with the crash report. The values specified
  6784. * here will be sent in addition to any values set via the `extra` option when
  6785. * `start` was called.
  6786. *
  6787. * Parameters added in this fashion (or via the `extra` parameter to
  6788. * `crashReporter.start`) are specific to the calling process. Adding extra
  6789. * parameters in the main process will not cause those parameters to be sent along
  6790. * with crashes from renderer or other child processes. Similarly, adding extra
  6791. * parameters in a renderer process will not result in those parameters being sent
  6792. * with crashes that occur in other renderer processes or in the main process.
  6793. *
  6794. * **Note:** Parameters have limits on the length of the keys and values. Key names
  6795. * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
  6796. * Keys with names longer than the maximum will be silently ignored. Key values
  6797. * longer than the maximum length will be truncated.
  6798. */
  6799. addExtraParameter(key: string, value: string): void;
  6800. /**
  6801. * The date and ID of the last crash report. Only crash reports that have been
  6802. * uploaded will be returned; even if a crash report is present on disk it will not
  6803. * be returned until it is uploaded. In the case that there are no uploaded
  6804. * reports, `null` is returned.
  6805. *
  6806. * **Note:** This method is only available in the main process.
  6807. */
  6808. getLastCrashReport(): (CrashReport) | (null);
  6809. /**
  6810. * The current 'extra' parameters of the crash reporter.
  6811. */
  6812. getParameters(): Record<string, string>;
  6813. /**
  6814. * Returns all uploaded crash reports. Each report contains the date and uploaded
  6815. * ID.
  6816. *
  6817. * **Note:** This method is only available in the main process.
  6818. */
  6819. getUploadedReports(): CrashReport[];
  6820. /**
  6821. * Whether reports should be submitted to the server. Set through the `start`
  6822. * method or `setUploadToServer`.
  6823. *
  6824. * **Note:** This method is only available in the main process.
  6825. */
  6826. getUploadToServer(): boolean;
  6827. /**
  6828. * Remove an extra parameter from the current set of parameters. Future crashes
  6829. * will not include this parameter.
  6830. */
  6831. removeExtraParameter(key: string): void;
  6832. /**
  6833. * This would normally be controlled by user preferences. This has no effect if
  6834. * called before `start` is called.
  6835. *
  6836. * **Note:** This method is only available in the main process.
  6837. */
  6838. setUploadToServer(uploadToServer: boolean): void;
  6839. /**
  6840. * This method must be called before using any other `crashReporter` APIs. Once
  6841. * initialized this way, the crashpad handler collects crashes from all
  6842. * subsequently created processes. The crash reporter cannot be disabled once
  6843. * started.
  6844. *
  6845. * This method should be called as early as possible in app startup, preferably
  6846. * before `app.on('ready')`. If the crash reporter is not initialized at the time a
  6847. * renderer process is created, then that renderer process will not be monitored by
  6848. * the crash reporter.
  6849. *
  6850. * **Note:** You can test out the crash reporter by generating a crash using
  6851. * `process.crash()`.
  6852. *
  6853. * **Note:** If you need to send additional/updated `extra` parameters after your
  6854. * first call `start` you can call `addExtraParameter`.
  6855. *
  6856. * **Note:** Parameters passed in `extra`, `globalExtra` or set with
  6857. * `addExtraParameter` have limits on the length of the keys and values. Key names
  6858. * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
  6859. * with names longer than the maximum will be silently ignored. Key values longer
  6860. * than the maximum length will be truncated.
  6861. *
  6862. * **Note:** This method is only available in the main process.
  6863. */
  6864. start(options: CrashReporterStartOptions): void;
  6865. }
  6866. interface CustomScheme {
  6867. // Docs: https://electronjs.org/docs/api/structures/custom-scheme
  6868. privileges?: Privileges;
  6869. /**
  6870. * Custom schemes to be registered with options.
  6871. */
  6872. scheme: string;
  6873. }
  6874. class Debugger extends NodeEventEmitter {
  6875. // Docs: https://electronjs.org/docs/api/debugger
  6876. /**
  6877. * Emitted when the debugging session is terminated. This happens either when
  6878. * `webContents` is closed or devtools is invoked for the attached `webContents`.
  6879. */
  6880. on(event: 'detach', listener: (event: Event,
  6881. /**
  6882. * Reason for detaching debugger.
  6883. */
  6884. reason: string) => void): this;
  6885. off(event: 'detach', listener: (event: Event,
  6886. /**
  6887. * Reason for detaching debugger.
  6888. */
  6889. reason: string) => void): this;
  6890. once(event: 'detach', listener: (event: Event,
  6891. /**
  6892. * Reason for detaching debugger.
  6893. */
  6894. reason: string) => void): this;
  6895. addListener(event: 'detach', listener: (event: Event,
  6896. /**
  6897. * Reason for detaching debugger.
  6898. */
  6899. reason: string) => void): this;
  6900. removeListener(event: 'detach', listener: (event: Event,
  6901. /**
  6902. * Reason for detaching debugger.
  6903. */
  6904. reason: string) => void): this;
  6905. /**
  6906. * Emitted whenever the debugging target issues an instrumentation event.
  6907. */
  6908. on(event: 'message', listener: (event: Event,
  6909. /**
  6910. * Method name.
  6911. */
  6912. method: string,
  6913. /**
  6914. * Event parameters defined by the 'parameters' attribute in the remote debugging
  6915. * protocol.
  6916. */
  6917. params: any,
  6918. /**
  6919. * Unique identifier of attached debugging session, will match the value sent from
  6920. * `debugger.sendCommand`.
  6921. */
  6922. sessionId: string) => void): this;
  6923. off(event: 'message', listener: (event: Event,
  6924. /**
  6925. * Method name.
  6926. */
  6927. method: string,
  6928. /**
  6929. * Event parameters defined by the 'parameters' attribute in the remote debugging
  6930. * protocol.
  6931. */
  6932. params: any,
  6933. /**
  6934. * Unique identifier of attached debugging session, will match the value sent from
  6935. * `debugger.sendCommand`.
  6936. */
  6937. sessionId: string) => void): this;
  6938. once(event: 'message', listener: (event: Event,
  6939. /**
  6940. * Method name.
  6941. */
  6942. method: string,
  6943. /**
  6944. * Event parameters defined by the 'parameters' attribute in the remote debugging
  6945. * protocol.
  6946. */
  6947. params: any,
  6948. /**
  6949. * Unique identifier of attached debugging session, will match the value sent from
  6950. * `debugger.sendCommand`.
  6951. */
  6952. sessionId: string) => void): this;
  6953. addListener(event: 'message', listener: (event: Event,
  6954. /**
  6955. * Method name.
  6956. */
  6957. method: string,
  6958. /**
  6959. * Event parameters defined by the 'parameters' attribute in the remote debugging
  6960. * protocol.
  6961. */
  6962. params: any,
  6963. /**
  6964. * Unique identifier of attached debugging session, will match the value sent from
  6965. * `debugger.sendCommand`.
  6966. */
  6967. sessionId: string) => void): this;
  6968. removeListener(event: 'message', listener: (event: Event,
  6969. /**
  6970. * Method name.
  6971. */
  6972. method: string,
  6973. /**
  6974. * Event parameters defined by the 'parameters' attribute in the remote debugging
  6975. * protocol.
  6976. */
  6977. params: any,
  6978. /**
  6979. * Unique identifier of attached debugging session, will match the value sent from
  6980. * `debugger.sendCommand`.
  6981. */
  6982. sessionId: string) => void): this;
  6983. /**
  6984. * Attaches the debugger to the `webContents`.
  6985. */
  6986. attach(protocolVersion?: string): void;
  6987. /**
  6988. * Detaches the debugger from the `webContents`.
  6989. */
  6990. detach(): void;
  6991. /**
  6992. * Whether a debugger is attached to the `webContents`.
  6993. */
  6994. isAttached(): boolean;
  6995. /**
  6996. * A promise that resolves with the response defined by the 'returns' attribute of
  6997. * the command description in the remote debugging protocol or is rejected
  6998. * indicating the failure of the command.
  6999. *
  7000. * Send given command to the debugging target.
  7001. */
  7002. sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
  7003. }
  7004. interface DesktopCapturer {
  7005. // Docs: https://electronjs.org/docs/api/desktop-capturer
  7006. /**
  7007. * Resolves with an array of `DesktopCapturerSource` objects, each
  7008. * `DesktopCapturerSource` represents a screen or an individual window that can be
  7009. * captured.
  7010. *
  7011. * **Note** Capturing the screen contents requires user consent on macOS 10.15
  7012. * Catalina or higher, which can detected by
  7013. * `systemPreferences.getMediaAccessStatus`.
  7014. */
  7015. getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
  7016. }
  7017. interface DesktopCapturerSource {
  7018. // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
  7019. /**
  7020. * An icon image of the application that owns the window or null if the source has
  7021. * a type screen. The size of the icon is not known in advance and depends on what
  7022. * the application provides.
  7023. */
  7024. appIcon: NativeImage;
  7025. /**
  7026. * A unique identifier that will correspond to the `id` of the matching Display
  7027. * returned by the Screen API. On some platforms, this is equivalent to the `XX`
  7028. * portion of the `id` field above and on others it will differ. It will be an
  7029. * empty string if not available.
  7030. */
  7031. display_id: string;
  7032. /**
  7033. * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
  7034. * constraint when calling `navigator.getUserMedia`. The format of the identifier
  7035. * will be `window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle. YY is 1 for
  7036. * the current process, and 0 for all others. ZZ is a sequential number that
  7037. * represents the screen, and it does not equal to the index in the source's name.
  7038. */
  7039. id: string;
  7040. /**
  7041. * A screen source will be named either `Entire Screen` or `Screen <index>`, while
  7042. * the name of a window source will match the window title.
  7043. */
  7044. name: string;
  7045. /**
  7046. * A thumbnail image. **Note:** There is no guarantee that the size of the
  7047. * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
  7048. * to `desktopCapturer.getSources`. The actual size depends on the scale of the
  7049. * screen or window.
  7050. */
  7051. thumbnail: NativeImage;
  7052. }
  7053. interface Dialog {
  7054. // Docs: https://electronjs.org/docs/api/dialog
  7055. /**
  7056. * resolves when the certificate trust dialog is shown.
  7057. *
  7058. * On macOS, this displays a modal dialog that shows a message and certificate
  7059. * information, and gives the user the option of trusting/importing the
  7060. * certificate. If you provide a `browserWindow` argument the dialog will be
  7061. * attached to the parent window, making it modal.
  7062. *
  7063. * On Windows the options are more limited, due to the Win32 APIs used:
  7064. *
  7065. * * The `message` argument is not used, as the OS provides its own confirmation
  7066. * dialog.
  7067. * * The `browserWindow` argument is ignored since it is not possible to make this
  7068. * confirmation dialog modal.
  7069. *
  7070. * @platform darwin,win32
  7071. */
  7072. showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
  7073. /**
  7074. * resolves when the certificate trust dialog is shown.
  7075. *
  7076. * On macOS, this displays a modal dialog that shows a message and certificate
  7077. * information, and gives the user the option of trusting/importing the
  7078. * certificate. If you provide a `browserWindow` argument the dialog will be
  7079. * attached to the parent window, making it modal.
  7080. *
  7081. * On Windows the options are more limited, due to the Win32 APIs used:
  7082. *
  7083. * * The `message` argument is not used, as the OS provides its own confirmation
  7084. * dialog.
  7085. * * The `browserWindow` argument is ignored since it is not possible to make this
  7086. * confirmation dialog modal.
  7087. *
  7088. * @platform darwin,win32
  7089. */
  7090. showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
  7091. /**
  7092. * Displays a modal dialog that shows an error message.
  7093. *
  7094. * This API can be called safely before the `ready` event the `app` module emits,
  7095. * it is usually used to report errors in early stage of startup. If called before
  7096. * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
  7097. * dialog will appear.
  7098. */
  7099. showErrorBox(title: string, content: string): void;
  7100. /**
  7101. * resolves with a promise containing the following properties:
  7102. *
  7103. * * `response` number - The index of the clicked button.
  7104. * * `checkboxChecked` boolean - The checked state of the checkbox if
  7105. * `checkboxLabel` was set. Otherwise `false`.
  7106. *
  7107. * Shows a message box.
  7108. *
  7109. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7110. * window, making it modal.
  7111. */
  7112. showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  7113. /**
  7114. * resolves with a promise containing the following properties:
  7115. *
  7116. * * `response` number - The index of the clicked button.
  7117. * * `checkboxChecked` boolean - The checked state of the checkbox if
  7118. * `checkboxLabel` was set. Otherwise `false`.
  7119. *
  7120. * Shows a message box.
  7121. *
  7122. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7123. * window, making it modal.
  7124. */
  7125. showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  7126. /**
  7127. * the index of the clicked button.
  7128. *
  7129. * Shows a message box, it will block the process until the message box is closed.
  7130. * It returns the index of the clicked button.
  7131. *
  7132. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7133. * window, making it modal. If `browserWindow` is not shown dialog will not be
  7134. * attached to it. In such case it will be displayed as an independent window.
  7135. */
  7136. showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
  7137. /**
  7138. * the index of the clicked button.
  7139. *
  7140. * Shows a message box, it will block the process until the message box is closed.
  7141. * It returns the index of the clicked button.
  7142. *
  7143. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7144. * window, making it modal. If `browserWindow` is not shown dialog will not be
  7145. * attached to it. In such case it will be displayed as an independent window.
  7146. */
  7147. showMessageBoxSync(options: MessageBoxSyncOptions): number;
  7148. /**
  7149. * Resolve with an object containing the following:
  7150. *
  7151. * * `canceled` boolean - whether or not the dialog was canceled.
  7152. * * `filePaths` string[] - An array of file paths chosen by the user. If the
  7153. * dialog is cancelled this will be an empty array.
  7154. * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
  7155. * `filePaths` array of base64 encoded strings which contains security scoped
  7156. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  7157. * populated. (For return values, see table here.)
  7158. *
  7159. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7160. * window, making it modal.
  7161. *
  7162. * The `filters` specifies an array of file types that can be displayed or selected
  7163. * when you want to limit the user to a specific type. For example:
  7164. *
  7165. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  7166. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  7167. * `'*'` wildcard (no other wildcard is supported).
  7168. *
  7169. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  7170. * and a directory selector, so if you set `properties` to `['openFile',
  7171. * 'openDirectory']` on these platforms, a directory selector will be shown.
  7172. */
  7173. showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  7174. /**
  7175. * Resolve with an object containing the following:
  7176. *
  7177. * * `canceled` boolean - whether or not the dialog was canceled.
  7178. * * `filePaths` string[] - An array of file paths chosen by the user. If the
  7179. * dialog is cancelled this will be an empty array.
  7180. * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
  7181. * `filePaths` array of base64 encoded strings which contains security scoped
  7182. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  7183. * populated. (For return values, see table here.)
  7184. *
  7185. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7186. * window, making it modal.
  7187. *
  7188. * The `filters` specifies an array of file types that can be displayed or selected
  7189. * when you want to limit the user to a specific type. For example:
  7190. *
  7191. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  7192. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  7193. * `'*'` wildcard (no other wildcard is supported).
  7194. *
  7195. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  7196. * and a directory selector, so if you set `properties` to `['openFile',
  7197. * 'openDirectory']` on these platforms, a directory selector will be shown.
  7198. */
  7199. showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  7200. /**
  7201. * the file paths chosen by the user; if the dialog is cancelled it returns
  7202. * `undefined`.
  7203. *
  7204. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7205. * window, making it modal.
  7206. *
  7207. * The `filters` specifies an array of file types that can be displayed or selected
  7208. * when you want to limit the user to a specific type. For example:
  7209. *
  7210. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  7211. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  7212. * `'*'` wildcard (no other wildcard is supported).
  7213. *
  7214. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  7215. * and a directory selector, so if you set `properties` to `['openFile',
  7216. * 'openDirectory']` on these platforms, a directory selector will be shown.
  7217. */
  7218. showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
  7219. /**
  7220. * the file paths chosen by the user; if the dialog is cancelled it returns
  7221. * `undefined`.
  7222. *
  7223. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7224. * window, making it modal.
  7225. *
  7226. * The `filters` specifies an array of file types that can be displayed or selected
  7227. * when you want to limit the user to a specific type. For example:
  7228. *
  7229. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  7230. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  7231. * `'*'` wildcard (no other wildcard is supported).
  7232. *
  7233. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  7234. * and a directory selector, so if you set `properties` to `['openFile',
  7235. * 'openDirectory']` on these platforms, a directory selector will be shown.
  7236. */
  7237. showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
  7238. /**
  7239. * Resolve with an object containing the following:
  7240. *
  7241. * * `canceled` boolean - whether or not the dialog was canceled.
  7242. * * `filePath` string - If the dialog is canceled, this will be an empty string.
  7243. * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
  7244. * contains the security scoped bookmark data for the saved file.
  7245. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  7246. * values, see table here.)
  7247. *
  7248. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7249. * window, making it modal.
  7250. *
  7251. * The `filters` specifies an array of file types that can be displayed, see
  7252. * `dialog.showOpenDialog` for an example.
  7253. *
  7254. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  7255. * issues when expanding and collapsing the dialog.
  7256. */
  7257. showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  7258. /**
  7259. * Resolve with an object containing the following:
  7260. *
  7261. * * `canceled` boolean - whether or not the dialog was canceled.
  7262. * * `filePath` string - If the dialog is canceled, this will be an empty string.
  7263. * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
  7264. * contains the security scoped bookmark data for the saved file.
  7265. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  7266. * values, see table here.)
  7267. *
  7268. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7269. * window, making it modal.
  7270. *
  7271. * The `filters` specifies an array of file types that can be displayed, see
  7272. * `dialog.showOpenDialog` for an example.
  7273. *
  7274. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  7275. * issues when expanding and collapsing the dialog.
  7276. */
  7277. showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  7278. /**
  7279. * the path of the file chosen by the user; if the dialog is cancelled it returns
  7280. * an empty string.
  7281. *
  7282. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7283. * window, making it modal.
  7284. *
  7285. * The `filters` specifies an array of file types that can be displayed, see
  7286. * `dialog.showOpenDialog` for an example.
  7287. */
  7288. showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): string;
  7289. /**
  7290. * the path of the file chosen by the user; if the dialog is cancelled it returns
  7291. * an empty string.
  7292. *
  7293. * The `browserWindow` argument allows the dialog to attach itself to a parent
  7294. * window, making it modal.
  7295. *
  7296. * The `filters` specifies an array of file types that can be displayed, see
  7297. * `dialog.showOpenDialog` for an example.
  7298. */
  7299. showSaveDialogSync(options: SaveDialogSyncOptions): string;
  7300. }
  7301. interface Display {
  7302. // Docs: https://electronjs.org/docs/api/structures/display
  7303. /**
  7304. * Can be `available`, `unavailable`, `unknown`.
  7305. */
  7306. accelerometerSupport: ('available' | 'unavailable' | 'unknown');
  7307. /**
  7308. * the bounds of the display in DIP points.
  7309. */
  7310. bounds: Rectangle;
  7311. /**
  7312. * The number of bits per pixel.
  7313. */
  7314. colorDepth: number;
  7315. /**
  7316. * represent a color space (three-dimensional object which contains all realizable
  7317. * color combinations) for the purpose of color conversions.
  7318. */
  7319. colorSpace: string;
  7320. /**
  7321. * The number of bits per color component.
  7322. */
  7323. depthPerComponent: number;
  7324. /**
  7325. * `true`` if the display is detected by the system.
  7326. */
  7327. detected: boolean;
  7328. /**
  7329. * The display refresh rate.
  7330. */
  7331. displayFrequency: number;
  7332. /**
  7333. * Unique identifier associated with the display. A value of of -1 means the
  7334. * display is invalid or the correct `id` is not yet known, and a value of -10
  7335. * means the display is a virtual display assigned to a unified desktop.
  7336. */
  7337. id: number;
  7338. /**
  7339. * `true` for an internal display and `false` for an external display.
  7340. */
  7341. internal: boolean;
  7342. /**
  7343. * User-friendly label, determined by the platform.
  7344. */
  7345. label: string;
  7346. /**
  7347. * Maximum cursor size in native pixels.
  7348. */
  7349. maximumCursorSize: Size;
  7350. /**
  7351. * Whether or not the display is a monochrome display.
  7352. */
  7353. monochrome: boolean;
  7354. /**
  7355. * Returns the display's origin in pixel coordinates. Only available on windowing
  7356. * systems like X11 that position displays in pixel coordinates.
  7357. */
  7358. nativeOrigin: Point;
  7359. /**
  7360. * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
  7361. */
  7362. rotation: number;
  7363. /**
  7364. * Output device's pixel scale factor.
  7365. */
  7366. scaleFactor: number;
  7367. size: Size;
  7368. /**
  7369. * Can be `available`, `unavailable`, `unknown`.
  7370. */
  7371. touchSupport: ('available' | 'unavailable' | 'unknown');
  7372. /**
  7373. * the work area of the display in DIP points.
  7374. */
  7375. workArea: Rectangle;
  7376. /**
  7377. * The size of the work area.
  7378. */
  7379. workAreaSize: Size;
  7380. }
  7381. class Dock {
  7382. // Docs: https://electronjs.org/docs/api/dock
  7383. /**
  7384. * an ID representing the request.
  7385. *
  7386. * When `critical` is passed, the dock icon will bounce until either the
  7387. * application becomes active or the request is canceled.
  7388. *
  7389. * When `informational` is passed, the dock icon will bounce for one second.
  7390. * However, the request remains active until either the application becomes active
  7391. * or the request is canceled.
  7392. *
  7393. * **Note:** This method can only be used while the app is not focused; when the
  7394. * app is focused it will return -1.
  7395. *
  7396. * @platform darwin
  7397. */
  7398. bounce(type?: 'critical' | 'informational'): number;
  7399. /**
  7400. * Cancel the bounce of `id`.
  7401. *
  7402. * @platform darwin
  7403. */
  7404. cancelBounce(id: number): void;
  7405. /**
  7406. * Bounces the Downloads stack if the filePath is inside the Downloads folder.
  7407. *
  7408. * @platform darwin
  7409. */
  7410. downloadFinished(filePath: string): void;
  7411. /**
  7412. * The badge string of the dock.
  7413. *
  7414. * @platform darwin
  7415. */
  7416. getBadge(): string;
  7417. /**
  7418. * The application's dock menu.
  7419. *
  7420. * @platform darwin
  7421. */
  7422. getMenu(): (Menu) | (null);
  7423. /**
  7424. * Hides the dock icon.
  7425. *
  7426. * @platform darwin
  7427. */
  7428. hide(): void;
  7429. /**
  7430. * Whether the dock icon is visible.
  7431. *
  7432. * @platform darwin
  7433. */
  7434. isVisible(): boolean;
  7435. /**
  7436. * Sets the string to be displayed in the dock’s badging area.
  7437. *
  7438. * @platform darwin
  7439. */
  7440. setBadge(text: string): void;
  7441. /**
  7442. * Sets the `image` associated with this dock icon.
  7443. *
  7444. * @platform darwin
  7445. */
  7446. setIcon(image: (NativeImage) | (string)): void;
  7447. /**
  7448. * Sets the application's dock menu.
  7449. *
  7450. * @platform darwin
  7451. */
  7452. setMenu(menu: Menu): void;
  7453. /**
  7454. * Resolves when the dock icon is shown.
  7455. *
  7456. * @platform darwin
  7457. */
  7458. show(): Promise<void>;
  7459. }
  7460. class DownloadItem extends NodeEventEmitter {
  7461. // Docs: https://electronjs.org/docs/api/download-item
  7462. /**
  7463. * Emitted when the download is in a terminal state. This includes a completed
  7464. * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
  7465. * download that can't be resumed.
  7466. *
  7467. * The `state` can be one of following:
  7468. *
  7469. * * `completed` - The download completed successfully.
  7470. * * `cancelled` - The download has been cancelled.
  7471. * * `interrupted` - The download has interrupted and can not resume.
  7472. */
  7473. on(event: 'done', listener: (event: Event,
  7474. /**
  7475. * Can be `completed`, `cancelled` or `interrupted`.
  7476. */
  7477. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  7478. off(event: 'done', listener: (event: Event,
  7479. /**
  7480. * Can be `completed`, `cancelled` or `interrupted`.
  7481. */
  7482. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  7483. once(event: 'done', listener: (event: Event,
  7484. /**
  7485. * Can be `completed`, `cancelled` or `interrupted`.
  7486. */
  7487. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  7488. addListener(event: 'done', listener: (event: Event,
  7489. /**
  7490. * Can be `completed`, `cancelled` or `interrupted`.
  7491. */
  7492. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  7493. removeListener(event: 'done', listener: (event: Event,
  7494. /**
  7495. * Can be `completed`, `cancelled` or `interrupted`.
  7496. */
  7497. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  7498. /**
  7499. * Emitted when the download has been updated and is not done.
  7500. *
  7501. * The `state` can be one of following:
  7502. *
  7503. * * `progressing` - The download is in-progress.
  7504. * * `interrupted` - The download has interrupted and can be resumed.
  7505. */
  7506. on(event: 'updated', listener: (event: Event,
  7507. /**
  7508. * Can be `progressing` or `interrupted`.
  7509. */
  7510. state: ('progressing' | 'interrupted')) => void): this;
  7511. off(event: 'updated', listener: (event: Event,
  7512. /**
  7513. * Can be `progressing` or `interrupted`.
  7514. */
  7515. state: ('progressing' | 'interrupted')) => void): this;
  7516. once(event: 'updated', listener: (event: Event,
  7517. /**
  7518. * Can be `progressing` or `interrupted`.
  7519. */
  7520. state: ('progressing' | 'interrupted')) => void): this;
  7521. addListener(event: 'updated', listener: (event: Event,
  7522. /**
  7523. * Can be `progressing` or `interrupted`.
  7524. */
  7525. state: ('progressing' | 'interrupted')) => void): this;
  7526. removeListener(event: 'updated', listener: (event: Event,
  7527. /**
  7528. * Can be `progressing` or `interrupted`.
  7529. */
  7530. state: ('progressing' | 'interrupted')) => void): this;
  7531. /**
  7532. * Cancels the download operation.
  7533. */
  7534. cancel(): void;
  7535. /**
  7536. * Whether the download can resume.
  7537. */
  7538. canResume(): boolean;
  7539. /**
  7540. * The Content-Disposition field from the response header.
  7541. */
  7542. getContentDisposition(): string;
  7543. /**
  7544. * ETag header value.
  7545. */
  7546. getETag(): string;
  7547. /**
  7548. * The file name of the download item.
  7549. *
  7550. * **Note:** The file name is not always the same as the actual one saved in local
  7551. * disk. If user changes the file name in a prompted download saving dialog, the
  7552. * actual name of saved file will be different.
  7553. */
  7554. getFilename(): string;
  7555. /**
  7556. * Last-Modified header value.
  7557. */
  7558. getLastModifiedTime(): string;
  7559. /**
  7560. * The files mime type.
  7561. */
  7562. getMimeType(): string;
  7563. /**
  7564. * The received bytes of the download item.
  7565. */
  7566. getReceivedBytes(): number;
  7567. /**
  7568. * Returns the object previously set by
  7569. * `downloadItem.setSaveDialogOptions(options)`.
  7570. */
  7571. getSaveDialogOptions(): SaveDialogOptions;
  7572. /**
  7573. * The save path of the download item. This will be either the path set via
  7574. * `downloadItem.setSavePath(path)` or the path selected from the shown save
  7575. * dialog.
  7576. */
  7577. getSavePath(): string;
  7578. /**
  7579. * Number of seconds since the UNIX epoch when the download was started.
  7580. */
  7581. getStartTime(): number;
  7582. /**
  7583. * The current state. Can be `progressing`, `completed`, `cancelled` or
  7584. * `interrupted`.
  7585. *
  7586. * **Note:** The following methods are useful specifically to resume a `cancelled`
  7587. * item when session is restarted.
  7588. */
  7589. getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
  7590. /**
  7591. * The total size in bytes of the download item.
  7592. *
  7593. * If the size is unknown, it returns 0.
  7594. */
  7595. getTotalBytes(): number;
  7596. /**
  7597. * The origin URL where the item is downloaded from.
  7598. */
  7599. getURL(): string;
  7600. /**
  7601. * The complete URL chain of the item including any redirects.
  7602. */
  7603. getURLChain(): string[];
  7604. /**
  7605. * Whether the download has user gesture.
  7606. */
  7607. hasUserGesture(): boolean;
  7608. /**
  7609. * Whether the download is paused.
  7610. */
  7611. isPaused(): boolean;
  7612. /**
  7613. * Pauses the download.
  7614. */
  7615. pause(): void;
  7616. /**
  7617. * Resumes the download that has been paused.
  7618. *
  7619. * **Note:** To enable resumable downloads the server you are downloading from must
  7620. * support range requests and provide both `Last-Modified` and `ETag` header
  7621. * values. Otherwise `resume()` will dismiss previously received bytes and restart
  7622. * the download from the beginning.
  7623. */
  7624. resume(): void;
  7625. /**
  7626. * This API allows the user to set custom options for the save dialog that opens
  7627. * for the download item by default. The API is only available in session's
  7628. * `will-download` callback function.
  7629. */
  7630. setSaveDialogOptions(options: SaveDialogOptions): void;
  7631. /**
  7632. * The API is only available in session's `will-download` callback function. If
  7633. * `path` doesn't exist, Electron will try to make the directory recursively. If
  7634. * user doesn't set the save path via the API, Electron will use the original
  7635. * routine to determine the save path; this usually prompts a save dialog.
  7636. */
  7637. setSavePath(path: string): void;
  7638. /**
  7639. * A `string` property that determines the save file path of the download item.
  7640. *
  7641. * The property is only available in session's `will-download` callback function.
  7642. * If user doesn't set the save path via the property, Electron will use the
  7643. * original routine to determine the save path; this usually prompts a save dialog.
  7644. */
  7645. savePath: string;
  7646. }
  7647. interface Extension {
  7648. // Docs: https://electronjs.org/docs/api/structures/extension
  7649. id: string;
  7650. /**
  7651. * Copy of the extension's manifest data.
  7652. */
  7653. manifest: any;
  7654. name: string;
  7655. /**
  7656. * The extension's file path.
  7657. */
  7658. path: string;
  7659. /**
  7660. * The extension's `chrome-extension://` URL.
  7661. */
  7662. url: string;
  7663. version: string;
  7664. }
  7665. interface ExtensionInfo {
  7666. // Docs: https://electronjs.org/docs/api/structures/extension-info
  7667. name: string;
  7668. version: string;
  7669. }
  7670. interface FileFilter {
  7671. // Docs: https://electronjs.org/docs/api/structures/file-filter
  7672. extensions: string[];
  7673. name: string;
  7674. }
  7675. interface FilePathWithHeaders {
  7676. // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
  7677. /**
  7678. * Additional headers to be sent.
  7679. */
  7680. headers?: Record<string, string>;
  7681. /**
  7682. * The path to the file to send.
  7683. */
  7684. path: string;
  7685. }
  7686. interface FilesystemPermissionRequest extends PermissionRequest {
  7687. // Docs: https://electronjs.org/docs/api/structures/filesystem-permission-request
  7688. /**
  7689. * The access type of the `fileSystem` request. Can be `writable` or `readable`.
  7690. */
  7691. fileAccessType?: ('writable' | 'readable');
  7692. /**
  7693. * The path of the `fileSystem` request.
  7694. */
  7695. filePath?: string;
  7696. /**
  7697. * Whether the `fileSystem` request is a directory.
  7698. */
  7699. isDirectory?: boolean;
  7700. }
  7701. interface GlobalShortcut {
  7702. // Docs: https://electronjs.org/docs/api/global-shortcut
  7703. /**
  7704. * Whether this application has registered `accelerator`.
  7705. *
  7706. * When the accelerator is already taken by other applications, this call will
  7707. * still return `false`. This behavior is intended by operating systems, since they
  7708. * don't want applications to fight for global shortcuts.
  7709. */
  7710. isRegistered(accelerator: Accelerator): boolean;
  7711. /**
  7712. * Whether or not the shortcut was registered successfully.
  7713. *
  7714. * Registers a global shortcut of `accelerator`. The `callback` is called when the
  7715. * registered shortcut is pressed by the user.
  7716. *
  7717. * When the accelerator is already taken by other applications, this call will
  7718. * silently fail. This behavior is intended by operating systems, since they don't
  7719. * want applications to fight for global shortcuts.
  7720. *
  7721. * The following accelerators will not be registered successfully on macOS 10.14
  7722. * Mojave unless the app has been authorized as a trusted accessibility client:
  7723. *
  7724. * * "Media Play/Pause"
  7725. * * "Media Next Track"
  7726. * * "Media Previous Track"
  7727. * * "Media Stop"
  7728. */
  7729. register(accelerator: Accelerator, callback: () => void): boolean;
  7730. /**
  7731. * Registers a global shortcut of all `accelerator` items in `accelerators`. The
  7732. * `callback` is called when any of the registered shortcuts are pressed by the
  7733. * user.
  7734. *
  7735. * When a given accelerator is already taken by other applications, this call will
  7736. * silently fail. This behavior is intended by operating systems, since they don't
  7737. * want applications to fight for global shortcuts.
  7738. *
  7739. * The following accelerators will not be registered successfully on macOS 10.14
  7740. * Mojave unless the app has been authorized as a trusted accessibility client:
  7741. *
  7742. * * "Media Play/Pause"
  7743. * * "Media Next Track"
  7744. * * "Media Previous Track"
  7745. * * "Media Stop"
  7746. */
  7747. registerAll(accelerators: Accelerator[], callback: () => void): void;
  7748. /**
  7749. * Unregisters the global shortcut of `accelerator`.
  7750. */
  7751. unregister(accelerator: Accelerator): void;
  7752. /**
  7753. * Unregisters all of the global shortcuts.
  7754. */
  7755. unregisterAll(): void;
  7756. }
  7757. interface GPUFeatureStatus {
  7758. // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
  7759. /**
  7760. * Canvas.
  7761. */
  7762. '2d_canvas': string;
  7763. /**
  7764. * Flash.
  7765. */
  7766. flash_3d: string;
  7767. /**
  7768. * Flash Stage3D.
  7769. */
  7770. flash_stage3d: string;
  7771. /**
  7772. * Flash Stage3D Baseline profile.
  7773. */
  7774. flash_stage3d_baseline: string;
  7775. /**
  7776. * Compositing.
  7777. */
  7778. gpu_compositing: string;
  7779. /**
  7780. * Multiple Raster Threads.
  7781. */
  7782. multiple_raster_threads: string;
  7783. /**
  7784. * Native GpuMemoryBuffers.
  7785. */
  7786. native_gpu_memory_buffers: string;
  7787. /**
  7788. * Rasterization.
  7789. */
  7790. rasterization: string;
  7791. /**
  7792. * Video Decode.
  7793. */
  7794. video_decode: string;
  7795. /**
  7796. * Video Encode.
  7797. */
  7798. video_encode: string;
  7799. /**
  7800. * VPx Video Decode.
  7801. */
  7802. vpx_decode: string;
  7803. /**
  7804. * WebGL.
  7805. */
  7806. webgl: string;
  7807. /**
  7808. * WebGL2.
  7809. */
  7810. webgl2: string;
  7811. }
  7812. interface HIDDevice {
  7813. // Docs: https://electronjs.org/docs/api/structures/hid-device
  7814. /**
  7815. * Unique identifier for the device.
  7816. */
  7817. deviceId: string;
  7818. /**
  7819. * Unique identifier for the HID interface. A device may have multiple HID
  7820. * interfaces.
  7821. */
  7822. guid?: string;
  7823. /**
  7824. * Name of the device.
  7825. */
  7826. name: string;
  7827. /**
  7828. * The USB product ID.
  7829. */
  7830. productId: number;
  7831. /**
  7832. * The USB device serial number.
  7833. */
  7834. serialNumber?: string;
  7835. /**
  7836. * The USB vendor ID.
  7837. */
  7838. vendorId: number;
  7839. }
  7840. interface InAppPurchase extends NodeJS.EventEmitter {
  7841. // Docs: https://electronjs.org/docs/api/in-app-purchase
  7842. on(event: 'transactions-updated', listener: Function): this;
  7843. off(event: 'transactions-updated', listener: Function): this;
  7844. once(event: 'transactions-updated', listener: Function): this;
  7845. addListener(event: 'transactions-updated', listener: Function): this;
  7846. removeListener(event: 'transactions-updated', listener: Function): this;
  7847. /**
  7848. * whether a user can make a payment.
  7849. */
  7850. canMakePayments(): boolean;
  7851. /**
  7852. * Completes all pending transactions.
  7853. */
  7854. finishAllTransactions(): void;
  7855. /**
  7856. * Completes the pending transactions corresponding to the date.
  7857. */
  7858. finishTransactionByDate(date: string): void;
  7859. /**
  7860. * Resolves with an array of `Product` objects.
  7861. *
  7862. * Retrieves the product descriptions.
  7863. */
  7864. getProducts(productIDs: string[]): Promise<Electron.Product[]>;
  7865. /**
  7866. * the path to the receipt.
  7867. */
  7868. getReceiptURL(): string;
  7869. /**
  7870. * Returns `true` if the product is valid and added to the payment queue.
  7871. *
  7872. * You should listen for the `transactions-updated` event as soon as possible and
  7873. * certainly before you call `purchaseProduct`.
  7874. */
  7875. purchaseProduct(productID: string, opts?: (number) | (PurchaseProductOpts)): Promise<boolean>;
  7876. /**
  7877. * Restores finished transactions. This method can be called either to install
  7878. * purchases on additional devices, or to restore purchases for an application that
  7879. * the user deleted and reinstalled.
  7880. *
  7881. * The payment queue delivers a new transaction for each previously completed
  7882. * transaction that can be restored. Each transaction includes a copy of the
  7883. * original transaction.
  7884. */
  7885. restoreCompletedTransactions(): void;
  7886. }
  7887. class IncomingMessage extends NodeEventEmitter {
  7888. // Docs: https://electronjs.org/docs/api/incoming-message
  7889. /**
  7890. * Emitted when a request has been canceled during an ongoing HTTP transaction.
  7891. */
  7892. on(event: 'aborted', listener: Function): this;
  7893. off(event: 'aborted', listener: Function): this;
  7894. once(event: 'aborted', listener: Function): this;
  7895. addListener(event: 'aborted', listener: Function): this;
  7896. removeListener(event: 'aborted', listener: Function): this;
  7897. /**
  7898. * The `data` event is the usual method of transferring response data into
  7899. * applicative code.
  7900. */
  7901. on(event: 'data', listener: (
  7902. /**
  7903. * A chunk of response body's data.
  7904. */
  7905. chunk: Buffer) => void): this;
  7906. off(event: 'data', listener: (
  7907. /**
  7908. * A chunk of response body's data.
  7909. */
  7910. chunk: Buffer) => void): this;
  7911. once(event: 'data', listener: (
  7912. /**
  7913. * A chunk of response body's data.
  7914. */
  7915. chunk: Buffer) => void): this;
  7916. addListener(event: 'data', listener: (
  7917. /**
  7918. * A chunk of response body's data.
  7919. */
  7920. chunk: Buffer) => void): this;
  7921. removeListener(event: 'data', listener: (
  7922. /**
  7923. * A chunk of response body's data.
  7924. */
  7925. chunk: Buffer) => void): this;
  7926. /**
  7927. * Indicates that response body has ended. Must be placed before 'data' event.
  7928. */
  7929. on(event: 'end', listener: Function): this;
  7930. off(event: 'end', listener: Function): this;
  7931. once(event: 'end', listener: Function): this;
  7932. addListener(event: 'end', listener: Function): this;
  7933. removeListener(event: 'end', listener: Function): this;
  7934. /**
  7935. * Returns:
  7936. *
  7937. * `error` Error - Typically holds an error string identifying failure root cause.
  7938. *
  7939. * Emitted when an error was encountered while streaming response data events. For
  7940. * instance, if the server closes the underlying while the response is still
  7941. * streaming, an `error` event will be emitted on the response object and a `close`
  7942. * event will subsequently follow on the request object.
  7943. */
  7944. on(event: 'error', listener: Function): this;
  7945. off(event: 'error', listener: Function): this;
  7946. once(event: 'error', listener: Function): this;
  7947. addListener(event: 'error', listener: Function): this;
  7948. removeListener(event: 'error', listener: Function): this;
  7949. /**
  7950. * A `Record<string, string | string[]>` representing the HTTP response headers.
  7951. * The `headers` object is formatted as follows:
  7952. *
  7953. * * All header names are lowercased.
  7954. * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,
  7955. * `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,
  7956. * `last-modified`, `location`, `max-forwards`, `proxy-authorization`, `referer`,
  7957. * `retry-after`, `server`, or `user-agent` are discarded.
  7958. * * `set-cookie` is always an array. Duplicates are added to the array.
  7959. * * For duplicate `cookie` headers, the values are joined together with '; '.
  7960. * * For all other headers, the values are joined together with ', '.
  7961. */
  7962. headers: Record<string, (string) | (string[])>;
  7963. /**
  7964. * A `string` indicating the HTTP protocol version number. Typical values are '1.0'
  7965. * or '1.1'. Additionally `httpVersionMajor` and `httpVersionMinor` are two
  7966. * Integer-valued readable properties that return respectively the HTTP major and
  7967. * minor version numbers.
  7968. */
  7969. httpVersion: string;
  7970. /**
  7971. * An `Integer` indicating the HTTP protocol major version number.
  7972. */
  7973. httpVersionMajor: number;
  7974. /**
  7975. * An `Integer` indicating the HTTP protocol minor version number.
  7976. */
  7977. httpVersionMinor: number;
  7978. /**
  7979. * A `string[]` containing the raw HTTP response headers exactly as they were
  7980. * received. The keys and values are in the same list. It is not a list of tuples.
  7981. * So, the even-numbered offsets are key values, and the odd-numbered offsets are
  7982. * the associated values. Header names are not lowercased, and duplicates are not
  7983. * merged.
  7984. */
  7985. rawHeaders: string[];
  7986. /**
  7987. * An `Integer` indicating the HTTP response status code.
  7988. */
  7989. statusCode: number;
  7990. /**
  7991. * A `string` representing the HTTP status message.
  7992. */
  7993. statusMessage: string;
  7994. }
  7995. interface InputEvent {
  7996. // Docs: https://electronjs.org/docs/api/structures/input-event
  7997. /**
  7998. * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
  7999. * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
  8000. * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
  8001. */
  8002. modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
  8003. /**
  8004. * Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`,
  8005. * `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`,
  8006. * `char`, `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`,
  8007. * `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`,
  8008. * `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`,
  8009. * `gestureTap`, `gestureTapCancel`, `gestureShortPress`, `gestureLongPress`,
  8010. * `gestureLongTap`, `gestureTwoFingerTap`, `gestureTapUnconfirmed`,
  8011. * `gestureDoubleTap`, `touchStart`, `touchMove`, `touchEnd`, `touchCancel`,
  8012. * `touchScrollStarted`, `pointerDown`, `pointerUp`, `pointerMove`,
  8013. * `pointerRawUpdate`, `pointerCancel` or `pointerCausedUaAction`.
  8014. */
  8015. type: ('undefined' | 'mouseDown' | 'mouseUp' | 'mouseMove' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'rawKeyDown' | 'keyDown' | 'keyUp' | 'char' | 'gestureScrollBegin' | 'gestureScrollEnd' | 'gestureScrollUpdate' | 'gestureFlingStart' | 'gestureFlingCancel' | 'gesturePinchBegin' | 'gesturePinchEnd' | 'gesturePinchUpdate' | 'gestureTapDown' | 'gestureShowPress' | 'gestureTap' | 'gestureTapCancel' | 'gestureShortPress' | 'gestureLongPress' | 'gestureLongTap' | 'gestureTwoFingerTap' | 'gestureTapUnconfirmed' | 'gestureDoubleTap' | 'touchStart' | 'touchMove' | 'touchEnd' | 'touchCancel' | 'touchScrollStarted' | 'pointerDown' | 'pointerUp' | 'pointerMove' | 'pointerRawUpdate' | 'pointerCancel' | 'pointerCausedUaAction');
  8016. }
  8017. interface IpcMain extends NodeJS.EventEmitter {
  8018. // Docs: https://electronjs.org/docs/api/ipc-main
  8019. /**
  8020. * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
  8021. * renderer calls `ipcRenderer.invoke(channel, ...args)`.
  8022. *
  8023. * If `listener` returns a Promise, the eventual result of the promise will be
  8024. * returned as a reply to the remote caller. Otherwise, the return value of the
  8025. * listener will be used as the value of the reply.
  8026. *
  8027. * The `event` that is passed as the first argument to the handler is the same as
  8028. * that passed to a regular event listener. It includes information about which
  8029. * WebContents is the source of the invoke request.
  8030. *
  8031. * Errors thrown through `handle` in the main process are not transparent as they
  8032. * are serialized and only the `message` property from the original error is
  8033. * provided to the renderer process. Please refer to #24427 for details.
  8034. */
  8035. handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<any>) | (any)): void;
  8036. /**
  8037. * Handles a single `invoke`able IPC message, then removes the listener. See
  8038. * `ipcMain.handle(channel, listener)`.
  8039. */
  8040. handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<any>) | (any)): void;
  8041. /**
  8042. * Listens to `channel`, when a new message arrives `listener` would be called with
  8043. * `listener(event, args...)`.
  8044. */
  8045. on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  8046. /**
  8047. * Adds a one time `listener` function for the event. This `listener` is invoked
  8048. * only the next time a message is sent to `channel`, after which it is removed.
  8049. */
  8050. once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  8051. /**
  8052. * Removes listeners of the specified `channel`.
  8053. */
  8054. removeAllListeners(channel?: string): this;
  8055. /**
  8056. * Removes any handler for `channel`, if present.
  8057. */
  8058. removeHandler(channel: string): void;
  8059. /**
  8060. * Removes the specified `listener` from the listener array for the specified
  8061. * `channel`.
  8062. */
  8063. removeListener(channel: string, listener: (...args: any[]) => void): this;
  8064. }
  8065. interface IpcMainEvent extends Event {
  8066. // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
  8067. /**
  8068. * The ID of the renderer frame that sent this message
  8069. */
  8070. frameId: number;
  8071. /**
  8072. * A list of MessagePorts that were transferred with this message
  8073. */
  8074. ports: MessagePortMain[];
  8075. /**
  8076. * The internal ID of the renderer process that sent this message
  8077. */
  8078. processId: number;
  8079. /**
  8080. * A function that will send an IPC message to the renderer frame that sent the
  8081. * original message that you are currently handling. You should use this method to
  8082. * "reply" to the sent message in order to guarantee the reply will go to the
  8083. * correct process and frame.
  8084. */
  8085. reply: (channel: string, ...args: any[]) => void;
  8086. /**
  8087. * Set this to the value to be returned in a synchronous message
  8088. */
  8089. returnValue: any;
  8090. /**
  8091. * Returns the `webContents` that sent the message
  8092. */
  8093. sender: WebContents;
  8094. /**
  8095. * The frame that sent this message
  8096. *
  8097. */
  8098. readonly senderFrame: WebFrameMain;
  8099. }
  8100. interface IpcMainInvokeEvent extends Event {
  8101. // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
  8102. /**
  8103. * The ID of the renderer frame that sent this message
  8104. */
  8105. frameId: number;
  8106. /**
  8107. * The internal ID of the renderer process that sent this message
  8108. */
  8109. processId: number;
  8110. /**
  8111. * Returns the `webContents` that sent the message
  8112. */
  8113. sender: WebContents;
  8114. /**
  8115. * The frame that sent this message
  8116. *
  8117. */
  8118. readonly senderFrame: WebFrameMain;
  8119. }
  8120. interface IpcRenderer extends NodeJS.EventEmitter {
  8121. // Docs: https://electronjs.org/docs/api/ipc-renderer
  8122. /**
  8123. * Alias for `ipcRenderer.on`.
  8124. */
  8125. addListener(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  8126. /**
  8127. * Resolves with the response from the main process.
  8128. *
  8129. * Send a message to the main process via `channel` and expect a result
  8130. * asynchronously. Arguments will be serialized with the Structured Clone
  8131. * Algorithm, just like `window.postMessage`, so prototype chains will not be
  8132. * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
  8133. * an exception.
  8134. *
  8135. * The main process should listen for `channel` with `ipcMain.handle()`.
  8136. *
  8137. * For example:
  8138. *
  8139. * If you need to transfer a `MessagePort` to the main process, use
  8140. * `ipcRenderer.postMessage`.
  8141. *
  8142. * If you do not need a response to the message, consider using `ipcRenderer.send`.
  8143. *
  8144. * > **Note** Sending non-standard JavaScript types such as DOM objects or special
  8145. * Electron objects will throw an exception.
  8146. *
  8147. * Since the main process does not have support for DOM objects such as
  8148. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  8149. * Electron's IPC to the main process, as the main process would have no way to
  8150. * decode them. Attempting to send such objects over IPC will result in an error.
  8151. *
  8152. * > **Note** If the handler in the main process throws an error, the promise
  8153. * returned by `invoke` will reject. However, the `Error` object in the renderer
  8154. * process will not be the same as the one thrown in the main process.
  8155. */
  8156. invoke(channel: string, ...args: any[]): Promise<any>;
  8157. /**
  8158. * Alias for `ipcRenderer.removeListener`.
  8159. */
  8160. off(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  8161. /**
  8162. * Listens to `channel`, when a new message arrives `listener` would be called with
  8163. * `listener(event, args...)`.
  8164. */
  8165. on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  8166. /**
  8167. * Adds a one time `listener` function for the event. This `listener` is invoked
  8168. * only the next time a message is sent to `channel`, after which it is removed.
  8169. */
  8170. once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  8171. /**
  8172. * Send a message to the main process, optionally transferring ownership of zero or
  8173. * more `MessagePort` objects.
  8174. *
  8175. * The transferred `MessagePort` objects will be available in the main process as
  8176. * `MessagePortMain` objects by accessing the `ports` property of the emitted
  8177. * event.
  8178. *
  8179. * For example:
  8180. *
  8181. * For more information on using `MessagePort` and `MessageChannel`, see the MDN
  8182. * documentation.
  8183. */
  8184. postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
  8185. /**
  8186. * Removes all listeners, or those of the specified `channel`.
  8187. */
  8188. removeAllListeners(channel: string): this;
  8189. /**
  8190. * Removes the specified `listener` from the listener array for the specified
  8191. * `channel`.
  8192. */
  8193. removeListener(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  8194. /**
  8195. * Send an asynchronous message to the main process via `channel`, along with
  8196. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  8197. * just like `window.postMessage`, so prototype chains will not be included.
  8198. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  8199. * exception.
  8200. *
  8201. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  8202. * Electron objects will throw an exception.
  8203. *
  8204. * Since the main process does not have support for DOM objects such as
  8205. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  8206. * Electron's IPC to the main process, as the main process would have no way to
  8207. * decode them. Attempting to send such objects over IPC will result in an error.
  8208. *
  8209. * The main process handles it by listening for `channel` with the `ipcMain`
  8210. * module.
  8211. *
  8212. * If you need to transfer a `MessagePort` to the main process, use
  8213. * `ipcRenderer.postMessage`.
  8214. *
  8215. * If you want to receive a single response from the main process, like the result
  8216. * of a method call, consider using `ipcRenderer.invoke`.
  8217. */
  8218. send(channel: string, ...args: any[]): void;
  8219. /**
  8220. * The value sent back by the `ipcMain` handler.
  8221. *
  8222. * Send a message to the main process via `channel` and expect a result
  8223. * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
  8224. * just like `window.postMessage`, so prototype chains will not be included.
  8225. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  8226. * exception.
  8227. *
  8228. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  8229. * Electron objects will throw an exception.
  8230. *
  8231. * Since the main process does not have support for DOM objects such as
  8232. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  8233. * Electron's IPC to the main process, as the main process would have no way to
  8234. * decode them. Attempting to send such objects over IPC will result in an error.
  8235. *
  8236. * The main process handles it by listening for `channel` with `ipcMain` module,
  8237. * and replies by setting `event.returnValue`.
  8238. *
  8239. * > :warning: **WARNING**: Sending a synchronous message will block the whole
  8240. * renderer process until the reply is received, so use this method only as a last
  8241. * resort. It's much better to use the asynchronous version, `invoke()`.
  8242. */
  8243. sendSync(channel: string, ...args: any[]): any;
  8244. /**
  8245. * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
  8246. * the host page instead of the main process.
  8247. */
  8248. sendToHost(channel: string, ...args: any[]): void;
  8249. }
  8250. interface IpcRendererEvent extends Event {
  8251. // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
  8252. /**
  8253. * A list of MessagePorts that were transferred with this message
  8254. */
  8255. ports: MessagePort[];
  8256. /**
  8257. * The `IpcRenderer` instance that emitted the event originally
  8258. */
  8259. sender: IpcRenderer;
  8260. }
  8261. interface JumpListCategory {
  8262. // Docs: https://electronjs.org/docs/api/structures/jump-list-category
  8263. /**
  8264. * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
  8265. * should be omitted.
  8266. */
  8267. items?: JumpListItem[];
  8268. /**
  8269. * Must be set if `type` is `custom`, otherwise it should be omitted.
  8270. */
  8271. name?: string;
  8272. /**
  8273. * One of the following:
  8274. */
  8275. type?: ('tasks' | 'frequent' | 'recent' | 'custom');
  8276. }
  8277. interface JumpListItem {
  8278. // Docs: https://electronjs.org/docs/api/structures/jump-list-item
  8279. /**
  8280. * The command line arguments when `program` is executed. Should only be set if
  8281. * `type` is `task`.
  8282. */
  8283. args?: string;
  8284. /**
  8285. * Description of the task (displayed in a tooltip). Should only be set if `type`
  8286. * is `task`. Maximum length 260 characters.
  8287. */
  8288. description?: string;
  8289. /**
  8290. * The index of the icon in the resource file. If a resource file contains multiple
  8291. * icons this value can be used to specify the zero-based index of the icon that
  8292. * should be displayed for this task. If a resource file contains only one icon,
  8293. * this property should be set to zero.
  8294. */
  8295. iconIndex?: number;
  8296. /**
  8297. * The absolute path to an icon to be displayed in a Jump List, which can be an
  8298. * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
  8299. * can usually specify `process.execPath` to show the program icon.
  8300. */
  8301. iconPath?: string;
  8302. /**
  8303. * Path of the file to open, should only be set if `type` is `file`.
  8304. */
  8305. path?: string;
  8306. /**
  8307. * Path of the program to execute, usually you should specify `process.execPath`
  8308. * which opens the current program. Should only be set if `type` is `task`.
  8309. */
  8310. program?: string;
  8311. /**
  8312. * The text to be displayed for the item in the Jump List. Should only be set if
  8313. * `type` is `task`.
  8314. */
  8315. title?: string;
  8316. /**
  8317. * One of the following:
  8318. */
  8319. type?: ('task' | 'separator' | 'file');
  8320. /**
  8321. * The working directory. Default is empty.
  8322. */
  8323. workingDirectory?: string;
  8324. }
  8325. interface KeyboardEvent {
  8326. // Docs: https://electronjs.org/docs/api/structures/keyboard-event
  8327. /**
  8328. * whether an Alt key was used in an accelerator to trigger the Event
  8329. */
  8330. altKey?: boolean;
  8331. /**
  8332. * whether the Control key was used in an accelerator to trigger the Event
  8333. */
  8334. ctrlKey?: boolean;
  8335. /**
  8336. * whether a meta key was used in an accelerator to trigger the Event
  8337. */
  8338. metaKey?: boolean;
  8339. /**
  8340. * whether a Shift key was used in an accelerator to trigger the Event
  8341. */
  8342. shiftKey?: boolean;
  8343. /**
  8344. * whether an accelerator was used to trigger the event as opposed to another user
  8345. * gesture like mouse click
  8346. */
  8347. triggeredByAccelerator?: boolean;
  8348. }
  8349. interface KeyboardInputEvent extends InputEvent {
  8350. // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
  8351. /**
  8352. * The character that will be sent as the keyboard event. Should only use the valid
  8353. * key codes in Accelerator.
  8354. */
  8355. keyCode: string;
  8356. /**
  8357. * The type of the event, can be `rawKeyDown`, `keyDown`, `keyUp` or `char`.
  8358. */
  8359. type: ('rawKeyDown' | 'keyDown' | 'keyUp' | 'char');
  8360. }
  8361. interface MediaAccessPermissionRequest extends PermissionRequest {
  8362. // Docs: https://electronjs.org/docs/api/structures/media-access-permission-request
  8363. /**
  8364. * The types of media access being requested - elements can be `video` or `audio`.
  8365. */
  8366. mediaTypes?: Array<'video' | 'audio'>;
  8367. /**
  8368. * The security origin of the request.
  8369. */
  8370. securityOrigin?: string;
  8371. }
  8372. interface MemoryInfo {
  8373. // Docs: https://electronjs.org/docs/api/structures/memory-info
  8374. /**
  8375. * The maximum amount of memory that has ever been pinned to actual physical RAM.
  8376. */
  8377. peakWorkingSetSize: number;
  8378. /**
  8379. * The amount of memory not shared by other processes, such as JS heap or HTML
  8380. * content.
  8381. *
  8382. * @platform win32
  8383. */
  8384. privateBytes?: number;
  8385. /**
  8386. * The amount of memory currently pinned to actual physical RAM.
  8387. */
  8388. workingSetSize: number;
  8389. }
  8390. interface MemoryUsageDetails {
  8391. // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
  8392. count: number;
  8393. liveSize: number;
  8394. size: number;
  8395. }
  8396. class Menu extends NodeEventEmitter {
  8397. // Docs: https://electronjs.org/docs/api/menu
  8398. /**
  8399. * Emitted when a popup is closed either manually or with `menu.closePopup()`.
  8400. */
  8401. on(event: 'menu-will-close', listener: (event: Event) => void): this;
  8402. off(event: 'menu-will-close', listener: (event: Event) => void): this;
  8403. once(event: 'menu-will-close', listener: (event: Event) => void): this;
  8404. addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  8405. removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  8406. /**
  8407. * Emitted when `menu.popup()` is called.
  8408. */
  8409. on(event: 'menu-will-show', listener: (event: Event) => void): this;
  8410. off(event: 'menu-will-show', listener: (event: Event) => void): this;
  8411. once(event: 'menu-will-show', listener: (event: Event) => void): this;
  8412. addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  8413. removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  8414. /**
  8415. * Menu
  8416. */
  8417. constructor();
  8418. /**
  8419. * Generally, the `template` is an array of `options` for constructing a MenuItem.
  8420. * The usage can be referenced above.
  8421. *
  8422. * You can also attach other fields to the element of the `template` and they will
  8423. * become properties of the constructed menu items.
  8424. */
  8425. static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
  8426. /**
  8427. * The application menu, if set, or `null`, if not set.
  8428. *
  8429. * **Note:** The returned `Menu` instance doesn't support dynamic addition or
  8430. * removal of menu items. Instance properties can still be dynamically modified.
  8431. */
  8432. static getApplicationMenu(): (Menu) | (null);
  8433. /**
  8434. * Sends the `action` to the first responder of application. This is used for
  8435. * emulating default macOS menu behaviors. Usually you would use the `role`
  8436. * property of a `MenuItem`.
  8437. *
  8438. * See the macOS Cocoa Event Handling Guide for more information on macOS' native
  8439. * actions.
  8440. *
  8441. * @platform darwin
  8442. */
  8443. static sendActionToFirstResponder(action: string): void;
  8444. /**
  8445. * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
  8446. * will be set as each window's top menu.
  8447. *
  8448. * Also on Windows and Linux, you can use a `&` in the top-level item name to
  8449. * indicate which letter should get a generated accelerator. For example, using
  8450. * `&File` for the file menu would result in a generated `Alt-F` accelerator that
  8451. * opens the associated menu. The indicated character in the button label then gets
  8452. * an underline, and the `&` character is not displayed on the button label.
  8453. *
  8454. * In order to escape the `&` character in an item name, add a proceeding `&`. For
  8455. * example, `&&File` would result in `&File` displayed on the button label.
  8456. *
  8457. * Passing `null` will suppress the default menu. On Windows and Linux, this has
  8458. * the additional effect of removing the menu bar from the window.
  8459. *
  8460. * **Note:** The default menu will be created automatically if the app does not set
  8461. * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
  8462. * `Help`.
  8463. */
  8464. static setApplicationMenu(menu: (Menu) | (null)): void;
  8465. /**
  8466. * Appends the `menuItem` to the menu.
  8467. */
  8468. append(menuItem: MenuItem): void;
  8469. /**
  8470. * Closes the context menu in the `browserWindow`.
  8471. */
  8472. closePopup(browserWindow?: BrowserWindow): void;
  8473. /**
  8474. * the item with the specified `id`
  8475. */
  8476. getMenuItemById(id: string): (MenuItem) | (null);
  8477. /**
  8478. * Inserts the `menuItem` to the `pos` position of the menu.
  8479. */
  8480. insert(pos: number, menuItem: MenuItem): void;
  8481. /**
  8482. * Pops up this menu as a context menu in the `BrowserWindow`.
  8483. */
  8484. popup(options?: PopupOptions): void;
  8485. /**
  8486. * A `MenuItem[]` array containing the menu's items.
  8487. *
  8488. * Each `Menu` consists of multiple `MenuItem`s and each `MenuItem` can have a
  8489. * submenu.
  8490. */
  8491. items: MenuItem[];
  8492. }
  8493. class MenuItem {
  8494. // Docs: https://electronjs.org/docs/api/menu-item
  8495. /**
  8496. * MenuItem
  8497. */
  8498. constructor(options: MenuItemConstructorOptions);
  8499. /**
  8500. * An `Accelerator` (optional) indicating the item's accelerator, if set.
  8501. */
  8502. accelerator?: Accelerator;
  8503. /**
  8504. * A `boolean` indicating whether the item is checked, this property can be
  8505. * dynamically changed.
  8506. *
  8507. * A `checkbox` menu item will toggle the `checked` property on and off when
  8508. * selected.
  8509. *
  8510. * A `radio` menu item will turn on its `checked` property when clicked, and will
  8511. * turn off that property for all adjacent items in the same menu.
  8512. *
  8513. * You can add a `click` function for additional behavior.
  8514. */
  8515. checked: boolean;
  8516. /**
  8517. * A `Function` that is fired when the MenuItem receives a click event. It can be
  8518. * called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
  8519. *
  8520. * * `event` KeyboardEvent
  8521. * * `focusedWindow` BrowserWindow
  8522. * * `focusedWebContents` WebContents
  8523. */
  8524. click: Function;
  8525. /**
  8526. * A `number` indicating an item's sequential unique id.
  8527. */
  8528. commandId: number;
  8529. /**
  8530. * A `boolean` indicating whether the item is enabled, this property can be
  8531. * dynamically changed.
  8532. */
  8533. enabled: boolean;
  8534. /**
  8535. * A `NativeImage | string` (optional) indicating the item's icon, if set.
  8536. */
  8537. icon?: (NativeImage) | (string);
  8538. /**
  8539. * A `string` indicating the item's unique id, this property can be dynamically
  8540. * changed.
  8541. */
  8542. id: string;
  8543. /**
  8544. * A `string` indicating the item's visible label.
  8545. */
  8546. label: string;
  8547. /**
  8548. * A `Menu` that the item is a part of.
  8549. */
  8550. menu: Menu;
  8551. /**
  8552. * A `boolean` indicating if the accelerator should be registered with the system
  8553. * or just displayed.
  8554. *
  8555. * This property can be dynamically changed.
  8556. */
  8557. registerAccelerator: boolean;
  8558. /**
  8559. * A `string` (optional) indicating the item's role, if set. Can be `undo`, `redo`,
  8560. * `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`,
  8561. * `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`,
  8562. * `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`,
  8563. * `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
  8564. * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
  8565. * `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`,
  8566. * `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`,
  8567. * `moveTabToNewWindow` or `windowMenu`
  8568. */
  8569. role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'toggleSpellChecker' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'shareMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'showAllTabs' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  8570. /**
  8571. * A `SharingItem` indicating the item to share when the `role` is `shareMenu`.
  8572. *
  8573. * This property can be dynamically changed.
  8574. *
  8575. * @platform darwin
  8576. */
  8577. sharingItem: SharingItem;
  8578. /**
  8579. * A `string` indicating the item's sublabel.
  8580. */
  8581. sublabel: string;
  8582. /**
  8583. * A `Menu` (optional) containing the menu item's submenu, if present.
  8584. */
  8585. submenu?: Menu;
  8586. /**
  8587. * A `string` indicating the item's hover text.
  8588. *
  8589. * @platform darwin
  8590. */
  8591. toolTip: string;
  8592. /**
  8593. * A `string` indicating the type of the item. Can be `normal`, `separator`,
  8594. * `submenu`, `checkbox` or `radio`.
  8595. */
  8596. type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  8597. /**
  8598. * An `Accelerator | null` indicating the item's user-assigned accelerator for the
  8599. * menu item.
  8600. *
  8601. * **Note:** This property is only initialized after the `MenuItem` has been added
  8602. * to a `Menu`. Either via `Menu.buildFromTemplate` or via
  8603. * `Menu.append()/insert()`. Accessing before initialization will just return
  8604. * `null`.
  8605. *
  8606. * @platform darwin
  8607. */
  8608. readonly userAccelerator: (Accelerator) | (null);
  8609. /**
  8610. * A `boolean` indicating whether the item is visible, this property can be
  8611. * dynamically changed.
  8612. */
  8613. visible: boolean;
  8614. }
  8615. class MessageChannelMain extends NodeEventEmitter {
  8616. // Docs: https://electronjs.org/docs/api/message-channel-main
  8617. /**
  8618. * A `MessagePortMain` property.
  8619. */
  8620. port1: MessagePortMain;
  8621. /**
  8622. * A `MessagePortMain` property.
  8623. */
  8624. port2: MessagePortMain;
  8625. }
  8626. class MessagePortMain extends NodeEventEmitter {
  8627. // Docs: https://electronjs.org/docs/api/message-port-main
  8628. /**
  8629. * Emitted when the remote end of a MessagePortMain object becomes disconnected.
  8630. */
  8631. on(event: 'close', listener: Function): this;
  8632. off(event: 'close', listener: Function): this;
  8633. once(event: 'close', listener: Function): this;
  8634. addListener(event: 'close', listener: Function): this;
  8635. removeListener(event: 'close', listener: Function): this;
  8636. /**
  8637. * Emitted when a MessagePortMain object receives a message.
  8638. */
  8639. on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  8640. off(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  8641. once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  8642. addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  8643. removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  8644. /**
  8645. * Disconnects the port, so it is no longer active.
  8646. */
  8647. close(): void;
  8648. /**
  8649. * Sends a message from the port, and optionally, transfers ownership of objects to
  8650. * other browsing contexts.
  8651. */
  8652. postMessage(message: any, transfer?: MessagePortMain[]): void;
  8653. /**
  8654. * Starts the sending of messages queued on the port. Messages will be queued until
  8655. * this method is called.
  8656. */
  8657. start(): void;
  8658. }
  8659. interface MimeTypedBuffer {
  8660. // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
  8661. /**
  8662. * Charset of the buffer.
  8663. */
  8664. charset?: string;
  8665. /**
  8666. * The actual Buffer content.
  8667. */
  8668. data: Buffer;
  8669. /**
  8670. * MIME type of the buffer.
  8671. */
  8672. mimeType?: string;
  8673. }
  8674. interface MouseInputEvent extends InputEvent {
  8675. // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
  8676. /**
  8677. * The button pressed, can be `left`, `middle`, `right`.
  8678. */
  8679. button?: ('left' | 'middle' | 'right');
  8680. clickCount?: number;
  8681. globalX?: number;
  8682. globalY?: number;
  8683. movementX?: number;
  8684. movementY?: number;
  8685. /**
  8686. * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
  8687. * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
  8688. */
  8689. type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
  8690. x: number;
  8691. y: number;
  8692. }
  8693. interface MouseWheelInputEvent extends MouseInputEvent {
  8694. // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
  8695. accelerationRatioX?: number;
  8696. accelerationRatioY?: number;
  8697. canScroll?: boolean;
  8698. deltaX?: number;
  8699. deltaY?: number;
  8700. hasPreciseScrollingDeltas?: boolean;
  8701. /**
  8702. * The type of the event, can be `mouseWheel`.
  8703. */
  8704. type: ('mouseWheel');
  8705. wheelTicksX?: number;
  8706. wheelTicksY?: number;
  8707. }
  8708. class NativeImage {
  8709. // Docs: https://electronjs.org/docs/api/native-image
  8710. /**
  8711. * Creates an empty `NativeImage` instance.
  8712. */
  8713. static createEmpty(): NativeImage;
  8714. /**
  8715. * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
  8716. * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
  8717. */
  8718. static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
  8719. /**
  8720. * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
  8721. * JPEG first.
  8722. */
  8723. static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
  8724. /**
  8725. * Creates a new `NativeImage` instance from `dataUrl`, a base 64 encoded Data URL
  8726. * string.
  8727. */
  8728. static createFromDataURL(dataURL: string): NativeImage;
  8729. /**
  8730. * Creates a new `NativeImage` instance from the `NSImage` that maps to the given
  8731. * image name. See Apple's `NSImageName` documentation for a list of possible
  8732. * values.
  8733. *
  8734. * The `hslShift` is applied to the image with the following rules:
  8735. *
  8736. * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
  8737. * and 360 on the hue color wheel (red).
  8738. * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
  8739. * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
  8740. * saturate the image.
  8741. * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
  8742. * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
  8743. * leave unchanged. 1 = full lightness (make all pixels white).
  8744. *
  8745. * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
  8746. * 0]` will make the image completely black.
  8747. *
  8748. * In some cases, the `NSImageName` doesn't match its string representation; one
  8749. * example of this is `NSFolderImageName`, whose string representation would
  8750. * actually be `NSFolder`. Therefore, you'll need to determine the correct string
  8751. * representation for your image before passing it in. This can be done with the
  8752. * following:
  8753. *
  8754. * where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
  8755. *
  8756. * @platform darwin
  8757. */
  8758. static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
  8759. /**
  8760. * Creates a new `NativeImage` instance from a file located at `path`. This method
  8761. * returns an empty image if the `path` does not exist, cannot be read, or is not a
  8762. * valid image.
  8763. */
  8764. static createFromPath(path: string): NativeImage;
  8765. /**
  8766. * fulfilled with the file's thumbnail preview image, which is a NativeImage.
  8767. *
  8768. * Note: The Windows implementation will ignore `size.height` and scale the height
  8769. * according to `size.width`.
  8770. *
  8771. * @platform darwin,win32
  8772. */
  8773. static createThumbnailFromPath(path: string, size: Size): Promise<Electron.NativeImage>;
  8774. /**
  8775. * Add an image representation for a specific scale factor. This can be used to
  8776. * programmatically add different scale factor representations to an image. This
  8777. * can be called on empty images.
  8778. */
  8779. addRepresentation(options: AddRepresentationOptions): void;
  8780. /**
  8781. * The cropped image.
  8782. */
  8783. crop(rect: Rectangle): NativeImage;
  8784. /**
  8785. * The image's aspect ratio (width divided by height).
  8786. *
  8787. * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
  8788. * the image representation most closely matching the passed value.
  8789. */
  8790. getAspectRatio(scaleFactor?: number): number;
  8791. /**
  8792. * A Buffer that contains the image's raw bitmap pixel data.
  8793. *
  8794. * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
  8795. * not copy the bitmap data, so you have to use the returned Buffer immediately in
  8796. * current event loop tick; otherwise the data might be changed or destroyed.
  8797. */
  8798. getBitmap(options?: BitmapOptions): Buffer;
  8799. /**
  8800. * A Buffer that stores C pointer to underlying native handle of the image. On
  8801. * macOS, a pointer to `NSImage` instance is returned.
  8802. *
  8803. * Notice that the returned pointer is a weak pointer to the underlying native
  8804. * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
  8805. * instance is kept around.
  8806. *
  8807. * @platform darwin
  8808. */
  8809. getNativeHandle(): Buffer;
  8810. /**
  8811. * An array of all scale factors corresponding to representations for a given
  8812. * `NativeImage`.
  8813. */
  8814. getScaleFactors(): number[];
  8815. /**
  8816. * If `scaleFactor` is passed, this will return the size corresponding to the image
  8817. * representation most closely matching the passed value.
  8818. */
  8819. getSize(scaleFactor?: number): Size;
  8820. /**
  8821. * Whether the image is empty.
  8822. */
  8823. isEmpty(): boolean;
  8824. /**
  8825. * Whether the image is a macOS template image.
  8826. */
  8827. isTemplateImage(): boolean;
  8828. /**
  8829. * The resized image.
  8830. *
  8831. * If only the `height` or the `width` are specified then the current aspect ratio
  8832. * will be preserved in the resized image.
  8833. */
  8834. resize(options: ResizeOptions): NativeImage;
  8835. /**
  8836. * Marks the image as a macOS template image.
  8837. */
  8838. setTemplateImage(option: boolean): void;
  8839. /**
  8840. * A Buffer that contains a copy of the image's raw bitmap pixel data.
  8841. */
  8842. toBitmap(options?: ToBitmapOptions): Buffer;
  8843. /**
  8844. * The Data URL of the image.
  8845. */
  8846. toDataURL(options?: ToDataURLOptions): string;
  8847. /**
  8848. * A Buffer that contains the image's `JPEG` encoded data.
  8849. */
  8850. toJPEG(quality: number): Buffer;
  8851. /**
  8852. * A Buffer that contains the image's `PNG` encoded data.
  8853. */
  8854. toPNG(options?: ToPNGOptions): Buffer;
  8855. /**
  8856. * A `boolean` property that determines whether the image is considered a template
  8857. * image.
  8858. *
  8859. * Please note that this property only has an effect on macOS.
  8860. *
  8861. * @platform darwin
  8862. */
  8863. isMacTemplateImage: boolean;
  8864. }
  8865. interface NativeTheme extends NodeJS.EventEmitter {
  8866. // Docs: https://electronjs.org/docs/api/native-theme
  8867. /**
  8868. * Emitted when something in the underlying NativeTheme has changed. This normally
  8869. * means that either the value of `shouldUseDarkColors`,
  8870. * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
  8871. * will have to check them to determine which one has changed.
  8872. */
  8873. on(event: 'updated', listener: Function): this;
  8874. off(event: 'updated', listener: Function): this;
  8875. once(event: 'updated', listener: Function): this;
  8876. addListener(event: 'updated', listener: Function): this;
  8877. removeListener(event: 'updated', listener: Function): this;
  8878. /**
  8879. * A `boolean` indicating whether Chromium is in forced colors mode, controlled by
  8880. * system accessibility settings. Currently, Windows high contrast is the only
  8881. * system setting that triggers forced colors mode.
  8882. *
  8883. * @platform win32
  8884. */
  8885. readonly inForcedColorsMode: boolean;
  8886. /**
  8887. * A `boolean` for if the OS / Chromium currently has a dark mode enabled or is
  8888. * being instructed to show a dark-style UI. If you want to modify this value you
  8889. * should use `themeSource` below.
  8890. *
  8891. */
  8892. readonly shouldUseDarkColors: boolean;
  8893. /**
  8894. * A `boolean` for if the OS / Chromium currently has high-contrast mode enabled or
  8895. * is being instructed to show a high-contrast UI.
  8896. *
  8897. * @platform darwin,win32
  8898. */
  8899. readonly shouldUseHighContrastColors: boolean;
  8900. /**
  8901. * A `boolean` for if the OS / Chromium currently has an inverted color scheme or
  8902. * is being instructed to use an inverted color scheme.
  8903. *
  8904. * @platform darwin,win32
  8905. */
  8906. readonly shouldUseInvertedColorScheme: boolean;
  8907. /**
  8908. * A `string` property that can be `system`, `light` or `dark`. It is used to
  8909. * override and supersede the value that Chromium has chosen to use internally.
  8910. *
  8911. * Setting this property to `system` will remove the override and everything will
  8912. * be reset to the OS default. By default `themeSource` is `system`.
  8913. *
  8914. * Settings this property to `dark` will have the following effects:
  8915. *
  8916. * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
  8917. * * Any UI Electron renders on Linux and Windows including context menus,
  8918. * devtools, etc. will use the dark UI.
  8919. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  8920. * the dark UI.
  8921. * * The `prefers-color-scheme` CSS query will match `dark` mode.
  8922. * * The `updated` event will be emitted
  8923. *
  8924. * Settings this property to `light` will have the following effects:
  8925. *
  8926. * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
  8927. * * Any UI Electron renders on Linux and Windows including context menus,
  8928. * devtools, etc. will use the light UI.
  8929. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  8930. * the light UI.
  8931. * * The `prefers-color-scheme` CSS query will match `light` mode.
  8932. * * The `updated` event will be emitted
  8933. *
  8934. * The usage of this property should align with a classic "dark mode" state machine
  8935. * in your application where the user has three options.
  8936. *
  8937. * * `Follow OS` --> `themeSource = 'system'`
  8938. * * `Dark Mode` --> `themeSource = 'dark'`
  8939. * * `Light Mode` --> `themeSource = 'light'`
  8940. *
  8941. * Your application should then always use `shouldUseDarkColors` to determine what
  8942. * CSS to apply.
  8943. */
  8944. themeSource: ('system' | 'light' | 'dark');
  8945. }
  8946. class NavigationHistory extends NodeEventEmitter {
  8947. // Docs: https://electronjs.org/docs/api/navigation-history
  8948. /**
  8949. * The index of the current page, from which we would go back/forward or reload.
  8950. */
  8951. getActiveIndex(): number;
  8952. /**
  8953. * * `url` string - The URL of the navigation entry at the given index.
  8954. * * `title` string - The page title of the navigation entry at the given index.
  8955. *
  8956. * If index is out of bounds (greater than history length or less than 0), null
  8957. * will be returned.
  8958. */
  8959. getEntryAtIndex(index: number): EntryAtIndex;
  8960. /**
  8961. * History length.
  8962. */
  8963. length(): number;
  8964. }
  8965. interface Net {
  8966. // Docs: https://electronjs.org/docs/api/net
  8967. /**
  8968. * see Response.
  8969. *
  8970. * Sends a request, similarly to how `fetch()` works in the renderer, using
  8971. * Chrome's network stack. This differs from Node's `fetch()`, which uses Node.js's
  8972. * HTTP stack.
  8973. *
  8974. * Example:
  8975. *
  8976. * This method will issue requests from the default session. To send a `fetch`
  8977. * request from another session, use ses.fetch().
  8978. *
  8979. * See the MDN documentation for `fetch()` for more details.
  8980. *
  8981. * Limitations:
  8982. *
  8983. * * `net.fetch()` does not support the `data:` or `blob:` schemes.
  8984. * * The value of the `integrity` option is ignored.
  8985. * * The `.type` and `.url` values of the returned `Response` object are incorrect.
  8986. *
  8987. * By default, requests made with `net.fetch` can be made to custom protocols as
  8988. * well as `file:`, and will trigger webRequest handlers if present. When the
  8989. * non-standard `bypassCustomProtocolHandlers` option is set in RequestInit, custom
  8990. * protocol handlers will not be called for this request. This allows forwarding an
  8991. * intercepted request to the built-in handler. webRequest handlers will still be
  8992. * triggered when bypassing custom protocols.
  8993. *
  8994. * Note: in the utility process custom protocols are not supported.
  8995. */
  8996. fetch(input: (string) | (GlobalRequest), init?: RequestInit & { bypassCustomProtocolHandlers?: boolean }): Promise<GlobalResponse>;
  8997. /**
  8998. * Whether there is currently internet connection.
  8999. *
  9000. * A return value of `false` is a pretty strong indicator that the user won't be
  9001. * able to connect to remote sites. However, a return value of `true` is
  9002. * inconclusive; even if some link is up, it is uncertain whether a particular
  9003. * connection attempt to a particular remote site will be successful.
  9004. */
  9005. isOnline(): boolean;
  9006. /**
  9007. * Creates a `ClientRequest` instance using the provided `options` which are
  9008. * directly forwarded to the `ClientRequest` constructor. The `net.request` method
  9009. * would be used to issue both secure and insecure HTTP requests according to the
  9010. * specified protocol scheme in the `options` object.
  9011. */
  9012. request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
  9013. /**
  9014. * Resolves with the resolved IP addresses for the `host`.
  9015. *
  9016. * This method will resolve hosts from the default session. To resolve a host from
  9017. * another session, use ses.resolveHost().
  9018. */
  9019. resolveHost(host: string, options?: ResolveHostOptions): Promise<Electron.ResolvedHost>;
  9020. /**
  9021. * A `boolean` property. Whether there is currently internet connection.
  9022. *
  9023. * A return value of `false` is a pretty strong indicator that the user won't be
  9024. * able to connect to remote sites. However, a return value of `true` is
  9025. * inconclusive; even if some link is up, it is uncertain whether a particular
  9026. * connection attempt to a particular remote site will be successful.
  9027. *
  9028. */
  9029. readonly online: boolean;
  9030. }
  9031. interface NetLog {
  9032. // Docs: https://electronjs.org/docs/api/net-log
  9033. /**
  9034. * resolves when the net log has begun recording.
  9035. *
  9036. * Starts recording network events to `path`.
  9037. */
  9038. startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
  9039. /**
  9040. * resolves when the net log has been flushed to disk.
  9041. *
  9042. * Stops recording network events. If not called, net logging will automatically
  9043. * end when app quits.
  9044. */
  9045. stopLogging(): Promise<void>;
  9046. /**
  9047. * A `boolean` property that indicates whether network logs are currently being
  9048. * recorded.
  9049. *
  9050. */
  9051. readonly currentlyLogging: boolean;
  9052. }
  9053. class Notification extends NodeEventEmitter {
  9054. // Docs: https://electronjs.org/docs/api/notification
  9055. /**
  9056. * @platform darwin
  9057. */
  9058. on(event: 'action', listener: (event: Event,
  9059. /**
  9060. * The index of the action that was activated.
  9061. */
  9062. index: number) => void): this;
  9063. /**
  9064. * @platform darwin
  9065. */
  9066. off(event: 'action', listener: (event: Event,
  9067. /**
  9068. * The index of the action that was activated.
  9069. */
  9070. index: number) => void): this;
  9071. /**
  9072. * @platform darwin
  9073. */
  9074. once(event: 'action', listener: (event: Event,
  9075. /**
  9076. * The index of the action that was activated.
  9077. */
  9078. index: number) => void): this;
  9079. /**
  9080. * @platform darwin
  9081. */
  9082. addListener(event: 'action', listener: (event: Event,
  9083. /**
  9084. * The index of the action that was activated.
  9085. */
  9086. index: number) => void): this;
  9087. /**
  9088. * @platform darwin
  9089. */
  9090. removeListener(event: 'action', listener: (event: Event,
  9091. /**
  9092. * The index of the action that was activated.
  9093. */
  9094. index: number) => void): this;
  9095. /**
  9096. * Emitted when the notification is clicked by the user.
  9097. */
  9098. on(event: 'click', listener: (event: Event) => void): this;
  9099. off(event: 'click', listener: (event: Event) => void): this;
  9100. once(event: 'click', listener: (event: Event) => void): this;
  9101. addListener(event: 'click', listener: (event: Event) => void): this;
  9102. removeListener(event: 'click', listener: (event: Event) => void): this;
  9103. /**
  9104. * Emitted when the notification is closed by manual intervention from the user.
  9105. *
  9106. * This event is not guaranteed to be emitted in all cases where the notification
  9107. * is closed.
  9108. *
  9109. * On Windows, the `close` event can be emitted in one of three ways: programmatic
  9110. * dismissal with `notification.close()`, by the user closing the notification, or
  9111. * via system timeout. If a notification is in the Action Center after the initial
  9112. * `close` event is emitted, a call to `notification.close()` will remove the
  9113. * notification from the action center but the `close` event will not be emitted
  9114. * again.
  9115. */
  9116. on(event: 'close', listener: (event: Event) => void): this;
  9117. off(event: 'close', listener: (event: Event) => void): this;
  9118. once(event: 'close', listener: (event: Event) => void): this;
  9119. addListener(event: 'close', listener: (event: Event) => void): this;
  9120. removeListener(event: 'close', listener: (event: Event) => void): this;
  9121. /**
  9122. * Emitted when an error is encountered while creating and showing the native
  9123. * notification.
  9124. *
  9125. * @platform win32
  9126. */
  9127. on(event: 'failed', listener: (event: Event,
  9128. /**
  9129. * The error encountered during execution of the `show()` method.
  9130. */
  9131. error: string) => void): this;
  9132. /**
  9133. * @platform win32
  9134. */
  9135. off(event: 'failed', listener: (event: Event,
  9136. /**
  9137. * The error encountered during execution of the `show()` method.
  9138. */
  9139. error: string) => void): this;
  9140. /**
  9141. * @platform win32
  9142. */
  9143. once(event: 'failed', listener: (event: Event,
  9144. /**
  9145. * The error encountered during execution of the `show()` method.
  9146. */
  9147. error: string) => void): this;
  9148. /**
  9149. * @platform win32
  9150. */
  9151. addListener(event: 'failed', listener: (event: Event,
  9152. /**
  9153. * The error encountered during execution of the `show()` method.
  9154. */
  9155. error: string) => void): this;
  9156. /**
  9157. * @platform win32
  9158. */
  9159. removeListener(event: 'failed', listener: (event: Event,
  9160. /**
  9161. * The error encountered during execution of the `show()` method.
  9162. */
  9163. error: string) => void): this;
  9164. /**
  9165. * Emitted when the user clicks the "Reply" button on a notification with
  9166. * `hasReply: true`.
  9167. *
  9168. * @platform darwin
  9169. */
  9170. on(event: 'reply', listener: (event: Event,
  9171. /**
  9172. * The string the user entered into the inline reply field.
  9173. */
  9174. reply: string) => void): this;
  9175. /**
  9176. * @platform darwin
  9177. */
  9178. off(event: 'reply', listener: (event: Event,
  9179. /**
  9180. * The string the user entered into the inline reply field.
  9181. */
  9182. reply: string) => void): this;
  9183. /**
  9184. * @platform darwin
  9185. */
  9186. once(event: 'reply', listener: (event: Event,
  9187. /**
  9188. * The string the user entered into the inline reply field.
  9189. */
  9190. reply: string) => void): this;
  9191. /**
  9192. * @platform darwin
  9193. */
  9194. addListener(event: 'reply', listener: (event: Event,
  9195. /**
  9196. * The string the user entered into the inline reply field.
  9197. */
  9198. reply: string) => void): this;
  9199. /**
  9200. * @platform darwin
  9201. */
  9202. removeListener(event: 'reply', listener: (event: Event,
  9203. /**
  9204. * The string the user entered into the inline reply field.
  9205. */
  9206. reply: string) => void): this;
  9207. /**
  9208. * Emitted when the notification is shown to the user. Note that this event can be
  9209. * fired multiple times as a notification can be shown multiple times through the
  9210. * `show()` method.
  9211. */
  9212. on(event: 'show', listener: (event: Event) => void): this;
  9213. off(event: 'show', listener: (event: Event) => void): this;
  9214. once(event: 'show', listener: (event: Event) => void): this;
  9215. addListener(event: 'show', listener: (event: Event) => void): this;
  9216. removeListener(event: 'show', listener: (event: Event) => void): this;
  9217. /**
  9218. * Notification
  9219. */
  9220. constructor(options?: NotificationConstructorOptions);
  9221. /**
  9222. * Whether or not desktop notifications are supported on the current system
  9223. */
  9224. static isSupported(): boolean;
  9225. /**
  9226. * Dismisses the notification.
  9227. *
  9228. * On Windows, calling `notification.close()` while the notification is visible on
  9229. * screen will dismiss the notification and remove it from the Action Center. If
  9230. * `notification.close()` is called after the notification is no longer visible on
  9231. * screen, calling `notification.close()` will try remove it from the Action
  9232. * Center.
  9233. */
  9234. close(): void;
  9235. /**
  9236. * Immediately shows the notification to the user. Unlike the web notification API,
  9237. * instantiating a `new Notification()` does not immediately show it to the user.
  9238. * Instead, you need to call this method before the OS will display it.
  9239. *
  9240. * If the notification has been shown before, this method will dismiss the
  9241. * previously shown notification and create a new one with identical properties.
  9242. */
  9243. show(): void;
  9244. /**
  9245. * A `NotificationAction[]` property representing the actions of the notification.
  9246. */
  9247. actions: NotificationAction[];
  9248. /**
  9249. * A `string` property representing the body of the notification.
  9250. */
  9251. body: string;
  9252. /**
  9253. * A `string` property representing the close button text of the notification.
  9254. */
  9255. closeButtonText: string;
  9256. /**
  9257. * A `boolean` property representing whether the notification has a reply action.
  9258. */
  9259. hasReply: boolean;
  9260. /**
  9261. * A `string` property representing the reply placeholder of the notification.
  9262. */
  9263. replyPlaceholder: string;
  9264. /**
  9265. * A `boolean` property representing whether the notification is silent.
  9266. */
  9267. silent: boolean;
  9268. /**
  9269. * A `string` property representing the sound of the notification.
  9270. */
  9271. sound: string;
  9272. /**
  9273. * A `string` property representing the subtitle of the notification.
  9274. */
  9275. subtitle: string;
  9276. /**
  9277. * A `string` property representing the type of timeout duration for the
  9278. * notification. Can be 'default' or 'never'.
  9279. *
  9280. * If `timeoutType` is set to 'never', the notification never expires. It stays
  9281. * open until closed by the calling API or the user.
  9282. *
  9283. * @platform linux,win32
  9284. */
  9285. timeoutType: ('default' | 'never');
  9286. /**
  9287. * A `string` property representing the title of the notification.
  9288. */
  9289. title: string;
  9290. /**
  9291. * A `string` property representing the custom Toast XML of the notification.
  9292. *
  9293. * @platform win32
  9294. */
  9295. toastXml: string;
  9296. /**
  9297. * A `string` property representing the urgency level of the notification. Can be
  9298. * 'normal', 'critical', or 'low'.
  9299. *
  9300. * Default is 'low' - see NotifyUrgency for more information.
  9301. *
  9302. * @platform linux
  9303. */
  9304. urgency: ('normal' | 'critical' | 'low');
  9305. }
  9306. interface NotificationAction {
  9307. // Docs: https://electronjs.org/docs/api/structures/notification-action
  9308. /**
  9309. * The label for the given action.
  9310. */
  9311. text?: string;
  9312. /**
  9313. * The type of action, can be `button`.
  9314. */
  9315. type: ('button');
  9316. }
  9317. interface NotificationResponse {
  9318. // Docs: https://electronjs.org/docs/api/structures/notification-response
  9319. /**
  9320. * The identifier string of the action that the user selected.
  9321. */
  9322. actionIdentifier: string;
  9323. /**
  9324. * The delivery date of the notification.
  9325. */
  9326. date: number;
  9327. /**
  9328. * The unique identifier for this notification request.
  9329. */
  9330. identifier: string;
  9331. /**
  9332. * A dictionary of custom information associated with the notification.
  9333. */
  9334. userInfo: Record<string, any>;
  9335. /**
  9336. * The text entered or chosen by the user.
  9337. */
  9338. userText?: string;
  9339. }
  9340. interface OpenExternalPermissionRequest extends PermissionRequest {
  9341. // Docs: https://electronjs.org/docs/api/structures/open-external-permission-request
  9342. /**
  9343. * The url of the `openExternal` request.
  9344. */
  9345. externalURL?: string;
  9346. }
  9347. interface ParentPort extends NodeJS.EventEmitter {
  9348. // Docs: https://electronjs.org/docs/api/parent-port
  9349. /**
  9350. * Emitted when the process receives a message. Messages received on this port will
  9351. * be queued up until a handler is registered for this event.
  9352. */
  9353. on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  9354. off(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  9355. once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  9356. addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  9357. removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  9358. /**
  9359. * Sends a message from the process to its parent.
  9360. */
  9361. postMessage(message: any): void;
  9362. }
  9363. interface PaymentDiscount {
  9364. // Docs: https://electronjs.org/docs/api/structures/payment-discount
  9365. /**
  9366. * A string used to uniquely identify a discount offer for a product.
  9367. */
  9368. identifier: string;
  9369. /**
  9370. * A string that identifies the key used to generate the signature.
  9371. */
  9372. keyIdentifier: string;
  9373. /**
  9374. * A universally unique ID (UUID) value that you define.
  9375. */
  9376. nonce: string;
  9377. /**
  9378. * A UTF-8 string representing the properties of a specific discount offer,
  9379. * cryptographically signed.
  9380. */
  9381. signature: string;
  9382. /**
  9383. * The date and time of the signature's creation in milliseconds, formatted in Unix
  9384. * epoch time.
  9385. */
  9386. timestamp: number;
  9387. }
  9388. interface PermissionRequest {
  9389. // Docs: https://electronjs.org/docs/api/structures/permission-request
  9390. /**
  9391. * Whether the frame making the request is the main frame.
  9392. */
  9393. isMainFrame: boolean;
  9394. /**
  9395. * The last URL the requesting frame loaded.
  9396. */
  9397. requestingUrl: string;
  9398. }
  9399. interface Point {
  9400. // Docs: https://electronjs.org/docs/api/structures/point
  9401. x: number;
  9402. y: number;
  9403. }
  9404. interface PostBody {
  9405. // Docs: https://electronjs.org/docs/api/structures/post-body
  9406. /**
  9407. * The boundary used to separate multiple parts of the message. Only valid when
  9408. * `contentType` is `multipart/form-data`.
  9409. */
  9410. boundary?: string;
  9411. /**
  9412. * The `content-type` header used for the data. One of
  9413. * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
  9414. * `enctype` attribute of the submitted HTML form.
  9415. */
  9416. contentType: string;
  9417. /**
  9418. * The post data to be sent to the new window.
  9419. */
  9420. data: Array<(UploadRawData) | (UploadFile)>;
  9421. }
  9422. interface PowerMonitor extends NodeJS.EventEmitter {
  9423. // Docs: https://electronjs.org/docs/api/power-monitor
  9424. /**
  9425. * Emitted when the system is about to lock the screen.
  9426. *
  9427. * @platform darwin,win32
  9428. */
  9429. on(event: 'lock-screen', listener: Function): this;
  9430. /**
  9431. * @platform darwin,win32
  9432. */
  9433. off(event: 'lock-screen', listener: Function): this;
  9434. /**
  9435. * @platform darwin,win32
  9436. */
  9437. once(event: 'lock-screen', listener: Function): this;
  9438. /**
  9439. * @platform darwin,win32
  9440. */
  9441. addListener(event: 'lock-screen', listener: Function): this;
  9442. /**
  9443. * @platform darwin,win32
  9444. */
  9445. removeListener(event: 'lock-screen', listener: Function): this;
  9446. /**
  9447. * Emitted when the system changes to AC power.
  9448. *
  9449. * @platform darwin,win32
  9450. */
  9451. on(event: 'on-ac', listener: Function): this;
  9452. /**
  9453. * @platform darwin,win32
  9454. */
  9455. off(event: 'on-ac', listener: Function): this;
  9456. /**
  9457. * @platform darwin,win32
  9458. */
  9459. once(event: 'on-ac', listener: Function): this;
  9460. /**
  9461. * @platform darwin,win32
  9462. */
  9463. addListener(event: 'on-ac', listener: Function): this;
  9464. /**
  9465. * @platform darwin,win32
  9466. */
  9467. removeListener(event: 'on-ac', listener: Function): this;
  9468. /**
  9469. * Emitted when system changes to battery power.
  9470. *
  9471. * @platform darwin
  9472. */
  9473. on(event: 'on-battery', listener: Function): this;
  9474. /**
  9475. * @platform darwin
  9476. */
  9477. off(event: 'on-battery', listener: Function): this;
  9478. /**
  9479. * @platform darwin
  9480. */
  9481. once(event: 'on-battery', listener: Function): this;
  9482. /**
  9483. * @platform darwin
  9484. */
  9485. addListener(event: 'on-battery', listener: Function): this;
  9486. /**
  9487. * @platform darwin
  9488. */
  9489. removeListener(event: 'on-battery', listener: Function): this;
  9490. /**
  9491. * Emitted when system is resuming.
  9492. */
  9493. on(event: 'resume', listener: Function): this;
  9494. off(event: 'resume', listener: Function): this;
  9495. once(event: 'resume', listener: Function): this;
  9496. addListener(event: 'resume', listener: Function): this;
  9497. removeListener(event: 'resume', listener: Function): this;
  9498. /**
  9499. * Emitted when the system is about to reboot or shut down. If the event handler
  9500. * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
  9501. * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
  9502. * should exit as soon as possible by calling something like `app.quit()`.
  9503. *
  9504. * @platform linux,darwin
  9505. */
  9506. on(event: 'shutdown', listener: Function): this;
  9507. /**
  9508. * @platform linux,darwin
  9509. */
  9510. off(event: 'shutdown', listener: Function): this;
  9511. /**
  9512. * @platform linux,darwin
  9513. */
  9514. once(event: 'shutdown', listener: Function): this;
  9515. /**
  9516. * @platform linux,darwin
  9517. */
  9518. addListener(event: 'shutdown', listener: Function): this;
  9519. /**
  9520. * @platform linux,darwin
  9521. */
  9522. removeListener(event: 'shutdown', listener: Function): this;
  9523. /**
  9524. * Notification of a change in the operating system's advertised speed limit for
  9525. * CPUs, in percent. Values below 100 indicate that the system is impairing
  9526. * processing power due to thermal management.
  9527. *
  9528. * @platform darwin,win32
  9529. */
  9530. on(event: 'speed-limit-change', listener: Function): this;
  9531. /**
  9532. * @platform darwin,win32
  9533. */
  9534. off(event: 'speed-limit-change', listener: Function): this;
  9535. /**
  9536. * @platform darwin,win32
  9537. */
  9538. once(event: 'speed-limit-change', listener: Function): this;
  9539. /**
  9540. * @platform darwin,win32
  9541. */
  9542. addListener(event: 'speed-limit-change', listener: Function): this;
  9543. /**
  9544. * @platform darwin,win32
  9545. */
  9546. removeListener(event: 'speed-limit-change', listener: Function): this;
  9547. /**
  9548. * Emitted when the system is suspending.
  9549. */
  9550. on(event: 'suspend', listener: Function): this;
  9551. off(event: 'suspend', listener: Function): this;
  9552. once(event: 'suspend', listener: Function): this;
  9553. addListener(event: 'suspend', listener: Function): this;
  9554. removeListener(event: 'suspend', listener: Function): this;
  9555. /**
  9556. * Emitted when the thermal state of the system changes. Notification of a change
  9557. * in the thermal status of the system, such as entering a critical temperature
  9558. * range. Depending on the severity, the system might take steps to reduce said
  9559. * temperature, for example, throttling the CPU or switching on the fans if
  9560. * available.
  9561. *
  9562. * Apps may react to the new state by reducing expensive computing tasks (e.g.
  9563. * video encoding), or notifying the user. The same state might be received
  9564. * repeatedly.
  9565. *
  9566. * See
  9567. * https://developer.apple.com/library/archive/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/RespondToThermalStateChanges.html
  9568. *
  9569. * @platform darwin
  9570. */
  9571. on(event: 'thermal-state-change', listener: Function): this;
  9572. /**
  9573. * @platform darwin
  9574. */
  9575. off(event: 'thermal-state-change', listener: Function): this;
  9576. /**
  9577. * @platform darwin
  9578. */
  9579. once(event: 'thermal-state-change', listener: Function): this;
  9580. /**
  9581. * @platform darwin
  9582. */
  9583. addListener(event: 'thermal-state-change', listener: Function): this;
  9584. /**
  9585. * @platform darwin
  9586. */
  9587. removeListener(event: 'thermal-state-change', listener: Function): this;
  9588. /**
  9589. * Emitted as soon as the systems screen is unlocked.
  9590. *
  9591. * @platform darwin,win32
  9592. */
  9593. on(event: 'unlock-screen', listener: Function): this;
  9594. /**
  9595. * @platform darwin,win32
  9596. */
  9597. off(event: 'unlock-screen', listener: Function): this;
  9598. /**
  9599. * @platform darwin,win32
  9600. */
  9601. once(event: 'unlock-screen', listener: Function): this;
  9602. /**
  9603. * @platform darwin,win32
  9604. */
  9605. addListener(event: 'unlock-screen', listener: Function): this;
  9606. /**
  9607. * @platform darwin,win32
  9608. */
  9609. removeListener(event: 'unlock-screen', listener: Function): this;
  9610. /**
  9611. * Emitted when a login session is activated. See documentation for more
  9612. * information.
  9613. *
  9614. * @platform darwin
  9615. */
  9616. on(event: 'user-did-become-active', listener: Function): this;
  9617. /**
  9618. * @platform darwin
  9619. */
  9620. off(event: 'user-did-become-active', listener: Function): this;
  9621. /**
  9622. * @platform darwin
  9623. */
  9624. once(event: 'user-did-become-active', listener: Function): this;
  9625. /**
  9626. * @platform darwin
  9627. */
  9628. addListener(event: 'user-did-become-active', listener: Function): this;
  9629. /**
  9630. * @platform darwin
  9631. */
  9632. removeListener(event: 'user-did-become-active', listener: Function): this;
  9633. /**
  9634. * Emitted when a login session is deactivated. See documentation for more
  9635. * information.
  9636. *
  9637. * @platform darwin
  9638. */
  9639. on(event: 'user-did-resign-active', listener: Function): this;
  9640. /**
  9641. * @platform darwin
  9642. */
  9643. off(event: 'user-did-resign-active', listener: Function): this;
  9644. /**
  9645. * @platform darwin
  9646. */
  9647. once(event: 'user-did-resign-active', listener: Function): this;
  9648. /**
  9649. * @platform darwin
  9650. */
  9651. addListener(event: 'user-did-resign-active', listener: Function): this;
  9652. /**
  9653. * @platform darwin
  9654. */
  9655. removeListener(event: 'user-did-resign-active', listener: Function): this;
  9656. /**
  9657. * The system's current thermal state. Can be `unknown`, `nominal`, `fair`,
  9658. * `serious`, or `critical`.
  9659. *
  9660. * @platform darwin
  9661. */
  9662. getCurrentThermalState(): ('unknown' | 'nominal' | 'fair' | 'serious' | 'critical');
  9663. /**
  9664. * The system's current idle state. Can be `active`, `idle`, `locked` or `unknown`.
  9665. *
  9666. * Calculate the system idle state. `idleThreshold` is the amount of time (in
  9667. * seconds) before considered idle. `locked` is available on supported systems
  9668. * only.
  9669. */
  9670. getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
  9671. /**
  9672. * Idle time in seconds
  9673. *
  9674. * Calculate system idle time in seconds.
  9675. */
  9676. getSystemIdleTime(): number;
  9677. /**
  9678. * Whether the system is on battery power.
  9679. *
  9680. * To monitor for changes in this property, use the `on-battery` and `on-ac`
  9681. * events.
  9682. */
  9683. isOnBatteryPower(): boolean;
  9684. /**
  9685. * A `boolean` property. True if the system is on battery power.
  9686. *
  9687. * See `powerMonitor.isOnBatteryPower()`.
  9688. */
  9689. onBatteryPower: boolean;
  9690. }
  9691. interface PowerSaveBlocker {
  9692. // Docs: https://electronjs.org/docs/api/power-save-blocker
  9693. /**
  9694. * Whether the corresponding `powerSaveBlocker` has started.
  9695. */
  9696. isStarted(id: number): boolean;
  9697. /**
  9698. * The blocker ID that is assigned to this power blocker.
  9699. *
  9700. * Starts preventing the system from entering lower-power mode. Returns an integer
  9701. * identifying the power save blocker.
  9702. *
  9703. * **Note:** `prevent-display-sleep` has higher precedence over
  9704. * `prevent-app-suspension`. Only the highest precedence type takes effect. In
  9705. * other words, `prevent-display-sleep` always takes precedence over
  9706. * `prevent-app-suspension`.
  9707. *
  9708. * For example, an API calling A requests for `prevent-app-suspension`, and another
  9709. * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
  9710. * used until B stops its request. After that, `prevent-app-suspension` is used.
  9711. */
  9712. start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
  9713. /**
  9714. * Stops the specified power save blocker.
  9715. *
  9716. * Whether the specified `powerSaveBlocker` has been stopped.
  9717. */
  9718. stop(id: number): boolean;
  9719. }
  9720. interface PrinterInfo {
  9721. // Docs: https://electronjs.org/docs/api/structures/printer-info
  9722. /**
  9723. * a longer description of the printer's type.
  9724. */
  9725. description: string;
  9726. /**
  9727. * the name of the printer as shown in Print Preview.
  9728. */
  9729. displayName: string;
  9730. /**
  9731. * whether or not a given printer is set as the default printer on the OS.
  9732. */
  9733. isDefault: boolean;
  9734. /**
  9735. * the name of the printer as understood by the OS.
  9736. */
  9737. name: string;
  9738. /**
  9739. * an object containing a variable number of platform-specific printer information.
  9740. */
  9741. options: Options;
  9742. /**
  9743. * the current status of the printer.
  9744. */
  9745. status: number;
  9746. }
  9747. interface ProcessMemoryInfo {
  9748. // Docs: https://electronjs.org/docs/api/structures/process-memory-info
  9749. /**
  9750. * The amount of memory not shared by other processes, such as JS heap or HTML
  9751. * content in Kilobytes.
  9752. */
  9753. private: number;
  9754. /**
  9755. * The amount of memory currently pinned to actual physical RAM in Kilobytes.
  9756. *
  9757. * @platform linux,win32
  9758. */
  9759. residentSet: number;
  9760. /**
  9761. * The amount of memory shared between processes, typically memory consumed by the
  9762. * Electron code itself in Kilobytes.
  9763. */
  9764. shared: number;
  9765. }
  9766. interface ProcessMetric {
  9767. // Docs: https://electronjs.org/docs/api/structures/process-metric
  9768. /**
  9769. * CPU usage of the process.
  9770. */
  9771. cpu: CPUUsage;
  9772. /**
  9773. * Creation time for this process. The time is represented as number of
  9774. * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
  9775. * is useful to use both the `pid` and the `creationTime` to uniquely identify a
  9776. * process.
  9777. */
  9778. creationTime: number;
  9779. /**
  9780. * One of the following values:
  9781. *
  9782. * @platform win32
  9783. */
  9784. integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
  9785. /**
  9786. * Memory information for the process.
  9787. */
  9788. memory: MemoryInfo;
  9789. /**
  9790. * The name of the process. Examples for utility: `Audio Service`, `Content
  9791. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  9792. */
  9793. name?: string;
  9794. /**
  9795. * Process id of the process.
  9796. */
  9797. pid: number;
  9798. /**
  9799. * Whether the process is sandboxed on OS level.
  9800. *
  9801. * @platform darwin,win32
  9802. */
  9803. sandboxed?: boolean;
  9804. /**
  9805. * The non-localized name of the process.
  9806. */
  9807. serviceName?: string;
  9808. /**
  9809. * Process type. One of the following values:
  9810. */
  9811. type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  9812. }
  9813. interface Product {
  9814. // Docs: https://electronjs.org/docs/api/structures/product
  9815. /**
  9816. * 3 character code presenting a product's currency based on the ISO 4217 standard.
  9817. */
  9818. currencyCode: string;
  9819. /**
  9820. * An array of discount offers
  9821. */
  9822. discounts: ProductDiscount[];
  9823. /**
  9824. * The total size of the content, in bytes.
  9825. */
  9826. downloadContentLengths: number[];
  9827. /**
  9828. * A string that identifies the version of the content.
  9829. */
  9830. downloadContentVersion: string;
  9831. /**
  9832. * The locale formatted price of the product.
  9833. */
  9834. formattedPrice: string;
  9835. /**
  9836. * The object containing introductory price information for the product. available
  9837. * for the product.
  9838. */
  9839. introductoryPrice?: ProductDiscount;
  9840. /**
  9841. * A boolean value that indicates whether the App Store has downloadable content
  9842. * for this product. `true` if at least one file has been associated with the
  9843. * product.
  9844. */
  9845. isDownloadable: boolean;
  9846. /**
  9847. * A description of the product.
  9848. */
  9849. localizedDescription: string;
  9850. /**
  9851. * The name of the product.
  9852. */
  9853. localizedTitle: string;
  9854. /**
  9855. * The cost of the product in the local currency.
  9856. */
  9857. price: number;
  9858. /**
  9859. * The string that identifies the product to the Apple App Store.
  9860. */
  9861. productIdentifier: string;
  9862. /**
  9863. * The identifier of the subscription group to which the subscription belongs.
  9864. */
  9865. subscriptionGroupIdentifier: string;
  9866. /**
  9867. * The period details for products that are subscriptions.
  9868. */
  9869. subscriptionPeriod?: ProductSubscriptionPeriod;
  9870. }
  9871. interface ProductDiscount {
  9872. // Docs: https://electronjs.org/docs/api/structures/product-discount
  9873. /**
  9874. * A string used to uniquely identify a discount offer for a product.
  9875. */
  9876. identifier: string;
  9877. /**
  9878. * An integer that indicates the number of periods the product discount is
  9879. * available.
  9880. */
  9881. numberOfPeriods: number;
  9882. /**
  9883. * The payment mode for this product discount. Can be `payAsYouGo`, `payUpFront`,
  9884. * or `freeTrial`.
  9885. */
  9886. paymentMode: ('payAsYouGo' | 'payUpFront' | 'freeTrial');
  9887. /**
  9888. * The discount price of the product in the local currency.
  9889. */
  9890. price: number;
  9891. /**
  9892. * The locale used to format the discount price of the product.
  9893. */
  9894. priceLocale: string;
  9895. /**
  9896. * An object that defines the period for the product discount.
  9897. */
  9898. subscriptionPeriod?: ProductSubscriptionPeriod;
  9899. /**
  9900. * The type of discount offer.
  9901. */
  9902. type: number;
  9903. }
  9904. interface ProductSubscriptionPeriod {
  9905. // Docs: https://electronjs.org/docs/api/structures/product-subscription-period
  9906. /**
  9907. * The number of units per subscription period.
  9908. */
  9909. numberOfUnits: number;
  9910. /**
  9911. * The increment of time that a subscription period is specified in. Can be `day`,
  9912. * `week`, `month`, `year`.
  9913. */
  9914. unit: ('day' | 'week' | 'month' | 'year');
  9915. }
  9916. interface Protocol {
  9917. // Docs: https://electronjs.org/docs/api/protocol
  9918. /**
  9919. * Register a protocol handler for `scheme`. Requests made to URLs with this scheme
  9920. * will delegate to this handler to determine what response should be sent.
  9921. *
  9922. * Either a `Response` or a `Promise<Response>` can be returned.
  9923. *
  9924. * Example:
  9925. *
  9926. * See the MDN docs for `Request` and `Response` for more details.
  9927. */
  9928. handle(scheme: string, handler: (request: GlobalRequest) => (GlobalResponse) | (Promise<GlobalResponse>)): void;
  9929. /**
  9930. * Whether the protocol was successfully intercepted
  9931. *
  9932. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  9933. * which sends a `Buffer` as a response.
  9934. *
  9935. * @deprecated
  9936. */
  9937. interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  9938. /**
  9939. * Whether the protocol was successfully intercepted
  9940. *
  9941. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  9942. * which sends a file as a response.
  9943. *
  9944. * @deprecated
  9945. */
  9946. interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  9947. /**
  9948. * Whether the protocol was successfully intercepted
  9949. *
  9950. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  9951. * which sends a new HTTP request as a response.
  9952. *
  9953. * @deprecated
  9954. */
  9955. interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  9956. /**
  9957. * Whether the protocol was successfully intercepted
  9958. *
  9959. * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
  9960. * protocol handler.
  9961. *
  9962. * @deprecated
  9963. */
  9964. interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  9965. /**
  9966. * Whether the protocol was successfully intercepted
  9967. *
  9968. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  9969. * which sends a `string` as a response.
  9970. *
  9971. * @deprecated
  9972. */
  9973. interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  9974. /**
  9975. * Whether `scheme` is already handled.
  9976. */
  9977. isProtocolHandled(scheme: string): boolean;
  9978. /**
  9979. * Whether `scheme` is already intercepted.
  9980. *
  9981. * @deprecated
  9982. */
  9983. isProtocolIntercepted(scheme: string): boolean;
  9984. /**
  9985. * Whether `scheme` is already registered.
  9986. *
  9987. * @deprecated
  9988. */
  9989. isProtocolRegistered(scheme: string): boolean;
  9990. /**
  9991. * Whether the protocol was successfully registered
  9992. *
  9993. * Registers a protocol of `scheme` that will send a `Buffer` as a response.
  9994. *
  9995. * The usage is the same with `registerFileProtocol`, except that the `callback`
  9996. * should be called with either a `Buffer` object or an object that has the `data`
  9997. * property.
  9998. *
  9999. * Example:
  10000. *
  10001. * @deprecated
  10002. */
  10003. registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  10004. /**
  10005. * Whether the protocol was successfully registered
  10006. *
  10007. * Registers a protocol of `scheme` that will send a file as the response. The
  10008. * `handler` will be called with `request` and `callback` where `request` is an
  10009. * incoming request for the `scheme`.
  10010. *
  10011. * To handle the `request`, the `callback` should be called with either the file's
  10012. * path or an object that has a `path` property, e.g. `callback(filePath)` or
  10013. * `callback({ path: filePath })`. The `filePath` must be an absolute path.
  10014. *
  10015. * By default the `scheme` is treated like `http:`, which is parsed differently
  10016. * from protocols that follow the "generic URI syntax" like `file:`.
  10017. *
  10018. * @deprecated
  10019. */
  10020. registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  10021. /**
  10022. * Whether the protocol was successfully registered
  10023. *
  10024. * Registers a protocol of `scheme` that will send an HTTP request as a response.
  10025. *
  10026. * The usage is the same with `registerFileProtocol`, except that the `callback`
  10027. * should be called with an object that has the `url` property.
  10028. *
  10029. * @deprecated
  10030. */
  10031. registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  10032. /**
  10033. * **Note:** This method can only be used before the `ready` event of the `app`
  10034. * module gets emitted and can be called only once.
  10035. *
  10036. * Registers the `scheme` as standard, secure, bypasses content security policy for
  10037. * resources, allows registering ServiceWorker, supports fetch API, streaming
  10038. * video/audio, and V8 code cache. Specify a privilege with the value of `true` to
  10039. * enable the capability.
  10040. *
  10041. * An example of registering a privileged scheme, that bypasses Content Security
  10042. * Policy:
  10043. *
  10044. * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
  10045. * `http` and `https` are standard schemes, while `file` is not.
  10046. *
  10047. * Registering a scheme as standard allows relative and absolute resources to be
  10048. * resolved correctly when served. Otherwise the scheme will behave like the `file`
  10049. * protocol, but without the ability to resolve relative URLs.
  10050. *
  10051. * For example when you load following page with custom protocol without
  10052. * registering it as standard scheme, the image will not be loaded because
  10053. * non-standard schemes can not recognize relative URLs:
  10054. *
  10055. * Registering a scheme as standard will allow access to files through the
  10056. * FileSystem API. Otherwise the renderer will throw a security error for the
  10057. * scheme.
  10058. *
  10059. * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
  10060. * cookies) are disabled for non standard schemes. So in general if you want to
  10061. * register a custom protocol to replace the `http` protocol, you have to register
  10062. * it as a standard scheme.
  10063. *
  10064. * Protocols that use streams (http and stream protocols) should set `stream:
  10065. * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
  10066. * their responses by default. The `stream` flag configures those elements to
  10067. * correctly expect streaming responses.
  10068. */
  10069. registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
  10070. /**
  10071. * Whether the protocol was successfully registered
  10072. *
  10073. * Registers a protocol of `scheme` that will send a stream as a response.
  10074. *
  10075. * The usage is the same with `registerFileProtocol`, except that the `callback`
  10076. * should be called with either a `ReadableStream` object or an object that has the
  10077. * `data` property.
  10078. *
  10079. * Example:
  10080. *
  10081. * It is possible to pass any object that implements the readable stream API (emits
  10082. * `data`/`end`/`error` events). For example, here's how a file could be returned:
  10083. *
  10084. * @deprecated
  10085. */
  10086. registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  10087. /**
  10088. * Whether the protocol was successfully registered
  10089. *
  10090. * Registers a protocol of `scheme` that will send a `string` as a response.
  10091. *
  10092. * The usage is the same with `registerFileProtocol`, except that the `callback`
  10093. * should be called with either a `string` or an object that has the `data`
  10094. * property.
  10095. *
  10096. * @deprecated
  10097. */
  10098. registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  10099. /**
  10100. * Removes a protocol handler registered with `protocol.handle`.
  10101. */
  10102. unhandle(scheme: string): void;
  10103. /**
  10104. * Whether the protocol was successfully unintercepted
  10105. *
  10106. * Remove the interceptor installed for `scheme` and restore its original handler.
  10107. *
  10108. * @deprecated
  10109. */
  10110. uninterceptProtocol(scheme: string): boolean;
  10111. /**
  10112. * Whether the protocol was successfully unregistered
  10113. *
  10114. * Unregisters the custom protocol of `scheme`.
  10115. *
  10116. * @deprecated
  10117. */
  10118. unregisterProtocol(scheme: string): boolean;
  10119. }
  10120. interface ProtocolRequest {
  10121. // Docs: https://electronjs.org/docs/api/structures/protocol-request
  10122. headers: Record<string, string>;
  10123. method: string;
  10124. referrer: string;
  10125. uploadData?: UploadData[];
  10126. url: string;
  10127. }
  10128. interface ProtocolResponse {
  10129. // Docs: https://electronjs.org/docs/api/structures/protocol-response
  10130. /**
  10131. * The charset of response body, default is `"utf-8"`.
  10132. */
  10133. charset?: string;
  10134. /**
  10135. * The response body. When returning stream as response, this is a Node.js readable
  10136. * stream representing the response body. When returning `Buffer` as response, this
  10137. * is a `Buffer`. When returning `string` as response, this is a `string`. This is
  10138. * ignored for other types of responses.
  10139. */
  10140. data?: (Buffer) | (string) | (NodeJS.ReadableStream);
  10141. /**
  10142. * When assigned, the `request` will fail with the `error` number . For the
  10143. * available error numbers you can use, please see the net error list.
  10144. */
  10145. error?: number;
  10146. /**
  10147. * An object containing the response headers. The keys must be string, and values
  10148. * must be either string or Array of string.
  10149. */
  10150. headers?: Record<string, (string) | (string[])>;
  10151. /**
  10152. * The HTTP `method`. This is only used for file and URL responses.
  10153. */
  10154. method?: string;
  10155. /**
  10156. * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
  10157. * would implicitly set the `content-type` header in response, but if
  10158. * `content-type` is already set in `headers`, the `mimeType` would be ignored.
  10159. */
  10160. mimeType?: string;
  10161. /**
  10162. * Path to the file which would be sent as response body. This is only used for
  10163. * file responses.
  10164. */
  10165. path?: string;
  10166. /**
  10167. * The `referrer` URL. This is only used for file and URL responses.
  10168. */
  10169. referrer?: string;
  10170. /**
  10171. * The session used for requesting URL, by default the HTTP request will reuse the
  10172. * current session. Setting `session` to `null` would use a random independent
  10173. * session. This is only used for URL responses.
  10174. */
  10175. session?: Session;
  10176. /**
  10177. * The HTTP response code, default is 200.
  10178. */
  10179. statusCode?: number;
  10180. /**
  10181. * The data used as upload data. This is only used for URL responses when `method`
  10182. * is `"POST"`.
  10183. */
  10184. uploadData?: ProtocolResponseUploadData;
  10185. /**
  10186. * Download the `url` and pipe the result as response body. This is only used for
  10187. * URL responses.
  10188. */
  10189. url?: string;
  10190. }
  10191. interface ProtocolResponseUploadData {
  10192. // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
  10193. /**
  10194. * MIME type of the content.
  10195. */
  10196. contentType: string;
  10197. /**
  10198. * Content to be sent.
  10199. */
  10200. data: (string) | (Buffer);
  10201. }
  10202. interface ProxyConfig {
  10203. // Docs: https://electronjs.org/docs/api/structures/proxy-config
  10204. /**
  10205. * The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`,
  10206. * `fixed_servers` or `system`. Defaults to `pac_script` proxy mode if `pacScript`
  10207. * option is specified otherwise defaults to `fixed_servers`.
  10208. */
  10209. mode?: ('direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system');
  10210. /**
  10211. * The URL associated with the PAC file.
  10212. */
  10213. pacScript?: string;
  10214. /**
  10215. * Rules indicating which URLs should bypass the proxy settings.
  10216. */
  10217. proxyBypassRules?: string;
  10218. /**
  10219. * Rules indicating which proxies to use.
  10220. */
  10221. proxyRules?: string;
  10222. }
  10223. interface PushNotifications extends NodeJS.EventEmitter {
  10224. // Docs: https://electronjs.org/docs/api/push-notifications
  10225. /**
  10226. * Emitted when the app receives a remote notification while running. See:
  10227. * https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428430-application?language=objc
  10228. *
  10229. * @platform darwin
  10230. */
  10231. on(event: 'received-apns-notification', listener: (event: Event,
  10232. userInfo: Record<string, any>) => void): this;
  10233. /**
  10234. * @platform darwin
  10235. */
  10236. off(event: 'received-apns-notification', listener: (event: Event,
  10237. userInfo: Record<string, any>) => void): this;
  10238. /**
  10239. * @platform darwin
  10240. */
  10241. once(event: 'received-apns-notification', listener: (event: Event,
  10242. userInfo: Record<string, any>) => void): this;
  10243. /**
  10244. * @platform darwin
  10245. */
  10246. addListener(event: 'received-apns-notification', listener: (event: Event,
  10247. userInfo: Record<string, any>) => void): this;
  10248. /**
  10249. * @platform darwin
  10250. */
  10251. removeListener(event: 'received-apns-notification', listener: (event: Event,
  10252. userInfo: Record<string, any>) => void): this;
  10253. /**
  10254. * Registers the app with Apple Push Notification service (APNS) to receive Badge,
  10255. * Sound, and Alert notifications. If registration is successful, the promise will
  10256. * be resolved with the APNS device token. Otherwise, the promise will be rejected
  10257. * with an error message. See:
  10258. * https://developer.apple.com/documentation/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc
  10259. *
  10260. * @platform darwin
  10261. */
  10262. registerForAPNSNotifications(): Promise<string>;
  10263. /**
  10264. * Unregisters the app from notifications received from APNS. See:
  10265. * https://developer.apple.com/documentation/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc
  10266. *
  10267. * @platform darwin
  10268. */
  10269. unregisterForAPNSNotifications(): void;
  10270. }
  10271. interface Rectangle {
  10272. // Docs: https://electronjs.org/docs/api/structures/rectangle
  10273. /**
  10274. * The height of the rectangle (must be an integer).
  10275. */
  10276. height: number;
  10277. /**
  10278. * The width of the rectangle (must be an integer).
  10279. */
  10280. width: number;
  10281. /**
  10282. * The x coordinate of the origin of the rectangle (must be an integer).
  10283. */
  10284. x: number;
  10285. /**
  10286. * The y coordinate of the origin of the rectangle (must be an integer).
  10287. */
  10288. y: number;
  10289. }
  10290. interface Referrer {
  10291. // Docs: https://electronjs.org/docs/api/structures/referrer
  10292. /**
  10293. * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
  10294. * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
  10295. * See the Referrer-Policy spec for more details on the meaning of these values.
  10296. */
  10297. policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
  10298. /**
  10299. * HTTP Referrer URL.
  10300. */
  10301. url: string;
  10302. }
  10303. interface RenderProcessGoneDetails {
  10304. // Docs: https://electronjs.org/docs/api/structures/render-process-gone-details
  10305. /**
  10306. * The exit code of the process, unless `reason` is `launch-failed`, in which case
  10307. * `exitCode` will be a platform-specific launch failure error code.
  10308. */
  10309. exitCode: number;
  10310. /**
  10311. * The reason the render process is gone. Possible values:
  10312. */
  10313. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  10314. }
  10315. interface ResolvedEndpoint {
  10316. // Docs: https://electronjs.org/docs/api/structures/resolved-endpoint
  10317. address: string;
  10318. /**
  10319. * One of the following:
  10320. */
  10321. family: ('ipv4' | 'ipv6' | 'unspec');
  10322. }
  10323. interface ResolvedHost {
  10324. // Docs: https://electronjs.org/docs/api/structures/resolved-host
  10325. /**
  10326. * resolved DNS entries for the hostname
  10327. */
  10328. endpoints: ResolvedEndpoint[];
  10329. }
  10330. interface SafeStorage extends NodeJS.EventEmitter {
  10331. // Docs: https://electronjs.org/docs/api/safe-storage
  10332. /**
  10333. * the decrypted string. Decrypts the encrypted buffer obtained with
  10334. * `safeStorage.encryptString` back into a string.
  10335. *
  10336. * This function will throw an error if decryption fails.
  10337. */
  10338. decryptString(encrypted: Buffer): string;
  10339. /**
  10340. * An array of bytes representing the encrypted string.
  10341. *
  10342. * This function will throw an error if encryption fails.
  10343. */
  10344. encryptString(plainText: string): Buffer;
  10345. /**
  10346. * User friendly name of the password manager selected on Linux.
  10347. *
  10348. * This function will return one of the following values:
  10349. *
  10350. * * `basic_text` - When the desktop environment is not recognised or if the
  10351. * following command line flag is provided `--password-store="basic"`.
  10352. * * `gnome_libsecret` - When the desktop environment is `X-Cinnamon`, `Deepin`,
  10353. * `GNOME`, `Pantheon`, `XFCE`, `UKUI`, `unity` or if the following command line
  10354. * flag is provided `--password-store="gnome-libsecret"`.
  10355. * * `kwallet` - When the desktop session is `kde4` or if the following command
  10356. * line flag is provided `--password-store="kwallet"`.
  10357. * * `kwallet5` - When the desktop session is `kde5` or if the following command
  10358. * line flag is provided `--password-store="kwallet5"`.
  10359. * * `kwallet6` - When the desktop session is `kde6`.
  10360. * * `unknown` - When the function is called before app has emitted the `ready`
  10361. * event.
  10362. *
  10363. * @platform linux
  10364. */
  10365. getSelectedStorageBackend(): ('basic_text' | 'gnome_libsecret' | 'kwallet' | 'kwallet5' | 'kwallet6' | 'unknown');
  10366. /**
  10367. * Whether encryption is available.
  10368. *
  10369. * On Linux, returns true if the app has emitted the `ready` event and the secret
  10370. * key is available. On MacOS, returns true if Keychain is available. On Windows,
  10371. * returns true once the app has emitted the `ready` event.
  10372. */
  10373. isEncryptionAvailable(): boolean;
  10374. /**
  10375. * This function on Linux will force the module to use an in memory password for
  10376. * creating symmetric key that is used for encrypt/decrypt functions when a valid
  10377. * OS password manager cannot be determined for the current active desktop
  10378. * environment. This function is a no-op on Windows and MacOS.
  10379. */
  10380. setUsePlainTextEncryption(usePlainText: boolean): void;
  10381. }
  10382. interface Screen extends NodeJS.EventEmitter {
  10383. // Docs: https://electronjs.org/docs/api/screen
  10384. /**
  10385. * Emitted when `newDisplay` has been added.
  10386. */
  10387. on(event: 'display-added', listener: (event: Event,
  10388. newDisplay: Display) => void): this;
  10389. off(event: 'display-added', listener: (event: Event,
  10390. newDisplay: Display) => void): this;
  10391. once(event: 'display-added', listener: (event: Event,
  10392. newDisplay: Display) => void): this;
  10393. addListener(event: 'display-added', listener: (event: Event,
  10394. newDisplay: Display) => void): this;
  10395. removeListener(event: 'display-added', listener: (event: Event,
  10396. newDisplay: Display) => void): this;
  10397. /**
  10398. * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
  10399. * an array of strings that describe the changes. Possible changes are `bounds`,
  10400. * `workArea`, `scaleFactor` and `rotation`.
  10401. */
  10402. on(event: 'display-metrics-changed', listener: (event: Event,
  10403. display: Display,
  10404. changedMetrics: string[]) => void): this;
  10405. off(event: 'display-metrics-changed', listener: (event: Event,
  10406. display: Display,
  10407. changedMetrics: string[]) => void): this;
  10408. once(event: 'display-metrics-changed', listener: (event: Event,
  10409. display: Display,
  10410. changedMetrics: string[]) => void): this;
  10411. addListener(event: 'display-metrics-changed', listener: (event: Event,
  10412. display: Display,
  10413. changedMetrics: string[]) => void): this;
  10414. removeListener(event: 'display-metrics-changed', listener: (event: Event,
  10415. display: Display,
  10416. changedMetrics: string[]) => void): this;
  10417. /**
  10418. * Emitted when `oldDisplay` has been removed.
  10419. */
  10420. on(event: 'display-removed', listener: (event: Event,
  10421. oldDisplay: Display) => void): this;
  10422. off(event: 'display-removed', listener: (event: Event,
  10423. oldDisplay: Display) => void): this;
  10424. once(event: 'display-removed', listener: (event: Event,
  10425. oldDisplay: Display) => void): this;
  10426. addListener(event: 'display-removed', listener: (event: Event,
  10427. oldDisplay: Display) => void): this;
  10428. removeListener(event: 'display-removed', listener: (event: Event,
  10429. oldDisplay: Display) => void): this;
  10430. /**
  10431. * Converts a screen DIP point to a screen physical point. The DPI scale is
  10432. * performed relative to the display containing the DIP point.
  10433. *
  10434. * @platform win32
  10435. */
  10436. dipToScreenPoint(point: Point): Point;
  10437. /**
  10438. * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
  10439. * relative to the display nearest to `window`. If `window` is null, scaling will
  10440. * be performed to the display nearest to `rect`.
  10441. *
  10442. * @platform win32
  10443. */
  10444. dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  10445. /**
  10446. * An array of displays that are currently available.
  10447. */
  10448. getAllDisplays(): Display[];
  10449. /**
  10450. * The current absolute position of the mouse pointer.
  10451. *
  10452. * **Note:** The return value is a DIP point, not a screen physical point.
  10453. */
  10454. getCursorScreenPoint(): Point;
  10455. /**
  10456. * The display that most closely intersects the provided bounds.
  10457. */
  10458. getDisplayMatching(rect: Rectangle): Display;
  10459. /**
  10460. * The display nearest the specified point.
  10461. */
  10462. getDisplayNearestPoint(point: Point): Display;
  10463. /**
  10464. * The primary display.
  10465. */
  10466. getPrimaryDisplay(): Display;
  10467. /**
  10468. * Converts a screen physical point to a screen DIP point. The DPI scale is
  10469. * performed relative to the display containing the physical point.
  10470. *
  10471. * @platform win32
  10472. */
  10473. screenToDipPoint(point: Point): Point;
  10474. /**
  10475. * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
  10476. * relative to the display nearest to `window`. If `window` is null, scaling will
  10477. * be performed to the display nearest to `rect`.
  10478. *
  10479. * @platform win32
  10480. */
  10481. screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  10482. }
  10483. interface ScrubberItem {
  10484. // Docs: https://electronjs.org/docs/api/structures/scrubber-item
  10485. /**
  10486. * The image to appear in this item.
  10487. */
  10488. icon?: NativeImage;
  10489. /**
  10490. * The text to appear in this item.
  10491. */
  10492. label?: string;
  10493. }
  10494. interface SegmentedControlSegment {
  10495. // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
  10496. /**
  10497. * Whether this segment is selectable. Default: true.
  10498. */
  10499. enabled?: boolean;
  10500. /**
  10501. * The image to appear in this segment.
  10502. */
  10503. icon?: NativeImage;
  10504. /**
  10505. * The text to appear in this segment.
  10506. */
  10507. label?: string;
  10508. }
  10509. interface SerialPort {
  10510. // Docs: https://electronjs.org/docs/api/structures/serial-port
  10511. /**
  10512. * A stable identifier on Windows that can be used for device permissions.
  10513. *
  10514. * @platform win32
  10515. */
  10516. deviceInstanceId?: string;
  10517. /**
  10518. * A string suitable for display to the user for describing this device.
  10519. */
  10520. displayName?: string;
  10521. /**
  10522. * Unique identifier for the port.
  10523. */
  10524. portId: string;
  10525. /**
  10526. * Name of the port.
  10527. */
  10528. portName: string;
  10529. /**
  10530. * The USB product ID.
  10531. */
  10532. productId?: string;
  10533. /**
  10534. * The USB device serial number.
  10535. */
  10536. serialNumber?: string;
  10537. /**
  10538. * Represents a single serial port on macOS can be enumerated by multiple drivers.
  10539. *
  10540. * @platform darwin
  10541. */
  10542. usbDriverName?: string;
  10543. /**
  10544. * The USB vendor ID.
  10545. */
  10546. vendorId?: string;
  10547. }
  10548. interface ServiceWorkerInfo {
  10549. // Docs: https://electronjs.org/docs/api/structures/service-worker-info
  10550. /**
  10551. * The virtual ID of the process that this service worker is running in. This is
  10552. * not an OS level PID. This aligns with the ID set used for
  10553. * `webContents.getProcessId()`.
  10554. */
  10555. renderProcessId: number;
  10556. /**
  10557. * The base URL that this service worker is active for.
  10558. */
  10559. scope: string;
  10560. /**
  10561. * The full URL to the script that this service worker runs
  10562. */
  10563. scriptUrl: string;
  10564. }
  10565. class ServiceWorkers extends NodeEventEmitter {
  10566. // Docs: https://electronjs.org/docs/api/service-workers
  10567. /**
  10568. * Emitted when a service worker logs something to the console.
  10569. */
  10570. on(event: 'console-message', listener: (event: Event,
  10571. /**
  10572. * Information about the console message
  10573. */
  10574. messageDetails: MessageDetails) => void): this;
  10575. off(event: 'console-message', listener: (event: Event,
  10576. /**
  10577. * Information about the console message
  10578. */
  10579. messageDetails: MessageDetails) => void): this;
  10580. once(event: 'console-message', listener: (event: Event,
  10581. /**
  10582. * Information about the console message
  10583. */
  10584. messageDetails: MessageDetails) => void): this;
  10585. addListener(event: 'console-message', listener: (event: Event,
  10586. /**
  10587. * Information about the console message
  10588. */
  10589. messageDetails: MessageDetails) => void): this;
  10590. removeListener(event: 'console-message', listener: (event: Event,
  10591. /**
  10592. * Information about the console message
  10593. */
  10594. messageDetails: MessageDetails) => void): this;
  10595. /**
  10596. * Emitted when a service worker has been registered. Can occur after a call to
  10597. * `navigator.serviceWorker.register('/sw.js')` successfully resolves or when a
  10598. * Chrome extension is loaded.
  10599. */
  10600. on(event: 'registration-completed', listener: (event: Event,
  10601. /**
  10602. * Information about the registered service worker
  10603. */
  10604. details: RegistrationCompletedDetails) => void): this;
  10605. off(event: 'registration-completed', listener: (event: Event,
  10606. /**
  10607. * Information about the registered service worker
  10608. */
  10609. details: RegistrationCompletedDetails) => void): this;
  10610. once(event: 'registration-completed', listener: (event: Event,
  10611. /**
  10612. * Information about the registered service worker
  10613. */
  10614. details: RegistrationCompletedDetails) => void): this;
  10615. addListener(event: 'registration-completed', listener: (event: Event,
  10616. /**
  10617. * Information about the registered service worker
  10618. */
  10619. details: RegistrationCompletedDetails) => void): this;
  10620. removeListener(event: 'registration-completed', listener: (event: Event,
  10621. /**
  10622. * Information about the registered service worker
  10623. */
  10624. details: RegistrationCompletedDetails) => void): this;
  10625. /**
  10626. * A ServiceWorkerInfo object where the keys are the service worker version ID and
  10627. * the values are the information about that service worker.
  10628. */
  10629. getAllRunning(): Record<number, ServiceWorkerInfo>;
  10630. /**
  10631. * Information about this service worker
  10632. *
  10633. * If the service worker does not exist or is not running this method will throw an
  10634. * exception.
  10635. */
  10636. getFromVersionID(versionId: number): ServiceWorkerInfo;
  10637. }
  10638. class Session extends NodeEventEmitter {
  10639. // Docs: https://electronjs.org/docs/api/session
  10640. /**
  10641. * A session instance from `partition` string. When there is an existing `Session`
  10642. * with the same `partition`, it will be returned; otherwise a new `Session`
  10643. * instance will be created with `options`.
  10644. *
  10645. * If `partition` starts with `persist:`, the page will use a persistent session
  10646. * available to all pages in the app with the same `partition`. if there is no
  10647. * `persist:` prefix, the page will use an in-memory session. If the `partition` is
  10648. * empty then default session of the app will be returned.
  10649. *
  10650. * To create a `Session` with `options`, you have to ensure the `Session` with the
  10651. * `partition` has never been used before. There is no way to change the `options`
  10652. * of an existing `Session` object.
  10653. */
  10654. static fromPartition(partition: string, options?: FromPartitionOptions): Session;
  10655. /**
  10656. * A session instance from the absolute path as specified by the `path` string.
  10657. * When there is an existing `Session` with the same absolute path, it will be
  10658. * returned; otherwise a new `Session` instance will be created with `options`. The
  10659. * call will throw an error if the path is not an absolute path. Additionally, an
  10660. * error will be thrown if an empty string is provided.
  10661. *
  10662. * To create a `Session` with `options`, you have to ensure the `Session` with the
  10663. * `path` has never been used before. There is no way to change the `options` of an
  10664. * existing `Session` object.
  10665. */
  10666. static fromPath(path: string, options?: FromPathOptions): Session;
  10667. /**
  10668. * A `Session` object, the default session object of the app.
  10669. */
  10670. static defaultSession: Session;
  10671. /**
  10672. * Emitted after an extension is loaded. This occurs whenever an extension is added
  10673. * to the "enabled" set of extensions. This includes:
  10674. *
  10675. * * Extensions being loaded from `Session.loadExtension`.
  10676. * * Extensions being reloaded:
  10677. * * from a crash.
  10678. * * if the extension requested it (`chrome.runtime.reload()`).
  10679. */
  10680. on(event: 'extension-loaded', listener: (event: Event,
  10681. extension: Extension) => void): this;
  10682. off(event: 'extension-loaded', listener: (event: Event,
  10683. extension: Extension) => void): this;
  10684. once(event: 'extension-loaded', listener: (event: Event,
  10685. extension: Extension) => void): this;
  10686. addListener(event: 'extension-loaded', listener: (event: Event,
  10687. extension: Extension) => void): this;
  10688. removeListener(event: 'extension-loaded', listener: (event: Event,
  10689. extension: Extension) => void): this;
  10690. /**
  10691. * Emitted after an extension is loaded and all necessary browser state is
  10692. * initialized to support the start of the extension's background page.
  10693. */
  10694. on(event: 'extension-ready', listener: (event: Event,
  10695. extension: Extension) => void): this;
  10696. off(event: 'extension-ready', listener: (event: Event,
  10697. extension: Extension) => void): this;
  10698. once(event: 'extension-ready', listener: (event: Event,
  10699. extension: Extension) => void): this;
  10700. addListener(event: 'extension-ready', listener: (event: Event,
  10701. extension: Extension) => void): this;
  10702. removeListener(event: 'extension-ready', listener: (event: Event,
  10703. extension: Extension) => void): this;
  10704. /**
  10705. * Emitted after an extension is unloaded. This occurs when
  10706. * `Session.removeExtension` is called.
  10707. */
  10708. on(event: 'extension-unloaded', listener: (event: Event,
  10709. extension: Extension) => void): this;
  10710. off(event: 'extension-unloaded', listener: (event: Event,
  10711. extension: Extension) => void): this;
  10712. once(event: 'extension-unloaded', listener: (event: Event,
  10713. extension: Extension) => void): this;
  10714. addListener(event: 'extension-unloaded', listener: (event: Event,
  10715. extension: Extension) => void): this;
  10716. removeListener(event: 'extension-unloaded', listener: (event: Event,
  10717. extension: Extension) => void): this;
  10718. /**
  10719. * Emitted after `navigator.hid.requestDevice` has been called and
  10720. * `select-hid-device` has fired if a new device becomes available before the
  10721. * callback from `select-hid-device` is called. This event is intended for use
  10722. * when using a UI to ask users to pick a device so that the UI can be updated with
  10723. * the newly added device.
  10724. */
  10725. on(event: 'hid-device-added', listener: (event: Event,
  10726. details: HidDeviceAddedDetails) => void): this;
  10727. off(event: 'hid-device-added', listener: (event: Event,
  10728. details: HidDeviceAddedDetails) => void): this;
  10729. once(event: 'hid-device-added', listener: (event: Event,
  10730. details: HidDeviceAddedDetails) => void): this;
  10731. addListener(event: 'hid-device-added', listener: (event: Event,
  10732. details: HidDeviceAddedDetails) => void): this;
  10733. removeListener(event: 'hid-device-added', listener: (event: Event,
  10734. details: HidDeviceAddedDetails) => void): this;
  10735. /**
  10736. * Emitted after `navigator.hid.requestDevice` has been called and
  10737. * `select-hid-device` has fired if a device has been removed before the callback
  10738. * from `select-hid-device` is called. This event is intended for use when using a
  10739. * UI to ask users to pick a device so that the UI can be updated to remove the
  10740. * specified device.
  10741. */
  10742. on(event: 'hid-device-removed', listener: (event: Event,
  10743. details: HidDeviceRemovedDetails) => void): this;
  10744. off(event: 'hid-device-removed', listener: (event: Event,
  10745. details: HidDeviceRemovedDetails) => void): this;
  10746. once(event: 'hid-device-removed', listener: (event: Event,
  10747. details: HidDeviceRemovedDetails) => void): this;
  10748. addListener(event: 'hid-device-removed', listener: (event: Event,
  10749. details: HidDeviceRemovedDetails) => void): this;
  10750. removeListener(event: 'hid-device-removed', listener: (event: Event,
  10751. details: HidDeviceRemovedDetails) => void): this;
  10752. /**
  10753. * Emitted after `HIDDevice.forget()` has been called. This event can be used to
  10754. * help maintain persistent storage of permissions when
  10755. * `setDevicePermissionHandler` is used.
  10756. */
  10757. on(event: 'hid-device-revoked', listener: (event: Event,
  10758. details: HidDeviceRevokedDetails) => void): this;
  10759. off(event: 'hid-device-revoked', listener: (event: Event,
  10760. details: HidDeviceRevokedDetails) => void): this;
  10761. once(event: 'hid-device-revoked', listener: (event: Event,
  10762. details: HidDeviceRevokedDetails) => void): this;
  10763. addListener(event: 'hid-device-revoked', listener: (event: Event,
  10764. details: HidDeviceRevokedDetails) => void): this;
  10765. removeListener(event: 'hid-device-revoked', listener: (event: Event,
  10766. details: HidDeviceRevokedDetails) => void): this;
  10767. /**
  10768. * Emitted when a render process requests preconnection to a URL, generally due to
  10769. * a resource hint.
  10770. */
  10771. on(event: 'preconnect', listener: (event: Event,
  10772. /**
  10773. * The URL being requested for preconnection by the renderer.
  10774. */
  10775. preconnectUrl: string,
  10776. /**
  10777. * True if the renderer is requesting that the connection include credentials (see
  10778. * the spec for more details.)
  10779. */
  10780. allowCredentials: boolean) => void): this;
  10781. off(event: 'preconnect', listener: (event: Event,
  10782. /**
  10783. * The URL being requested for preconnection by the renderer.
  10784. */
  10785. preconnectUrl: string,
  10786. /**
  10787. * True if the renderer is requesting that the connection include credentials (see
  10788. * the spec for more details.)
  10789. */
  10790. allowCredentials: boolean) => void): this;
  10791. once(event: 'preconnect', listener: (event: Event,
  10792. /**
  10793. * The URL being requested for preconnection by the renderer.
  10794. */
  10795. preconnectUrl: string,
  10796. /**
  10797. * True if the renderer is requesting that the connection include credentials (see
  10798. * the spec for more details.)
  10799. */
  10800. allowCredentials: boolean) => void): this;
  10801. addListener(event: 'preconnect', listener: (event: Event,
  10802. /**
  10803. * The URL being requested for preconnection by the renderer.
  10804. */
  10805. preconnectUrl: string,
  10806. /**
  10807. * True if the renderer is requesting that the connection include credentials (see
  10808. * the spec for more details.)
  10809. */
  10810. allowCredentials: boolean) => void): this;
  10811. removeListener(event: 'preconnect', listener: (event: Event,
  10812. /**
  10813. * The URL being requested for preconnection by the renderer.
  10814. */
  10815. preconnectUrl: string,
  10816. /**
  10817. * True if the renderer is requesting that the connection include credentials (see
  10818. * the spec for more details.)
  10819. */
  10820. allowCredentials: boolean) => void): this;
  10821. /**
  10822. * Emitted when a HID device needs to be selected when a call to
  10823. * `navigator.hid.requestDevice` is made. `callback` should be called with
  10824. * `deviceId` to be selected; passing no arguments to `callback` will cancel the
  10825. * request. Additionally, permissioning on `navigator.hid` can be further managed
  10826. * by using `ses.setPermissionCheckHandler(handler)` and
  10827. * `ses.setDevicePermissionHandler(handler)`.
  10828. */
  10829. on(event: 'select-hid-device', listener: (event: Event,
  10830. details: SelectHidDeviceDetails,
  10831. callback: (deviceId?: (string) | (null)) => void) => void): this;
  10832. off(event: 'select-hid-device', listener: (event: Event,
  10833. details: SelectHidDeviceDetails,
  10834. callback: (deviceId?: (string) | (null)) => void) => void): this;
  10835. once(event: 'select-hid-device', listener: (event: Event,
  10836. details: SelectHidDeviceDetails,
  10837. callback: (deviceId?: (string) | (null)) => void) => void): this;
  10838. addListener(event: 'select-hid-device', listener: (event: Event,
  10839. details: SelectHidDeviceDetails,
  10840. callback: (deviceId?: (string) | (null)) => void) => void): this;
  10841. removeListener(event: 'select-hid-device', listener: (event: Event,
  10842. details: SelectHidDeviceDetails,
  10843. callback: (deviceId?: (string) | (null)) => void) => void): this;
  10844. /**
  10845. * Emitted when a serial port needs to be selected when a call to
  10846. * `navigator.serial.requestPort` is made. `callback` should be called with
  10847. * `portId` to be selected, passing an empty string to `callback` will cancel the
  10848. * request. Additionally, permissioning on `navigator.serial` can be managed by
  10849. * using ses.setPermissionCheckHandler(handler) with the `serial` permission.
  10850. */
  10851. on(event: 'select-serial-port', listener: (event: Event,
  10852. portList: SerialPort[],
  10853. webContents: WebContents,
  10854. callback: (portId: string) => void) => void): this;
  10855. off(event: 'select-serial-port', listener: (event: Event,
  10856. portList: SerialPort[],
  10857. webContents: WebContents,
  10858. callback: (portId: string) => void) => void): this;
  10859. once(event: 'select-serial-port', listener: (event: Event,
  10860. portList: SerialPort[],
  10861. webContents: WebContents,
  10862. callback: (portId: string) => void) => void): this;
  10863. addListener(event: 'select-serial-port', listener: (event: Event,
  10864. portList: SerialPort[],
  10865. webContents: WebContents,
  10866. callback: (portId: string) => void) => void): this;
  10867. removeListener(event: 'select-serial-port', listener: (event: Event,
  10868. portList: SerialPort[],
  10869. webContents: WebContents,
  10870. callback: (portId: string) => void) => void): this;
  10871. /**
  10872. * Emitted when a USB device needs to be selected when a call to
  10873. * `navigator.usb.requestDevice` is made. `callback` should be called with
  10874. * `deviceId` to be selected; passing no arguments to `callback` will cancel the
  10875. * request. Additionally, permissioning on `navigator.usb` can be further managed
  10876. * by using `ses.setPermissionCheckHandler(handler)` and
  10877. * `ses.setDevicePermissionHandler(handler)`.
  10878. */
  10879. on(event: 'select-usb-device', listener: (event: Event,
  10880. details: SelectUsbDeviceDetails,
  10881. callback: (deviceId?: string) => void) => void): this;
  10882. off(event: 'select-usb-device', listener: (event: Event,
  10883. details: SelectUsbDeviceDetails,
  10884. callback: (deviceId?: string) => void) => void): this;
  10885. once(event: 'select-usb-device', listener: (event: Event,
  10886. details: SelectUsbDeviceDetails,
  10887. callback: (deviceId?: string) => void) => void): this;
  10888. addListener(event: 'select-usb-device', listener: (event: Event,
  10889. details: SelectUsbDeviceDetails,
  10890. callback: (deviceId?: string) => void) => void): this;
  10891. removeListener(event: 'select-usb-device', listener: (event: Event,
  10892. details: SelectUsbDeviceDetails,
  10893. callback: (deviceId?: string) => void) => void): this;
  10894. /**
  10895. * Emitted after `navigator.serial.requestPort` has been called and
  10896. * `select-serial-port` has fired if a new serial port becomes available before the
  10897. * callback from `select-serial-port` is called. This event is intended for use
  10898. * when using a UI to ask users to pick a port so that the UI can be updated with
  10899. * the newly added port.
  10900. */
  10901. on(event: 'serial-port-added', listener: (event: Event,
  10902. port: SerialPort,
  10903. webContents: WebContents) => void): this;
  10904. off(event: 'serial-port-added', listener: (event: Event,
  10905. port: SerialPort,
  10906. webContents: WebContents) => void): this;
  10907. once(event: 'serial-port-added', listener: (event: Event,
  10908. port: SerialPort,
  10909. webContents: WebContents) => void): this;
  10910. addListener(event: 'serial-port-added', listener: (event: Event,
  10911. port: SerialPort,
  10912. webContents: WebContents) => void): this;
  10913. removeListener(event: 'serial-port-added', listener: (event: Event,
  10914. port: SerialPort,
  10915. webContents: WebContents) => void): this;
  10916. /**
  10917. * Emitted after `navigator.serial.requestPort` has been called and
  10918. * `select-serial-port` has fired if a serial port has been removed before the
  10919. * callback from `select-serial-port` is called. This event is intended for use
  10920. * when using a UI to ask users to pick a port so that the UI can be updated to
  10921. * remove the specified port.
  10922. */
  10923. on(event: 'serial-port-removed', listener: (event: Event,
  10924. port: SerialPort,
  10925. webContents: WebContents) => void): this;
  10926. off(event: 'serial-port-removed', listener: (event: Event,
  10927. port: SerialPort,
  10928. webContents: WebContents) => void): this;
  10929. once(event: 'serial-port-removed', listener: (event: Event,
  10930. port: SerialPort,
  10931. webContents: WebContents) => void): this;
  10932. addListener(event: 'serial-port-removed', listener: (event: Event,
  10933. port: SerialPort,
  10934. webContents: WebContents) => void): this;
  10935. removeListener(event: 'serial-port-removed', listener: (event: Event,
  10936. port: SerialPort,
  10937. webContents: WebContents) => void): this;
  10938. /**
  10939. * Emitted after `SerialPort.forget()` has been called. This event can be used to
  10940. * help maintain persistent storage of permissions when
  10941. * `setDevicePermissionHandler` is used.
  10942. */
  10943. on(event: 'serial-port-revoked', listener: (event: Event,
  10944. details: SerialPortRevokedDetails) => void): this;
  10945. off(event: 'serial-port-revoked', listener: (event: Event,
  10946. details: SerialPortRevokedDetails) => void): this;
  10947. once(event: 'serial-port-revoked', listener: (event: Event,
  10948. details: SerialPortRevokedDetails) => void): this;
  10949. addListener(event: 'serial-port-revoked', listener: (event: Event,
  10950. details: SerialPortRevokedDetails) => void): this;
  10951. removeListener(event: 'serial-port-revoked', listener: (event: Event,
  10952. details: SerialPortRevokedDetails) => void): this;
  10953. /**
  10954. * Emitted when a hunspell dictionary file starts downloading
  10955. */
  10956. on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  10957. /**
  10958. * The language code of the dictionary file
  10959. */
  10960. languageCode: string) => void): this;
  10961. off(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  10962. /**
  10963. * The language code of the dictionary file
  10964. */
  10965. languageCode: string) => void): this;
  10966. once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  10967. /**
  10968. * The language code of the dictionary file
  10969. */
  10970. languageCode: string) => void): this;
  10971. addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  10972. /**
  10973. * The language code of the dictionary file
  10974. */
  10975. languageCode: string) => void): this;
  10976. removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  10977. /**
  10978. * The language code of the dictionary file
  10979. */
  10980. languageCode: string) => void): this;
  10981. /**
  10982. * Emitted when a hunspell dictionary file download fails. For details on the
  10983. * failure you should collect a netlog and inspect the download request.
  10984. */
  10985. on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  10986. /**
  10987. * The language code of the dictionary file
  10988. */
  10989. languageCode: string) => void): this;
  10990. off(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  10991. /**
  10992. * The language code of the dictionary file
  10993. */
  10994. languageCode: string) => void): this;
  10995. once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  10996. /**
  10997. * The language code of the dictionary file
  10998. */
  10999. languageCode: string) => void): this;
  11000. addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  11001. /**
  11002. * The language code of the dictionary file
  11003. */
  11004. languageCode: string) => void): this;
  11005. removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  11006. /**
  11007. * The language code of the dictionary file
  11008. */
  11009. languageCode: string) => void): this;
  11010. /**
  11011. * Emitted when a hunspell dictionary file has been successfully downloaded
  11012. */
  11013. on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  11014. /**
  11015. * The language code of the dictionary file
  11016. */
  11017. languageCode: string) => void): this;
  11018. off(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  11019. /**
  11020. * The language code of the dictionary file
  11021. */
  11022. languageCode: string) => void): this;
  11023. once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  11024. /**
  11025. * The language code of the dictionary file
  11026. */
  11027. languageCode: string) => void): this;
  11028. addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  11029. /**
  11030. * The language code of the dictionary file
  11031. */
  11032. languageCode: string) => void): this;
  11033. removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  11034. /**
  11035. * The language code of the dictionary file
  11036. */
  11037. languageCode: string) => void): this;
  11038. /**
  11039. * Emitted when a hunspell dictionary file has been successfully initialized. This
  11040. * occurs after the file has been downloaded.
  11041. */
  11042. on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  11043. /**
  11044. * The language code of the dictionary file
  11045. */
  11046. languageCode: string) => void): this;
  11047. off(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  11048. /**
  11049. * The language code of the dictionary file
  11050. */
  11051. languageCode: string) => void): this;
  11052. once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  11053. /**
  11054. * The language code of the dictionary file
  11055. */
  11056. languageCode: string) => void): this;
  11057. addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  11058. /**
  11059. * The language code of the dictionary file
  11060. */
  11061. languageCode: string) => void): this;
  11062. removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  11063. /**
  11064. * The language code of the dictionary file
  11065. */
  11066. languageCode: string) => void): this;
  11067. /**
  11068. * Emitted after `navigator.usb.requestDevice` has been called and
  11069. * `select-usb-device` has fired if a new device becomes available before the
  11070. * callback from `select-usb-device` is called. This event is intended for use
  11071. * when using a UI to ask users to pick a device so that the UI can be updated with
  11072. * the newly added device.
  11073. */
  11074. on(event: 'usb-device-added', listener: (event: Event,
  11075. device: USBDevice,
  11076. webContents: WebContents) => void): this;
  11077. off(event: 'usb-device-added', listener: (event: Event,
  11078. device: USBDevice,
  11079. webContents: WebContents) => void): this;
  11080. once(event: 'usb-device-added', listener: (event: Event,
  11081. device: USBDevice,
  11082. webContents: WebContents) => void): this;
  11083. addListener(event: 'usb-device-added', listener: (event: Event,
  11084. device: USBDevice,
  11085. webContents: WebContents) => void): this;
  11086. removeListener(event: 'usb-device-added', listener: (event: Event,
  11087. device: USBDevice,
  11088. webContents: WebContents) => void): this;
  11089. /**
  11090. * Emitted after `navigator.usb.requestDevice` has been called and
  11091. * `select-usb-device` has fired if a device has been removed before the callback
  11092. * from `select-usb-device` is called. This event is intended for use when using a
  11093. * UI to ask users to pick a device so that the UI can be updated to remove the
  11094. * specified device.
  11095. */
  11096. on(event: 'usb-device-removed', listener: (event: Event,
  11097. device: USBDevice,
  11098. webContents: WebContents) => void): this;
  11099. off(event: 'usb-device-removed', listener: (event: Event,
  11100. device: USBDevice,
  11101. webContents: WebContents) => void): this;
  11102. once(event: 'usb-device-removed', listener: (event: Event,
  11103. device: USBDevice,
  11104. webContents: WebContents) => void): this;
  11105. addListener(event: 'usb-device-removed', listener: (event: Event,
  11106. device: USBDevice,
  11107. webContents: WebContents) => void): this;
  11108. removeListener(event: 'usb-device-removed', listener: (event: Event,
  11109. device: USBDevice,
  11110. webContents: WebContents) => void): this;
  11111. /**
  11112. * Emitted after `USBDevice.forget()` has been called. This event can be used to
  11113. * help maintain persistent storage of permissions when
  11114. * `setDevicePermissionHandler` is used.
  11115. */
  11116. on(event: 'usb-device-revoked', listener: (event: Event,
  11117. details: UsbDeviceRevokedDetails) => void): this;
  11118. off(event: 'usb-device-revoked', listener: (event: Event,
  11119. details: UsbDeviceRevokedDetails) => void): this;
  11120. once(event: 'usb-device-revoked', listener: (event: Event,
  11121. details: UsbDeviceRevokedDetails) => void): this;
  11122. addListener(event: 'usb-device-revoked', listener: (event: Event,
  11123. details: UsbDeviceRevokedDetails) => void): this;
  11124. removeListener(event: 'usb-device-revoked', listener: (event: Event,
  11125. details: UsbDeviceRevokedDetails) => void): this;
  11126. /**
  11127. * Emitted when Electron is about to download `item` in `webContents`.
  11128. *
  11129. * Calling `event.preventDefault()` will cancel the download and `item` will not be
  11130. * available from next tick of the process.
  11131. */
  11132. on(event: 'will-download', listener: (event: Event,
  11133. item: DownloadItem,
  11134. webContents: WebContents) => void): this;
  11135. off(event: 'will-download', listener: (event: Event,
  11136. item: DownloadItem,
  11137. webContents: WebContents) => void): this;
  11138. once(event: 'will-download', listener: (event: Event,
  11139. item: DownloadItem,
  11140. webContents: WebContents) => void): this;
  11141. addListener(event: 'will-download', listener: (event: Event,
  11142. item: DownloadItem,
  11143. webContents: WebContents) => void): this;
  11144. removeListener(event: 'will-download', listener: (event: Event,
  11145. item: DownloadItem,
  11146. webContents: WebContents) => void): this;
  11147. /**
  11148. * Whether the word was successfully written to the custom dictionary. This API
  11149. * will not work on non-persistent (in-memory) sessions.
  11150. *
  11151. * **Note:** On macOS and Windows 10 this word will be written to the OS custom
  11152. * dictionary as well
  11153. */
  11154. addWordToSpellCheckerDictionary(word: string): boolean;
  11155. /**
  11156. * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
  11157. * authentication.
  11158. */
  11159. allowNTLMCredentialsForDomains(domains: string): void;
  11160. /**
  11161. * resolves when the session’s HTTP authentication cache has been cleared.
  11162. */
  11163. clearAuthCache(): Promise<void>;
  11164. /**
  11165. * resolves when the cache clear operation is complete.
  11166. *
  11167. * Clears the session’s HTTP cache.
  11168. */
  11169. clearCache(): Promise<void>;
  11170. /**
  11171. * resolves when the code cache clear operation is complete.
  11172. */
  11173. clearCodeCaches(options: ClearCodeCachesOptions): Promise<void>;
  11174. /**
  11175. * resolves when all data has been cleared.
  11176. *
  11177. * Clears various different types of data.
  11178. *
  11179. * This method clears more types of data and is more thourough than the
  11180. * `clearStorageData` method.
  11181. *
  11182. * **Note:** Cookies are stored at a broader scope than origins. When removing
  11183. * cookies and filtering by `origins` (or `excludeOrigins`), the cookies will be
  11184. * removed at the registrable domain level. For example, clearing cookies for the
  11185. * origin `https://really.specific.origin.example.com/` will end up clearing all
  11186. * cookies for `example.com`. Clearing cookies for the origin
  11187. * `https://my.website.example.co.uk/` will end up clearing all cookies for
  11188. * `example.co.uk`.
  11189. *
  11190. * For more information, refer to Chromium's `BrowsingDataRemover` interface.
  11191. */
  11192. clearData(options?: ClearDataOptions): Promise<void>;
  11193. /**
  11194. * Resolves when the operation is complete.
  11195. *
  11196. * Clears the host resolver cache.
  11197. */
  11198. clearHostResolverCache(): Promise<void>;
  11199. /**
  11200. * resolves when the storage data has been cleared.
  11201. */
  11202. clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
  11203. /**
  11204. * Resolves when all connections are closed.
  11205. *
  11206. * **Note:** It will terminate / fail all requests currently in flight.
  11207. */
  11208. closeAllConnections(): Promise<void>;
  11209. /**
  11210. * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
  11211. * The API will generate a DownloadItem that can be accessed with the will-download
  11212. * event. The DownloadItem will not have any `WebContents` associated with it and
  11213. * the initial state will be `interrupted`. The download will start only when the
  11214. * `resume` API is called on the DownloadItem.
  11215. */
  11216. createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
  11217. /**
  11218. * Disables any network emulation already active for the `session`. Resets to the
  11219. * original network configuration.
  11220. */
  11221. disableNetworkEmulation(): void;
  11222. /**
  11223. * Initiates a download of the resource at `url`. The API will generate a
  11224. * DownloadItem that can be accessed with the will-download event.
  11225. *
  11226. * **Note:** This does not perform any security checks that relate to a page's
  11227. * origin, unlike `webContents.downloadURL`.
  11228. */
  11229. downloadURL(url: string, options?: DownloadURLOptions): void;
  11230. /**
  11231. * Emulates network with the given configuration for the `session`.
  11232. */
  11233. enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
  11234. /**
  11235. * see Response.
  11236. *
  11237. * Sends a request, similarly to how `fetch()` works in the renderer, using
  11238. * Chrome's network stack. This differs from Node's `fetch()`, which uses Node.js's
  11239. * HTTP stack.
  11240. *
  11241. * Example:
  11242. *
  11243. * See also `net.fetch()`, a convenience method which issues requests from the
  11244. * default session.
  11245. *
  11246. * See the MDN documentation for `fetch()` for more details.
  11247. *
  11248. * Limitations:
  11249. *
  11250. * * `net.fetch()` does not support the `data:` or `blob:` schemes.
  11251. * * The value of the `integrity` option is ignored.
  11252. * * The `.type` and `.url` values of the returned `Response` object are incorrect.
  11253. *
  11254. * By default, requests made with `net.fetch` can be made to custom protocols as
  11255. * well as `file:`, and will trigger webRequest handlers if present. When the
  11256. * non-standard `bypassCustomProtocolHandlers` option is set in RequestInit, custom
  11257. * protocol handlers will not be called for this request. This allows forwarding an
  11258. * intercepted request to the built-in handler. webRequest handlers will still be
  11259. * triggered when bypassing custom protocols.
  11260. */
  11261. fetch(input: (string) | (GlobalRequest), init?: RequestInit & { bypassCustomProtocolHandlers?: boolean }): Promise<GlobalResponse>;
  11262. /**
  11263. * Writes any unwritten DOMStorage data to disk.
  11264. */
  11265. flushStorageData(): void;
  11266. /**
  11267. * Resolves when the all internal states of proxy service is reset and the latest
  11268. * proxy configuration is reapplied if it's already available. The pac script will
  11269. * be fetched from `pacScript` again if the proxy mode is `pac_script`.
  11270. */
  11271. forceReloadProxyConfig(): Promise<void>;
  11272. /**
  11273. * A list of all loaded extensions.
  11274. *
  11275. * **Note:** This API cannot be called before the `ready` event of the `app` module
  11276. * is emitted.
  11277. */
  11278. getAllExtensions(): Extension[];
  11279. /**
  11280. * resolves with blob data.
  11281. */
  11282. getBlobData(identifier: string): Promise<Buffer>;
  11283. /**
  11284. * the session's current cache size, in bytes.
  11285. */
  11286. getCacheSize(): Promise<number>;
  11287. /**
  11288. * The loaded extension with the given ID.
  11289. *
  11290. * **Note:** This API cannot be called before the `ready` event of the `app` module
  11291. * is emitted.
  11292. */
  11293. getExtension(extensionId: string): (Extension) | (null);
  11294. /**
  11295. * an array of paths to preload scripts that have been registered.
  11296. */
  11297. getPreloads(): string[];
  11298. /**
  11299. * An array of language codes the spellchecker is enabled for. If this list is
  11300. * empty the spellchecker will fallback to using `en-US`. By default on launch if
  11301. * this setting is an empty list Electron will try to populate this setting with
  11302. * the current OS locale. This setting is persisted across restarts.
  11303. *
  11304. * **Note:** On macOS the OS spellchecker is used and has its own list of
  11305. * languages. On macOS, this API will return whichever languages have been
  11306. * configured by the OS.
  11307. */
  11308. getSpellCheckerLanguages(): string[];
  11309. /**
  11310. * The absolute file system path where data for this session is persisted on disk.
  11311. * For in memory sessions this returns `null`.
  11312. */
  11313. getStoragePath(): (string) | (null);
  11314. /**
  11315. * The user agent for this session.
  11316. */
  11317. getUserAgent(): string;
  11318. /**
  11319. * Whether or not this session is a persistent one. The default `webContents`
  11320. * session of a `BrowserWindow` is persistent. When creating a session from a
  11321. * partition, session prefixed with `persist:` will be persistent, while others
  11322. * will be temporary.
  11323. */
  11324. isPersistent(): boolean;
  11325. /**
  11326. * Whether the builtin spell checker is enabled.
  11327. */
  11328. isSpellCheckerEnabled(): boolean;
  11329. /**
  11330. * An array of all words in app's custom dictionary. Resolves when the full
  11331. * dictionary is loaded from disk.
  11332. */
  11333. listWordsInSpellCheckerDictionary(): Promise<string[]>;
  11334. /**
  11335. * resolves when the extension is loaded.
  11336. *
  11337. * This method will raise an exception if the extension could not be loaded. If
  11338. * there are warnings when installing the extension (e.g. if the extension requests
  11339. * an API that Electron does not support) then they will be logged to the console.
  11340. *
  11341. * Note that Electron does not support the full range of Chrome extensions APIs.
  11342. * See Supported Extensions APIs for more details on what is supported.
  11343. *
  11344. * Note that in previous versions of Electron, extensions that were loaded would be
  11345. * remembered for future runs of the application. This is no longer the case:
  11346. * `loadExtension` must be called on every boot of your app if you want the
  11347. * extension to be loaded.
  11348. *
  11349. * This API does not support loading packed (.crx) extensions.
  11350. *
  11351. * **Note:** This API cannot be called before the `ready` event of the `app` module
  11352. * is emitted.
  11353. *
  11354. * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
  11355. * supported and will throw an error.
  11356. */
  11357. loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
  11358. /**
  11359. * Preconnects the given number of sockets to an origin.
  11360. */
  11361. preconnect(options: PreconnectOptions): void;
  11362. /**
  11363. * Unloads an extension.
  11364. *
  11365. * **Note:** This API cannot be called before the `ready` event of the `app` module
  11366. * is emitted.
  11367. */
  11368. removeExtension(extensionId: string): void;
  11369. /**
  11370. * Whether the word was successfully removed from the custom dictionary. This API
  11371. * will not work on non-persistent (in-memory) sessions.
  11372. *
  11373. * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
  11374. * dictionary as well
  11375. */
  11376. removeWordFromSpellCheckerDictionary(word: string): boolean;
  11377. /**
  11378. * Resolves with the resolved IP addresses for the `host`.
  11379. */
  11380. resolveHost(host: string, options?: ResolveHostOptions): Promise<Electron.ResolvedHost>;
  11381. /**
  11382. * Resolves with the proxy information for `url`.
  11383. */
  11384. resolveProxy(url: string): Promise<string>;
  11385. /**
  11386. * Sets a handler to respond to Bluetooth pairing requests. This handler allows
  11387. * developers to handle devices that require additional validation before pairing.
  11388. * When a handler is not defined, any pairing on Linux or Windows that requires
  11389. * additional validation will be automatically cancelled. macOS does not require a
  11390. * handler because macOS handles the pairing automatically. To clear the handler,
  11391. * call `setBluetoothPairingHandler(null)`.
  11392. *
  11393. * @platform win32,linux
  11394. */
  11395. setBluetoothPairingHandler(handler: ((details: BluetoothPairingHandlerHandlerDetails, callback: (response: Response) => void) => void) | (null)): void;
  11396. /**
  11397. * Sets the certificate verify proc for `session`, the `proc` will be called with
  11398. * `proc(request, callback)` whenever a server certificate verification is
  11399. * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
  11400. * rejects it.
  11401. *
  11402. * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
  11403. * verify proc.
  11404. *
  11405. * > **NOTE:** The result of this procedure is cached by the network service.
  11406. */
  11407. setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
  11408. /**
  11409. * Sets the directory to store the generated JS code cache for this session. The
  11410. * directory is not required to be created by the user before this call, the
  11411. * runtime will create if it does not exist otherwise will use the existing
  11412. * directory. If directory cannot be created, then code cache will not be used and
  11413. * all operations related to code cache will fail silently inside the runtime. By
  11414. * default, the directory will be `Code Cache` under the respective user data
  11415. * folder.
  11416. *
  11417. * Note that by default code cache is only enabled for http(s) URLs, to enable code
  11418. * cache for custom protocols, `codeCache: true` and `standard: true` must be
  11419. * specified when registering the protocol.
  11420. */
  11421. setCodeCachePath(path: string): void;
  11422. /**
  11423. * Sets the handler which can be used to respond to device permission checks for
  11424. * the `session`. Returning `true` will allow the device to be permitted and
  11425. * `false` will reject it. To clear the handler, call
  11426. * `setDevicePermissionHandler(null)`. This handler can be used to provide default
  11427. * permissioning to devices without first calling for permission to devices (eg via
  11428. * `navigator.hid.requestDevice`). If this handler is not defined, the default
  11429. * device permissions as granted through device selection (eg via
  11430. * `navigator.hid.requestDevice`) will be used. Additionally, the default behavior
  11431. * of Electron is to store granted device permission in memory. If longer term
  11432. * storage is needed, a developer can store granted device permissions (eg when
  11433. * handling the `select-hid-device` event) and then read from that storage with
  11434. * `setDevicePermissionHandler`.
  11435. */
  11436. setDevicePermissionHandler(handler: ((details: DevicePermissionHandlerHandlerDetails) => boolean) | (null)): void;
  11437. /**
  11438. * This handler will be called when web content requests access to display media
  11439. * via the `navigator.mediaDevices.getDisplayMedia` API. Use the desktopCapturer
  11440. * API to choose which stream(s) to grant access to.
  11441. *
  11442. * Passing a WebFrameMain object as a video or audio stream will capture the video
  11443. * or audio stream from that frame.
  11444. *
  11445. * Passing `null` instead of a function resets the handler to its default state.
  11446. */
  11447. setDisplayMediaRequestHandler(handler: ((request: DisplayMediaRequestHandlerHandlerRequest, callback: (streams: Streams) => void) => void) | (null)): void;
  11448. /**
  11449. * Sets download saving directory. By default, the download directory will be the
  11450. * `Downloads` under the respective app folder.
  11451. */
  11452. setDownloadPath(path: string): void;
  11453. /**
  11454. * Sets the handler which can be used to respond to permission checks for the
  11455. * `session`. Returning `true` will allow the permission and `false` will reject
  11456. * it. Please note that you must also implement `setPermissionRequestHandler` to
  11457. * get complete permission handling. Most web APIs do a permission check and then
  11458. * make a permission request if the check is denied. To clear the handler, call
  11459. * `setPermissionCheckHandler(null)`.
  11460. */
  11461. setPermissionCheckHandler(handler: ((webContents: (WebContents) | (null), permission: 'clipboard-read' | 'clipboard-sanitized-write' | 'geolocation' | 'fullscreen' | 'hid' | 'idle-detection' | 'media' | 'mediaKeySystem' | 'midi' | 'midiSysex' | 'notifications' | 'openExternal' | 'pointerLock' | 'serial' | 'storage-access' | 'top-level-storage-access' | 'usb', requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
  11462. /**
  11463. * Sets the handler which can be used to respond to permission requests for the
  11464. * `session`. Calling `callback(true)` will allow the permission and
  11465. * `callback(false)` will reject it. To clear the handler, call
  11466. * `setPermissionRequestHandler(null)`. Please note that you must also implement
  11467. * `setPermissionCheckHandler` to get complete permission handling. Most web APIs
  11468. * do a permission check and then make a permission request if the check is denied.
  11469. */
  11470. setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'clipboard-sanitized-write' | 'display-capture' | 'fullscreen' | 'geolocation' | 'idle-detection' | 'media' | 'mediaKeySystem' | 'midi' | 'midiSysex' | 'notifications' | 'pointerLock' | 'keyboardLock' | 'openExternal' | 'speaker-selection' | 'storage-access' | 'top-level-storage-access' | 'window-management' | 'unknown' | 'fileSystem', callback: (permissionGranted: boolean) => void, details: (PermissionRequest) | (FilesystemPermissionRequest) | (MediaAccessPermissionRequest) | (OpenExternalPermissionRequest)) => void) | (null)): void;
  11471. /**
  11472. * Adds scripts that will be executed on ALL web contents that are associated with
  11473. * this session just before normal `preload` scripts run.
  11474. */
  11475. setPreloads(preloads: string[]): void;
  11476. /**
  11477. * Resolves when the proxy setting process is complete.
  11478. *
  11479. * Sets the proxy settings.
  11480. *
  11481. * You may need `ses.closeAllConnections` to close currently in flight connections
  11482. * to prevent pooled sockets using previous proxy from being reused by future
  11483. * requests.
  11484. */
  11485. setProxy(config: ProxyConfig): Promise<void>;
  11486. /**
  11487. * By default Electron will download hunspell dictionaries from the Chromium CDN.
  11488. * If you want to override this behavior you can use this API to point the
  11489. * dictionary downloader at your own hosted version of the hunspell dictionaries.
  11490. * We publish a `hunspell_dictionaries.zip` file with each release which contains
  11491. * the files you need to host here.
  11492. *
  11493. * The file server must be **case insensitive**. If you cannot do this, you must
  11494. * upload each file twice: once with the case it has in the ZIP file and once with
  11495. * the filename as all lowercase.
  11496. *
  11497. * If the files present in `hunspell_dictionaries.zip` are available at
  11498. * `https://example.com/dictionaries/language-code.bdic` then you should call this
  11499. * api with
  11500. * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
  11501. * Please note the trailing slash. The URL to the dictionaries is formed as
  11502. * `${url}${filename}`.
  11503. *
  11504. * **Note:** On macOS the OS spellchecker is used and therefore we do not download
  11505. * any dictionary files. This API is a no-op on macOS.
  11506. */
  11507. setSpellCheckerDictionaryDownloadURL(url: string): void;
  11508. /**
  11509. * Sets whether to enable the builtin spell checker.
  11510. */
  11511. setSpellCheckerEnabled(enable: boolean): void;
  11512. /**
  11513. * The built in spellchecker does not automatically detect what language a user is
  11514. * typing in. In order for the spell checker to correctly check their words you
  11515. * must call this API with an array of language codes. You can get the list of
  11516. * supported language codes with the `ses.availableSpellCheckerLanguages` property.
  11517. *
  11518. * **Note:** On macOS the OS spellchecker is used and will detect your language
  11519. * automatically. This API is a no-op on macOS.
  11520. */
  11521. setSpellCheckerLanguages(languages: string[]): void;
  11522. /**
  11523. * Sets the SSL configuration for the session. All subsequent network requests will
  11524. * use the new configuration. Existing network connections (such as WebSocket
  11525. * connections) will not be terminated, but old sockets in the pool will not be
  11526. * reused for new connections.
  11527. */
  11528. setSSLConfig(config: Config): void;
  11529. /**
  11530. * Sets the handler which can be used to override which USB classes are protected.
  11531. * The return value for the handler is a string array of USB classes which should
  11532. * be considered protected (eg not available in the renderer). Valid values for
  11533. * the array are:
  11534. *
  11535. * * `audio`
  11536. * * `audio-video`
  11537. * * `hid`
  11538. * * `mass-storage`
  11539. * * `smart-card`
  11540. * * `video`
  11541. * * `wireless`
  11542. *
  11543. * Returning an empty string array from the handler will allow all USB classes;
  11544. * returning the passed in array will maintain the default list of protected USB
  11545. * classes (this is also the default behavior if a handler is not defined). To
  11546. * clear the handler, call `setUSBProtectedClassesHandler(null)`.
  11547. */
  11548. setUSBProtectedClassesHandler(handler: ((details: USBProtectedClassesHandlerHandlerDetails) => string[]) | (null)): void;
  11549. /**
  11550. * Overrides the `userAgent` and `acceptLanguages` for this session.
  11551. *
  11552. * The `acceptLanguages` must a comma separated ordered list of language codes, for
  11553. * example `"en-US,fr,de,ko,zh-CN,ja"`.
  11554. *
  11555. * This doesn't affect existing `WebContents`, and each `WebContents` can use
  11556. * `webContents.setUserAgent` to override the session-wide user agent.
  11557. */
  11558. setUserAgent(userAgent: string, acceptLanguages?: string): void;
  11559. /**
  11560. * A `string[]` array which consists of all the known available spell checker
  11561. * languages. Providing a language code to the `setSpellCheckerLanguages` API that
  11562. * isn't in this array will result in an error.
  11563. *
  11564. */
  11565. readonly availableSpellCheckerLanguages: string[];
  11566. /**
  11567. * A `Cookies` object for this session.
  11568. *
  11569. */
  11570. readonly cookies: Cookies;
  11571. /**
  11572. * A `NetLog` object for this session.
  11573. *
  11574. */
  11575. readonly netLog: NetLog;
  11576. /**
  11577. * A `Protocol` object for this session.
  11578. *
  11579. */
  11580. readonly protocol: Protocol;
  11581. /**
  11582. * A `ServiceWorkers` object for this session.
  11583. *
  11584. */
  11585. readonly serviceWorkers: ServiceWorkers;
  11586. /**
  11587. * A `boolean` indicating whether builtin spell checker is enabled.
  11588. */
  11589. spellCheckerEnabled: boolean;
  11590. /**
  11591. * A `string | null` indicating the absolute file system path where data for this
  11592. * session is persisted on disk. For in memory sessions this returns `null`.
  11593. *
  11594. */
  11595. readonly storagePath: (string) | (null);
  11596. /**
  11597. * A `WebRequest` object for this session.
  11598. *
  11599. */
  11600. readonly webRequest: WebRequest;
  11601. }
  11602. interface SharedWorkerInfo {
  11603. // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
  11604. /**
  11605. * The unique id of the shared worker.
  11606. */
  11607. id: string;
  11608. /**
  11609. * The url of the shared worker.
  11610. */
  11611. url: string;
  11612. }
  11613. class ShareMenu extends NodeEventEmitter {
  11614. // Docs: https://electronjs.org/docs/api/share-menu
  11615. /**
  11616. * ShareMenu
  11617. */
  11618. constructor(sharingItem: SharingItem);
  11619. /**
  11620. * Closes the context menu in the `browserWindow`.
  11621. */
  11622. closePopup(browserWindow?: BrowserWindow): void;
  11623. /**
  11624. * Pops up this menu as a context menu in the `BrowserWindow`.
  11625. */
  11626. popup(options?: PopupOptions): void;
  11627. }
  11628. interface SharingItem {
  11629. // Docs: https://electronjs.org/docs/api/structures/sharing-item
  11630. /**
  11631. * An array of files to share.
  11632. */
  11633. filePaths?: string[];
  11634. /**
  11635. * An array of text to share.
  11636. */
  11637. texts?: string[];
  11638. /**
  11639. * An array of URLs to share.
  11640. */
  11641. urls?: string[];
  11642. }
  11643. interface Shell {
  11644. // Docs: https://electronjs.org/docs/api/shell
  11645. /**
  11646. * Play the beep sound.
  11647. */
  11648. beep(): void;
  11649. /**
  11650. * Open the given external protocol URL in the desktop's default manner. (For
  11651. * example, mailto: URLs in the user's default mail agent).
  11652. */
  11653. openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
  11654. /**
  11655. * Resolves with a string containing the error message corresponding to the failure
  11656. * if a failure occurred, otherwise "".
  11657. *
  11658. * Open the given file in the desktop's default manner.
  11659. */
  11660. openPath(path: string): Promise<string>;
  11661. /**
  11662. * Resolves the shortcut link at `shortcutPath`.
  11663. *
  11664. * An exception will be thrown when any error happens.
  11665. *
  11666. * @platform win32
  11667. */
  11668. readShortcutLink(shortcutPath: string): ShortcutDetails;
  11669. /**
  11670. * Show the given file in a file manager. If possible, select the file.
  11671. */
  11672. showItemInFolder(fullPath: string): void;
  11673. /**
  11674. * Resolves when the operation has been completed. Rejects if there was an error
  11675. * while deleting the requested item.
  11676. *
  11677. * This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin
  11678. * on Windows, and a desktop-environment-specific location on Linux).
  11679. */
  11680. trashItem(path: string): Promise<void>;
  11681. /**
  11682. * Whether the shortcut was created successfully.
  11683. *
  11684. * Creates or updates a shortcut link at `shortcutPath`.
  11685. *
  11686. * @platform win32
  11687. */
  11688. writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
  11689. /**
  11690. * Whether the shortcut was created successfully.
  11691. *
  11692. * Creates or updates a shortcut link at `shortcutPath`.
  11693. *
  11694. * @platform win32
  11695. */
  11696. writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
  11697. }
  11698. interface ShortcutDetails {
  11699. // Docs: https://electronjs.org/docs/api/structures/shortcut-details
  11700. /**
  11701. * The Application User Model ID. Default is empty.
  11702. */
  11703. appUserModelId?: string;
  11704. /**
  11705. * The arguments to be applied to `target` when launching from this shortcut.
  11706. * Default is empty.
  11707. */
  11708. args?: string;
  11709. /**
  11710. * The working directory. Default is empty.
  11711. */
  11712. cwd?: string;
  11713. /**
  11714. * The description of the shortcut. Default is empty.
  11715. */
  11716. description?: string;
  11717. /**
  11718. * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
  11719. * together. Default is empty, which uses the target's icon.
  11720. */
  11721. icon?: string;
  11722. /**
  11723. * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
  11724. */
  11725. iconIndex?: number;
  11726. /**
  11727. * The target to launch from this shortcut.
  11728. */
  11729. target: string;
  11730. /**
  11731. * The Application Toast Activator CLSID. Needed for participating in Action
  11732. * Center.
  11733. */
  11734. toastActivatorClsid?: string;
  11735. }
  11736. interface Size {
  11737. // Docs: https://electronjs.org/docs/api/structures/size
  11738. height: number;
  11739. width: number;
  11740. }
  11741. interface SystemPreferences extends NodeJS.EventEmitter {
  11742. // Docs: https://electronjs.org/docs/api/system-preferences
  11743. /**
  11744. * @platform win32
  11745. */
  11746. on(event: 'accent-color-changed', listener: (event: Event,
  11747. /**
  11748. * The new RGBA color the user assigned to be their system accent color.
  11749. */
  11750. newColor: string) => void): this;
  11751. /**
  11752. * @platform win32
  11753. */
  11754. off(event: 'accent-color-changed', listener: (event: Event,
  11755. /**
  11756. * The new RGBA color the user assigned to be their system accent color.
  11757. */
  11758. newColor: string) => void): this;
  11759. /**
  11760. * @platform win32
  11761. */
  11762. once(event: 'accent-color-changed', listener: (event: Event,
  11763. /**
  11764. * The new RGBA color the user assigned to be their system accent color.
  11765. */
  11766. newColor: string) => void): this;
  11767. /**
  11768. * @platform win32
  11769. */
  11770. addListener(event: 'accent-color-changed', listener: (event: Event,
  11771. /**
  11772. * The new RGBA color the user assigned to be their system accent color.
  11773. */
  11774. newColor: string) => void): this;
  11775. /**
  11776. * @platform win32
  11777. */
  11778. removeListener(event: 'accent-color-changed', listener: (event: Event,
  11779. /**
  11780. * The new RGBA color the user assigned to be their system accent color.
  11781. */
  11782. newColor: string) => void): this;
  11783. /**
  11784. * @platform win32
  11785. */
  11786. on(event: 'color-changed', listener: (event: Event) => void): this;
  11787. /**
  11788. * @platform win32
  11789. */
  11790. off(event: 'color-changed', listener: (event: Event) => void): this;
  11791. /**
  11792. * @platform win32
  11793. */
  11794. once(event: 'color-changed', listener: (event: Event) => void): this;
  11795. /**
  11796. * @platform win32
  11797. */
  11798. addListener(event: 'color-changed', listener: (event: Event) => void): this;
  11799. /**
  11800. * @platform win32
  11801. */
  11802. removeListener(event: 'color-changed', listener: (event: Event) => void): this;
  11803. /**
  11804. * A promise that resolves with `true` if consent was granted and `false` if it was
  11805. * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
  11806. * access request was denied and later is changed through the System Preferences
  11807. * pane, a restart of the app will be required for the new permissions to take
  11808. * effect. If access has already been requested and denied, it _must_ be changed
  11809. * through the preference pane; an alert will not pop up and the promise will
  11810. * resolve with the existing access status.
  11811. *
  11812. * **Important:** In order to properly leverage this API, you must set the
  11813. * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
  11814. * app's `Info.plist` file. The values for these keys will be used to populate the
  11815. * permission dialogs so that the user will be properly informed as to the purpose
  11816. * of the permission request. See Electron Application Distribution for more
  11817. * information about how to set these in the context of Electron.
  11818. *
  11819. * This user consent was not required until macOS 10.14 Mojave, so this method will
  11820. * always return `true` if your system is running 10.13 High Sierra.
  11821. *
  11822. * @platform darwin
  11823. */
  11824. askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
  11825. /**
  11826. * whether or not this device has the ability to use Touch ID.
  11827. *
  11828. * @platform darwin
  11829. */
  11830. canPromptTouchID(): boolean;
  11831. /**
  11832. * The users current system wide accent color preference in RGBA hexadecimal form.
  11833. *
  11834. * This API is only available on macOS 10.14 Mojave or newer.
  11835. *
  11836. * @platform win32,darwin
  11837. */
  11838. getAccentColor(): string;
  11839. /**
  11840. * * `shouldRenderRichAnimation` boolean - Returns true if rich animations should
  11841. * be rendered. Looks at session type (e.g. remote desktop) and accessibility
  11842. * settings to give guidance for heavy animations.
  11843. * * `scrollAnimationsEnabledBySystem` boolean - Determines on a per-platform basis
  11844. * whether scroll animations (e.g. produced by home/end key) should be enabled.
  11845. * * `prefersReducedMotion` boolean - Determines whether the user desires reduced
  11846. * motion based on platform APIs.
  11847. *
  11848. * Returns an object with system animation settings.
  11849. */
  11850. getAnimationSettings(): AnimationSettings;
  11851. /**
  11852. * The system color setting in RGBA hexadecimal form (`#RRGGBBAA`). See the Windows
  11853. * docs and the macOS docs for more details.
  11854. *
  11855. * The following colors are only available on macOS 10.14: `find-highlight`,
  11856. * `selected-content-background`, `separator`,
  11857. * `unemphasized-selected-content-background`,
  11858. * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
  11859. *
  11860. * @platform win32,darwin
  11861. */
  11862. getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text' | 'control-background' | 'control' | 'control-text' | 'disabled-control-text' | 'find-highlight' | 'grid' | 'header-text' | 'highlight' | 'keyboard-focus-indicator' | 'label' | 'link' | 'placeholder-text' | 'quaternary-label' | 'scrubber-textured-background' | 'secondary-label' | 'selected-content-background' | 'selected-control' | 'selected-control-text' | 'selected-menu-item-text' | 'selected-text-background' | 'selected-text' | 'separator' | 'shadow' | 'tertiary-label' | 'text-background' | 'text' | 'under-page-background' | 'unemphasized-selected-content-background' | 'unemphasized-selected-text-background' | 'unemphasized-selected-text' | 'window-background' | 'window-frame-text'): string;
  11863. /**
  11864. * Can be `dark`, `light` or `unknown`.
  11865. *
  11866. * Gets the macOS appearance setting that is currently applied to your application,
  11867. * maps to NSApplication.effectiveAppearance
  11868. *
  11869. * @platform darwin
  11870. */
  11871. getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
  11872. /**
  11873. * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
  11874. *
  11875. * This user consent was not required on macOS 10.13 High Sierra so this method
  11876. * will always return `granted`. macOS 10.14 Mojave or higher requires consent for
  11877. * `microphone` and `camera` access. macOS 10.15 Catalina or higher requires
  11878. * consent for `screen` access.
  11879. *
  11880. * Windows 10 has a global setting controlling `microphone` and `camera` access for
  11881. * all win32 applications. It will always return `granted` for `screen` and for all
  11882. * media types on older versions of Windows.
  11883. *
  11884. * @platform win32,darwin
  11885. */
  11886. getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
  11887. /**
  11888. * The standard system color formatted as `#RRGGBBAA`.
  11889. *
  11890. * Returns one of several standard system colors that automatically adapt to
  11891. * vibrancy and changes in accessibility settings like 'Increase contrast' and
  11892. * 'Reduce transparency'. See Apple Documentation for more details.
  11893. *
  11894. * @platform darwin
  11895. */
  11896. getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
  11897. /**
  11898. * The value of `key` in `NSUserDefaults`.
  11899. *
  11900. * Some popular `key` and `type`s are:
  11901. *
  11902. * * `AppleInterfaceStyle`: `string`
  11903. * * `AppleAquaColorVariant`: `integer`
  11904. * * `AppleHighlightColor`: `string`
  11905. * * `AppleShowScrollBars`: `string`
  11906. * * `NSNavRecentPlaces`: `array`
  11907. * * `NSPreferredWebServices`: `dictionary`
  11908. * * `NSUserDictionaryReplacementItems`: `array`
  11909. *
  11910. * @platform darwin
  11911. */
  11912. getUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type): UserDefaultTypes[Type];
  11913. /**
  11914. * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
  11915. *
  11916. * An example of using it to determine if you should create a transparent window or
  11917. * not (transparent windows won't work correctly when DWM composition is disabled):
  11918. *
  11919. * @platform win32
  11920. */
  11921. isAeroGlassEnabled(): boolean;
  11922. /**
  11923. * Whether the Swipe between pages setting is on.
  11924. *
  11925. * @platform darwin
  11926. */
  11927. isSwipeTrackingFromScrollEventsEnabled(): boolean;
  11928. /**
  11929. * `true` if the current process is a trusted accessibility client and `false` if
  11930. * it is not.
  11931. *
  11932. * @platform darwin
  11933. */
  11934. isTrustedAccessibilityClient(prompt: boolean): boolean;
  11935. /**
  11936. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  11937. * contains the user information dictionary sent along with the notification.
  11938. *
  11939. * @platform darwin
  11940. */
  11941. postLocalNotification(event: string, userInfo: Record<string, any>): void;
  11942. /**
  11943. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  11944. * contains the user information dictionary sent along with the notification.
  11945. *
  11946. * @platform darwin
  11947. */
  11948. postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
  11949. /**
  11950. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  11951. * contains the user information dictionary sent along with the notification.
  11952. *
  11953. * @platform darwin
  11954. */
  11955. postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
  11956. /**
  11957. * resolves if the user has successfully authenticated with Touch ID.
  11958. *
  11959. * This API itself will not protect your user data; rather, it is a mechanism to
  11960. * allow you to do so. Native apps will need to set Access Control Constants like
  11961. * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
  11962. * auto-prompt for Touch ID biometric consent. This could be done with
  11963. * `node-keytar`, such that one would store an encryption key with `node-keytar`
  11964. * and only fetch it if `promptTouchID()` resolves.
  11965. *
  11966. * @platform darwin
  11967. */
  11968. promptTouchID(reason: string): Promise<void>;
  11969. /**
  11970. * Add the specified defaults to your application's `NSUserDefaults`.
  11971. *
  11972. * @platform darwin
  11973. */
  11974. registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
  11975. /**
  11976. * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
  11977. * or global value of a `key` previously set with `setUserDefault`.
  11978. *
  11979. * @platform darwin
  11980. */
  11981. removeUserDefault(key: string): void;
  11982. /**
  11983. * Set the value of `key` in `NSUserDefaults`.
  11984. *
  11985. * Note that `type` should match actual type of `value`. An exception is thrown if
  11986. * they don't.
  11987. *
  11988. * Some popular `key` and `type`s are:
  11989. *
  11990. * * `ApplePressAndHoldEnabled`: `boolean`
  11991. *
  11992. * @platform darwin
  11993. */
  11994. setUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type, value: UserDefaultTypes[Type]): void;
  11995. /**
  11996. * The ID of this subscription
  11997. *
  11998. * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
  11999. * defaults. This is necessary for events such as
  12000. * `NSUserDefaultsDidChangeNotification`.
  12001. *
  12002. * If `event` is null, the `NSNotificationCenter` doesn’t use it as criteria for
  12003. * delivery to the observer. See docs for more information.
  12004. *
  12005. * @platform darwin
  12006. */
  12007. subscribeLocalNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  12008. /**
  12009. * The ID of this subscription
  12010. *
  12011. * Subscribes to native notifications of macOS, `callback` will be called with
  12012. * `callback(event, userInfo)` when the corresponding `event` happens. The
  12013. * `userInfo` is an Object that contains the user information dictionary sent along
  12014. * with the notification. The `object` is the sender of the notification, and only
  12015. * supports `NSString` values for now.
  12016. *
  12017. * The `id` of the subscriber is returned, which can be used to unsubscribe the
  12018. * `event`.
  12019. *
  12020. * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
  12021. * values of `event` are:
  12022. *
  12023. * * `AppleInterfaceThemeChangedNotification`
  12024. * * `AppleAquaColorVariantChanged`
  12025. * * `AppleColorPreferencesChangedNotification`
  12026. * * `AppleShowScrollBarsSettingChanged`
  12027. *
  12028. * If `event` is null, the `NSDistributedNotificationCenter` doesn’t use it as
  12029. * criteria for delivery to the observer. See docs for more information.
  12030. *
  12031. * @platform darwin
  12032. */
  12033. subscribeNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  12034. /**
  12035. * The ID of this subscription
  12036. *
  12037. * Same as `subscribeNotification`, but uses
  12038. * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
  12039. * such as `NSWorkspaceDidActivateApplicationNotification`.
  12040. *
  12041. * If `event` is null, the `NSWorkspaceNotificationCenter` doesn’t use it as
  12042. * criteria for delivery to the observer. See docs for more information.
  12043. *
  12044. * @platform darwin
  12045. */
  12046. subscribeWorkspaceNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  12047. /**
  12048. * Same as `unsubscribeNotification`, but removes the subscriber from
  12049. * `NSNotificationCenter`.
  12050. *
  12051. * @platform darwin
  12052. */
  12053. unsubscribeLocalNotification(id: number): void;
  12054. /**
  12055. * Removes the subscriber with `id`.
  12056. *
  12057. * @platform darwin
  12058. */
  12059. unsubscribeNotification(id: number): void;
  12060. /**
  12061. * Same as `unsubscribeNotification`, but removes the subscriber from
  12062. * `NSWorkspace.sharedWorkspace.notificationCenter`.
  12063. *
  12064. * @platform darwin
  12065. */
  12066. unsubscribeWorkspaceNotification(id: number): void;
  12067. /**
  12068. * A `boolean` property which determines whether the app avoids using
  12069. * semitransparent backgrounds. This maps to
  12070. * NSWorkspace.accessibilityDisplayShouldReduceTransparency
  12071. *
  12072. * @platform darwin
  12073. */
  12074. accessibilityDisplayShouldReduceTransparency(): boolean;
  12075. /**
  12076. * A `string` property that can be `dark`, `light` or `unknown`.
  12077. *
  12078. * Returns the macOS appearance setting that is currently applied to your
  12079. * application, maps to NSApplication.effectiveAppearance
  12080. *
  12081. * @platform darwin
  12082. */
  12083. readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
  12084. }
  12085. interface Task {
  12086. // Docs: https://electronjs.org/docs/api/structures/task
  12087. /**
  12088. * The command line arguments when `program` is executed.
  12089. */
  12090. arguments: string;
  12091. /**
  12092. * Description of this task.
  12093. */
  12094. description: string;
  12095. /**
  12096. * The icon index in the icon file. If an icon file consists of two or more icons,
  12097. * set this value to identify the icon. If an icon file consists of one icon, this
  12098. * value is 0.
  12099. */
  12100. iconIndex: number;
  12101. /**
  12102. * The absolute path to an icon to be displayed in a JumpList, which can be an
  12103. * arbitrary resource file that contains an icon. You can usually specify
  12104. * `process.execPath` to show the icon of the program.
  12105. */
  12106. iconPath: string;
  12107. /**
  12108. * Path of the program to execute, usually you should specify `process.execPath`
  12109. * which opens the current program.
  12110. */
  12111. program: string;
  12112. /**
  12113. * The string to be displayed in a JumpList.
  12114. */
  12115. title: string;
  12116. /**
  12117. * The working directory. Default is empty.
  12118. */
  12119. workingDirectory?: string;
  12120. }
  12121. interface ThumbarButton {
  12122. // Docs: https://electronjs.org/docs/api/structures/thumbar-button
  12123. click: () => void;
  12124. /**
  12125. * Control specific states and behaviors of the button. By default, it is
  12126. * `['enabled']`.
  12127. */
  12128. flags?: string[];
  12129. /**
  12130. * The icon showing in thumbnail toolbar.
  12131. */
  12132. icon: NativeImage;
  12133. /**
  12134. * The text of the button's tooltip.
  12135. */
  12136. tooltip?: string;
  12137. }
  12138. class TouchBar {
  12139. // Docs: https://electronjs.org/docs/api/touch-bar
  12140. /**
  12141. * TouchBar
  12142. */
  12143. constructor(options: TouchBarConstructorOptions);
  12144. /**
  12145. * A `TouchBarItem` that will replace the "esc" button on the touch bar when set.
  12146. * Setting to `null` restores the default "esc" button. Changing this value
  12147. * immediately updates the escape item in the touch bar.
  12148. */
  12149. escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
  12150. /**
  12151. * A `typeof TouchBarButton` reference to the `TouchBarButton` class.
  12152. */
  12153. static TouchBarButton: typeof TouchBarButton;
  12154. /**
  12155. * A `typeof TouchBarColorPicker` reference to the `TouchBarColorPicker` class.
  12156. */
  12157. static TouchBarColorPicker: typeof TouchBarColorPicker;
  12158. /**
  12159. * A `typeof TouchBarGroup` reference to the `TouchBarGroup` class.
  12160. */
  12161. static TouchBarGroup: typeof TouchBarGroup;
  12162. /**
  12163. * A `typeof TouchBarLabel` reference to the `TouchBarLabel` class.
  12164. */
  12165. static TouchBarLabel: typeof TouchBarLabel;
  12166. /**
  12167. * A `typeof TouchBarOtherItemsProxy` reference to the `TouchBarOtherItemsProxy`
  12168. * class.
  12169. */
  12170. static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
  12171. /**
  12172. * A `typeof TouchBarPopover` reference to the `TouchBarPopover` class.
  12173. */
  12174. static TouchBarPopover: typeof TouchBarPopover;
  12175. /**
  12176. * A `typeof TouchBarScrubber` reference to the `TouchBarScrubber` class.
  12177. */
  12178. static TouchBarScrubber: typeof TouchBarScrubber;
  12179. /**
  12180. * A `typeof TouchBarSegmentedControl` reference to the `TouchBarSegmentedControl`
  12181. * class.
  12182. */
  12183. static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
  12184. /**
  12185. * A `typeof TouchBarSlider` reference to the `TouchBarSlider` class.
  12186. */
  12187. static TouchBarSlider: typeof TouchBarSlider;
  12188. /**
  12189. * A `typeof TouchBarSpacer` reference to the `TouchBarSpacer` class.
  12190. */
  12191. static TouchBarSpacer: typeof TouchBarSpacer;
  12192. }
  12193. class TouchBarButton {
  12194. // Docs: https://electronjs.org/docs/api/touch-bar-button
  12195. /**
  12196. * TouchBarButton
  12197. */
  12198. constructor(options: TouchBarButtonConstructorOptions);
  12199. /**
  12200. * A `string` representing the description of the button to be read by a screen
  12201. * reader. Will only be read by screen readers if no label is set.
  12202. */
  12203. accessibilityLabel: string;
  12204. /**
  12205. * A `string` hex code representing the button's current background color. Changing
  12206. * this value immediately updates the button in the touch bar.
  12207. */
  12208. backgroundColor: string;
  12209. /**
  12210. * A `boolean` representing whether the button is in an enabled state.
  12211. */
  12212. enabled: boolean;
  12213. /**
  12214. * A `NativeImage` representing the button's current icon. Changing this value
  12215. * immediately updates the button in the touch bar.
  12216. */
  12217. icon: NativeImage;
  12218. /**
  12219. * A `string` - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
  12220. */
  12221. iconPosition: ('left' | 'right' | 'overlay');
  12222. /**
  12223. * A `string` representing the button's current text. Changing this value
  12224. * immediately updates the button in the touch bar.
  12225. */
  12226. label: string;
  12227. }
  12228. class TouchBarColorPicker extends NodeEventEmitter {
  12229. // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
  12230. /**
  12231. * TouchBarColorPicker
  12232. */
  12233. constructor(options: TouchBarColorPickerConstructorOptions);
  12234. /**
  12235. * A `string[]` array representing the color picker's available colors to select.
  12236. * Changing this value immediately updates the color picker in the touch bar.
  12237. */
  12238. availableColors: string[];
  12239. /**
  12240. * A `string` hex code representing the color picker's currently selected color.
  12241. * Changing this value immediately updates the color picker in the touch bar.
  12242. */
  12243. selectedColor: string;
  12244. }
  12245. class TouchBarGroup extends NodeEventEmitter {
  12246. // Docs: https://electronjs.org/docs/api/touch-bar-group
  12247. /**
  12248. * TouchBarGroup
  12249. */
  12250. constructor(options: TouchBarGroupConstructorOptions);
  12251. }
  12252. class TouchBarLabel extends NodeEventEmitter {
  12253. // Docs: https://electronjs.org/docs/api/touch-bar-label
  12254. /**
  12255. * TouchBarLabel
  12256. */
  12257. constructor(options: TouchBarLabelConstructorOptions);
  12258. /**
  12259. * A `string` representing the description of the label to be read by a screen
  12260. * reader.
  12261. */
  12262. accessibilityLabel: string;
  12263. /**
  12264. * A `string` representing the label's current text. Changing this value
  12265. * immediately updates the label in the touch bar.
  12266. */
  12267. label: string;
  12268. /**
  12269. * A `string` hex code representing the label's current text color. Changing this
  12270. * value immediately updates the label in the touch bar.
  12271. */
  12272. textColor: string;
  12273. }
  12274. class TouchBarOtherItemsProxy extends NodeEventEmitter {
  12275. // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
  12276. /**
  12277. * TouchBarOtherItemsProxy
  12278. */
  12279. constructor();
  12280. }
  12281. class TouchBarPopover extends NodeEventEmitter {
  12282. // Docs: https://electronjs.org/docs/api/touch-bar-popover
  12283. /**
  12284. * TouchBarPopover
  12285. */
  12286. constructor(options: TouchBarPopoverConstructorOptions);
  12287. /**
  12288. * A `NativeImage` representing the popover's current button icon. Changing this
  12289. * value immediately updates the popover in the touch bar.
  12290. */
  12291. icon: NativeImage;
  12292. /**
  12293. * A `string` representing the popover's current button text. Changing this value
  12294. * immediately updates the popover in the touch bar.
  12295. */
  12296. label: string;
  12297. }
  12298. class TouchBarScrubber extends NodeEventEmitter {
  12299. // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
  12300. /**
  12301. * TouchBarScrubber
  12302. */
  12303. constructor(options: TouchBarScrubberConstructorOptions);
  12304. /**
  12305. * A `boolean` representing whether this scrubber is continuous or not. Updating
  12306. * this value immediately updates the control in the touch bar.
  12307. */
  12308. continuous: boolean;
  12309. /**
  12310. * A `ScrubberItem[]` array representing the items in this scrubber. Updating this
  12311. * value immediately updates the control in the touch bar. Updating deep properties
  12312. * inside this array **does not update the touch bar**.
  12313. */
  12314. items: ScrubberItem[];
  12315. /**
  12316. * A `string` representing the mode of this scrubber. Updating this value
  12317. * immediately updates the control in the touch bar. Possible values:
  12318. *
  12319. * * `fixed` - Maps to `NSScrubberModeFixed`.
  12320. * * `free` - Maps to `NSScrubberModeFree`.
  12321. */
  12322. mode: ('fixed' | 'free');
  12323. /**
  12324. * A `string` representing the style that selected items in the scrubber should
  12325. * have. This style is overlayed on top of the scrubber item instead of being
  12326. * placed behind it. Updating this value immediately updates the control in the
  12327. * touch bar. Possible values:
  12328. *
  12329. * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
  12330. * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
  12331. * * `none` - Removes all styles.
  12332. */
  12333. overlayStyle: ('background' | 'outline' | 'none');
  12334. /**
  12335. * A `string` representing the style that selected items in the scrubber should
  12336. * have. Updating this value immediately updates the control in the touch bar.
  12337. * Possible values:
  12338. *
  12339. * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
  12340. * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
  12341. * * `none` - Removes all styles.
  12342. */
  12343. selectedStyle: ('background' | 'outline' | 'none');
  12344. /**
  12345. * A `boolean` representing whether to show the left / right selection arrows in
  12346. * this scrubber. Updating this value immediately updates the control in the touch
  12347. * bar.
  12348. */
  12349. showArrowButtons: boolean;
  12350. }
  12351. class TouchBarSegmentedControl extends NodeEventEmitter {
  12352. // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
  12353. /**
  12354. * TouchBarSegmentedControl
  12355. */
  12356. constructor(options: TouchBarSegmentedControlConstructorOptions);
  12357. /**
  12358. * A `string` representing the current selection mode of the control. Can be
  12359. * `single`, `multiple` or `buttons`.
  12360. */
  12361. mode: ('single' | 'multiple' | 'buttons');
  12362. /**
  12363. * A `SegmentedControlSegment[]` array representing the segments in this control.
  12364. * Updating this value immediately updates the control in the touch bar. Updating
  12365. * deep properties inside this array **does not update the touch bar**.
  12366. */
  12367. segments: SegmentedControlSegment[];
  12368. /**
  12369. * A `string` representing the controls current segment style. Updating this value
  12370. * immediately updates the control in the touch bar.
  12371. */
  12372. segmentStyle: string;
  12373. /**
  12374. * An `Integer` representing the currently selected segment. Changing this value
  12375. * immediately updates the control in the touch bar. User interaction with the
  12376. * touch bar will update this value automatically.
  12377. */
  12378. selectedIndex: number;
  12379. }
  12380. class TouchBarSlider extends NodeEventEmitter {
  12381. // Docs: https://electronjs.org/docs/api/touch-bar-slider
  12382. /**
  12383. * TouchBarSlider
  12384. */
  12385. constructor(options: TouchBarSliderConstructorOptions);
  12386. /**
  12387. * A `string` representing the slider's current text. Changing this value
  12388. * immediately updates the slider in the touch bar.
  12389. */
  12390. label: string;
  12391. /**
  12392. * A `number` representing the slider's current maximum value. Changing this value
  12393. * immediately updates the slider in the touch bar.
  12394. */
  12395. maxValue: number;
  12396. /**
  12397. * A `number` representing the slider's current minimum value. Changing this value
  12398. * immediately updates the slider in the touch bar.
  12399. */
  12400. minValue: number;
  12401. /**
  12402. * A `number` representing the slider's current value. Changing this value
  12403. * immediately updates the slider in the touch bar.
  12404. */
  12405. value: number;
  12406. }
  12407. class TouchBarSpacer extends NodeEventEmitter {
  12408. // Docs: https://electronjs.org/docs/api/touch-bar-spacer
  12409. /**
  12410. * TouchBarSpacer
  12411. */
  12412. constructor(options: TouchBarSpacerConstructorOptions);
  12413. /**
  12414. * A `string` representing the size of the spacer. Can be `small`, `large` or
  12415. * `flexible`.
  12416. */
  12417. size: ('small' | 'large' | 'flexible');
  12418. }
  12419. interface TraceCategoriesAndOptions {
  12420. // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
  12421. /**
  12422. * A filter to control what category groups should be traced. A filter can have an
  12423. * optional '-' prefix to exclude category groups that contain a matching category.
  12424. * Having both included and excluded category patterns in the same list is not
  12425. * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
  12426. * `-excluded_category1,-excluded_category2`.
  12427. */
  12428. categoryFilter: string;
  12429. /**
  12430. * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
  12431. * the following strings: `record-until-full`, `record-continuously`,
  12432. * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
  12433. * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
  12434. * modes and hence mutually exclusive. If more than one trace recording modes
  12435. * appear in the `traceOptions` string, the last one takes precedence. If none of
  12436. * the trace recording modes are specified, recording mode is `record-until-full`.
  12437. * The trace option will first be reset to the default option (`record_mode` set to
  12438. * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
  12439. * before options parsed from `traceOptions` are applied on it.
  12440. */
  12441. traceOptions: string;
  12442. }
  12443. interface TraceConfig {
  12444. // Docs: https://electronjs.org/docs/api/structures/trace-config
  12445. /**
  12446. * if true, filter event data according to a specific list of events that have been
  12447. * manually vetted to not include any PII. See the implementation in Chromium for
  12448. * specifics.
  12449. */
  12450. enable_argument_filter?: boolean;
  12451. /**
  12452. * a list of tracing categories to exclude. Can include glob-like patterns using
  12453. * `*` at the end of the category name. See tracing categories for the list of
  12454. * categories.
  12455. */
  12456. excluded_categories?: string[];
  12457. /**
  12458. * a list of histogram names to report with the trace.
  12459. */
  12460. histogram_names?: string[];
  12461. /**
  12462. * a list of tracing categories to include. Can include glob-like patterns using
  12463. * `*` at the end of the category name. See tracing categories for the list of
  12464. * categories.
  12465. */
  12466. included_categories?: string[];
  12467. /**
  12468. * a list of process IDs to include in the trace. If not specified, trace all
  12469. * processes.
  12470. */
  12471. included_process_ids?: number[];
  12472. /**
  12473. * if the `disabled-by-default-memory-infra` category is enabled, this contains
  12474. * optional additional configuration for data collection. See the Chromium
  12475. * memory-infra docs for more information.
  12476. */
  12477. memory_dump_config?: Record<string, any>;
  12478. /**
  12479. * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
  12480. * or `trace-to-console`. Defaults to `record-until-full`.
  12481. */
  12482. recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
  12483. /**
  12484. * maximum size of the trace recording buffer in events.
  12485. */
  12486. trace_buffer_size_in_events?: number;
  12487. /**
  12488. * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
  12489. */
  12490. trace_buffer_size_in_kb?: number;
  12491. }
  12492. interface Transaction {
  12493. // Docs: https://electronjs.org/docs/api/structures/transaction
  12494. /**
  12495. * The error code if an error occurred while processing the transaction.
  12496. */
  12497. errorCode: number;
  12498. /**
  12499. * The error message if an error occurred while processing the transaction.
  12500. */
  12501. errorMessage: string;
  12502. /**
  12503. * The identifier of the restored transaction by the App Store.
  12504. */
  12505. originalTransactionIdentifier: string;
  12506. payment: Payment;
  12507. /**
  12508. * The date the transaction was added to the App Store’s payment queue.
  12509. */
  12510. transactionDate: string;
  12511. /**
  12512. * A string that uniquely identifies a successful payment transaction.
  12513. */
  12514. transactionIdentifier: string;
  12515. /**
  12516. * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
  12517. * `deferred`.
  12518. */
  12519. transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
  12520. }
  12521. class Tray extends NodeEventEmitter {
  12522. // Docs: https://electronjs.org/docs/api/tray
  12523. /**
  12524. * Emitted when the tray balloon is clicked.
  12525. *
  12526. * @platform win32
  12527. */
  12528. on(event: 'balloon-click', listener: Function): this;
  12529. /**
  12530. * @platform win32
  12531. */
  12532. off(event: 'balloon-click', listener: Function): this;
  12533. /**
  12534. * @platform win32
  12535. */
  12536. once(event: 'balloon-click', listener: Function): this;
  12537. /**
  12538. * @platform win32
  12539. */
  12540. addListener(event: 'balloon-click', listener: Function): this;
  12541. /**
  12542. * @platform win32
  12543. */
  12544. removeListener(event: 'balloon-click', listener: Function): this;
  12545. /**
  12546. * Emitted when the tray balloon is closed because of timeout or user manually
  12547. * closes it.
  12548. *
  12549. * @platform win32
  12550. */
  12551. on(event: 'balloon-closed', listener: Function): this;
  12552. /**
  12553. * @platform win32
  12554. */
  12555. off(event: 'balloon-closed', listener: Function): this;
  12556. /**
  12557. * @platform win32
  12558. */
  12559. once(event: 'balloon-closed', listener: Function): this;
  12560. /**
  12561. * @platform win32
  12562. */
  12563. addListener(event: 'balloon-closed', listener: Function): this;
  12564. /**
  12565. * @platform win32
  12566. */
  12567. removeListener(event: 'balloon-closed', listener: Function): this;
  12568. /**
  12569. * Emitted when the tray balloon shows.
  12570. *
  12571. * @platform win32
  12572. */
  12573. on(event: 'balloon-show', listener: Function): this;
  12574. /**
  12575. * @platform win32
  12576. */
  12577. off(event: 'balloon-show', listener: Function): this;
  12578. /**
  12579. * @platform win32
  12580. */
  12581. once(event: 'balloon-show', listener: Function): this;
  12582. /**
  12583. * @platform win32
  12584. */
  12585. addListener(event: 'balloon-show', listener: Function): this;
  12586. /**
  12587. * @platform win32
  12588. */
  12589. removeListener(event: 'balloon-show', listener: Function): this;
  12590. /**
  12591. * Emitted when the tray icon is clicked.
  12592. *
  12593. * Note that on Linux this event is emitted when the tray icon receives an
  12594. * activation, which might not necessarily be left mouse click.
  12595. */
  12596. on(event: 'click', listener: (event: KeyboardEvent,
  12597. /**
  12598. * The bounds of tray icon.
  12599. */
  12600. bounds: Rectangle,
  12601. /**
  12602. * The position of the event.
  12603. */
  12604. position: Point) => void): this;
  12605. off(event: 'click', listener: (event: KeyboardEvent,
  12606. /**
  12607. * The bounds of tray icon.
  12608. */
  12609. bounds: Rectangle,
  12610. /**
  12611. * The position of the event.
  12612. */
  12613. position: Point) => void): this;
  12614. once(event: 'click', listener: (event: KeyboardEvent,
  12615. /**
  12616. * The bounds of tray icon.
  12617. */
  12618. bounds: Rectangle,
  12619. /**
  12620. * The position of the event.
  12621. */
  12622. position: Point) => void): this;
  12623. addListener(event: 'click', listener: (event: KeyboardEvent,
  12624. /**
  12625. * The bounds of tray icon.
  12626. */
  12627. bounds: Rectangle,
  12628. /**
  12629. * The position of the event.
  12630. */
  12631. position: Point) => void): this;
  12632. removeListener(event: 'click', listener: (event: KeyboardEvent,
  12633. /**
  12634. * The bounds of tray icon.
  12635. */
  12636. bounds: Rectangle,
  12637. /**
  12638. * The position of the event.
  12639. */
  12640. position: Point) => void): this;
  12641. /**
  12642. * Emitted when the tray icon is double clicked.
  12643. *
  12644. * @platform darwin,win32
  12645. */
  12646. on(event: 'double-click', listener: (event: KeyboardEvent,
  12647. /**
  12648. * The bounds of tray icon.
  12649. */
  12650. bounds: Rectangle) => void): this;
  12651. /**
  12652. * @platform darwin,win32
  12653. */
  12654. off(event: 'double-click', listener: (event: KeyboardEvent,
  12655. /**
  12656. * The bounds of tray icon.
  12657. */
  12658. bounds: Rectangle) => void): this;
  12659. /**
  12660. * @platform darwin,win32
  12661. */
  12662. once(event: 'double-click', listener: (event: KeyboardEvent,
  12663. /**
  12664. * The bounds of tray icon.
  12665. */
  12666. bounds: Rectangle) => void): this;
  12667. /**
  12668. * @platform darwin,win32
  12669. */
  12670. addListener(event: 'double-click', listener: (event: KeyboardEvent,
  12671. /**
  12672. * The bounds of tray icon.
  12673. */
  12674. bounds: Rectangle) => void): this;
  12675. /**
  12676. * @platform darwin,win32
  12677. */
  12678. removeListener(event: 'double-click', listener: (event: KeyboardEvent,
  12679. /**
  12680. * The bounds of tray icon.
  12681. */
  12682. bounds: Rectangle) => void): this;
  12683. /**
  12684. * Emitted when a drag operation ends on the tray or ends at another location.
  12685. *
  12686. * @platform darwin
  12687. */
  12688. on(event: 'drag-end', listener: Function): this;
  12689. /**
  12690. * @platform darwin
  12691. */
  12692. off(event: 'drag-end', listener: Function): this;
  12693. /**
  12694. * @platform darwin
  12695. */
  12696. once(event: 'drag-end', listener: Function): this;
  12697. /**
  12698. * @platform darwin
  12699. */
  12700. addListener(event: 'drag-end', listener: Function): this;
  12701. /**
  12702. * @platform darwin
  12703. */
  12704. removeListener(event: 'drag-end', listener: Function): this;
  12705. /**
  12706. * Emitted when a drag operation enters the tray icon.
  12707. *
  12708. * @platform darwin
  12709. */
  12710. on(event: 'drag-enter', listener: Function): this;
  12711. /**
  12712. * @platform darwin
  12713. */
  12714. off(event: 'drag-enter', listener: Function): this;
  12715. /**
  12716. * @platform darwin
  12717. */
  12718. once(event: 'drag-enter', listener: Function): this;
  12719. /**
  12720. * @platform darwin
  12721. */
  12722. addListener(event: 'drag-enter', listener: Function): this;
  12723. /**
  12724. * @platform darwin
  12725. */
  12726. removeListener(event: 'drag-enter', listener: Function): this;
  12727. /**
  12728. * Emitted when a drag operation exits the tray icon.
  12729. *
  12730. * @platform darwin
  12731. */
  12732. on(event: 'drag-leave', listener: Function): this;
  12733. /**
  12734. * @platform darwin
  12735. */
  12736. off(event: 'drag-leave', listener: Function): this;
  12737. /**
  12738. * @platform darwin
  12739. */
  12740. once(event: 'drag-leave', listener: Function): this;
  12741. /**
  12742. * @platform darwin
  12743. */
  12744. addListener(event: 'drag-leave', listener: Function): this;
  12745. /**
  12746. * @platform darwin
  12747. */
  12748. removeListener(event: 'drag-leave', listener: Function): this;
  12749. /**
  12750. * Emitted when any dragged items are dropped on the tray icon.
  12751. *
  12752. * @platform darwin
  12753. */
  12754. on(event: 'drop', listener: Function): this;
  12755. /**
  12756. * @platform darwin
  12757. */
  12758. off(event: 'drop', listener: Function): this;
  12759. /**
  12760. * @platform darwin
  12761. */
  12762. once(event: 'drop', listener: Function): this;
  12763. /**
  12764. * @platform darwin
  12765. */
  12766. addListener(event: 'drop', listener: Function): this;
  12767. /**
  12768. * @platform darwin
  12769. */
  12770. removeListener(event: 'drop', listener: Function): this;
  12771. /**
  12772. * Emitted when dragged files are dropped in the tray icon.
  12773. *
  12774. * @platform darwin
  12775. */
  12776. on(event: 'drop-files', listener: (event: Event,
  12777. /**
  12778. * The paths of the dropped files.
  12779. */
  12780. files: string[]) => void): this;
  12781. /**
  12782. * @platform darwin
  12783. */
  12784. off(event: 'drop-files', listener: (event: Event,
  12785. /**
  12786. * The paths of the dropped files.
  12787. */
  12788. files: string[]) => void): this;
  12789. /**
  12790. * @platform darwin
  12791. */
  12792. once(event: 'drop-files', listener: (event: Event,
  12793. /**
  12794. * The paths of the dropped files.
  12795. */
  12796. files: string[]) => void): this;
  12797. /**
  12798. * @platform darwin
  12799. */
  12800. addListener(event: 'drop-files', listener: (event: Event,
  12801. /**
  12802. * The paths of the dropped files.
  12803. */
  12804. files: string[]) => void): this;
  12805. /**
  12806. * @platform darwin
  12807. */
  12808. removeListener(event: 'drop-files', listener: (event: Event,
  12809. /**
  12810. * The paths of the dropped files.
  12811. */
  12812. files: string[]) => void): this;
  12813. /**
  12814. * Emitted when dragged text is dropped in the tray icon.
  12815. *
  12816. * @platform darwin
  12817. */
  12818. on(event: 'drop-text', listener: (event: Event,
  12819. /**
  12820. * the dropped text string.
  12821. */
  12822. text: string) => void): this;
  12823. /**
  12824. * @platform darwin
  12825. */
  12826. off(event: 'drop-text', listener: (event: Event,
  12827. /**
  12828. * the dropped text string.
  12829. */
  12830. text: string) => void): this;
  12831. /**
  12832. * @platform darwin
  12833. */
  12834. once(event: 'drop-text', listener: (event: Event,
  12835. /**
  12836. * the dropped text string.
  12837. */
  12838. text: string) => void): this;
  12839. /**
  12840. * @platform darwin
  12841. */
  12842. addListener(event: 'drop-text', listener: (event: Event,
  12843. /**
  12844. * the dropped text string.
  12845. */
  12846. text: string) => void): this;
  12847. /**
  12848. * @platform darwin
  12849. */
  12850. removeListener(event: 'drop-text', listener: (event: Event,
  12851. /**
  12852. * the dropped text string.
  12853. */
  12854. text: string) => void): this;
  12855. /**
  12856. * Emitted when the tray icon is middle clicked.
  12857. *
  12858. * @platform win32
  12859. */
  12860. on(event: 'middle-click', listener: (event: KeyboardEvent,
  12861. /**
  12862. * The bounds of tray icon.
  12863. */
  12864. bounds: Rectangle) => void): this;
  12865. /**
  12866. * @platform win32
  12867. */
  12868. off(event: 'middle-click', listener: (event: KeyboardEvent,
  12869. /**
  12870. * The bounds of tray icon.
  12871. */
  12872. bounds: Rectangle) => void): this;
  12873. /**
  12874. * @platform win32
  12875. */
  12876. once(event: 'middle-click', listener: (event: KeyboardEvent,
  12877. /**
  12878. * The bounds of tray icon.
  12879. */
  12880. bounds: Rectangle) => void): this;
  12881. /**
  12882. * @platform win32
  12883. */
  12884. addListener(event: 'middle-click', listener: (event: KeyboardEvent,
  12885. /**
  12886. * The bounds of tray icon.
  12887. */
  12888. bounds: Rectangle) => void): this;
  12889. /**
  12890. * @platform win32
  12891. */
  12892. removeListener(event: 'middle-click', listener: (event: KeyboardEvent,
  12893. /**
  12894. * The bounds of tray icon.
  12895. */
  12896. bounds: Rectangle) => void): this;
  12897. /**
  12898. * Emitted when the mouse clicks the tray icon.
  12899. *
  12900. * @platform darwin
  12901. */
  12902. on(event: 'mouse-down', listener: (event: KeyboardEvent,
  12903. /**
  12904. * The position of the event.
  12905. */
  12906. position: Point) => void): this;
  12907. /**
  12908. * @platform darwin
  12909. */
  12910. off(event: 'mouse-down', listener: (event: KeyboardEvent,
  12911. /**
  12912. * The position of the event.
  12913. */
  12914. position: Point) => void): this;
  12915. /**
  12916. * @platform darwin
  12917. */
  12918. once(event: 'mouse-down', listener: (event: KeyboardEvent,
  12919. /**
  12920. * The position of the event.
  12921. */
  12922. position: Point) => void): this;
  12923. /**
  12924. * @platform darwin
  12925. */
  12926. addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  12927. /**
  12928. * The position of the event.
  12929. */
  12930. position: Point) => void): this;
  12931. /**
  12932. * @platform darwin
  12933. */
  12934. removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  12935. /**
  12936. * The position of the event.
  12937. */
  12938. position: Point) => void): this;
  12939. /**
  12940. * Emitted when the mouse enters the tray icon.
  12941. *
  12942. * @platform darwin,win32
  12943. */
  12944. on(event: 'mouse-enter', listener: (event: KeyboardEvent,
  12945. /**
  12946. * The position of the event.
  12947. */
  12948. position: Point) => void): this;
  12949. /**
  12950. * @platform darwin,win32
  12951. */
  12952. off(event: 'mouse-enter', listener: (event: KeyboardEvent,
  12953. /**
  12954. * The position of the event.
  12955. */
  12956. position: Point) => void): this;
  12957. /**
  12958. * @platform darwin,win32
  12959. */
  12960. once(event: 'mouse-enter', listener: (event: KeyboardEvent,
  12961. /**
  12962. * The position of the event.
  12963. */
  12964. position: Point) => void): this;
  12965. /**
  12966. * @platform darwin,win32
  12967. */
  12968. addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  12969. /**
  12970. * The position of the event.
  12971. */
  12972. position: Point) => void): this;
  12973. /**
  12974. * @platform darwin,win32
  12975. */
  12976. removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  12977. /**
  12978. * The position of the event.
  12979. */
  12980. position: Point) => void): this;
  12981. /**
  12982. * Emitted when the mouse exits the tray icon.
  12983. *
  12984. * @platform darwin,win32
  12985. */
  12986. on(event: 'mouse-leave', listener: (event: KeyboardEvent,
  12987. /**
  12988. * The position of the event.
  12989. */
  12990. position: Point) => void): this;
  12991. /**
  12992. * @platform darwin,win32
  12993. */
  12994. off(event: 'mouse-leave', listener: (event: KeyboardEvent,
  12995. /**
  12996. * The position of the event.
  12997. */
  12998. position: Point) => void): this;
  12999. /**
  13000. * @platform darwin,win32
  13001. */
  13002. once(event: 'mouse-leave', listener: (event: KeyboardEvent,
  13003. /**
  13004. * The position of the event.
  13005. */
  13006. position: Point) => void): this;
  13007. /**
  13008. * @platform darwin,win32
  13009. */
  13010. addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  13011. /**
  13012. * The position of the event.
  13013. */
  13014. position: Point) => void): this;
  13015. /**
  13016. * @platform darwin,win32
  13017. */
  13018. removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  13019. /**
  13020. * The position of the event.
  13021. */
  13022. position: Point) => void): this;
  13023. /**
  13024. * Emitted when the mouse moves in the tray icon.
  13025. *
  13026. * @platform darwin,win32
  13027. */
  13028. on(event: 'mouse-move', listener: (event: KeyboardEvent,
  13029. /**
  13030. * The position of the event.
  13031. */
  13032. position: Point) => void): this;
  13033. /**
  13034. * @platform darwin,win32
  13035. */
  13036. off(event: 'mouse-move', listener: (event: KeyboardEvent,
  13037. /**
  13038. * The position of the event.
  13039. */
  13040. position: Point) => void): this;
  13041. /**
  13042. * @platform darwin,win32
  13043. */
  13044. once(event: 'mouse-move', listener: (event: KeyboardEvent,
  13045. /**
  13046. * The position of the event.
  13047. */
  13048. position: Point) => void): this;
  13049. /**
  13050. * @platform darwin,win32
  13051. */
  13052. addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  13053. /**
  13054. * The position of the event.
  13055. */
  13056. position: Point) => void): this;
  13057. /**
  13058. * @platform darwin,win32
  13059. */
  13060. removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  13061. /**
  13062. * The position of the event.
  13063. */
  13064. position: Point) => void): this;
  13065. /**
  13066. * Emitted when the mouse is released from clicking the tray icon.
  13067. *
  13068. * Note: This will not be emitted if you have set a context menu for your Tray
  13069. * using `tray.setContextMenu`, as a result of macOS-level constraints.
  13070. *
  13071. * @platform darwin
  13072. */
  13073. on(event: 'mouse-up', listener: (event: KeyboardEvent,
  13074. /**
  13075. * The position of the event.
  13076. */
  13077. position: Point) => void): this;
  13078. /**
  13079. * @platform darwin
  13080. */
  13081. off(event: 'mouse-up', listener: (event: KeyboardEvent,
  13082. /**
  13083. * The position of the event.
  13084. */
  13085. position: Point) => void): this;
  13086. /**
  13087. * @platform darwin
  13088. */
  13089. once(event: 'mouse-up', listener: (event: KeyboardEvent,
  13090. /**
  13091. * The position of the event.
  13092. */
  13093. position: Point) => void): this;
  13094. /**
  13095. * @platform darwin
  13096. */
  13097. addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  13098. /**
  13099. * The position of the event.
  13100. */
  13101. position: Point) => void): this;
  13102. /**
  13103. * @platform darwin
  13104. */
  13105. removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  13106. /**
  13107. * The position of the event.
  13108. */
  13109. position: Point) => void): this;
  13110. /**
  13111. * Emitted when the tray icon is right clicked.
  13112. *
  13113. * @platform darwin,win32
  13114. */
  13115. on(event: 'right-click', listener: (event: KeyboardEvent,
  13116. /**
  13117. * The bounds of tray icon.
  13118. */
  13119. bounds: Rectangle) => void): this;
  13120. /**
  13121. * @platform darwin,win32
  13122. */
  13123. off(event: 'right-click', listener: (event: KeyboardEvent,
  13124. /**
  13125. * The bounds of tray icon.
  13126. */
  13127. bounds: Rectangle) => void): this;
  13128. /**
  13129. * @platform darwin,win32
  13130. */
  13131. once(event: 'right-click', listener: (event: KeyboardEvent,
  13132. /**
  13133. * The bounds of tray icon.
  13134. */
  13135. bounds: Rectangle) => void): this;
  13136. /**
  13137. * @platform darwin,win32
  13138. */
  13139. addListener(event: 'right-click', listener: (event: KeyboardEvent,
  13140. /**
  13141. * The bounds of tray icon.
  13142. */
  13143. bounds: Rectangle) => void): this;
  13144. /**
  13145. * @platform darwin,win32
  13146. */
  13147. removeListener(event: 'right-click', listener: (event: KeyboardEvent,
  13148. /**
  13149. * The bounds of tray icon.
  13150. */
  13151. bounds: Rectangle) => void): this;
  13152. /**
  13153. * Tray
  13154. */
  13155. constructor(image: (NativeImage) | (string), guid?: string);
  13156. /**
  13157. * Closes an open context menu, as set by `tray.setContextMenu()`.
  13158. *
  13159. * @platform darwin,win32
  13160. */
  13161. closeContextMenu(): void;
  13162. /**
  13163. * Destroys the tray icon immediately.
  13164. */
  13165. destroy(): void;
  13166. /**
  13167. * Displays a tray balloon.
  13168. *
  13169. * @platform win32
  13170. */
  13171. displayBalloon(options: DisplayBalloonOptions): void;
  13172. /**
  13173. * Returns focus to the taskbar notification area. Notification area icons should
  13174. * use this message when they have completed their UI operation. For example, if
  13175. * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
  13176. * `tray.focus()` to return focus to the notification area.
  13177. *
  13178. * @platform win32
  13179. */
  13180. focus(): void;
  13181. /**
  13182. * The `bounds` of this tray icon as `Object`.
  13183. *
  13184. * @platform darwin,win32
  13185. */
  13186. getBounds(): Rectangle;
  13187. /**
  13188. * Whether double click events will be ignored.
  13189. *
  13190. * @platform darwin
  13191. */
  13192. getIgnoreDoubleClickEvents(): boolean;
  13193. /**
  13194. * the title displayed next to the tray icon in the status bar
  13195. *
  13196. * @platform darwin
  13197. */
  13198. getTitle(): string;
  13199. /**
  13200. * Whether the tray icon is destroyed.
  13201. */
  13202. isDestroyed(): boolean;
  13203. /**
  13204. * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
  13205. * will be shown instead of the tray icon's context menu.
  13206. *
  13207. * The `position` is only available on Windows, and it is (0, 0) by default.
  13208. *
  13209. * @platform darwin,win32
  13210. */
  13211. popUpContextMenu(menu?: Menu, position?: Point): void;
  13212. /**
  13213. * Removes a tray balloon.
  13214. *
  13215. * @platform win32
  13216. */
  13217. removeBalloon(): void;
  13218. /**
  13219. * Sets the context menu for this icon.
  13220. */
  13221. setContextMenu(menu: (Menu) | (null)): void;
  13222. /**
  13223. * Sets the option to ignore double click events. Ignoring these events allows you
  13224. * to detect every individual click of the tray icon.
  13225. *
  13226. * This value is set to false by default.
  13227. *
  13228. * @platform darwin
  13229. */
  13230. setIgnoreDoubleClickEvents(ignore: boolean): void;
  13231. /**
  13232. * Sets the `image` associated with this tray icon.
  13233. */
  13234. setImage(image: (NativeImage) | (string)): void;
  13235. /**
  13236. * Sets the `image` associated with this tray icon when pressed on macOS.
  13237. *
  13238. * @platform darwin
  13239. */
  13240. setPressedImage(image: (NativeImage) | (string)): void;
  13241. /**
  13242. * Sets the title displayed next to the tray icon in the status bar (Support ANSI
  13243. * colors).
  13244. *
  13245. * @platform darwin
  13246. */
  13247. setTitle(title: string, options?: TitleOptions): void;
  13248. /**
  13249. * Sets the hover text for this tray icon.
  13250. */
  13251. setToolTip(toolTip: string): void;
  13252. }
  13253. interface UploadData {
  13254. // Docs: https://electronjs.org/docs/api/structures/upload-data
  13255. /**
  13256. * UUID of blob data. Use ses.getBlobData method to retrieve the data.
  13257. */
  13258. blobUUID?: string;
  13259. /**
  13260. * Content being sent.
  13261. */
  13262. bytes: Buffer;
  13263. /**
  13264. * Path of file being uploaded.
  13265. */
  13266. file?: string;
  13267. }
  13268. interface UploadFile {
  13269. // Docs: https://electronjs.org/docs/api/structures/upload-file
  13270. /**
  13271. * Path of file to be uploaded.
  13272. */
  13273. filePath: string;
  13274. /**
  13275. * Number of bytes to read from `offset`. Defaults to `0`.
  13276. */
  13277. length?: number;
  13278. /**
  13279. * Last Modification time in number of seconds since the UNIX epoch. Defaults to
  13280. * `0`.
  13281. */
  13282. modificationTime?: number;
  13283. /**
  13284. * Defaults to `0`.
  13285. */
  13286. offset?: number;
  13287. /**
  13288. * `file`.
  13289. */
  13290. type: 'file';
  13291. }
  13292. interface UploadRawData {
  13293. // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
  13294. /**
  13295. * Data to be uploaded.
  13296. */
  13297. bytes: Buffer;
  13298. /**
  13299. * `rawData`.
  13300. */
  13301. type: 'rawData';
  13302. }
  13303. interface USBDevice {
  13304. // Docs: https://electronjs.org/docs/api/structures/usb-device
  13305. /**
  13306. * The device class for the communication interface supported by the device
  13307. */
  13308. deviceClass: number;
  13309. /**
  13310. * Unique identifier for the device.
  13311. */
  13312. deviceId: string;
  13313. /**
  13314. * The device protocol for the communication interface supported by the device
  13315. */
  13316. deviceProtocol: number;
  13317. /**
  13318. * The device subclass for the communication interface supported by the device
  13319. */
  13320. deviceSubclass: number;
  13321. /**
  13322. * The major version number of the device as defined by the device manufacturer.
  13323. */
  13324. deviceVersionMajor: number;
  13325. /**
  13326. * The minor version number of the device as defined by the device manufacturer.
  13327. */
  13328. deviceVersionMinor: number;
  13329. /**
  13330. * The subminor version number of the device as defined by the device manufacturer.
  13331. */
  13332. deviceVersionSubminor: number;
  13333. /**
  13334. * The manufacturer name of the device.
  13335. */
  13336. manufacturerName?: string;
  13337. /**
  13338. * The USB product ID.
  13339. */
  13340. productId: number;
  13341. /**
  13342. * Name of the device.
  13343. */
  13344. productName?: string;
  13345. /**
  13346. * The USB device serial number.
  13347. */
  13348. serialNumber?: string;
  13349. /**
  13350. * The USB protocol major version supported by the device
  13351. */
  13352. usbVersionMajor: number;
  13353. /**
  13354. * The USB protocol minor version supported by the device
  13355. */
  13356. usbVersionMinor: number;
  13357. /**
  13358. * The USB protocol subminor version supported by the device
  13359. */
  13360. usbVersionSubminor: number;
  13361. /**
  13362. * The USB vendor ID.
  13363. */
  13364. vendorId: number;
  13365. }
  13366. interface UserDefaultTypes {
  13367. // Docs: https://electronjs.org/docs/api/structures/user-default-types
  13368. array: Array<unknown>;
  13369. boolean: boolean;
  13370. dictionary: Record<string, unknown>;
  13371. double: number;
  13372. float: number;
  13373. integer: number;
  13374. string: string;
  13375. url: string;
  13376. }
  13377. class UtilityProcess extends NodeEventEmitter {
  13378. // Docs: https://electronjs.org/docs/api/utility-process
  13379. static fork(modulePath: string, args?: string[], options?: ForkOptions): UtilityProcess;
  13380. /**
  13381. * Emitted after the child process ends.
  13382. */
  13383. on(event: 'exit', listener: (
  13384. /**
  13385. * Contains the exit code for the process obtained from waitpid on posix, or
  13386. * GetExitCodeProcess on windows.
  13387. */
  13388. code: number) => void): this;
  13389. off(event: 'exit', listener: (
  13390. /**
  13391. * Contains the exit code for the process obtained from waitpid on posix, or
  13392. * GetExitCodeProcess on windows.
  13393. */
  13394. code: number) => void): this;
  13395. once(event: 'exit', listener: (
  13396. /**
  13397. * Contains the exit code for the process obtained from waitpid on posix, or
  13398. * GetExitCodeProcess on windows.
  13399. */
  13400. code: number) => void): this;
  13401. addListener(event: 'exit', listener: (
  13402. /**
  13403. * Contains the exit code for the process obtained from waitpid on posix, or
  13404. * GetExitCodeProcess on windows.
  13405. */
  13406. code: number) => void): this;
  13407. removeListener(event: 'exit', listener: (
  13408. /**
  13409. * Contains the exit code for the process obtained from waitpid on posix, or
  13410. * GetExitCodeProcess on windows.
  13411. */
  13412. code: number) => void): this;
  13413. /**
  13414. * Emitted when the child process sends a message using
  13415. * `process.parentPort.postMessage()`.
  13416. */
  13417. on(event: 'message', listener: (message: any) => void): this;
  13418. off(event: 'message', listener: (message: any) => void): this;
  13419. once(event: 'message', listener: (message: any) => void): this;
  13420. addListener(event: 'message', listener: (message: any) => void): this;
  13421. removeListener(event: 'message', listener: (message: any) => void): this;
  13422. /**
  13423. * Emitted once the child process has spawned successfully.
  13424. */
  13425. on(event: 'spawn', listener: Function): this;
  13426. off(event: 'spawn', listener: Function): this;
  13427. once(event: 'spawn', listener: Function): this;
  13428. addListener(event: 'spawn', listener: Function): this;
  13429. removeListener(event: 'spawn', listener: Function): this;
  13430. /**
  13431. * Terminates the process gracefully. On POSIX, it uses SIGTERM but will ensure the
  13432. * process is reaped on exit. This function returns true if the kill is successful,
  13433. * and false otherwise.
  13434. */
  13435. kill(): boolean;
  13436. /**
  13437. * Send a message to the child process, optionally transferring ownership of zero
  13438. * or more `MessagePortMain` objects.
  13439. *
  13440. * For example:
  13441. */
  13442. postMessage(message: any, transfer?: MessagePortMain[]): void;
  13443. /**
  13444. * A `Integer | undefined` representing the process identifier (PID) of the child
  13445. * process. If the child process fails to spawn due to errors, then the value is
  13446. * `undefined`. When the child process exits, then the value is `undefined` after
  13447. * the `exit` event is emitted.
  13448. */
  13449. pid: (number) | (undefined);
  13450. /**
  13451. * A `NodeJS.ReadableStream | null` that represents the child process's stderr. If
  13452. * the child was spawned with options.stdio[2] set to anything other than 'pipe',
  13453. * then this will be `null`. When the child process exits, then the value is `null`
  13454. * after the `exit` event is emitted.
  13455. */
  13456. stderr: (NodeJS.ReadableStream) | (null);
  13457. /**
  13458. * A `NodeJS.ReadableStream | null` that represents the child process's stdout. If
  13459. * the child was spawned with options.stdio[1] set to anything other than 'pipe',
  13460. * then this will be `null`. When the child process exits, then the value is `null`
  13461. * after the `exit` event is emitted.
  13462. */
  13463. stdout: (NodeJS.ReadableStream) | (null);
  13464. }
  13465. class View extends NodeEventEmitter {
  13466. // Docs: https://electronjs.org/docs/api/view
  13467. /**
  13468. * Emitted when the view's bounds have changed in response to being laid out. The
  13469. * new bounds can be retrieved with `view.getBounds()`.
  13470. */
  13471. on(event: 'bounds-changed', listener: Function): this;
  13472. off(event: 'bounds-changed', listener: Function): this;
  13473. once(event: 'bounds-changed', listener: Function): this;
  13474. addListener(event: 'bounds-changed', listener: Function): this;
  13475. removeListener(event: 'bounds-changed', listener: Function): this;
  13476. /**
  13477. * View
  13478. */
  13479. constructor();
  13480. /**
  13481. * If the same View is added to a parent which already contains it, it will be
  13482. * reordered such that it becomes the topmost view.
  13483. */
  13484. addChildView(view: View, index?: number): void;
  13485. /**
  13486. * The bounds of this View, relative to its parent.
  13487. */
  13488. getBounds(): Rectangle;
  13489. removeChildView(view: View): void;
  13490. /**
  13491. * Examples of valid `color` values:
  13492. *
  13493. * * Hex
  13494. * * `#fff` (RGB)
  13495. * * `#ffff` (ARGB)
  13496. * * `#ffffff` (RRGGBB)
  13497. * * `#ffffffff` (AARRGGBB)
  13498. * * RGB
  13499. * * `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
  13500. * * e.g. `rgb(255, 255, 255)`
  13501. * * RGBA
  13502. * * `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
  13503. * * e.g. `rgba(255, 255, 255, 1.0)`
  13504. * * HSL
  13505. * * `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
  13506. * * e.g. `hsl(200, 20%, 50%)`
  13507. * * HSLA
  13508. * * `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
  13509. * * e.g. `hsla(200, 20%, 50%, 0.5)`
  13510. * * Color name
  13511. * * Options are listed in SkParseColor.cpp
  13512. * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
  13513. * * e.g. `blueviolet` or `red`
  13514. *
  13515. * **Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBAA` or
  13516. * `RGB`.
  13517. */
  13518. setBackgroundColor(color: string): void;
  13519. setBounds(bounds: Rectangle): void;
  13520. setVisible(visible: boolean): void;
  13521. /**
  13522. * A `View[]` property representing the child views of this view.
  13523. *
  13524. */
  13525. readonly children: View[];
  13526. }
  13527. class WebContents extends NodeEventEmitter {
  13528. // Docs: https://electronjs.org/docs/api/web-contents
  13529. /**
  13530. * A WebContents instance with the given TargetID, or `undefined` if there is no
  13531. * WebContents associated with the given TargetID.
  13532. *
  13533. * When communicating with the Chrome DevTools Protocol, it can be useful to lookup
  13534. * a WebContents instance based on its assigned TargetID.
  13535. */
  13536. static fromDevToolsTargetId(targetId: string): (WebContents) | (undefined);
  13537. /**
  13538. * A WebContents instance with the given WebFrameMain, or `undefined` if there is
  13539. * no WebContents associated with the given WebFrameMain.
  13540. */
  13541. static fromFrame(frame: WebFrameMain): (WebContents) | (undefined);
  13542. /**
  13543. * A WebContents instance with the given ID, or `undefined` if there is no
  13544. * WebContents associated with the given ID.
  13545. */
  13546. static fromId(id: number): (WebContents) | (undefined);
  13547. /**
  13548. * An array of all `WebContents` instances. This will contain web contents for all
  13549. * windows, webviews, opened devtools, and devtools extension background pages.
  13550. */
  13551. static getAllWebContents(): WebContents[];
  13552. /**
  13553. * The web contents that is focused in this application, otherwise returns `null`.
  13554. */
  13555. static getFocusedWebContents(): (WebContents) | (null);
  13556. /**
  13557. * Emitted when media becomes audible or inaudible.
  13558. */
  13559. on(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  13560. off(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  13561. once(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  13562. addListener(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  13563. removeListener(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  13564. /**
  13565. * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
  13566. * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
  13567. * menu shortcuts.
  13568. *
  13569. * To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
  13570. */
  13571. on(event: 'before-input-event', listener: (event: Event,
  13572. /**
  13573. * Input properties.
  13574. */
  13575. input: Input) => void): this;
  13576. off(event: 'before-input-event', listener: (event: Event,
  13577. /**
  13578. * Input properties.
  13579. */
  13580. input: Input) => void): this;
  13581. once(event: 'before-input-event', listener: (event: Event,
  13582. /**
  13583. * Input properties.
  13584. */
  13585. input: Input) => void): this;
  13586. addListener(event: 'before-input-event', listener: (event: Event,
  13587. /**
  13588. * Input properties.
  13589. */
  13590. input: Input) => void): this;
  13591. removeListener(event: 'before-input-event', listener: (event: Event,
  13592. /**
  13593. * Input properties.
  13594. */
  13595. input: Input) => void): this;
  13596. /**
  13597. * Emitted when the `WebContents` loses focus.
  13598. */
  13599. on(event: 'blur', listener: Function): this;
  13600. off(event: 'blur', listener: Function): this;
  13601. once(event: 'blur', listener: Function): this;
  13602. addListener(event: 'blur', listener: Function): this;
  13603. removeListener(event: 'blur', listener: Function): this;
  13604. /**
  13605. * Emitted when failed to verify the `certificate` for `url`.
  13606. *
  13607. * The usage is the same with the `certificate-error` event of `app`.
  13608. */
  13609. on(event: 'certificate-error', listener: (event: Event,
  13610. url: string,
  13611. /**
  13612. * The error code.
  13613. */
  13614. error: string,
  13615. certificate: Certificate,
  13616. callback: (isTrusted: boolean) => void,
  13617. isMainFrame: boolean) => void): this;
  13618. off(event: 'certificate-error', listener: (event: Event,
  13619. url: string,
  13620. /**
  13621. * The error code.
  13622. */
  13623. error: string,
  13624. certificate: Certificate,
  13625. callback: (isTrusted: boolean) => void,
  13626. isMainFrame: boolean) => void): this;
  13627. once(event: 'certificate-error', listener: (event: Event,
  13628. url: string,
  13629. /**
  13630. * The error code.
  13631. */
  13632. error: string,
  13633. certificate: Certificate,
  13634. callback: (isTrusted: boolean) => void,
  13635. isMainFrame: boolean) => void): this;
  13636. addListener(event: 'certificate-error', listener: (event: Event,
  13637. url: string,
  13638. /**
  13639. * The error code.
  13640. */
  13641. error: string,
  13642. certificate: Certificate,
  13643. callback: (isTrusted: boolean) => void,
  13644. isMainFrame: boolean) => void): this;
  13645. removeListener(event: 'certificate-error', listener: (event: Event,
  13646. url: string,
  13647. /**
  13648. * The error code.
  13649. */
  13650. error: string,
  13651. certificate: Certificate,
  13652. callback: (isTrusted: boolean) => void,
  13653. isMainFrame: boolean) => void): this;
  13654. /**
  13655. * Emitted when the associated window logs a console message.
  13656. */
  13657. on(event: 'console-message', listener: (event: Event,
  13658. /**
  13659. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  13660. * `error`.
  13661. */
  13662. level: number,
  13663. /**
  13664. * The actual console message
  13665. */
  13666. message: string,
  13667. /**
  13668. * The line number of the source that triggered this console message
  13669. */
  13670. line: number,
  13671. sourceId: string) => void): this;
  13672. off(event: 'console-message', listener: (event: Event,
  13673. /**
  13674. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  13675. * `error`.
  13676. */
  13677. level: number,
  13678. /**
  13679. * The actual console message
  13680. */
  13681. message: string,
  13682. /**
  13683. * The line number of the source that triggered this console message
  13684. */
  13685. line: number,
  13686. sourceId: string) => void): this;
  13687. once(event: 'console-message', listener: (event: Event,
  13688. /**
  13689. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  13690. * `error`.
  13691. */
  13692. level: number,
  13693. /**
  13694. * The actual console message
  13695. */
  13696. message: string,
  13697. /**
  13698. * The line number of the source that triggered this console message
  13699. */
  13700. line: number,
  13701. sourceId: string) => void): this;
  13702. addListener(event: 'console-message', listener: (event: Event,
  13703. /**
  13704. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  13705. * `error`.
  13706. */
  13707. level: number,
  13708. /**
  13709. * The actual console message
  13710. */
  13711. message: string,
  13712. /**
  13713. * The line number of the source that triggered this console message
  13714. */
  13715. line: number,
  13716. sourceId: string) => void): this;
  13717. removeListener(event: 'console-message', listener: (event: Event,
  13718. /**
  13719. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  13720. * `error`.
  13721. */
  13722. level: number,
  13723. /**
  13724. * The actual console message
  13725. */
  13726. message: string,
  13727. /**
  13728. * The line number of the source that triggered this console message
  13729. */
  13730. line: number,
  13731. sourceId: string) => void): this;
  13732. /**
  13733. * Emitted when the page calls `window.moveTo`, `window.resizeTo` or related APIs.
  13734. *
  13735. * By default, this will move the window. To prevent that behavior, call
  13736. * `event.preventDefault()`.
  13737. */
  13738. on(event: 'content-bounds-updated', listener: (event: Event,
  13739. /**
  13740. * requested new content bounds
  13741. */
  13742. bounds: Rectangle) => void): this;
  13743. off(event: 'content-bounds-updated', listener: (event: Event,
  13744. /**
  13745. * requested new content bounds
  13746. */
  13747. bounds: Rectangle) => void): this;
  13748. once(event: 'content-bounds-updated', listener: (event: Event,
  13749. /**
  13750. * requested new content bounds
  13751. */
  13752. bounds: Rectangle) => void): this;
  13753. addListener(event: 'content-bounds-updated', listener: (event: Event,
  13754. /**
  13755. * requested new content bounds
  13756. */
  13757. bounds: Rectangle) => void): this;
  13758. removeListener(event: 'content-bounds-updated', listener: (event: Event,
  13759. /**
  13760. * requested new content bounds
  13761. */
  13762. bounds: Rectangle) => void): this;
  13763. /**
  13764. * Emitted when there is a new context menu that needs to be handled.
  13765. */
  13766. on(event: 'context-menu', listener: (event: Event,
  13767. params: ContextMenuParams) => void): this;
  13768. off(event: 'context-menu', listener: (event: Event,
  13769. params: ContextMenuParams) => void): this;
  13770. once(event: 'context-menu', listener: (event: Event,
  13771. params: ContextMenuParams) => void): this;
  13772. addListener(event: 'context-menu', listener: (event: Event,
  13773. params: ContextMenuParams) => void): this;
  13774. removeListener(event: 'context-menu', listener: (event: Event,
  13775. params: ContextMenuParams) => void): this;
  13776. /**
  13777. * Emitted when the cursor's type changes. The `type` parameter can be `pointer`,
  13778. * `crosshair`, `hand`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
  13779. * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
  13780. * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
  13781. * `row-resize`, `m-panning`, `m-panning-vertical`, `m-panning-horizontal`,
  13782. * `e-panning`, `n-panning`, `ne-panning`, `nw-panning`, `s-panning`, `se-panning`,
  13783. * `sw-panning`, `w-panning`, `move`, `vertical-text`, `cell`, `context-menu`,
  13784. * `alias`, `progress`, `nodrop`, `copy`, `none`, `not-allowed`, `zoom-in`,
  13785. * `zoom-out`, `grab`, `grabbing`, `custom`, `null`, `drag-drop-none`,
  13786. * `drag-drop-move`, `drag-drop-copy`, `drag-drop-link`, `ns-no-resize`,
  13787. * `ew-no-resize`, `nesw-no-resize`, `nwse-no-resize`, or `default`.
  13788. *
  13789. * If the `type` parameter is `custom`, the `image` parameter will hold the custom
  13790. * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
  13791. * additional information about the custom cursor.
  13792. */
  13793. on(event: 'cursor-changed', listener: (event: Event,
  13794. type: string,
  13795. image: NativeImage,
  13796. /**
  13797. * scaling factor for the custom cursor.
  13798. */
  13799. scale: number,
  13800. /**
  13801. * the size of the `image`.
  13802. */
  13803. size: Size,
  13804. /**
  13805. * coordinates of the custom cursor's hotspot.
  13806. */
  13807. hotspot: Point) => void): this;
  13808. off(event: 'cursor-changed', listener: (event: Event,
  13809. type: string,
  13810. image: NativeImage,
  13811. /**
  13812. * scaling factor for the custom cursor.
  13813. */
  13814. scale: number,
  13815. /**
  13816. * the size of the `image`.
  13817. */
  13818. size: Size,
  13819. /**
  13820. * coordinates of the custom cursor's hotspot.
  13821. */
  13822. hotspot: Point) => void): this;
  13823. once(event: 'cursor-changed', listener: (event: Event,
  13824. type: string,
  13825. image: NativeImage,
  13826. /**
  13827. * scaling factor for the custom cursor.
  13828. */
  13829. scale: number,
  13830. /**
  13831. * the size of the `image`.
  13832. */
  13833. size: Size,
  13834. /**
  13835. * coordinates of the custom cursor's hotspot.
  13836. */
  13837. hotspot: Point) => void): this;
  13838. addListener(event: 'cursor-changed', listener: (event: Event,
  13839. type: string,
  13840. image: NativeImage,
  13841. /**
  13842. * scaling factor for the custom cursor.
  13843. */
  13844. scale: number,
  13845. /**
  13846. * the size of the `image`.
  13847. */
  13848. size: Size,
  13849. /**
  13850. * coordinates of the custom cursor's hotspot.
  13851. */
  13852. hotspot: Point) => void): this;
  13853. removeListener(event: 'cursor-changed', listener: (event: Event,
  13854. type: string,
  13855. image: NativeImage,
  13856. /**
  13857. * scaling factor for the custom cursor.
  13858. */
  13859. scale: number,
  13860. /**
  13861. * the size of the `image`.
  13862. */
  13863. size: Size,
  13864. /**
  13865. * coordinates of the custom cursor's hotspot.
  13866. */
  13867. hotspot: Point) => void): this;
  13868. /**
  13869. * Emitted when `webContents` is destroyed.
  13870. */
  13871. on(event: 'destroyed', listener: Function): this;
  13872. off(event: 'destroyed', listener: Function): this;
  13873. once(event: 'destroyed', listener: Function): this;
  13874. addListener(event: 'destroyed', listener: Function): this;
  13875. removeListener(event: 'destroyed', listener: Function): this;
  13876. /**
  13877. * Emitted when DevTools is closed.
  13878. */
  13879. on(event: 'devtools-closed', listener: Function): this;
  13880. off(event: 'devtools-closed', listener: Function): this;
  13881. once(event: 'devtools-closed', listener: Function): this;
  13882. addListener(event: 'devtools-closed', listener: Function): this;
  13883. removeListener(event: 'devtools-closed', listener: Function): this;
  13884. /**
  13885. * Emitted when DevTools is focused / opened.
  13886. */
  13887. on(event: 'devtools-focused', listener: Function): this;
  13888. off(event: 'devtools-focused', listener: Function): this;
  13889. once(event: 'devtools-focused', listener: Function): this;
  13890. addListener(event: 'devtools-focused', listener: Function): this;
  13891. removeListener(event: 'devtools-focused', listener: Function): this;
  13892. /**
  13893. * Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for
  13894. * a link in its context menu.
  13895. */
  13896. on(event: 'devtools-open-url', listener: (event: Event,
  13897. /**
  13898. * URL of the link that was clicked or selected.
  13899. */
  13900. url: string) => void): this;
  13901. off(event: 'devtools-open-url', listener: (event: Event,
  13902. /**
  13903. * URL of the link that was clicked or selected.
  13904. */
  13905. url: string) => void): this;
  13906. once(event: 'devtools-open-url', listener: (event: Event,
  13907. /**
  13908. * URL of the link that was clicked or selected.
  13909. */
  13910. url: string) => void): this;
  13911. addListener(event: 'devtools-open-url', listener: (event: Event,
  13912. /**
  13913. * URL of the link that was clicked or selected.
  13914. */
  13915. url: string) => void): this;
  13916. removeListener(event: 'devtools-open-url', listener: (event: Event,
  13917. /**
  13918. * URL of the link that was clicked or selected.
  13919. */
  13920. url: string) => void): this;
  13921. /**
  13922. * Emitted when DevTools is opened.
  13923. */
  13924. on(event: 'devtools-opened', listener: Function): this;
  13925. off(event: 'devtools-opened', listener: Function): this;
  13926. once(event: 'devtools-opened', listener: Function): this;
  13927. addListener(event: 'devtools-opened', listener: Function): this;
  13928. removeListener(event: 'devtools-opened', listener: Function): this;
  13929. /**
  13930. * Emitted when the devtools window instructs the webContents to reload
  13931. */
  13932. on(event: 'devtools-reload-page', listener: Function): this;
  13933. off(event: 'devtools-reload-page', listener: Function): this;
  13934. once(event: 'devtools-reload-page', listener: Function): this;
  13935. addListener(event: 'devtools-reload-page', listener: Function): this;
  13936. removeListener(event: 'devtools-reload-page', listener: Function): this;
  13937. /**
  13938. * Emitted when 'Search' is selected for text in its context menu.
  13939. */
  13940. on(event: 'devtools-search-query', listener: (event: Event,
  13941. /**
  13942. * text to query for.
  13943. */
  13944. query: string) => void): this;
  13945. off(event: 'devtools-search-query', listener: (event: Event,
  13946. /**
  13947. * text to query for.
  13948. */
  13949. query: string) => void): this;
  13950. once(event: 'devtools-search-query', listener: (event: Event,
  13951. /**
  13952. * text to query for.
  13953. */
  13954. query: string) => void): this;
  13955. addListener(event: 'devtools-search-query', listener: (event: Event,
  13956. /**
  13957. * text to query for.
  13958. */
  13959. query: string) => void): this;
  13960. removeListener(event: 'devtools-search-query', listener: (event: Event,
  13961. /**
  13962. * text to query for.
  13963. */
  13964. query: string) => void): this;
  13965. /**
  13966. * Emitted when a `<webview>` has been attached to this web contents.
  13967. */
  13968. on(event: 'did-attach-webview', listener: (event: Event,
  13969. /**
  13970. * The guest web contents that is used by the `<webview>`.
  13971. */
  13972. webContents: WebContents) => void): this;
  13973. off(event: 'did-attach-webview', listener: (event: Event,
  13974. /**
  13975. * The guest web contents that is used by the `<webview>`.
  13976. */
  13977. webContents: WebContents) => void): this;
  13978. once(event: 'did-attach-webview', listener: (event: Event,
  13979. /**
  13980. * The guest web contents that is used by the `<webview>`.
  13981. */
  13982. webContents: WebContents) => void): this;
  13983. addListener(event: 'did-attach-webview', listener: (event: Event,
  13984. /**
  13985. * The guest web contents that is used by the `<webview>`.
  13986. */
  13987. webContents: WebContents) => void): this;
  13988. removeListener(event: 'did-attach-webview', listener: (event: Event,
  13989. /**
  13990. * The guest web contents that is used by the `<webview>`.
  13991. */
  13992. webContents: WebContents) => void): this;
  13993. /**
  13994. * Emitted when a page's theme color changes. This is usually due to encountering a
  13995. * meta tag:
  13996. */
  13997. on(event: 'did-change-theme-color', listener: (event: Event,
  13998. /**
  13999. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  14000. */
  14001. color: (string) | (null)) => void): this;
  14002. off(event: 'did-change-theme-color', listener: (event: Event,
  14003. /**
  14004. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  14005. */
  14006. color: (string) | (null)) => void): this;
  14007. once(event: 'did-change-theme-color', listener: (event: Event,
  14008. /**
  14009. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  14010. */
  14011. color: (string) | (null)) => void): this;
  14012. addListener(event: 'did-change-theme-color', listener: (event: Event,
  14013. /**
  14014. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  14015. */
  14016. color: (string) | (null)) => void): this;
  14017. removeListener(event: 'did-change-theme-color', listener: (event: Event,
  14018. /**
  14019. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  14020. */
  14021. color: (string) | (null)) => void): this;
  14022. /**
  14023. * Emitted _after_ successful creation of a window via `window.open` in the
  14024. * renderer. Not emitted if the creation of the window is canceled from
  14025. * `webContents.setWindowOpenHandler`.
  14026. *
  14027. * See `window.open()` for more details and how to use this in conjunction with
  14028. * `webContents.setWindowOpenHandler`.
  14029. */
  14030. on(event: 'did-create-window', listener: (window: BrowserWindow,
  14031. details: DidCreateWindowDetails) => void): this;
  14032. off(event: 'did-create-window', listener: (window: BrowserWindow,
  14033. details: DidCreateWindowDetails) => void): this;
  14034. once(event: 'did-create-window', listener: (window: BrowserWindow,
  14035. details: DidCreateWindowDetails) => void): this;
  14036. addListener(event: 'did-create-window', listener: (window: BrowserWindow,
  14037. details: DidCreateWindowDetails) => void): this;
  14038. removeListener(event: 'did-create-window', listener: (window: BrowserWindow,
  14039. details: DidCreateWindowDetails) => void): this;
  14040. /**
  14041. * This event is like `did-finish-load` but emitted when the load failed. The full
  14042. * list of error codes and their meaning is available here.
  14043. */
  14044. on(event: 'did-fail-load', listener: (event: Event,
  14045. errorCode: number,
  14046. errorDescription: string,
  14047. validatedURL: string,
  14048. isMainFrame: boolean,
  14049. frameProcessId: number,
  14050. frameRoutingId: number) => void): this;
  14051. off(event: 'did-fail-load', listener: (event: Event,
  14052. errorCode: number,
  14053. errorDescription: string,
  14054. validatedURL: string,
  14055. isMainFrame: boolean,
  14056. frameProcessId: number,
  14057. frameRoutingId: number) => void): this;
  14058. once(event: 'did-fail-load', listener: (event: Event,
  14059. errorCode: number,
  14060. errorDescription: string,
  14061. validatedURL: string,
  14062. isMainFrame: boolean,
  14063. frameProcessId: number,
  14064. frameRoutingId: number) => void): this;
  14065. addListener(event: 'did-fail-load', listener: (event: Event,
  14066. errorCode: number,
  14067. errorDescription: string,
  14068. validatedURL: string,
  14069. isMainFrame: boolean,
  14070. frameProcessId: number,
  14071. frameRoutingId: number) => void): this;
  14072. removeListener(event: 'did-fail-load', listener: (event: Event,
  14073. errorCode: number,
  14074. errorDescription: string,
  14075. validatedURL: string,
  14076. isMainFrame: boolean,
  14077. frameProcessId: number,
  14078. frameRoutingId: number) => void): this;
  14079. /**
  14080. * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
  14081. * `window.stop()` was invoked).
  14082. */
  14083. on(event: 'did-fail-provisional-load', listener: (event: Event,
  14084. errorCode: number,
  14085. errorDescription: string,
  14086. validatedURL: string,
  14087. isMainFrame: boolean,
  14088. frameProcessId: number,
  14089. frameRoutingId: number) => void): this;
  14090. off(event: 'did-fail-provisional-load', listener: (event: Event,
  14091. errorCode: number,
  14092. errorDescription: string,
  14093. validatedURL: string,
  14094. isMainFrame: boolean,
  14095. frameProcessId: number,
  14096. frameRoutingId: number) => void): this;
  14097. once(event: 'did-fail-provisional-load', listener: (event: Event,
  14098. errorCode: number,
  14099. errorDescription: string,
  14100. validatedURL: string,
  14101. isMainFrame: boolean,
  14102. frameProcessId: number,
  14103. frameRoutingId: number) => void): this;
  14104. addListener(event: 'did-fail-provisional-load', listener: (event: Event,
  14105. errorCode: number,
  14106. errorDescription: string,
  14107. validatedURL: string,
  14108. isMainFrame: boolean,
  14109. frameProcessId: number,
  14110. frameRoutingId: number) => void): this;
  14111. removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
  14112. errorCode: number,
  14113. errorDescription: string,
  14114. validatedURL: string,
  14115. isMainFrame: boolean,
  14116. frameProcessId: number,
  14117. frameRoutingId: number) => void): this;
  14118. /**
  14119. * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
  14120. * spinning, and the `onload` event was dispatched.
  14121. */
  14122. on(event: 'did-finish-load', listener: Function): this;
  14123. off(event: 'did-finish-load', listener: Function): this;
  14124. once(event: 'did-finish-load', listener: Function): this;
  14125. addListener(event: 'did-finish-load', listener: Function): this;
  14126. removeListener(event: 'did-finish-load', listener: Function): this;
  14127. /**
  14128. * Emitted when a frame has done navigation.
  14129. */
  14130. on(event: 'did-frame-finish-load', listener: (event: Event,
  14131. isMainFrame: boolean,
  14132. frameProcessId: number,
  14133. frameRoutingId: number) => void): this;
  14134. off(event: 'did-frame-finish-load', listener: (event: Event,
  14135. isMainFrame: boolean,
  14136. frameProcessId: number,
  14137. frameRoutingId: number) => void): this;
  14138. once(event: 'did-frame-finish-load', listener: (event: Event,
  14139. isMainFrame: boolean,
  14140. frameProcessId: number,
  14141. frameRoutingId: number) => void): this;
  14142. addListener(event: 'did-frame-finish-load', listener: (event: Event,
  14143. isMainFrame: boolean,
  14144. frameProcessId: number,
  14145. frameRoutingId: number) => void): this;
  14146. removeListener(event: 'did-frame-finish-load', listener: (event: Event,
  14147. isMainFrame: boolean,
  14148. frameProcessId: number,
  14149. frameRoutingId: number) => void): this;
  14150. /**
  14151. * Emitted when any frame navigation is done.
  14152. *
  14153. * This event is not emitted for in-page navigations, such as clicking anchor links
  14154. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  14155. * this purpose.
  14156. */
  14157. on(event: 'did-frame-navigate', listener: (event: Event,
  14158. url: string,
  14159. /**
  14160. * -1 for non HTTP navigations
  14161. */
  14162. httpResponseCode: number,
  14163. /**
  14164. * empty for non HTTP navigations,
  14165. */
  14166. httpStatusText: string,
  14167. isMainFrame: boolean,
  14168. frameProcessId: number,
  14169. frameRoutingId: number) => void): this;
  14170. off(event: 'did-frame-navigate', listener: (event: Event,
  14171. url: string,
  14172. /**
  14173. * -1 for non HTTP navigations
  14174. */
  14175. httpResponseCode: number,
  14176. /**
  14177. * empty for non HTTP navigations,
  14178. */
  14179. httpStatusText: string,
  14180. isMainFrame: boolean,
  14181. frameProcessId: number,
  14182. frameRoutingId: number) => void): this;
  14183. once(event: 'did-frame-navigate', listener: (event: Event,
  14184. url: string,
  14185. /**
  14186. * -1 for non HTTP navigations
  14187. */
  14188. httpResponseCode: number,
  14189. /**
  14190. * empty for non HTTP navigations,
  14191. */
  14192. httpStatusText: string,
  14193. isMainFrame: boolean,
  14194. frameProcessId: number,
  14195. frameRoutingId: number) => void): this;
  14196. addListener(event: 'did-frame-navigate', listener: (event: Event,
  14197. url: string,
  14198. /**
  14199. * -1 for non HTTP navigations
  14200. */
  14201. httpResponseCode: number,
  14202. /**
  14203. * empty for non HTTP navigations,
  14204. */
  14205. httpStatusText: string,
  14206. isMainFrame: boolean,
  14207. frameProcessId: number,
  14208. frameRoutingId: number) => void): this;
  14209. removeListener(event: 'did-frame-navigate', listener: (event: Event,
  14210. url: string,
  14211. /**
  14212. * -1 for non HTTP navigations
  14213. */
  14214. httpResponseCode: number,
  14215. /**
  14216. * empty for non HTTP navigations,
  14217. */
  14218. httpStatusText: string,
  14219. isMainFrame: boolean,
  14220. frameProcessId: number,
  14221. frameRoutingId: number) => void): this;
  14222. /**
  14223. * Emitted when a main frame navigation is done.
  14224. *
  14225. * This event is not emitted for in-page navigations, such as clicking anchor links
  14226. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  14227. * this purpose.
  14228. */
  14229. on(event: 'did-navigate', listener: (event: Event,
  14230. url: string,
  14231. /**
  14232. * -1 for non HTTP navigations
  14233. */
  14234. httpResponseCode: number,
  14235. /**
  14236. * empty for non HTTP navigations
  14237. */
  14238. httpStatusText: string) => void): this;
  14239. off(event: 'did-navigate', listener: (event: Event,
  14240. url: string,
  14241. /**
  14242. * -1 for non HTTP navigations
  14243. */
  14244. httpResponseCode: number,
  14245. /**
  14246. * empty for non HTTP navigations
  14247. */
  14248. httpStatusText: string) => void): this;
  14249. once(event: 'did-navigate', listener: (event: Event,
  14250. url: string,
  14251. /**
  14252. * -1 for non HTTP navigations
  14253. */
  14254. httpResponseCode: number,
  14255. /**
  14256. * empty for non HTTP navigations
  14257. */
  14258. httpStatusText: string) => void): this;
  14259. addListener(event: 'did-navigate', listener: (event: Event,
  14260. url: string,
  14261. /**
  14262. * -1 for non HTTP navigations
  14263. */
  14264. httpResponseCode: number,
  14265. /**
  14266. * empty for non HTTP navigations
  14267. */
  14268. httpStatusText: string) => void): this;
  14269. removeListener(event: 'did-navigate', listener: (event: Event,
  14270. url: string,
  14271. /**
  14272. * -1 for non HTTP navigations
  14273. */
  14274. httpResponseCode: number,
  14275. /**
  14276. * empty for non HTTP navigations
  14277. */
  14278. httpStatusText: string) => void): this;
  14279. /**
  14280. * Emitted when an in-page navigation happened in any frame.
  14281. *
  14282. * When in-page navigation happens, the page URL changes but does not cause
  14283. * navigation outside of the page. Examples of this occurring are when anchor links
  14284. * are clicked or when the DOM `hashchange` event is triggered.
  14285. */
  14286. on(event: 'did-navigate-in-page', listener: (event: Event,
  14287. url: string,
  14288. isMainFrame: boolean,
  14289. frameProcessId: number,
  14290. frameRoutingId: number) => void): this;
  14291. off(event: 'did-navigate-in-page', listener: (event: Event,
  14292. url: string,
  14293. isMainFrame: boolean,
  14294. frameProcessId: number,
  14295. frameRoutingId: number) => void): this;
  14296. once(event: 'did-navigate-in-page', listener: (event: Event,
  14297. url: string,
  14298. isMainFrame: boolean,
  14299. frameProcessId: number,
  14300. frameRoutingId: number) => void): this;
  14301. addListener(event: 'did-navigate-in-page', listener: (event: Event,
  14302. url: string,
  14303. isMainFrame: boolean,
  14304. frameProcessId: number,
  14305. frameRoutingId: number) => void): this;
  14306. removeListener(event: 'did-navigate-in-page', listener: (event: Event,
  14307. url: string,
  14308. isMainFrame: boolean,
  14309. frameProcessId: number,
  14310. frameRoutingId: number) => void): this;
  14311. /**
  14312. * Emitted after a server side redirect occurs during navigation. For example a
  14313. * 302 redirect.
  14314. *
  14315. * This event cannot be prevented, if you want to prevent redirects you should
  14316. * checkout out the `will-redirect` event above.
  14317. */
  14318. on(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  14319. /**
  14320. * @deprecated
  14321. */
  14322. url: string,
  14323. /**
  14324. * @deprecated
  14325. */
  14326. isInPlace: boolean,
  14327. /**
  14328. * @deprecated
  14329. */
  14330. isMainFrame: boolean,
  14331. /**
  14332. * @deprecated
  14333. */
  14334. frameProcessId: number,
  14335. /**
  14336. * @deprecated
  14337. */
  14338. frameRoutingId: number) => void): this;
  14339. off(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  14340. /**
  14341. * @deprecated
  14342. */
  14343. url: string,
  14344. /**
  14345. * @deprecated
  14346. */
  14347. isInPlace: boolean,
  14348. /**
  14349. * @deprecated
  14350. */
  14351. isMainFrame: boolean,
  14352. /**
  14353. * @deprecated
  14354. */
  14355. frameProcessId: number,
  14356. /**
  14357. * @deprecated
  14358. */
  14359. frameRoutingId: number) => void): this;
  14360. once(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  14361. /**
  14362. * @deprecated
  14363. */
  14364. url: string,
  14365. /**
  14366. * @deprecated
  14367. */
  14368. isInPlace: boolean,
  14369. /**
  14370. * @deprecated
  14371. */
  14372. isMainFrame: boolean,
  14373. /**
  14374. * @deprecated
  14375. */
  14376. frameProcessId: number,
  14377. /**
  14378. * @deprecated
  14379. */
  14380. frameRoutingId: number) => void): this;
  14381. addListener(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  14382. /**
  14383. * @deprecated
  14384. */
  14385. url: string,
  14386. /**
  14387. * @deprecated
  14388. */
  14389. isInPlace: boolean,
  14390. /**
  14391. * @deprecated
  14392. */
  14393. isMainFrame: boolean,
  14394. /**
  14395. * @deprecated
  14396. */
  14397. frameProcessId: number,
  14398. /**
  14399. * @deprecated
  14400. */
  14401. frameRoutingId: number) => void): this;
  14402. removeListener(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  14403. /**
  14404. * @deprecated
  14405. */
  14406. url: string,
  14407. /**
  14408. * @deprecated
  14409. */
  14410. isInPlace: boolean,
  14411. /**
  14412. * @deprecated
  14413. */
  14414. isMainFrame: boolean,
  14415. /**
  14416. * @deprecated
  14417. */
  14418. frameProcessId: number,
  14419. /**
  14420. * @deprecated
  14421. */
  14422. frameRoutingId: number) => void): this;
  14423. /**
  14424. * Corresponds to the points in time when the spinner of the tab started spinning.
  14425. */
  14426. on(event: 'did-start-loading', listener: Function): this;
  14427. off(event: 'did-start-loading', listener: Function): this;
  14428. once(event: 'did-start-loading', listener: Function): this;
  14429. addListener(event: 'did-start-loading', listener: Function): this;
  14430. removeListener(event: 'did-start-loading', listener: Function): this;
  14431. /**
  14432. * Emitted when any frame (including main) starts navigating.
  14433. */
  14434. on(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  14435. /**
  14436. * @deprecated
  14437. */
  14438. url: string,
  14439. /**
  14440. * @deprecated
  14441. */
  14442. isInPlace: boolean,
  14443. /**
  14444. * @deprecated
  14445. */
  14446. isMainFrame: boolean,
  14447. /**
  14448. * @deprecated
  14449. */
  14450. frameProcessId: number,
  14451. /**
  14452. * @deprecated
  14453. */
  14454. frameRoutingId: number) => void): this;
  14455. off(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  14456. /**
  14457. * @deprecated
  14458. */
  14459. url: string,
  14460. /**
  14461. * @deprecated
  14462. */
  14463. isInPlace: boolean,
  14464. /**
  14465. * @deprecated
  14466. */
  14467. isMainFrame: boolean,
  14468. /**
  14469. * @deprecated
  14470. */
  14471. frameProcessId: number,
  14472. /**
  14473. * @deprecated
  14474. */
  14475. frameRoutingId: number) => void): this;
  14476. once(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  14477. /**
  14478. * @deprecated
  14479. */
  14480. url: string,
  14481. /**
  14482. * @deprecated
  14483. */
  14484. isInPlace: boolean,
  14485. /**
  14486. * @deprecated
  14487. */
  14488. isMainFrame: boolean,
  14489. /**
  14490. * @deprecated
  14491. */
  14492. frameProcessId: number,
  14493. /**
  14494. * @deprecated
  14495. */
  14496. frameRoutingId: number) => void): this;
  14497. addListener(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  14498. /**
  14499. * @deprecated
  14500. */
  14501. url: string,
  14502. /**
  14503. * @deprecated
  14504. */
  14505. isInPlace: boolean,
  14506. /**
  14507. * @deprecated
  14508. */
  14509. isMainFrame: boolean,
  14510. /**
  14511. * @deprecated
  14512. */
  14513. frameProcessId: number,
  14514. /**
  14515. * @deprecated
  14516. */
  14517. frameRoutingId: number) => void): this;
  14518. removeListener(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  14519. /**
  14520. * @deprecated
  14521. */
  14522. url: string,
  14523. /**
  14524. * @deprecated
  14525. */
  14526. isInPlace: boolean,
  14527. /**
  14528. * @deprecated
  14529. */
  14530. isMainFrame: boolean,
  14531. /**
  14532. * @deprecated
  14533. */
  14534. frameProcessId: number,
  14535. /**
  14536. * @deprecated
  14537. */
  14538. frameRoutingId: number) => void): this;
  14539. /**
  14540. * Corresponds to the points in time when the spinner of the tab stopped spinning.
  14541. */
  14542. on(event: 'did-stop-loading', listener: Function): this;
  14543. off(event: 'did-stop-loading', listener: Function): this;
  14544. once(event: 'did-stop-loading', listener: Function): this;
  14545. addListener(event: 'did-stop-loading', listener: Function): this;
  14546. removeListener(event: 'did-stop-loading', listener: Function): this;
  14547. /**
  14548. * Emitted when the document in the top-level frame is loaded.
  14549. */
  14550. on(event: 'dom-ready', listener: Function): this;
  14551. off(event: 'dom-ready', listener: Function): this;
  14552. once(event: 'dom-ready', listener: Function): this;
  14553. addListener(event: 'dom-ready', listener: Function): this;
  14554. removeListener(event: 'dom-ready', listener: Function): this;
  14555. /**
  14556. * Emitted when the window enters a full-screen state triggered by HTML API.
  14557. */
  14558. on(event: 'enter-html-full-screen', listener: Function): this;
  14559. off(event: 'enter-html-full-screen', listener: Function): this;
  14560. once(event: 'enter-html-full-screen', listener: Function): this;
  14561. addListener(event: 'enter-html-full-screen', listener: Function): this;
  14562. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  14563. /**
  14564. * Emitted when the `WebContents` gains focus.
  14565. *
  14566. * Note that on macOS, having focus means the `WebContents` is the first responder
  14567. * of window, so switching focus between windows would not trigger the `focus` and
  14568. * `blur` events of `WebContents`, as the first responder of each window is not
  14569. * changed.
  14570. *
  14571. * The `focus` and `blur` events of `WebContents` should only be used to detect
  14572. * focus change between different `WebContents` and `BrowserView` in the same
  14573. * window.
  14574. */
  14575. on(event: 'focus', listener: Function): this;
  14576. off(event: 'focus', listener: Function): this;
  14577. once(event: 'focus', listener: Function): this;
  14578. addListener(event: 'focus', listener: Function): this;
  14579. removeListener(event: 'focus', listener: Function): this;
  14580. /**
  14581. * Emitted when a result is available for `webContents.findInPage` request.
  14582. */
  14583. on(event: 'found-in-page', listener: (event: Event,
  14584. result: Result) => void): this;
  14585. off(event: 'found-in-page', listener: (event: Event,
  14586. result: Result) => void): this;
  14587. once(event: 'found-in-page', listener: (event: Event,
  14588. result: Result) => void): this;
  14589. addListener(event: 'found-in-page', listener: (event: Event,
  14590. result: Result) => void): this;
  14591. removeListener(event: 'found-in-page', listener: (event: Event,
  14592. result: Result) => void): this;
  14593. /**
  14594. * Emitted when the mainFrame, an `<iframe>`, or a nested `<iframe>` is loaded
  14595. * within the page.
  14596. */
  14597. on(event: 'frame-created', listener: (event: Event,
  14598. details: FrameCreatedDetails) => void): this;
  14599. off(event: 'frame-created', listener: (event: Event,
  14600. details: FrameCreatedDetails) => void): this;
  14601. once(event: 'frame-created', listener: (event: Event,
  14602. details: FrameCreatedDetails) => void): this;
  14603. addListener(event: 'frame-created', listener: (event: Event,
  14604. details: FrameCreatedDetails) => void): this;
  14605. removeListener(event: 'frame-created', listener: (event: Event,
  14606. details: FrameCreatedDetails) => void): this;
  14607. /**
  14608. * Emitted when an input event is sent to the WebContents. See InputEvent for
  14609. * details.
  14610. */
  14611. on(event: 'input-event', listener: (event: Event,
  14612. inputEvent: InputEvent) => void): this;
  14613. off(event: 'input-event', listener: (event: Event,
  14614. inputEvent: InputEvent) => void): this;
  14615. once(event: 'input-event', listener: (event: Event,
  14616. inputEvent: InputEvent) => void): this;
  14617. addListener(event: 'input-event', listener: (event: Event,
  14618. inputEvent: InputEvent) => void): this;
  14619. removeListener(event: 'input-event', listener: (event: Event,
  14620. inputEvent: InputEvent) => void): this;
  14621. /**
  14622. * Emitted when the renderer process sends an asynchronous message via
  14623. * `ipcRenderer.send()`.
  14624. *
  14625. * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
  14626. * responding to IPC messages specifically from this WebContents.
  14627. */
  14628. on(event: 'ipc-message', listener: (event: IpcMainEvent,
  14629. channel: string,
  14630. ...args: any[]) => void): this;
  14631. off(event: 'ipc-message', listener: (event: IpcMainEvent,
  14632. channel: string,
  14633. ...args: any[]) => void): this;
  14634. once(event: 'ipc-message', listener: (event: IpcMainEvent,
  14635. channel: string,
  14636. ...args: any[]) => void): this;
  14637. addListener(event: 'ipc-message', listener: (event: IpcMainEvent,
  14638. channel: string,
  14639. ...args: any[]) => void): this;
  14640. removeListener(event: 'ipc-message', listener: (event: IpcMainEvent,
  14641. channel: string,
  14642. ...args: any[]) => void): this;
  14643. /**
  14644. * Emitted when the renderer process sends a synchronous message via
  14645. * `ipcRenderer.sendSync()`.
  14646. *
  14647. * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
  14648. * responding to IPC messages specifically from this WebContents.
  14649. */
  14650. on(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  14651. channel: string,
  14652. ...args: any[]) => void): this;
  14653. off(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  14654. channel: string,
  14655. ...args: any[]) => void): this;
  14656. once(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  14657. channel: string,
  14658. ...args: any[]) => void): this;
  14659. addListener(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  14660. channel: string,
  14661. ...args: any[]) => void): this;
  14662. removeListener(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  14663. channel: string,
  14664. ...args: any[]) => void): this;
  14665. /**
  14666. * Emitted when the window leaves a full-screen state triggered by HTML API.
  14667. */
  14668. on(event: 'leave-html-full-screen', listener: Function): this;
  14669. off(event: 'leave-html-full-screen', listener: Function): this;
  14670. once(event: 'leave-html-full-screen', listener: Function): this;
  14671. addListener(event: 'leave-html-full-screen', listener: Function): this;
  14672. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  14673. /**
  14674. * Emitted when `webContents` wants to do basic auth.
  14675. *
  14676. * The usage is the same with the `login` event of `app`.
  14677. */
  14678. on(event: 'login', listener: (event: Event,
  14679. authenticationResponseDetails: AuthenticationResponseDetails,
  14680. authInfo: AuthInfo,
  14681. callback: (username?: string, password?: string) => void) => void): this;
  14682. off(event: 'login', listener: (event: Event,
  14683. authenticationResponseDetails: AuthenticationResponseDetails,
  14684. authInfo: AuthInfo,
  14685. callback: (username?: string, password?: string) => void) => void): this;
  14686. once(event: 'login', listener: (event: Event,
  14687. authenticationResponseDetails: AuthenticationResponseDetails,
  14688. authInfo: AuthInfo,
  14689. callback: (username?: string, password?: string) => void) => void): this;
  14690. addListener(event: 'login', listener: (event: Event,
  14691. authenticationResponseDetails: AuthenticationResponseDetails,
  14692. authInfo: AuthInfo,
  14693. callback: (username?: string, password?: string) => void) => void): this;
  14694. removeListener(event: 'login', listener: (event: Event,
  14695. authenticationResponseDetails: AuthenticationResponseDetails,
  14696. authInfo: AuthInfo,
  14697. callback: (username?: string, password?: string) => void) => void): this;
  14698. /**
  14699. * Emitted when media is paused or done playing.
  14700. */
  14701. on(event: 'media-paused', listener: Function): this;
  14702. off(event: 'media-paused', listener: Function): this;
  14703. once(event: 'media-paused', listener: Function): this;
  14704. addListener(event: 'media-paused', listener: Function): this;
  14705. removeListener(event: 'media-paused', listener: Function): this;
  14706. /**
  14707. * Emitted when media starts playing.
  14708. */
  14709. on(event: 'media-started-playing', listener: Function): this;
  14710. off(event: 'media-started-playing', listener: Function): this;
  14711. once(event: 'media-started-playing', listener: Function): this;
  14712. addListener(event: 'media-started-playing', listener: Function): this;
  14713. removeListener(event: 'media-started-playing', listener: Function): this;
  14714. /**
  14715. * Emitted when page receives favicon urls.
  14716. */
  14717. on(event: 'page-favicon-updated', listener: (event: Event,
  14718. /**
  14719. * Array of URLs.
  14720. */
  14721. favicons: string[]) => void): this;
  14722. off(event: 'page-favicon-updated', listener: (event: Event,
  14723. /**
  14724. * Array of URLs.
  14725. */
  14726. favicons: string[]) => void): this;
  14727. once(event: 'page-favicon-updated', listener: (event: Event,
  14728. /**
  14729. * Array of URLs.
  14730. */
  14731. favicons: string[]) => void): this;
  14732. addListener(event: 'page-favicon-updated', listener: (event: Event,
  14733. /**
  14734. * Array of URLs.
  14735. */
  14736. favicons: string[]) => void): this;
  14737. removeListener(event: 'page-favicon-updated', listener: (event: Event,
  14738. /**
  14739. * Array of URLs.
  14740. */
  14741. favicons: string[]) => void): this;
  14742. /**
  14743. * Fired when page title is set during navigation. `explicitSet` is false when
  14744. * title is synthesized from file url.
  14745. */
  14746. on(event: 'page-title-updated', listener: (event: Event,
  14747. title: string,
  14748. explicitSet: boolean) => void): this;
  14749. off(event: 'page-title-updated', listener: (event: Event,
  14750. title: string,
  14751. explicitSet: boolean) => void): this;
  14752. once(event: 'page-title-updated', listener: (event: Event,
  14753. title: string,
  14754. explicitSet: boolean) => void): this;
  14755. addListener(event: 'page-title-updated', listener: (event: Event,
  14756. title: string,
  14757. explicitSet: boolean) => void): this;
  14758. removeListener(event: 'page-title-updated', listener: (event: Event,
  14759. title: string,
  14760. explicitSet: boolean) => void): this;
  14761. /**
  14762. * Emitted when a new frame is generated. Only the dirty area is passed in the
  14763. * buffer.
  14764. */
  14765. on(event: 'paint', listener: (event: Event,
  14766. dirtyRect: Rectangle,
  14767. /**
  14768. * The image data of the whole frame.
  14769. */
  14770. image: NativeImage) => void): this;
  14771. off(event: 'paint', listener: (event: Event,
  14772. dirtyRect: Rectangle,
  14773. /**
  14774. * The image data of the whole frame.
  14775. */
  14776. image: NativeImage) => void): this;
  14777. once(event: 'paint', listener: (event: Event,
  14778. dirtyRect: Rectangle,
  14779. /**
  14780. * The image data of the whole frame.
  14781. */
  14782. image: NativeImage) => void): this;
  14783. addListener(event: 'paint', listener: (event: Event,
  14784. dirtyRect: Rectangle,
  14785. /**
  14786. * The image data of the whole frame.
  14787. */
  14788. image: NativeImage) => void): this;
  14789. removeListener(event: 'paint', listener: (event: Event,
  14790. dirtyRect: Rectangle,
  14791. /**
  14792. * The image data of the whole frame.
  14793. */
  14794. image: NativeImage) => void): this;
  14795. /**
  14796. * Emitted when a plugin process has crashed.
  14797. */
  14798. on(event: 'plugin-crashed', listener: (event: Event,
  14799. name: string,
  14800. version: string) => void): this;
  14801. off(event: 'plugin-crashed', listener: (event: Event,
  14802. name: string,
  14803. version: string) => void): this;
  14804. once(event: 'plugin-crashed', listener: (event: Event,
  14805. name: string,
  14806. version: string) => void): this;
  14807. addListener(event: 'plugin-crashed', listener: (event: Event,
  14808. name: string,
  14809. version: string) => void): this;
  14810. removeListener(event: 'plugin-crashed', listener: (event: Event,
  14811. name: string,
  14812. version: string) => void): this;
  14813. /**
  14814. * Emitted when the `WebContents` preferred size has changed.
  14815. *
  14816. * This event will only be emitted when `enablePreferredSizeMode` is set to `true`
  14817. * in `webPreferences`.
  14818. */
  14819. on(event: 'preferred-size-changed', listener: (event: Event,
  14820. /**
  14821. * The minimum size needed to contain the layout of the document—without requiring
  14822. * scrolling.
  14823. */
  14824. preferredSize: Size) => void): this;
  14825. off(event: 'preferred-size-changed', listener: (event: Event,
  14826. /**
  14827. * The minimum size needed to contain the layout of the document—without requiring
  14828. * scrolling.
  14829. */
  14830. preferredSize: Size) => void): this;
  14831. once(event: 'preferred-size-changed', listener: (event: Event,
  14832. /**
  14833. * The minimum size needed to contain the layout of the document—without requiring
  14834. * scrolling.
  14835. */
  14836. preferredSize: Size) => void): this;
  14837. addListener(event: 'preferred-size-changed', listener: (event: Event,
  14838. /**
  14839. * The minimum size needed to contain the layout of the document—without requiring
  14840. * scrolling.
  14841. */
  14842. preferredSize: Size) => void): this;
  14843. removeListener(event: 'preferred-size-changed', listener: (event: Event,
  14844. /**
  14845. * The minimum size needed to contain the layout of the document—without requiring
  14846. * scrolling.
  14847. */
  14848. preferredSize: Size) => void): this;
  14849. /**
  14850. * Emitted when the preload script `preloadPath` throws an unhandled exception
  14851. * `error`.
  14852. */
  14853. on(event: 'preload-error', listener: (event: Event,
  14854. preloadPath: string,
  14855. error: Error) => void): this;
  14856. off(event: 'preload-error', listener: (event: Event,
  14857. preloadPath: string,
  14858. error: Error) => void): this;
  14859. once(event: 'preload-error', listener: (event: Event,
  14860. preloadPath: string,
  14861. error: Error) => void): this;
  14862. addListener(event: 'preload-error', listener: (event: Event,
  14863. preloadPath: string,
  14864. error: Error) => void): this;
  14865. removeListener(event: 'preload-error', listener: (event: Event,
  14866. preloadPath: string,
  14867. error: Error) => void): this;
  14868. /**
  14869. * Emitted when the renderer process unexpectedly disappears. This is normally
  14870. * because it was crashed or killed.
  14871. */
  14872. on(event: 'render-process-gone', listener: (event: Event,
  14873. details: RenderProcessGoneDetails) => void): this;
  14874. off(event: 'render-process-gone', listener: (event: Event,
  14875. details: RenderProcessGoneDetails) => void): this;
  14876. once(event: 'render-process-gone', listener: (event: Event,
  14877. details: RenderProcessGoneDetails) => void): this;
  14878. addListener(event: 'render-process-gone', listener: (event: Event,
  14879. details: RenderProcessGoneDetails) => void): this;
  14880. removeListener(event: 'render-process-gone', listener: (event: Event,
  14881. details: RenderProcessGoneDetails) => void): this;
  14882. /**
  14883. * Emitted when the unresponsive web page becomes responsive again.
  14884. */
  14885. on(event: 'responsive', listener: Function): this;
  14886. off(event: 'responsive', listener: Function): this;
  14887. once(event: 'responsive', listener: Function): this;
  14888. addListener(event: 'responsive', listener: Function): this;
  14889. removeListener(event: 'responsive', listener: Function): this;
  14890. /**
  14891. * Emitted when a bluetooth device needs to be selected when a call to
  14892. * `navigator.bluetooth.requestDevice` is made. `callback` should be called with
  14893. * the `deviceId` of the device to be selected. Passing an empty string to
  14894. * `callback` will cancel the request.
  14895. *
  14896. * If an event listener is not added for this event, or if `event.preventDefault`
  14897. * is not called when handling this event, the first available device will be
  14898. * automatically selected.
  14899. *
  14900. * Due to the nature of bluetooth, scanning for devices when
  14901. * `navigator.bluetooth.requestDevice` is called may take time and will cause
  14902. * `select-bluetooth-device` to fire multiple times until `callback` is called with
  14903. * either a device id or an empty string to cancel the request.
  14904. */
  14905. on(event: 'select-bluetooth-device', listener: (event: Event,
  14906. devices: BluetoothDevice[],
  14907. callback: (deviceId: string) => void) => void): this;
  14908. off(event: 'select-bluetooth-device', listener: (event: Event,
  14909. devices: BluetoothDevice[],
  14910. callback: (deviceId: string) => void) => void): this;
  14911. once(event: 'select-bluetooth-device', listener: (event: Event,
  14912. devices: BluetoothDevice[],
  14913. callback: (deviceId: string) => void) => void): this;
  14914. addListener(event: 'select-bluetooth-device', listener: (event: Event,
  14915. devices: BluetoothDevice[],
  14916. callback: (deviceId: string) => void) => void): this;
  14917. removeListener(event: 'select-bluetooth-device', listener: (event: Event,
  14918. devices: BluetoothDevice[],
  14919. callback: (deviceId: string) => void) => void): this;
  14920. /**
  14921. * Emitted when a client certificate is requested.
  14922. *
  14923. * The usage is the same with the `select-client-certificate` event of `app`.
  14924. */
  14925. on(event: 'select-client-certificate', listener: (event: Event,
  14926. url: string,
  14927. certificateList: Certificate[],
  14928. callback: (certificate: Certificate) => void) => void): this;
  14929. off(event: 'select-client-certificate', listener: (event: Event,
  14930. url: string,
  14931. certificateList: Certificate[],
  14932. callback: (certificate: Certificate) => void) => void): this;
  14933. once(event: 'select-client-certificate', listener: (event: Event,
  14934. url: string,
  14935. certificateList: Certificate[],
  14936. callback: (certificate: Certificate) => void) => void): this;
  14937. addListener(event: 'select-client-certificate', listener: (event: Event,
  14938. url: string,
  14939. certificateList: Certificate[],
  14940. callback: (certificate: Certificate) => void) => void): this;
  14941. removeListener(event: 'select-client-certificate', listener: (event: Event,
  14942. url: string,
  14943. certificateList: Certificate[],
  14944. callback: (certificate: Certificate) => void) => void): this;
  14945. /**
  14946. * Emitted when the web page becomes unresponsive.
  14947. */
  14948. on(event: 'unresponsive', listener: Function): this;
  14949. off(event: 'unresponsive', listener: Function): this;
  14950. once(event: 'unresponsive', listener: Function): this;
  14951. addListener(event: 'unresponsive', listener: Function): this;
  14952. removeListener(event: 'unresponsive', listener: Function): this;
  14953. /**
  14954. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  14955. */
  14956. on(event: 'update-target-url', listener: (event: Event,
  14957. url: string) => void): this;
  14958. off(event: 'update-target-url', listener: (event: Event,
  14959. url: string) => void): this;
  14960. once(event: 'update-target-url', listener: (event: Event,
  14961. url: string) => void): this;
  14962. addListener(event: 'update-target-url', listener: (event: Event,
  14963. url: string) => void): this;
  14964. removeListener(event: 'update-target-url', listener: (event: Event,
  14965. url: string) => void): this;
  14966. /**
  14967. * Emitted when a `<webview>`'s web contents is being attached to this web
  14968. * contents. Calling `event.preventDefault()` will destroy the guest page.
  14969. *
  14970. * This event can be used to configure `webPreferences` for the `webContents` of a
  14971. * `<webview>` before it's loaded, and provides the ability to set settings that
  14972. * can't be set via `<webview>` attributes.
  14973. */
  14974. on(event: 'will-attach-webview', listener: (event: Event,
  14975. /**
  14976. * The web preferences that will be used by the guest page. This object can be
  14977. * modified to adjust the preferences for the guest page.
  14978. */
  14979. webPreferences: WebPreferences,
  14980. /**
  14981. * The other `<webview>` parameters such as the `src` URL. This object can be
  14982. * modified to adjust the parameters of the guest page.
  14983. */
  14984. params: Record<string, string>) => void): this;
  14985. off(event: 'will-attach-webview', listener: (event: Event,
  14986. /**
  14987. * The web preferences that will be used by the guest page. This object can be
  14988. * modified to adjust the preferences for the guest page.
  14989. */
  14990. webPreferences: WebPreferences,
  14991. /**
  14992. * The other `<webview>` parameters such as the `src` URL. This object can be
  14993. * modified to adjust the parameters of the guest page.
  14994. */
  14995. params: Record<string, string>) => void): this;
  14996. once(event: 'will-attach-webview', listener: (event: Event,
  14997. /**
  14998. * The web preferences that will be used by the guest page. This object can be
  14999. * modified to adjust the preferences for the guest page.
  15000. */
  15001. webPreferences: WebPreferences,
  15002. /**
  15003. * The other `<webview>` parameters such as the `src` URL. This object can be
  15004. * modified to adjust the parameters of the guest page.
  15005. */
  15006. params: Record<string, string>) => void): this;
  15007. addListener(event: 'will-attach-webview', listener: (event: Event,
  15008. /**
  15009. * The web preferences that will be used by the guest page. This object can be
  15010. * modified to adjust the preferences for the guest page.
  15011. */
  15012. webPreferences: WebPreferences,
  15013. /**
  15014. * The other `<webview>` parameters such as the `src` URL. This object can be
  15015. * modified to adjust the parameters of the guest page.
  15016. */
  15017. params: Record<string, string>) => void): this;
  15018. removeListener(event: 'will-attach-webview', listener: (event: Event,
  15019. /**
  15020. * The web preferences that will be used by the guest page. This object can be
  15021. * modified to adjust the preferences for the guest page.
  15022. */
  15023. webPreferences: WebPreferences,
  15024. /**
  15025. * The other `<webview>` parameters such as the `src` URL. This object can be
  15026. * modified to adjust the parameters of the guest page.
  15027. */
  15028. params: Record<string, string>) => void): this;
  15029. /**
  15030. * Emitted when a user or the page wants to start navigation in any frame. It can
  15031. * happen when the `window.location` object is changed or a user clicks a link in
  15032. * the page.
  15033. *
  15034. * Unlike `will-navigate`, `will-frame-navigate` is fired when the main frame or
  15035. * any of its subframes attempts to navigate. When the navigation event comes from
  15036. * the main frame, `isMainFrame` will be `true`.
  15037. *
  15038. * This event will not emit when the navigation is started programmatically with
  15039. * APIs like `webContents.loadURL` and `webContents.back`.
  15040. *
  15041. * It is also not emitted for in-page navigations, such as clicking anchor links or
  15042. * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
  15043. * purpose.
  15044. *
  15045. * Calling `event.preventDefault()` will prevent the navigation.
  15046. */
  15047. on(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  15048. off(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  15049. once(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  15050. addListener(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  15051. removeListener(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  15052. /**
  15053. * Emitted when a user or the page wants to start navigation on the main frame. It
  15054. * can happen when the `window.location` object is changed or a user clicks a link
  15055. * in the page.
  15056. *
  15057. * This event will not emit when the navigation is started programmatically with
  15058. * APIs like `webContents.loadURL` and `webContents.back`.
  15059. *
  15060. * It is also not emitted for in-page navigations, such as clicking anchor links or
  15061. * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
  15062. * purpose.
  15063. *
  15064. * Calling `event.preventDefault()` will prevent the navigation.
  15065. */
  15066. on(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  15067. /**
  15068. * @deprecated
  15069. */
  15070. url: string,
  15071. /**
  15072. * @deprecated
  15073. */
  15074. isInPlace: boolean,
  15075. /**
  15076. * @deprecated
  15077. */
  15078. isMainFrame: boolean,
  15079. /**
  15080. * @deprecated
  15081. */
  15082. frameProcessId: number,
  15083. /**
  15084. * @deprecated
  15085. */
  15086. frameRoutingId: number) => void): this;
  15087. off(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  15088. /**
  15089. * @deprecated
  15090. */
  15091. url: string,
  15092. /**
  15093. * @deprecated
  15094. */
  15095. isInPlace: boolean,
  15096. /**
  15097. * @deprecated
  15098. */
  15099. isMainFrame: boolean,
  15100. /**
  15101. * @deprecated
  15102. */
  15103. frameProcessId: number,
  15104. /**
  15105. * @deprecated
  15106. */
  15107. frameRoutingId: number) => void): this;
  15108. once(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  15109. /**
  15110. * @deprecated
  15111. */
  15112. url: string,
  15113. /**
  15114. * @deprecated
  15115. */
  15116. isInPlace: boolean,
  15117. /**
  15118. * @deprecated
  15119. */
  15120. isMainFrame: boolean,
  15121. /**
  15122. * @deprecated
  15123. */
  15124. frameProcessId: number,
  15125. /**
  15126. * @deprecated
  15127. */
  15128. frameRoutingId: number) => void): this;
  15129. addListener(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  15130. /**
  15131. * @deprecated
  15132. */
  15133. url: string,
  15134. /**
  15135. * @deprecated
  15136. */
  15137. isInPlace: boolean,
  15138. /**
  15139. * @deprecated
  15140. */
  15141. isMainFrame: boolean,
  15142. /**
  15143. * @deprecated
  15144. */
  15145. frameProcessId: number,
  15146. /**
  15147. * @deprecated
  15148. */
  15149. frameRoutingId: number) => void): this;
  15150. removeListener(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  15151. /**
  15152. * @deprecated
  15153. */
  15154. url: string,
  15155. /**
  15156. * @deprecated
  15157. */
  15158. isInPlace: boolean,
  15159. /**
  15160. * @deprecated
  15161. */
  15162. isMainFrame: boolean,
  15163. /**
  15164. * @deprecated
  15165. */
  15166. frameProcessId: number,
  15167. /**
  15168. * @deprecated
  15169. */
  15170. frameRoutingId: number) => void): this;
  15171. /**
  15172. * Emitted when a `beforeunload` event handler is attempting to cancel a page
  15173. * unload.
  15174. *
  15175. * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
  15176. * and allow the page to be unloaded.
  15177. *
  15178. * **Note:** This will be emitted for `BrowserViews` but will _not_ be respected -
  15179. * this is because we have chosen not to tie the `BrowserView` lifecycle to its
  15180. * owning BrowserWindow should one exist per the specification.
  15181. */
  15182. on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  15183. off(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  15184. once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  15185. addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  15186. removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  15187. /**
  15188. * Emitted when a server side redirect occurs during navigation. For example a 302
  15189. * redirect.
  15190. *
  15191. * This event will be emitted after `did-start-navigation` and always before the
  15192. * `did-redirect-navigation` event for the same navigation.
  15193. *
  15194. * Calling `event.preventDefault()` will prevent the navigation (not just the
  15195. * redirect).
  15196. */
  15197. on(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  15198. /**
  15199. * @deprecated
  15200. */
  15201. url: string,
  15202. /**
  15203. * @deprecated
  15204. */
  15205. isInPlace: boolean,
  15206. /**
  15207. * @deprecated
  15208. */
  15209. isMainFrame: boolean,
  15210. /**
  15211. * @deprecated
  15212. */
  15213. frameProcessId: number,
  15214. /**
  15215. * @deprecated
  15216. */
  15217. frameRoutingId: number) => void): this;
  15218. off(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  15219. /**
  15220. * @deprecated
  15221. */
  15222. url: string,
  15223. /**
  15224. * @deprecated
  15225. */
  15226. isInPlace: boolean,
  15227. /**
  15228. * @deprecated
  15229. */
  15230. isMainFrame: boolean,
  15231. /**
  15232. * @deprecated
  15233. */
  15234. frameProcessId: number,
  15235. /**
  15236. * @deprecated
  15237. */
  15238. frameRoutingId: number) => void): this;
  15239. once(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  15240. /**
  15241. * @deprecated
  15242. */
  15243. url: string,
  15244. /**
  15245. * @deprecated
  15246. */
  15247. isInPlace: boolean,
  15248. /**
  15249. * @deprecated
  15250. */
  15251. isMainFrame: boolean,
  15252. /**
  15253. * @deprecated
  15254. */
  15255. frameProcessId: number,
  15256. /**
  15257. * @deprecated
  15258. */
  15259. frameRoutingId: number) => void): this;
  15260. addListener(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  15261. /**
  15262. * @deprecated
  15263. */
  15264. url: string,
  15265. /**
  15266. * @deprecated
  15267. */
  15268. isInPlace: boolean,
  15269. /**
  15270. * @deprecated
  15271. */
  15272. isMainFrame: boolean,
  15273. /**
  15274. * @deprecated
  15275. */
  15276. frameProcessId: number,
  15277. /**
  15278. * @deprecated
  15279. */
  15280. frameRoutingId: number) => void): this;
  15281. removeListener(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  15282. /**
  15283. * @deprecated
  15284. */
  15285. url: string,
  15286. /**
  15287. * @deprecated
  15288. */
  15289. isInPlace: boolean,
  15290. /**
  15291. * @deprecated
  15292. */
  15293. isMainFrame: boolean,
  15294. /**
  15295. * @deprecated
  15296. */
  15297. frameProcessId: number,
  15298. /**
  15299. * @deprecated
  15300. */
  15301. frameRoutingId: number) => void): this;
  15302. /**
  15303. * Emitted when the user is requesting to change the zoom level using the mouse
  15304. * wheel.
  15305. */
  15306. on(event: 'zoom-changed', listener: (event: Event,
  15307. /**
  15308. * Can be `in` or `out`.
  15309. */
  15310. zoomDirection: ('in' | 'out')) => void): this;
  15311. off(event: 'zoom-changed', listener: (event: Event,
  15312. /**
  15313. * Can be `in` or `out`.
  15314. */
  15315. zoomDirection: ('in' | 'out')) => void): this;
  15316. once(event: 'zoom-changed', listener: (event: Event,
  15317. /**
  15318. * Can be `in` or `out`.
  15319. */
  15320. zoomDirection: ('in' | 'out')) => void): this;
  15321. addListener(event: 'zoom-changed', listener: (event: Event,
  15322. /**
  15323. * Can be `in` or `out`.
  15324. */
  15325. zoomDirection: ('in' | 'out')) => void): this;
  15326. removeListener(event: 'zoom-changed', listener: (event: Event,
  15327. /**
  15328. * Can be `in` or `out`.
  15329. */
  15330. zoomDirection: ('in' | 'out')) => void): this;
  15331. /**
  15332. * Adds the specified path to DevTools workspace. Must be used after DevTools
  15333. * creation:
  15334. */
  15335. addWorkSpace(path: string): void;
  15336. /**
  15337. * Adjusts the current text selection starting and ending points in the focused
  15338. * frame by the given amounts. A negative amount moves the selection towards the
  15339. * beginning of the document, and a positive amount moves the selection towards the
  15340. * end of the document.
  15341. *
  15342. * Example:
  15343. *
  15344. * For a call of `win.webContents.adjustSelection({ start: 1, end: 5 })`
  15345. *
  15346. * Before:
  15347. *
  15348. * <img width="487" alt="Image Before Text Selection Adjustment"
  15349. * src="../images/web-contents-text-selection-before.png"/>
  15350. *
  15351. * After:
  15352. *
  15353. * <img width="487" alt="Image After Text Selection Adjustment"
  15354. * src="../images/web-contents-text-selection-after.png"/>
  15355. */
  15356. adjustSelection(options: AdjustSelectionOptions): void;
  15357. /**
  15358. * Begin subscribing for presentation events and captured frames, the `callback`
  15359. * will be called with `callback(image, dirtyRect)` when there is a presentation
  15360. * event.
  15361. *
  15362. * The `image` is an instance of NativeImage that stores the captured frame.
  15363. *
  15364. * The `dirtyRect` is an object with `x, y, width, height` properties that
  15365. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  15366. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  15367. */
  15368. beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  15369. /**
  15370. * Begin subscribing for presentation events and captured frames, the `callback`
  15371. * will be called with `callback(image, dirtyRect)` when there is a presentation
  15372. * event.
  15373. *
  15374. * The `image` is an instance of NativeImage that stores the captured frame.
  15375. *
  15376. * The `dirtyRect` is an object with `x, y, width, height` properties that
  15377. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  15378. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  15379. */
  15380. beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  15381. /**
  15382. * Whether the browser can go back to previous web page.
  15383. */
  15384. canGoBack(): boolean;
  15385. /**
  15386. * Whether the browser can go forward to next web page.
  15387. */
  15388. canGoForward(): boolean;
  15389. /**
  15390. * Whether the web page can go to `offset`.
  15391. */
  15392. canGoToOffset(offset: number): boolean;
  15393. /**
  15394. * Resolves with a NativeImage
  15395. *
  15396. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  15397. * whole visible page. The page is considered visible when its browser window is
  15398. * hidden and the capturer count is non-zero. If you would like the page to stay
  15399. * hidden, you should ensure that `stayHidden` is set to true.
  15400. */
  15401. capturePage(rect?: Rectangle, opts?: Opts): Promise<Electron.NativeImage>;
  15402. /**
  15403. * Centers the current text selection in web page.
  15404. */
  15405. centerSelection(): void;
  15406. /**
  15407. * Clears the navigation history.
  15408. */
  15409. clearHistory(): void;
  15410. /**
  15411. * Closes the page, as if the web content had called `window.close()`.
  15412. *
  15413. * If the page is successfully closed (i.e. the unload is not prevented by the
  15414. * page, or `waitForBeforeUnload` is false or unspecified), the WebContents will be
  15415. * destroyed and no longer usable. The `destroyed` event will be emitted.
  15416. */
  15417. close(opts?: CloseOpts): void;
  15418. /**
  15419. * Closes the devtools.
  15420. */
  15421. closeDevTools(): void;
  15422. /**
  15423. * Executes the editing command `copy` in web page.
  15424. */
  15425. copy(): void;
  15426. /**
  15427. * Copy the image at the given position to the clipboard.
  15428. */
  15429. copyImageAt(x: number, y: number): void;
  15430. /**
  15431. * Executes the editing command `cut` in web page.
  15432. */
  15433. cut(): void;
  15434. /**
  15435. * Executes the editing command `delete` in web page.
  15436. */
  15437. delete(): void;
  15438. /**
  15439. * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
  15440. */
  15441. disableDeviceEmulation(): void;
  15442. /**
  15443. * Initiates a download of the resource at `url` without navigating. The
  15444. * `will-download` event of `session` will be triggered.
  15445. */
  15446. downloadURL(url: string, options?: DownloadURLOptions): void;
  15447. /**
  15448. * Enable device emulation with the given parameters.
  15449. */
  15450. enableDeviceEmulation(parameters: Parameters): void;
  15451. /**
  15452. * End subscribing for frame presentation events.
  15453. */
  15454. endFrameSubscription(): void;
  15455. /**
  15456. * A promise that resolves with the result of the executed code or is rejected if
  15457. * the result of the code is a rejected promise.
  15458. *
  15459. * Evaluates `code` in page.
  15460. *
  15461. * In the browser window some HTML APIs like `requestFullScreen` can only be
  15462. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  15463. * this limitation.
  15464. *
  15465. * Code execution will be suspended until web page stop loading.
  15466. */
  15467. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  15468. /**
  15469. * A promise that resolves with the result of the executed code or is rejected if
  15470. * the result of the code is a rejected promise.
  15471. *
  15472. * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  15473. */
  15474. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
  15475. /**
  15476. * The request id used for the request.
  15477. *
  15478. * Starts a request to find all matches for the `text` in the web page. The result
  15479. * of the request can be obtained by subscribing to `found-in-page` event.
  15480. */
  15481. findInPage(text: string, options?: FindInPageOptions): number;
  15482. /**
  15483. * Focuses the web page.
  15484. */
  15485. focus(): void;
  15486. /**
  15487. * Forcefully terminates the renderer process that is currently hosting this
  15488. * `webContents`. This will cause the `render-process-gone` event to be emitted
  15489. * with the `reason=killed || reason=crashed`. Please note that some webContents
  15490. * share renderer processes and therefore calling this method may also crash the
  15491. * host process for other webContents as well.
  15492. *
  15493. * Calling `reload()` immediately after calling this method will force the reload
  15494. * to occur in a new process. This should be used when this process is unstable or
  15495. * unusable, for instance in order to recover from the `unresponsive` event.
  15496. */
  15497. forcefullyCrashRenderer(): void;
  15498. /**
  15499. * Information about all Shared Workers.
  15500. */
  15501. getAllSharedWorkers(): SharedWorkerInfo[];
  15502. /**
  15503. * whether or not this WebContents will throttle animations and timers when the
  15504. * page becomes backgrounded. This also affects the Page Visibility API.
  15505. */
  15506. getBackgroundThrottling(): boolean;
  15507. /**
  15508. * the current title of the DevTools window. This will only be visible if DevTools
  15509. * is opened in `undocked` or `detach` mode.
  15510. */
  15511. getDevToolsTitle(): string;
  15512. /**
  15513. * If _offscreen rendering_ is enabled returns the current frame rate.
  15514. */
  15515. getFrameRate(): number;
  15516. /**
  15517. * The identifier of a WebContents stream. This identifier can be used with
  15518. * `navigator.mediaDevices.getUserMedia` using a `chromeMediaSource` of `tab`. The
  15519. * identifier is restricted to the web contents that it is registered to and is
  15520. * only valid for 10 seconds.
  15521. */
  15522. getMediaSourceId(requestWebContents: WebContents): string;
  15523. /**
  15524. * The operating system `pid` of the associated renderer process.
  15525. */
  15526. getOSProcessId(): number;
  15527. /**
  15528. * Get the system printer list.
  15529. *
  15530. * Resolves with a `PrinterInfo[]`
  15531. */
  15532. getPrintersAsync(): Promise<Electron.PrinterInfo[]>;
  15533. /**
  15534. * The Chromium internal `pid` of the associated renderer. Can be compared to the
  15535. * `frameProcessId` passed by frame specific navigation events (e.g.
  15536. * `did-frame-navigate`)
  15537. */
  15538. getProcessId(): number;
  15539. /**
  15540. * The title of the current web page.
  15541. */
  15542. getTitle(): string;
  15543. /**
  15544. * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
  15545. * `remote`, `webview` or `offscreen`.
  15546. */
  15547. getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
  15548. /**
  15549. * The URL of the current web page.
  15550. */
  15551. getURL(): string;
  15552. /**
  15553. * The user agent for this web page.
  15554. */
  15555. getUserAgent(): string;
  15556. /**
  15557. * Returns the WebRTC IP Handling Policy.
  15558. */
  15559. getWebRTCIPHandlingPolicy(): string;
  15560. /**
  15561. * * `min` Integer - The minimum UDP port number that WebRTC should use.
  15562. * * `max` Integer - The maximum UDP port number that WebRTC should use.
  15563. *
  15564. * By default this value is `{ min: 0, max: 0 }` , which would apply no restriction
  15565. * on the udp port range.
  15566. */
  15567. getWebRTCUDPPortRange(): WebRTCUDPPortRange;
  15568. /**
  15569. * the current zoom factor.
  15570. */
  15571. getZoomFactor(): number;
  15572. /**
  15573. * the current zoom level.
  15574. */
  15575. getZoomLevel(): number;
  15576. /**
  15577. * Makes the browser go back a web page.
  15578. */
  15579. goBack(): void;
  15580. /**
  15581. * Makes the browser go forward a web page.
  15582. */
  15583. goForward(): void;
  15584. /**
  15585. * Navigates browser to the specified absolute web page index.
  15586. */
  15587. goToIndex(index: number): void;
  15588. /**
  15589. * Navigates to the specified offset from the "current entry".
  15590. */
  15591. goToOffset(offset: number): void;
  15592. /**
  15593. * A promise that resolves with a key for the inserted CSS that can later be used
  15594. * to remove the CSS via `contents.removeInsertedCSS(key)`.
  15595. *
  15596. * Injects CSS into the current web page and returns a unique key for the inserted
  15597. * stylesheet.
  15598. */
  15599. insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
  15600. /**
  15601. * Inserts `text` to the focused element.
  15602. */
  15603. insertText(text: string): Promise<void>;
  15604. /**
  15605. * Starts inspecting element at position (`x`, `y`).
  15606. */
  15607. inspectElement(x: number, y: number): void;
  15608. /**
  15609. * Opens the developer tools for the service worker context.
  15610. */
  15611. inspectServiceWorker(): void;
  15612. /**
  15613. * Opens the developer tools for the shared worker context.
  15614. */
  15615. inspectSharedWorker(): void;
  15616. /**
  15617. * Inspects the shared worker based on its ID.
  15618. */
  15619. inspectSharedWorkerById(workerId: string): void;
  15620. /**
  15621. * Schedules a full repaint of the window this web contents is in.
  15622. *
  15623. * If _offscreen rendering_ is enabled invalidates the frame and generates a new
  15624. * one through the `'paint'` event.
  15625. */
  15626. invalidate(): void;
  15627. /**
  15628. * Whether this page has been muted.
  15629. */
  15630. isAudioMuted(): boolean;
  15631. /**
  15632. * Whether this page is being captured. It returns true when the capturer count is
  15633. * large then 0.
  15634. */
  15635. isBeingCaptured(): boolean;
  15636. /**
  15637. * Whether the renderer process has crashed.
  15638. */
  15639. isCrashed(): boolean;
  15640. /**
  15641. * Whether audio is currently playing.
  15642. */
  15643. isCurrentlyAudible(): boolean;
  15644. /**
  15645. * Whether the web page is destroyed.
  15646. */
  15647. isDestroyed(): boolean;
  15648. /**
  15649. * Whether the devtools view is focused .
  15650. */
  15651. isDevToolsFocused(): boolean;
  15652. /**
  15653. * Whether the devtools is opened.
  15654. */
  15655. isDevToolsOpened(): boolean;
  15656. /**
  15657. * Whether the web page is focused.
  15658. */
  15659. isFocused(): boolean;
  15660. /**
  15661. * Whether web page is still loading resources.
  15662. */
  15663. isLoading(): boolean;
  15664. /**
  15665. * Whether the main frame (and not just iframes or frames within it) is still
  15666. * loading.
  15667. */
  15668. isLoadingMainFrame(): boolean;
  15669. /**
  15670. * Indicates whether _offscreen rendering_ is enabled.
  15671. */
  15672. isOffscreen(): boolean;
  15673. /**
  15674. * If _offscreen rendering_ is enabled returns whether it is currently painting.
  15675. */
  15676. isPainting(): boolean;
  15677. /**
  15678. * Whether the web page is waiting for a first-response from the main resource of
  15679. * the page.
  15680. */
  15681. isWaitingForResponse(): boolean;
  15682. /**
  15683. * the promise will resolve when the page has finished loading (see
  15684. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  15685. *
  15686. * Loads the given file in the window, `filePath` should be a path to an HTML file
  15687. * relative to the root of your application. For instance an app structure like
  15688. * this:
  15689. *
  15690. * Would require code like this
  15691. */
  15692. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  15693. /**
  15694. * the promise will resolve when the page has finished loading (see
  15695. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  15696. * A noop rejection handler is already attached, which avoids unhandled rejection
  15697. * errors.
  15698. *
  15699. * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
  15700. * the `http://` or `file://`. If the load should bypass http cache then use the
  15701. * `pragma` header to achieve it.
  15702. */
  15703. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  15704. /**
  15705. * Opens the devtools.
  15706. *
  15707. * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
  15708. * explicitly passing an empty `mode` can force using last used dock state.
  15709. *
  15710. * On Windows, if Windows Control Overlay is enabled, Devtools will be opened with
  15711. * `mode: 'detach'`.
  15712. */
  15713. openDevTools(options?: OpenDevToolsOptions): void;
  15714. /**
  15715. * Executes the editing command `paste` in web page.
  15716. */
  15717. paste(): void;
  15718. /**
  15719. * Executes the editing command `pasteAndMatchStyle` in web page.
  15720. */
  15721. pasteAndMatchStyle(): void;
  15722. /**
  15723. * Send a message to the renderer process, optionally transferring ownership of
  15724. * zero or more `MessagePortMain` objects.
  15725. *
  15726. * The transferred `MessagePortMain` objects will be available in the renderer
  15727. * process by accessing the `ports` property of the emitted event. When they arrive
  15728. * in the renderer, they will be native DOM `MessagePort` objects.
  15729. *
  15730. * For example:
  15731. */
  15732. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  15733. /**
  15734. * When a custom `pageSize` is passed, Chromium attempts to validate platform
  15735. * specific minimum values for `width_microns` and `height_microns`. Width and
  15736. * height must both be minimum 353 microns but may be higher on some operating
  15737. * systems.
  15738. *
  15739. * Prints window's web page. When `silent` is set to `true`, Electron will pick the
  15740. * system's default printer if `deviceName` is empty and the default settings for
  15741. * printing.
  15742. *
  15743. * Use `page-break-before: always;` CSS style to force to print to a new page.
  15744. *
  15745. * Example usage:
  15746. */
  15747. print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
  15748. /**
  15749. * Resolves with the generated PDF data.
  15750. *
  15751. * Prints the window's web page as PDF.
  15752. *
  15753. * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
  15754. *
  15755. * An example of `webContents.printToPDF`:
  15756. *
  15757. * See Page.printToPdf for more information.
  15758. */
  15759. printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
  15760. /**
  15761. * Executes the editing command `redo` in web page.
  15762. */
  15763. redo(): void;
  15764. /**
  15765. * Reloads the current web page.
  15766. */
  15767. reload(): void;
  15768. /**
  15769. * Reloads current page and ignores cache.
  15770. */
  15771. reloadIgnoringCache(): void;
  15772. /**
  15773. * Resolves if the removal was successful.
  15774. *
  15775. * Removes the inserted CSS from the current web page. The stylesheet is identified
  15776. * by its key, which is returned from `contents.insertCSS(css)`.
  15777. */
  15778. removeInsertedCSS(key: string): Promise<void>;
  15779. /**
  15780. * Removes the specified path from DevTools workspace.
  15781. */
  15782. removeWorkSpace(path: string): void;
  15783. /**
  15784. * Executes the editing command `replace` in web page.
  15785. */
  15786. replace(text: string): void;
  15787. /**
  15788. * Executes the editing command `replaceMisspelling` in web page.
  15789. */
  15790. replaceMisspelling(text: string): void;
  15791. /**
  15792. * resolves if the page is saved.
  15793. */
  15794. savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
  15795. /**
  15796. * Scrolls to the bottom of the current `webContents`.
  15797. */
  15798. scrollToBottom(): void;
  15799. /**
  15800. * Scrolls to the top of the current `webContents`.
  15801. */
  15802. scrollToTop(): void;
  15803. /**
  15804. * Executes the editing command `selectAll` in web page.
  15805. */
  15806. selectAll(): void;
  15807. /**
  15808. * Send an asynchronous message to the renderer process via `channel`, along with
  15809. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  15810. * just like `postMessage`, so prototype chains will not be included. Sending
  15811. * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
  15812. *
  15813. * :::warning
  15814. *
  15815. * Sending non-standard JavaScript types such as DOM objects or special Electron
  15816. * objects will throw an exception.
  15817. *
  15818. * :::
  15819. *
  15820. * For additional reading, refer to Electron's IPC guide.
  15821. */
  15822. send(channel: string, ...args: any[]): void;
  15823. /**
  15824. * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
  15825. * contents needs to be focused for `sendInputEvent()` to work.
  15826. */
  15827. sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
  15828. /**
  15829. * Send an asynchronous message to a specific frame in a renderer process via
  15830. * `channel`, along with arguments. Arguments will be serialized with the
  15831. * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
  15832. * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
  15833. * will throw an exception.
  15834. *
  15835. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  15836. * Electron objects will throw an exception.
  15837. *
  15838. * The renderer process can handle the message by listening to `channel` with the
  15839. * `ipcRenderer` module.
  15840. *
  15841. * If you want to get the `frameId` of a given renderer context you should use the
  15842. * `webFrame.routingId` value. E.g.
  15843. *
  15844. * You can also read `frameId` from all incoming IPC messages in the main process.
  15845. */
  15846. sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
  15847. /**
  15848. * Mute the audio on the current web page.
  15849. */
  15850. setAudioMuted(muted: boolean): void;
  15851. /**
  15852. * Controls whether or not this WebContents will throttle animations and timers
  15853. * when the page becomes backgrounded. This also affects the Page Visibility API.
  15854. */
  15855. setBackgroundThrottling(allowed: boolean): void;
  15856. /**
  15857. * Changes the title of the DevTools window to `title`. This will only be visible
  15858. * if DevTools is opened in `undocked` or `detach` mode.
  15859. */
  15860. setDevToolsTitle(title: string): void;
  15861. /**
  15862. * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
  15863. *
  15864. * The `devToolsWebContents` must not have done any navigation, and it should not
  15865. * be used for other purposes after the call.
  15866. *
  15867. * By default Electron manages the devtools by creating an internal `WebContents`
  15868. * with native view, which developers have very limited control of. With the
  15869. * `setDevToolsWebContents` method, developers can use any `WebContents` to show
  15870. * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
  15871. * tag.
  15872. *
  15873. * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
  15874. * caller's responsibility to destroy `devToolsWebContents`.
  15875. *
  15876. * An example of showing devtools in a `<webview>` tag:
  15877. *
  15878. * An example of showing devtools in a `BrowserWindow`:
  15879. */
  15880. setDevToolsWebContents(devToolsWebContents: WebContents): void;
  15881. /**
  15882. * If _offscreen rendering_ is enabled sets the frame rate to the specified number.
  15883. * Only values between 1 and 240 are accepted.
  15884. */
  15885. setFrameRate(fps: number): void;
  15886. /**
  15887. * Ignore application menu shortcuts while this web contents is focused.
  15888. */
  15889. setIgnoreMenuShortcuts(ignore: boolean): void;
  15890. /**
  15891. * Sets the image animation policy for this webContents. The policy only affects
  15892. * _new_ images, existing images that are currently being animated are unaffected.
  15893. * This is a known limitation in Chromium, you can force image animation to be
  15894. * recalculated with `img.src = img.src` which will result in no network traffic
  15895. * but will update the animation policy.
  15896. *
  15897. * This corresponds to the animationPolicy accessibility feature in Chromium.
  15898. */
  15899. setImageAnimationPolicy(policy: 'animate' | 'animateOnce' | 'noAnimation'): void;
  15900. /**
  15901. * Overrides the user agent for this web page.
  15902. */
  15903. setUserAgent(userAgent: string): void;
  15904. /**
  15905. * Sets the maximum and minimum pinch-to-zoom level.
  15906. *
  15907. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  15908. * call:
  15909. */
  15910. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  15911. /**
  15912. * Setting the WebRTC IP handling policy allows you to control which IPs are
  15913. * exposed via WebRTC. See BrowserLeaks for more details.
  15914. */
  15915. setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
  15916. /**
  15917. * Setting the WebRTC UDP Port Range allows you to restrict the udp port range used
  15918. * by WebRTC. By default the port range is unrestricted. **Note:** To reset to an
  15919. * unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
  15920. */
  15921. setWebRTCUDPPortRange(udpPortRange: UdpPortRange): void;
  15922. /**
  15923. * Called before creating a window a new window is requested by the renderer, e.g.
  15924. * by `window.open()`, a link with `target="_blank"`, shift+clicking on a link, or
  15925. * submitting a form with `<form target="_blank">`. See `window.open()` for more
  15926. * details and how to use this in conjunction with `did-create-window`.
  15927. *
  15928. * An example showing how to customize the process of new `BrowserWindow` creation
  15929. * to be `BrowserView` attached to main window instead:
  15930. */
  15931. setWindowOpenHandler(handler: (details: HandlerDetails) => WindowOpenHandlerResponse): void;
  15932. /**
  15933. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  15934. * divided by 100, so 300% = 3.0.
  15935. *
  15936. * The factor must be greater than 0.0.
  15937. */
  15938. setZoomFactor(factor: number): void;
  15939. /**
  15940. * Changes the zoom level to the specified level. The original size is 0 and each
  15941. * increment above or below represents zooming 20% larger or smaller to default
  15942. * limits of 300% and 50% of original size, respectively. The formula for this is
  15943. * `scale := 1.2 ^ level`.
  15944. *
  15945. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  15946. * the zoom level for a specific domain propagates across all instances of windows
  15947. * with the same domain. Differentiating the window URLs will make zoom work
  15948. * per-window.
  15949. */
  15950. setZoomLevel(level: number): void;
  15951. /**
  15952. * Shows pop-up dictionary that searches the selected word on the page.
  15953. *
  15954. * @platform darwin
  15955. */
  15956. showDefinitionForSelection(): void;
  15957. /**
  15958. * Sets the `item` as dragging item for current drag-drop operation, `file` is the
  15959. * absolute path of the file to be dragged, and `icon` is the image showing under
  15960. * the cursor when dragging.
  15961. */
  15962. startDrag(item: Item): void;
  15963. /**
  15964. * If _offscreen rendering_ is enabled and not painting, start painting.
  15965. */
  15966. startPainting(): void;
  15967. /**
  15968. * Stops any pending navigation.
  15969. */
  15970. stop(): void;
  15971. /**
  15972. * Stops any `findInPage` request for the `webContents` with the provided `action`.
  15973. */
  15974. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  15975. /**
  15976. * If _offscreen rendering_ is enabled and painting, stop painting.
  15977. */
  15978. stopPainting(): void;
  15979. /**
  15980. * Indicates whether the snapshot has been created successfully.
  15981. *
  15982. * Takes a V8 heap snapshot and saves it to `filePath`.
  15983. */
  15984. takeHeapSnapshot(filePath: string): Promise<void>;
  15985. /**
  15986. * Toggles the developer tools.
  15987. */
  15988. toggleDevTools(): void;
  15989. /**
  15990. * Executes the editing command `undo` in web page.
  15991. */
  15992. undo(): void;
  15993. /**
  15994. * Executes the editing command `unselect` in web page.
  15995. */
  15996. unselect(): void;
  15997. /**
  15998. * A `boolean` property that determines whether this page is muted.
  15999. */
  16000. audioMuted: boolean;
  16001. /**
  16002. * A `boolean` property that determines whether or not this WebContents will
  16003. * throttle animations and timers when the page becomes backgrounded. This also
  16004. * affects the Page Visibility API.
  16005. */
  16006. backgroundThrottling: boolean;
  16007. /**
  16008. * A `Debugger` instance for this webContents.
  16009. *
  16010. */
  16011. readonly debugger: Debugger;
  16012. /**
  16013. * A `WebContents | null` property that represents the of DevTools `WebContents`
  16014. * associated with a given `WebContents`.
  16015. *
  16016. * **Note:** Users should never store this object because it may become `null` when
  16017. * the DevTools has been closed.
  16018. *
  16019. */
  16020. readonly devToolsWebContents: (WebContents) | (null);
  16021. /**
  16022. * An `Integer` property that sets the frame rate of the web contents to the
  16023. * specified number. Only values between 1 and 240 are accepted.
  16024. *
  16025. * Only applicable if _offscreen rendering_ is enabled.
  16026. */
  16027. frameRate: number;
  16028. /**
  16029. * A `WebContents` instance that might own this `WebContents`.
  16030. *
  16031. */
  16032. readonly hostWebContents: WebContents;
  16033. /**
  16034. * A `Integer` representing the unique ID of this WebContents. Each ID is unique
  16035. * among all `WebContents` instances of the entire Electron application.
  16036. *
  16037. */
  16038. readonly id: number;
  16039. /**
  16040. * An `IpcMain` scoped to just IPC messages sent from this WebContents.
  16041. *
  16042. * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
  16043. * `ipcRenderer.postMessage` will be delivered in the following order:
  16044. *
  16045. * * `contents.on('ipc-message')`
  16046. * * `contents.mainFrame.on(channel)`
  16047. * * `contents.ipc.on(channel)`
  16048. * * `ipcMain.on(channel)`
  16049. *
  16050. * Handlers registered with `invoke` will be checked in the following order. The
  16051. * first one that is defined will be called, the rest will be ignored.
  16052. *
  16053. * * `contents.mainFrame.handle(channel)`
  16054. * * `contents.handle(channel)`
  16055. * * `ipcMain.handle(channel)`
  16056. *
  16057. * A handler or event listener registered on the WebContents will receive IPC
  16058. * messages sent from any frame, including child frames. In most cases, only the
  16059. * main frame can send IPC messages. However, if the `nodeIntegrationInSubFrames`
  16060. * option is enabled, it is possible for child frames to send IPC messages also. In
  16061. * that case, handlers should check the `senderFrame` property of the IPC event to
  16062. * ensure that the message is coming from the expected frame. Alternatively,
  16063. * register handlers on the appropriate frame directly using the `WebFrameMain.ipc`
  16064. * interface.
  16065. *
  16066. */
  16067. readonly ipc: IpcMain;
  16068. /**
  16069. * A `WebFrameMain` property that represents the top frame of the page's frame
  16070. * hierarchy.
  16071. *
  16072. */
  16073. readonly mainFrame: WebFrameMain;
  16074. /**
  16075. * A `NavigationHistory` used by this webContents.
  16076. *
  16077. */
  16078. readonly navigationHistory: NavigationHistory;
  16079. /**
  16080. * A `WebFrameMain` property that represents the frame that opened this
  16081. * WebContents, either with open(), or by navigating a link with a target
  16082. * attribute.
  16083. *
  16084. */
  16085. readonly opener: WebFrameMain;
  16086. /**
  16087. * A `Session` used by this webContents.
  16088. *
  16089. */
  16090. readonly session: Session;
  16091. /**
  16092. * A `string` property that determines the user agent for this web page.
  16093. */
  16094. userAgent: string;
  16095. /**
  16096. * A `number` property that determines the zoom factor for this web contents.
  16097. *
  16098. * The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
  16099. */
  16100. zoomFactor: number;
  16101. /**
  16102. * A `number` property that determines the zoom level for this web contents.
  16103. *
  16104. * The original size is 0 and each increment above or below represents zooming 20%
  16105. * larger or smaller to default limits of 300% and 50% of original size,
  16106. * respectively. The formula for this is `scale := 1.2 ^ level`.
  16107. */
  16108. zoomLevel: number;
  16109. }
  16110. class WebContentsView extends View {
  16111. // Docs: https://electronjs.org/docs/api/web-contents-view
  16112. /**
  16113. * Emitted when the view's bounds have changed in response to being laid out. The
  16114. * new bounds can be retrieved with `view.getBounds()`.
  16115. */
  16116. on(event: 'bounds-changed', listener: Function): this;
  16117. off(event: 'bounds-changed', listener: Function): this;
  16118. once(event: 'bounds-changed', listener: Function): this;
  16119. addListener(event: 'bounds-changed', listener: Function): this;
  16120. removeListener(event: 'bounds-changed', listener: Function): this;
  16121. /**
  16122. * WebContentsView
  16123. */
  16124. constructor(options?: WebContentsViewConstructorOptions);
  16125. /**
  16126. * A `WebContents` property containing a reference to the displayed `WebContents`.
  16127. * Use this to interact with the `WebContents`, for instance to load a URL.
  16128. *
  16129. */
  16130. readonly webContents: WebContents;
  16131. }
  16132. interface WebFrame {
  16133. // Docs: https://electronjs.org/docs/api/web-frame
  16134. /**
  16135. * Attempts to free memory that is no longer being used (like images from a
  16136. * previous navigation).
  16137. *
  16138. * Note that blindly calling this method probably makes Electron slower since it
  16139. * will have to refill these emptied caches, you should only call it if an event in
  16140. * your app has occurred that makes you think your page is actually using less
  16141. * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
  16142. * and intend to stay there).
  16143. */
  16144. clearCache(): void;
  16145. /**
  16146. * A promise that resolves with the result of the executed code or is rejected if
  16147. * execution throws or results in a rejected promise.
  16148. *
  16149. * Evaluates `code` in page.
  16150. *
  16151. * In the browser window some HTML APIs like `requestFullScreen` can only be
  16152. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  16153. * this limitation.
  16154. */
  16155. executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  16156. /**
  16157. * A promise that resolves with the result of the executed code or is rejected if
  16158. * execution could not start.
  16159. *
  16160. * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  16161. *
  16162. * Note that when the execution of script fails, the returned promise will not
  16163. * reject and the `result` would be `undefined`. This is because Chromium does not
  16164. * dispatch errors of isolated worlds to foreign worlds.
  16165. */
  16166. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  16167. /**
  16168. * A child of `webFrame` with the supplied `name`, `null` would be returned if
  16169. * there's no such frame or if the frame is not in the current renderer process.
  16170. */
  16171. findFrameByName(name: string): WebFrame;
  16172. /**
  16173. * that has the supplied `routingId`, `null` if not found.
  16174. */
  16175. findFrameByRoutingId(routingId: number): WebFrame;
  16176. /**
  16177. * The frame element in `webFrame's` document selected by `selector`, `null` would
  16178. * be returned if `selector` does not select a frame or if the frame is not in the
  16179. * current renderer process.
  16180. */
  16181. getFrameForSelector(selector: string): WebFrame;
  16182. /**
  16183. * * `images` MemoryUsageDetails
  16184. * * `scripts` MemoryUsageDetails
  16185. * * `cssStyleSheets` MemoryUsageDetails
  16186. * * `xslStyleSheets` MemoryUsageDetails
  16187. * * `fonts` MemoryUsageDetails
  16188. * * `other` MemoryUsageDetails
  16189. *
  16190. * Returns an object describing usage information of Blink's internal memory
  16191. * caches.
  16192. *
  16193. * This will generate:
  16194. */
  16195. getResourceUsage(): ResourceUsage;
  16196. /**
  16197. * A list of suggested words for a given word. If the word is spelled correctly,
  16198. * the result will be empty.
  16199. */
  16200. getWordSuggestions(word: string): string[];
  16201. /**
  16202. * The current zoom factor.
  16203. */
  16204. getZoomFactor(): number;
  16205. /**
  16206. * The current zoom level.
  16207. */
  16208. getZoomLevel(): number;
  16209. /**
  16210. * A key for the inserted CSS that can later be used to remove the CSS via
  16211. * `webFrame.removeInsertedCSS(key)`.
  16212. *
  16213. * Injects CSS into the current web page and returns a unique key for the inserted
  16214. * stylesheet.
  16215. */
  16216. insertCSS(css: string, options?: InsertCSSOptions): string;
  16217. /**
  16218. * Inserts `text` to the focused element.
  16219. */
  16220. insertText(text: string): void;
  16221. /**
  16222. * True if the word is misspelled according to the built in spellchecker, false
  16223. * otherwise. If no dictionary is loaded, always return false.
  16224. */
  16225. isWordMisspelled(word: string): boolean;
  16226. /**
  16227. * Removes the inserted CSS from the current web page. The stylesheet is identified
  16228. * by its key, which is returned from `webFrame.insertCSS(css)`.
  16229. */
  16230. removeInsertedCSS(key: string): void;
  16231. /**
  16232. * Set the security origin, content security policy and name of the isolated world.
  16233. * Note: If the `csp` is specified, then the `securityOrigin` also has to be
  16234. * specified.
  16235. */
  16236. setIsolatedWorldInfo(worldId: number, info: Info): void;
  16237. /**
  16238. * Sets a provider for spell checking in input fields and text areas.
  16239. *
  16240. * If you want to use this method you must disable the builtin spellchecker when
  16241. * you construct the window.
  16242. *
  16243. * The `provider` must be an object that has a `spellCheck` method that accepts an
  16244. * array of individual words for spellchecking. The `spellCheck` function runs
  16245. * asynchronously and calls the `callback` function with an array of misspelt words
  16246. * when complete.
  16247. *
  16248. * An example of using node-spellchecker as provider:
  16249. */
  16250. setSpellCheckProvider(language: string, provider: Provider): void;
  16251. /**
  16252. * Sets the maximum and minimum pinch-to-zoom level.
  16253. *
  16254. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  16255. * call:
  16256. *
  16257. * > **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom
  16258. * shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem
  16259. * roles in the application Menu. To disable shortcuts, manually define the Menu
  16260. * and omit zoom roles from the definition.
  16261. */
  16262. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
  16263. /**
  16264. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  16265. * divided by 100, so 300% = 3.0.
  16266. *
  16267. * The factor must be greater than 0.0.
  16268. */
  16269. setZoomFactor(factor: number): void;
  16270. /**
  16271. * Changes the zoom level to the specified level. The original size is 0 and each
  16272. * increment above or below represents zooming 20% larger or smaller to default
  16273. * limits of 300% and 50% of original size, respectively.
  16274. *
  16275. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  16276. * the zoom level for a specific domain propagates across all instances of windows
  16277. * with the same domain. Differentiating the window URLs will make zoom work
  16278. * per-window.
  16279. */
  16280. setZoomLevel(level: number): void;
  16281. /**
  16282. * A `WebFrame | null` representing the first child frame of `webFrame`, the
  16283. * property would be `null` if `webFrame` has no children or if first child is not
  16284. * in the current renderer process.
  16285. *
  16286. */
  16287. readonly firstChild: (WebFrame) | (null);
  16288. /**
  16289. * A `WebFrame | null` representing next sibling frame, the property would be
  16290. * `null` if `webFrame` is the last frame in its parent or if the next sibling is
  16291. * not in the current renderer process.
  16292. *
  16293. */
  16294. readonly nextSibling: (WebFrame) | (null);
  16295. /**
  16296. * A `WebFrame | null` representing the frame which opened `webFrame`, the property
  16297. * would be `null` if there's no opener or opener is not in the current renderer
  16298. * process.
  16299. *
  16300. */
  16301. readonly opener: (WebFrame) | (null);
  16302. /**
  16303. * A `WebFrame | null` representing parent frame of `webFrame`, the property would
  16304. * be `null` if `webFrame` is top or parent is not in the current renderer process.
  16305. *
  16306. */
  16307. readonly parent: (WebFrame) | (null);
  16308. /**
  16309. * An `Integer` representing the unique frame id in the current renderer process.
  16310. * Distinct WebFrame instances that refer to the same underlying frame will have
  16311. * the same `routingId`.
  16312. *
  16313. */
  16314. readonly routingId: number;
  16315. /**
  16316. * A `WebFrame | null` representing top frame in frame hierarchy to which
  16317. * `webFrame` belongs, the property would be `null` if top frame is not in the
  16318. * current renderer process.
  16319. *
  16320. */
  16321. readonly top: (WebFrame) | (null);
  16322. }
  16323. class WebFrameMain extends NodeEventEmitter {
  16324. // Docs: https://electronjs.org/docs/api/web-frame-main
  16325. /**
  16326. * A frame with the given process and routing IDs, or `undefined` if there is no
  16327. * WebFrameMain associated with the given IDs.
  16328. */
  16329. static fromId(processId: number, routingId: number): (WebFrameMain) | (undefined);
  16330. /**
  16331. * Emitted when the document is loaded.
  16332. */
  16333. on(event: 'dom-ready', listener: Function): this;
  16334. off(event: 'dom-ready', listener: Function): this;
  16335. once(event: 'dom-ready', listener: Function): this;
  16336. addListener(event: 'dom-ready', listener: Function): this;
  16337. removeListener(event: 'dom-ready', listener: Function): this;
  16338. /**
  16339. * A promise that resolves with the result of the executed code or is rejected if
  16340. * execution throws or results in a rejected promise.
  16341. *
  16342. * Evaluates `code` in page.
  16343. *
  16344. * In the browser window some HTML APIs like `requestFullScreen` can only be
  16345. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  16346. * this limitation.
  16347. */
  16348. executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>;
  16349. /**
  16350. * Send a message to the renderer process, optionally transferring ownership of
  16351. * zero or more `MessagePortMain` objects.
  16352. *
  16353. * The transferred `MessagePortMain` objects will be available in the renderer
  16354. * process by accessing the `ports` property of the emitted event. When they arrive
  16355. * in the renderer, they will be native DOM `MessagePort` objects.
  16356. *
  16357. * For example:
  16358. */
  16359. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  16360. /**
  16361. * Whether the reload was initiated successfully. Only results in `false` when the
  16362. * frame has no history.
  16363. */
  16364. reload(): boolean;
  16365. /**
  16366. * Send an asynchronous message to the renderer process via `channel`, along with
  16367. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  16368. * just like `postMessage`, so prototype chains will not be included. Sending
  16369. * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
  16370. *
  16371. * The renderer process can handle the message by listening to `channel` with the
  16372. * `ipcRenderer` module.
  16373. */
  16374. send(channel: string, ...args: any[]): void;
  16375. /**
  16376. * A `WebFrameMain[]` collection containing the direct descendents of `frame`.
  16377. *
  16378. */
  16379. readonly frames: WebFrameMain[];
  16380. /**
  16381. * A `WebFrameMain[]` collection containing every frame in the subtree of `frame`,
  16382. * including itself. This can be useful when traversing through all frames.
  16383. *
  16384. */
  16385. readonly framesInSubtree: WebFrameMain[];
  16386. /**
  16387. * An `Integer` representing the id of the frame's internal FrameTreeNode instance.
  16388. * This id is browser-global and uniquely identifies a frame that hosts content.
  16389. * The identifier is fixed at the creation of the frame and stays constant for the
  16390. * lifetime of the frame. When the frame is removed, the id is not used again.
  16391. *
  16392. */
  16393. readonly frameTreeNodeId: number;
  16394. /**
  16395. * An `IpcMain` instance scoped to the frame.
  16396. *
  16397. * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
  16398. * `ipcRenderer.postMessage` will be delivered in the following order:
  16399. *
  16400. * * `contents.on('ipc-message')`
  16401. * * `contents.mainFrame.on(channel)`
  16402. * * `contents.ipc.on(channel)`
  16403. * * `ipcMain.on(channel)`
  16404. *
  16405. * Handlers registered with `invoke` will be checked in the following order. The
  16406. * first one that is defined will be called, the rest will be ignored.
  16407. *
  16408. * * `contents.mainFrame.handle(channel)`
  16409. * * `contents.handle(channel)`
  16410. * * `ipcMain.handle(channel)`
  16411. *
  16412. * In most cases, only the main frame of a WebContents can send or receive IPC
  16413. * messages. However, if the `nodeIntegrationInSubFrames` option is enabled, it is
  16414. * possible for child frames to send and receive IPC messages also. The
  16415. * `WebContents.ipc` interface may be more convenient when
  16416. * `nodeIntegrationInSubFrames` is not enabled.
  16417. *
  16418. */
  16419. readonly ipc: IpcMain;
  16420. /**
  16421. * A `string` representing the frame name.
  16422. *
  16423. */
  16424. readonly name: string;
  16425. /**
  16426. * A `string` representing the current origin of the frame, serialized according to
  16427. * RFC 6454. This may be different from the URL. For instance, if the frame is a
  16428. * child window opened to `about:blank`, then `frame.origin` will return the parent
  16429. * frame's origin, while `frame.url` will return the empty string. Pages without a
  16430. * scheme/host/port triple origin will have the serialized origin of `"null"` (that
  16431. * is, the string containing the letters n, u, l, l).
  16432. *
  16433. */
  16434. readonly origin: string;
  16435. /**
  16436. * An `Integer` representing the operating system `pid` of the process which owns
  16437. * this frame.
  16438. *
  16439. */
  16440. readonly osProcessId: number;
  16441. /**
  16442. * A `WebFrameMain | null` representing parent frame of `frame`, the property would
  16443. * be `null` if `frame` is the top frame in the frame hierarchy.
  16444. *
  16445. */
  16446. readonly parent: (WebFrameMain) | (null);
  16447. /**
  16448. * An `Integer` representing the Chromium internal `pid` of the process which owns
  16449. * this frame. This is not the same as the OS process ID; to read that use
  16450. * `frame.osProcessId`.
  16451. *
  16452. */
  16453. readonly processId: number;
  16454. /**
  16455. * An `Integer` representing the unique frame id in the current renderer process.
  16456. * Distinct `WebFrameMain` instances that refer to the same underlying frame will
  16457. * have the same `routingId`.
  16458. *
  16459. */
  16460. readonly routingId: number;
  16461. /**
  16462. * A `WebFrameMain | null` representing top frame in the frame hierarchy to which
  16463. * `frame` belongs.
  16464. *
  16465. */
  16466. readonly top: (WebFrameMain) | (null);
  16467. /**
  16468. * A `string` representing the current URL of the frame.
  16469. *
  16470. */
  16471. readonly url: string;
  16472. /**
  16473. * A `string` representing the visibility state of the frame.
  16474. *
  16475. * See also how the Page Visibility API is affected by other Electron APIs.
  16476. *
  16477. */
  16478. readonly visibilityState: string;
  16479. }
  16480. interface WebPreferences {
  16481. // Docs: https://electronjs.org/docs/api/structures/web-preferences
  16482. /**
  16483. * An alternative title string provided only to accessibility tools such as screen
  16484. * readers. This string is not directly visible to users.
  16485. */
  16486. accessibleTitle?: string;
  16487. /**
  16488. * A list of strings that will be appended to `process.argv` in the renderer
  16489. * process of this app. Useful for passing small bits of data down to renderer
  16490. * process preload scripts.
  16491. */
  16492. additionalArguments?: string[];
  16493. /**
  16494. * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
  16495. * `false`.
  16496. */
  16497. allowRunningInsecureContent?: boolean;
  16498. /**
  16499. * Autoplay policy to apply to content in the window, can be
  16500. * `no-user-gesture-required`, `user-gesture-required`,
  16501. * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
  16502. */
  16503. autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
  16504. /**
  16505. * Whether to throttle animations and timers when the page becomes background. This
  16506. * also affects the Page Visibility API. When at least one webContents displayed in
  16507. * a single browserWindow has disabled `backgroundThrottling` then frames will be
  16508. * drawn and swapped for the whole window and other webContents displayed by it.
  16509. * Defaults to `true`.
  16510. */
  16511. backgroundThrottling?: boolean;
  16512. /**
  16513. * Whether to run Electron APIs and the specified `preload` script in a separate
  16514. * JavaScript context. Defaults to `true`. The context that the `preload` script
  16515. * runs in will only have access to its own dedicated `document` and `window`
  16516. * globals, as well as its own set of JavaScript builtins (`Array`, `Object`,
  16517. * `JSON`, etc.), which are all invisible to the loaded content. The Electron API
  16518. * will only be available in the `preload` script and not the loaded page. This
  16519. * option should be used when loading potentially untrusted remote content to
  16520. * ensure the loaded content cannot tamper with the `preload` script and any
  16521. * Electron APIs being used. This option uses the same technique used by Chrome
  16522. * Content Scripts. You can access this context in the dev tools by selecting the
  16523. * 'Electron Isolated Context' entry in the combo box at the top of the Console
  16524. * tab.
  16525. */
  16526. contextIsolation?: boolean;
  16527. /**
  16528. * Defaults to `ISO-8859-1`.
  16529. */
  16530. defaultEncoding?: string;
  16531. /**
  16532. * Sets the default font for the font-family.
  16533. */
  16534. defaultFontFamily?: DefaultFontFamily;
  16535. /**
  16536. * Defaults to `16`.
  16537. */
  16538. defaultFontSize?: number;
  16539. /**
  16540. * Defaults to `13`.
  16541. */
  16542. defaultMonospaceFontSize?: number;
  16543. /**
  16544. * Whether to enable DevTools. If it is set to `false`, can not use
  16545. * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
  16546. */
  16547. devTools?: boolean;
  16548. /**
  16549. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  16550. * to disable. The full list of supported feature strings can be found in the
  16551. * RuntimeEnabledFeatures.json5 file.
  16552. */
  16553. disableBlinkFeatures?: string;
  16554. /**
  16555. * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
  16556. * `false`.
  16557. */
  16558. disableDialogs?: boolean;
  16559. /**
  16560. * Whether to prevent the window from resizing when entering HTML Fullscreen.
  16561. * Default is `false`.
  16562. */
  16563. disableHtmlFullscreenWindowResize?: boolean;
  16564. /**
  16565. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  16566. * to enable. The full list of supported feature strings can be found in the
  16567. * RuntimeEnabledFeatures.json5 file.
  16568. */
  16569. enableBlinkFeatures?: string;
  16570. /**
  16571. * Whether to enable preferred size mode. The preferred size is the minimum size
  16572. * needed to contain the layout of the document—without requiring scrolling.
  16573. * Enabling this will cause the `preferred-size-changed` event to be emitted on the
  16574. * `WebContents` when the preferred size changes. Default is `false`.
  16575. */
  16576. enablePreferredSizeMode?: boolean;
  16577. /**
  16578. * Whether to enable the WebSQL api. Default is `true`.
  16579. */
  16580. enableWebSQL?: boolean;
  16581. /**
  16582. * Enables Chromium's experimental features. Default is `false`.
  16583. */
  16584. experimentalFeatures?: boolean;
  16585. /**
  16586. * Specifies how to run image animations (E.g. GIFs). Can be `animate`,
  16587. * `animateOnce` or `noAnimation`. Default is `animate`.
  16588. */
  16589. imageAnimationPolicy?: ('animate' | 'animateOnce' | 'noAnimation');
  16590. /**
  16591. * Enables image support. Default is `true`.
  16592. */
  16593. images?: boolean;
  16594. /**
  16595. * Enables JavaScript support. Default is `true`.
  16596. */
  16597. javascript?: boolean;
  16598. /**
  16599. * Defaults to `0`.
  16600. */
  16601. minimumFontSize?: number;
  16602. /**
  16603. * Whether dragging and dropping a file or link onto the page causes a navigation.
  16604. * Default is `false`.
  16605. */
  16606. navigateOnDragDrop?: boolean;
  16607. /**
  16608. * Whether node integration is enabled. Default is `false`.
  16609. */
  16610. nodeIntegration?: boolean;
  16611. /**
  16612. * Experimental option for enabling Node.js support in sub-frames such as iframes
  16613. * and child windows. All your preloads will load for every iframe, you can use
  16614. * `process.isMainFrame` to determine if you are in the main frame or not.
  16615. */
  16616. nodeIntegrationInSubFrames?: boolean;
  16617. /**
  16618. * Whether node integration is enabled in web workers. Default is `false`. More
  16619. * about this can be found in Multithreading.
  16620. */
  16621. nodeIntegrationInWorker?: boolean;
  16622. /**
  16623. * Whether to enable offscreen rendering for the browser window. Defaults to
  16624. * `false`. See the offscreen rendering tutorial for more details.
  16625. */
  16626. offscreen?: boolean;
  16627. /**
  16628. * Sets the session used by the page according to the session's partition string.
  16629. * If `partition` starts with `persist:`, the page will use a persistent session
  16630. * available to all pages in the app with the same `partition`. If there is no
  16631. * `persist:` prefix, the page will use an in-memory session. By assigning the same
  16632. * `partition`, multiple pages can share the same session. Default is the default
  16633. * session.
  16634. */
  16635. partition?: string;
  16636. /**
  16637. * Whether plugins should be enabled. Default is `false`.
  16638. */
  16639. plugins?: boolean;
  16640. /**
  16641. * Specifies a script that will be loaded before other scripts run in the page.
  16642. * This script will always have access to node APIs no matter whether node
  16643. * integration is turned on or off. The value should be the absolute file path to
  16644. * the script. When node integration is turned off, the preload script can
  16645. * reintroduce Node global symbols back to the global scope. See example here.
  16646. */
  16647. preload?: string;
  16648. /**
  16649. * Whether to enable browser style consecutive dialog protection. Default is
  16650. * `false`.
  16651. */
  16652. safeDialogs?: boolean;
  16653. /**
  16654. * The message to display when consecutive dialog protection is triggered. If not
  16655. * defined the default message would be used, note that currently the default
  16656. * message is in English and not localized.
  16657. */
  16658. safeDialogsMessage?: string;
  16659. /**
  16660. * If set, this will sandbox the renderer associated with the window, making it
  16661. * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
  16662. * This is not the same as the `nodeIntegration` option and the APIs available to
  16663. * the preload script are more limited. Read more about the option here.
  16664. */
  16665. sandbox?: boolean;
  16666. /**
  16667. * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
  16668. *
  16669. * @platform darwin
  16670. */
  16671. scrollBounce?: boolean;
  16672. /**
  16673. * Sets the session used by the page. Instead of passing the Session object
  16674. * directly, you can also choose to use the `partition` option instead, which
  16675. * accepts a partition string. When both `session` and `partition` are provided,
  16676. * `session` will be preferred. Default is the default session.
  16677. */
  16678. session?: Session;
  16679. /**
  16680. * Whether to enable the builtin spellchecker. Default is `true`.
  16681. */
  16682. spellcheck?: boolean;
  16683. /**
  16684. * Make TextArea elements resizable. Default is `true`.
  16685. */
  16686. textAreasAreResizable?: boolean;
  16687. /**
  16688. * Whether to enable background transparency for the guest page. Default is `true`.
  16689. * **Note:** The guest page's text and background colors are derived from the color
  16690. * scheme of its root element. When transparency is enabled, the text color will
  16691. * still change accordingly but the background will remain transparent.
  16692. */
  16693. transparent?: boolean;
  16694. /**
  16695. * Enforces the v8 code caching policy used by blink. Accepted values are
  16696. */
  16697. v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
  16698. /**
  16699. * Enables WebGL support. Default is `true`.
  16700. */
  16701. webgl?: boolean;
  16702. /**
  16703. * When `false`, it will disable the same-origin policy (usually using testing
  16704. * websites by people), and set `allowRunningInsecureContent` to `true` if this
  16705. * options has not been set by user. Default is `true`.
  16706. */
  16707. webSecurity?: boolean;
  16708. /**
  16709. * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
  16710. * `preload` script configured for the `<webview>` will have node integration
  16711. * enabled when it is executed so you should ensure remote/untrusted content is not
  16712. * able to create a `<webview>` tag with a possibly malicious `preload` script. You
  16713. * can use the `will-attach-webview` event on webContents to strip away the
  16714. * `preload` script and to validate or alter the `<webview>`'s initial settings.
  16715. */
  16716. webviewTag?: boolean;
  16717. /**
  16718. * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
  16719. */
  16720. zoomFactor?: number;
  16721. }
  16722. class WebRequest {
  16723. // Docs: https://electronjs.org/docs/api/web-request
  16724. /**
  16725. * The `listener` will be called with `listener(details)` when a server initiated
  16726. * redirect is about to occur.
  16727. */
  16728. onBeforeRedirect(filter: WebRequestFilter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  16729. /**
  16730. * The `listener` will be called with `listener(details)` when a server initiated
  16731. * redirect is about to occur.
  16732. */
  16733. onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  16734. /**
  16735. * The `listener` will be called with `listener(details, callback)` when a request
  16736. * is about to occur.
  16737. *
  16738. * The `uploadData` is an array of `UploadData` objects.
  16739. *
  16740. * The `callback` has to be called with an `response` object.
  16741. *
  16742. * Some examples of valid `urls`:
  16743. */
  16744. onBeforeRequest(filter: WebRequestFilter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
  16745. /**
  16746. * The `listener` will be called with `listener(details, callback)` when a request
  16747. * is about to occur.
  16748. *
  16749. * The `uploadData` is an array of `UploadData` objects.
  16750. *
  16751. * The `callback` has to be called with an `response` object.
  16752. *
  16753. * Some examples of valid `urls`:
  16754. */
  16755. onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
  16756. /**
  16757. * The `listener` will be called with `listener(details, callback)` before sending
  16758. * an HTTP request, once the request headers are available. This may occur after a
  16759. * TCP connection is made to the server, but before any http data is sent.
  16760. *
  16761. * The `callback` has to be called with a `response` object.
  16762. */
  16763. onBeforeSendHeaders(filter: WebRequestFilter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  16764. /**
  16765. * The `listener` will be called with `listener(details, callback)` before sending
  16766. * an HTTP request, once the request headers are available. This may occur after a
  16767. * TCP connection is made to the server, but before any http data is sent.
  16768. *
  16769. * The `callback` has to be called with a `response` object.
  16770. */
  16771. onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  16772. /**
  16773. * The `listener` will be called with `listener(details)` when a request is
  16774. * completed.
  16775. */
  16776. onCompleted(filter: WebRequestFilter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  16777. /**
  16778. * The `listener` will be called with `listener(details)` when a request is
  16779. * completed.
  16780. */
  16781. onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  16782. /**
  16783. * The `listener` will be called with `listener(details)` when an error occurs.
  16784. */
  16785. onErrorOccurred(filter: WebRequestFilter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  16786. /**
  16787. * The `listener` will be called with `listener(details)` when an error occurs.
  16788. */
  16789. onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  16790. /**
  16791. * The `listener` will be called with `listener(details, callback)` when HTTP
  16792. * response headers of a request have been received.
  16793. *
  16794. * The `callback` has to be called with a `response` object.
  16795. */
  16796. onHeadersReceived(filter: WebRequestFilter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  16797. /**
  16798. * The `listener` will be called with `listener(details, callback)` when HTTP
  16799. * response headers of a request have been received.
  16800. *
  16801. * The `callback` has to be called with a `response` object.
  16802. */
  16803. onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  16804. /**
  16805. * The `listener` will be called with `listener(details)` when first byte of the
  16806. * response body is received. For HTTP requests, this means that the status line
  16807. * and response headers are available.
  16808. */
  16809. onResponseStarted(filter: WebRequestFilter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  16810. /**
  16811. * The `listener` will be called with `listener(details)` when first byte of the
  16812. * response body is received. For HTTP requests, this means that the status line
  16813. * and response headers are available.
  16814. */
  16815. onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  16816. /**
  16817. * The `listener` will be called with `listener(details)` just before a request is
  16818. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  16819. * response are visible by the time this listener is fired.
  16820. */
  16821. onSendHeaders(filter: WebRequestFilter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  16822. /**
  16823. * The `listener` will be called with `listener(details)` just before a request is
  16824. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  16825. * response are visible by the time this listener is fired.
  16826. */
  16827. onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  16828. }
  16829. interface WebRequestFilter {
  16830. // Docs: https://electronjs.org/docs/api/structures/web-request-filter
  16831. /**
  16832. * Array of types that will be used to filter out the requests that do not match
  16833. * the types. When not specified, all types will be matched. Can be `mainFrame`,
  16834. * `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`,
  16835. * `cspReport`, `media` or `webSocket`.
  16836. */
  16837. types?: Array<'mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket'>;
  16838. /**
  16839. * Array of URL patterns that will be used to filter out the requests that do not
  16840. * match the URL patterns.
  16841. */
  16842. urls: string[];
  16843. }
  16844. interface WebSource {
  16845. // Docs: https://electronjs.org/docs/api/structures/web-source
  16846. code: string;
  16847. url?: string;
  16848. }
  16849. interface WebUtils extends NodeJS.EventEmitter {
  16850. // Docs: https://electronjs.org/docs/api/web-utils
  16851. /**
  16852. * The file system path that this `File` object points to. In the case where the
  16853. * object passed in is not a `File` object an exception is thrown. In the case
  16854. * where the File object passed in was constructed in JS and is not backed by a
  16855. * file on disk an empty string is returned.
  16856. *
  16857. * This method superceded the previous augmentation to the `File` object with the
  16858. * `path` property. An example is included below.
  16859. */
  16860. getPathForFile(file: File): string;
  16861. }
  16862. interface WebviewTag extends HTMLElement {
  16863. // Docs: https://electronjs.org/docs/api/webview-tag
  16864. /**
  16865. * Fired when a load has committed. This includes navigation within the current
  16866. * document as well as subframe document-level loads, but does not include
  16867. * asynchronous resource loads.
  16868. */
  16869. addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
  16870. removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
  16871. /**
  16872. * Fired when the navigation is done, i.e. the spinner of the tab will stop
  16873. * spinning, and the `onload` event is dispatched.
  16874. */
  16875. addEventListener(event: 'did-finish-load', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  16876. removeEventListener(event: 'did-finish-load', listener: (event: DOMEvent) => void): this;
  16877. /**
  16878. * This event is like `did-finish-load`, but fired when the load failed or was
  16879. * cancelled, e.g. `window.stop()` is invoked.
  16880. */
  16881. addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
  16882. removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
  16883. /**
  16884. * Fired when a frame has done navigation.
  16885. */
  16886. addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
  16887. removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
  16888. /**
  16889. * Corresponds to the points in time when the spinner of the tab starts spinning.
  16890. */
  16891. addEventListener(event: 'did-start-loading', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  16892. removeEventListener(event: 'did-start-loading', listener: (event: DOMEvent) => void): this;
  16893. /**
  16894. * Corresponds to the points in time when the spinner of the tab stops spinning.
  16895. */
  16896. addEventListener(event: 'did-stop-loading', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  16897. removeEventListener(event: 'did-stop-loading', listener: (event: DOMEvent) => void): this;
  16898. /**
  16899. * Fired when attached to the embedder web contents.
  16900. */
  16901. addEventListener(event: 'did-attach', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  16902. removeEventListener(event: 'did-attach', listener: (event: DOMEvent) => void): this;
  16903. /**
  16904. * Fired when document in the given frame is loaded.
  16905. */
  16906. addEventListener(event: 'dom-ready', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  16907. removeEventListener(event: 'dom-ready', listener: (event: DOMEvent) => void): this;
  16908. /**
  16909. * Fired when page title is set during navigation. `explicitSet` is false when
  16910. * title is synthesized from file url.
  16911. */
  16912. addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
  16913. removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
  16914. /**
  16915. * Fired when page receives favicon urls.
  16916. */
  16917. addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
  16918. removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
  16919. /**
  16920. * Fired when page enters fullscreen triggered by HTML API.
  16921. */
  16922. addEventListener(event: 'enter-html-full-screen', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  16923. removeEventListener(event: 'enter-html-full-screen', listener: (event: DOMEvent) => void): this;
  16924. /**
  16925. * Fired when page leaves fullscreen triggered by HTML API.
  16926. */
  16927. addEventListener(event: 'leave-html-full-screen', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  16928. removeEventListener(event: 'leave-html-full-screen', listener: (event: DOMEvent) => void): this;
  16929. /**
  16930. * Fired when the guest window logs a console message.
  16931. *
  16932. * The following example code forwards all log messages to the embedder's console
  16933. * without regard for log level or other properties.
  16934. */
  16935. addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
  16936. removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
  16937. /**
  16938. * Fired when a result is available for `webview.findInPage` request.
  16939. */
  16940. addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
  16941. removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
  16942. /**
  16943. * Emitted when a user or the page wants to start navigation. It can happen when
  16944. * the `window.location` object is changed or a user clicks a link in the page.
  16945. *
  16946. * This event will not emit when the navigation is started programmatically with
  16947. * APIs like `<webview>.loadURL` and `<webview>.back`.
  16948. *
  16949. * It is also not emitted during in-page navigation, such as clicking anchor links
  16950. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  16951. * this purpose.
  16952. *
  16953. * Calling `event.preventDefault()` does **NOT** have any effect.
  16954. */
  16955. addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
  16956. removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
  16957. /**
  16958. * Emitted when a user or the page wants to start navigation anywhere in the
  16959. * `<webview>` or any frames embedded within. It can happen when the
  16960. * `window.location` object is changed or a user clicks a link in the page.
  16961. *
  16962. * This event will not emit when the navigation is started programmatically with
  16963. * APIs like `<webview>.loadURL` and `<webview>.back`.
  16964. *
  16965. * It is also not emitted during in-page navigation, such as clicking anchor links
  16966. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  16967. * this purpose.
  16968. *
  16969. * Calling `event.preventDefault()` does **NOT** have any effect.
  16970. */
  16971. addEventListener(event: 'will-frame-navigate', listener: (event: WillFrameNavigateEvent) => void, useCapture?: boolean): this;
  16972. removeEventListener(event: 'will-frame-navigate', listener: (event: WillFrameNavigateEvent) => void): this;
  16973. /**
  16974. * Emitted when any frame (including main) starts navigating. `isInPlace` will be
  16975. * `true` for in-page navigations.
  16976. */
  16977. addEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void, useCapture?: boolean): this;
  16978. removeEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void): this;
  16979. /**
  16980. * Emitted after a server side redirect occurs during navigation. For example a 302
  16981. * redirect.
  16982. */
  16983. addEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void, useCapture?: boolean): this;
  16984. removeEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void): this;
  16985. /**
  16986. * Emitted when a navigation is done.
  16987. *
  16988. * This event is not emitted for in-page navigations, such as clicking anchor links
  16989. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  16990. * this purpose.
  16991. */
  16992. addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
  16993. removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
  16994. /**
  16995. * Emitted when any frame navigation is done.
  16996. *
  16997. * This event is not emitted for in-page navigations, such as clicking anchor links
  16998. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  16999. * this purpose.
  17000. */
  17001. addEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void, useCapture?: boolean): this;
  17002. removeEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void): this;
  17003. /**
  17004. * Emitted when an in-page navigation happened.
  17005. *
  17006. * When in-page navigation happens, the page URL changes but does not cause
  17007. * navigation outside of the page. Examples of this occurring are when anchor links
  17008. * are clicked or when the DOM `hashchange` event is triggered.
  17009. */
  17010. addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
  17011. removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
  17012. /**
  17013. * Fired when the guest page attempts to close itself.
  17014. *
  17015. * The following example code navigates the `webview` to `about:blank` when the
  17016. * guest attempts to close itself.
  17017. */
  17018. addEventListener(event: 'close', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  17019. removeEventListener(event: 'close', listener: (event: DOMEvent) => void): this;
  17020. /**
  17021. * Fired when the guest page has sent an asynchronous message to embedder page.
  17022. *
  17023. * With `sendToHost` method and `ipc-message` event you can communicate between
  17024. * guest page and embedder page:
  17025. */
  17026. addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
  17027. removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
  17028. /**
  17029. * Fired when the renderer process unexpectedly disappears. This is normally
  17030. * because it was crashed or killed.
  17031. */
  17032. addEventListener(event: 'render-process-gone', listener: (event: RenderProcessGoneEvent) => void, useCapture?: boolean): this;
  17033. removeEventListener(event: 'render-process-gone', listener: (event: RenderProcessGoneEvent) => void): this;
  17034. /**
  17035. * Fired when a plugin process is crashed.
  17036. */
  17037. addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
  17038. removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
  17039. /**
  17040. * Fired when the WebContents is destroyed.
  17041. */
  17042. addEventListener(event: 'destroyed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  17043. removeEventListener(event: 'destroyed', listener: (event: DOMEvent) => void): this;
  17044. /**
  17045. * Emitted when media starts playing.
  17046. */
  17047. addEventListener(event: 'media-started-playing', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  17048. removeEventListener(event: 'media-started-playing', listener: (event: DOMEvent) => void): this;
  17049. /**
  17050. * Emitted when media is paused or done playing.
  17051. */
  17052. addEventListener(event: 'media-paused', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  17053. removeEventListener(event: 'media-paused', listener: (event: DOMEvent) => void): this;
  17054. /**
  17055. * Emitted when a page's theme color changes. This is usually due to encountering a
  17056. * meta tag:
  17057. */
  17058. addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
  17059. removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
  17060. /**
  17061. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  17062. */
  17063. addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
  17064. removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
  17065. addEventListener(event: 'devtools-open-url', listener: (event: DevtoolsOpenUrlEvent) => void, useCapture?: boolean): this;
  17066. removeEventListener(event: 'devtools-open-url', listener: (event: DevtoolsOpenUrlEvent) => void): this;
  17067. /**
  17068. * Emitted when 'Search' is selected for text in its context menu.
  17069. */
  17070. addEventListener(event: 'devtools-search-query', listener: (event: DevtoolsSearchQueryEvent) => void, useCapture?: boolean): this;
  17071. removeEventListener(event: 'devtools-search-query', listener: (event: DevtoolsSearchQueryEvent) => void): this;
  17072. /**
  17073. * Emitted when DevTools is opened.
  17074. */
  17075. addEventListener(event: 'devtools-opened', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  17076. removeEventListener(event: 'devtools-opened', listener: (event: DOMEvent) => void): this;
  17077. /**
  17078. * Emitted when DevTools is closed.
  17079. */
  17080. addEventListener(event: 'devtools-closed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  17081. removeEventListener(event: 'devtools-closed', listener: (event: DOMEvent) => void): this;
  17082. /**
  17083. * Emitted when DevTools is focused / opened.
  17084. */
  17085. addEventListener(event: 'devtools-focused', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  17086. removeEventListener(event: 'devtools-focused', listener: (event: DOMEvent) => void): this;
  17087. /**
  17088. * Emitted when there is a new context menu that needs to be handled.
  17089. */
  17090. addEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void, useCapture?: boolean): this;
  17091. removeEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void): this;
  17092. addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  17093. addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  17094. removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  17095. removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  17096. /**
  17097. * Adjusts the current text selection starting and ending points in the focused
  17098. * frame by the given amounts. A negative amount moves the selection towards the
  17099. * beginning of the document, and a positive amount moves the selection towards the
  17100. * end of the document.
  17101. *
  17102. * See `webContents.adjustSelection` for examples.
  17103. */
  17104. adjustSelection(options: AdjustSelectionOptions): void;
  17105. /**
  17106. * Whether the guest page can go back.
  17107. */
  17108. canGoBack(): boolean;
  17109. /**
  17110. * Whether the guest page can go forward.
  17111. */
  17112. canGoForward(): boolean;
  17113. /**
  17114. * Whether the guest page can go to `offset`.
  17115. */
  17116. canGoToOffset(offset: number): boolean;
  17117. /**
  17118. * Resolves with a NativeImage
  17119. *
  17120. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  17121. * whole visible page.
  17122. */
  17123. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  17124. /**
  17125. * Centers the current text selection in page.
  17126. */
  17127. centerSelection(): void;
  17128. /**
  17129. * Clears the navigation history.
  17130. */
  17131. clearHistory(): void;
  17132. /**
  17133. * Closes the DevTools window of guest page.
  17134. */
  17135. closeDevTools(): void;
  17136. /**
  17137. * Executes editing command `copy` in page.
  17138. */
  17139. copy(): void;
  17140. /**
  17141. * Executes editing command `cut` in page.
  17142. */
  17143. cut(): void;
  17144. /**
  17145. * Executes editing command `delete` in page.
  17146. */
  17147. delete(): void;
  17148. /**
  17149. * Initiates a download of the resource at `url` without navigating.
  17150. */
  17151. downloadURL(url: string, options?: DownloadURLOptions): void;
  17152. /**
  17153. * A promise that resolves with the result of the executed code or is rejected if
  17154. * the result of the code is a rejected promise.
  17155. *
  17156. * Evaluates `code` in page. If `userGesture` is set, it will create the user
  17157. * gesture context in the page. HTML APIs like `requestFullScreen`, which require
  17158. * user action, can take advantage of this option for automation.
  17159. */
  17160. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  17161. /**
  17162. * The request id used for the request.
  17163. *
  17164. * Starts a request to find all matches for the `text` in the web page. The result
  17165. * of the request can be obtained by subscribing to `found-in-page` event.
  17166. */
  17167. findInPage(text: string, options?: FindInPageOptions): number;
  17168. /**
  17169. * The title of guest page.
  17170. */
  17171. getTitle(): string;
  17172. /**
  17173. * The URL of guest page.
  17174. */
  17175. getURL(): string;
  17176. /**
  17177. * The user agent for guest page.
  17178. */
  17179. getUserAgent(): string;
  17180. /**
  17181. * The WebContents ID of this `webview`.
  17182. */
  17183. getWebContentsId(): number;
  17184. /**
  17185. * the current zoom factor.
  17186. */
  17187. getZoomFactor(): number;
  17188. /**
  17189. * the current zoom level.
  17190. */
  17191. getZoomLevel(): number;
  17192. /**
  17193. * Makes the guest page go back.
  17194. */
  17195. goBack(): void;
  17196. /**
  17197. * Makes the guest page go forward.
  17198. */
  17199. goForward(): void;
  17200. /**
  17201. * Navigates to the specified absolute index.
  17202. */
  17203. goToIndex(index: number): void;
  17204. /**
  17205. * Navigates to the specified offset from the "current entry".
  17206. */
  17207. goToOffset(offset: number): void;
  17208. /**
  17209. * A promise that resolves with a key for the inserted CSS that can later be used
  17210. * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
  17211. *
  17212. * Injects CSS into the current web page and returns a unique key for the inserted
  17213. * stylesheet.
  17214. */
  17215. insertCSS(css: string): Promise<string>;
  17216. /**
  17217. * Inserts `text` to the focused element.
  17218. */
  17219. insertText(text: string): Promise<void>;
  17220. /**
  17221. * Starts inspecting element at position (`x`, `y`) of guest page.
  17222. */
  17223. inspectElement(x: number, y: number): void;
  17224. /**
  17225. * Opens the DevTools for the service worker context present in the guest page.
  17226. */
  17227. inspectServiceWorker(): void;
  17228. /**
  17229. * Opens the DevTools for the shared worker context present in the guest page.
  17230. */
  17231. inspectSharedWorker(): void;
  17232. /**
  17233. * Whether guest page has been muted.
  17234. */
  17235. isAudioMuted(): boolean;
  17236. /**
  17237. * Whether the renderer process has crashed.
  17238. */
  17239. isCrashed(): boolean;
  17240. /**
  17241. * Whether audio is currently playing.
  17242. */
  17243. isCurrentlyAudible(): boolean;
  17244. /**
  17245. * Whether DevTools window of guest page is focused.
  17246. */
  17247. isDevToolsFocused(): boolean;
  17248. /**
  17249. * Whether guest page has a DevTools window attached.
  17250. */
  17251. isDevToolsOpened(): boolean;
  17252. /**
  17253. * Whether guest page is still loading resources.
  17254. */
  17255. isLoading(): boolean;
  17256. /**
  17257. * Whether the main frame (and not just iframes or frames within it) is still
  17258. * loading.
  17259. */
  17260. isLoadingMainFrame(): boolean;
  17261. /**
  17262. * Whether the guest page is waiting for a first-response for the main resource of
  17263. * the page.
  17264. */
  17265. isWaitingForResponse(): boolean;
  17266. /**
  17267. * The promise will resolve when the page has finished loading (see
  17268. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  17269. *
  17270. * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
  17271. * the `http://` or `file://`.
  17272. */
  17273. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  17274. /**
  17275. * Opens a DevTools window for guest page.
  17276. */
  17277. openDevTools(): void;
  17278. /**
  17279. * Executes editing command `paste` in page.
  17280. */
  17281. paste(): void;
  17282. /**
  17283. * Executes editing command `pasteAndMatchStyle` in page.
  17284. */
  17285. pasteAndMatchStyle(): void;
  17286. /**
  17287. * Prints `webview`'s web page. Same as `webContents.print([options])`.
  17288. */
  17289. print(options?: WebviewTagPrintOptions): Promise<void>;
  17290. /**
  17291. * Resolves with the generated PDF data.
  17292. *
  17293. * Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
  17294. */
  17295. printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
  17296. /**
  17297. * Executes editing command `redo` in page.
  17298. */
  17299. redo(): void;
  17300. /**
  17301. * Reloads the guest page.
  17302. */
  17303. reload(): void;
  17304. /**
  17305. * Reloads the guest page and ignores cache.
  17306. */
  17307. reloadIgnoringCache(): void;
  17308. /**
  17309. * Resolves if the removal was successful.
  17310. *
  17311. * Removes the inserted CSS from the current web page. The stylesheet is identified
  17312. * by its key, which is returned from `<webview>.insertCSS(css)`.
  17313. */
  17314. removeInsertedCSS(key: string): Promise<void>;
  17315. /**
  17316. * Executes editing command `replace` in page.
  17317. */
  17318. replace(text: string): void;
  17319. /**
  17320. * Executes editing command `replaceMisspelling` in page.
  17321. */
  17322. replaceMisspelling(text: string): void;
  17323. /**
  17324. * Scrolls to the bottom of the current `<webview>`.
  17325. */
  17326. scrollToBottom(): void;
  17327. /**
  17328. * Scrolls to the top of the current `<webview>`.
  17329. */
  17330. scrollToTop(): void;
  17331. /**
  17332. * Executes editing command `selectAll` in page.
  17333. */
  17334. selectAll(): void;
  17335. /**
  17336. * Send an asynchronous message to renderer process via `channel`, you can also
  17337. * send arbitrary arguments. The renderer process can handle the message by
  17338. * listening to the `channel` event with the `ipcRenderer` module.
  17339. *
  17340. * See webContents.send for examples.
  17341. */
  17342. send(channel: string, ...args: any[]): Promise<void>;
  17343. /**
  17344. * Sends an input `event` to the page.
  17345. *
  17346. * See webContents.sendInputEvent for detailed description of `event` object.
  17347. */
  17348. sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
  17349. /**
  17350. * Send an asynchronous message to renderer process via `channel`, you can also
  17351. * send arbitrary arguments. The renderer process can handle the message by
  17352. * listening to the `channel` event with the `ipcRenderer` module.
  17353. *
  17354. * See webContents.sendToFrame for examples.
  17355. */
  17356. sendToFrame(frameId: [number, number], channel: string, ...args: any[]): Promise<void>;
  17357. /**
  17358. * Set guest page muted.
  17359. */
  17360. setAudioMuted(muted: boolean): void;
  17361. /**
  17362. * Overrides the user agent for the guest page.
  17363. */
  17364. setUserAgent(userAgent: string): void;
  17365. /**
  17366. * Sets the maximum and minimum pinch-to-zoom level.
  17367. */
  17368. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  17369. /**
  17370. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  17371. * divided by 100, so 300% = 3.0.
  17372. */
  17373. setZoomFactor(factor: number): void;
  17374. /**
  17375. * Changes the zoom level to the specified level. The original size is 0 and each
  17376. * increment above or below represents zooming 20% larger or smaller to default
  17377. * limits of 300% and 50% of original size, respectively. The formula for this is
  17378. * `scale := 1.2 ^ level`.
  17379. *
  17380. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  17381. * the zoom level for a specific domain propagates across all instances of windows
  17382. * with the same domain. Differentiating the window URLs will make zoom work
  17383. * per-window.
  17384. */
  17385. setZoomLevel(level: number): void;
  17386. /**
  17387. * Shows pop-up dictionary that searches the selected word on the page.
  17388. *
  17389. * @platform darwin
  17390. */
  17391. showDefinitionForSelection(): void;
  17392. /**
  17393. * Stops any pending navigation.
  17394. */
  17395. stop(): void;
  17396. /**
  17397. * Stops any `findInPage` request for the `webview` with the provided `action`.
  17398. */
  17399. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  17400. /**
  17401. * Executes editing command `undo` in page.
  17402. */
  17403. undo(): void;
  17404. /**
  17405. * Executes editing command `unselect` in page.
  17406. */
  17407. unselect(): void;
  17408. /**
  17409. * A `boolean`. When this attribute is present the guest page will be allowed to
  17410. * open new windows. Popups are disabled by default.
  17411. */
  17412. allowpopups: boolean;
  17413. /**
  17414. * A `string` which is a list of strings which specifies the blink features to be
  17415. * disabled separated by `,`. The full list of supported feature strings can be
  17416. * found in the RuntimeEnabledFeatures.json5 file.
  17417. */
  17418. disableblinkfeatures: string;
  17419. /**
  17420. * A `boolean`. When this attribute is present the guest page will have web
  17421. * security disabled. Web security is enabled by default.
  17422. *
  17423. * This value can only be modified before the first navigation.
  17424. */
  17425. disablewebsecurity: boolean;
  17426. /**
  17427. * A `string` which is a list of strings which specifies the blink features to be
  17428. * enabled separated by `,`. The full list of supported feature strings can be
  17429. * found in the RuntimeEnabledFeatures.json5 file.
  17430. */
  17431. enableblinkfeatures: string;
  17432. /**
  17433. * A `string` that sets the referrer URL for the guest page.
  17434. */
  17435. httpreferrer: string;
  17436. /**
  17437. * A `boolean`. When this attribute is present the guest page in `webview` will
  17438. * have node integration and can use node APIs like `require` and `process` to
  17439. * access low level system resources. Node integration is disabled by default in
  17440. * the guest page.
  17441. */
  17442. nodeintegration: boolean;
  17443. /**
  17444. * A `boolean` for the experimental option for enabling NodeJS support in
  17445. * sub-frames such as iframes inside the `webview`. All your preloads will load for
  17446. * every iframe, you can use `process.isMainFrame` to determine if you are in the
  17447. * main frame or not. This option is disabled by default in the guest page.
  17448. */
  17449. nodeintegrationinsubframes: boolean;
  17450. /**
  17451. * A `string` that sets the session used by the page. If `partition` starts with
  17452. * `persist:`, the page will use a persistent session available to all pages in the
  17453. * app with the same `partition`. if there is no `persist:` prefix, the page will
  17454. * use an in-memory session. By assigning the same `partition`, multiple pages can
  17455. * share the same session. If the `partition` is unset then default session of the
  17456. * app will be used.
  17457. *
  17458. * This value can only be modified before the first navigation, since the session
  17459. * of an active renderer process cannot change. Subsequent attempts to modify the
  17460. * value will fail with a DOM exception.
  17461. */
  17462. partition: string;
  17463. /**
  17464. * A `boolean`. When this attribute is present the guest page in `webview` will be
  17465. * able to use browser plugins. Plugins are disabled by default.
  17466. */
  17467. plugins: boolean;
  17468. /**
  17469. * A `string` that specifies a script that will be loaded before other scripts run
  17470. * in the guest page. The protocol of script's URL must be `file:` (even when using
  17471. * `asar:` archives) because it will be loaded by Node's `require` under the hood,
  17472. * which treats `asar:` archives as virtual directories.
  17473. *
  17474. * When the guest page doesn't have node integration this script will still have
  17475. * access to all Node APIs, but global objects injected by Node will be deleted
  17476. * after this script has finished executing.
  17477. */
  17478. preload: string;
  17479. /**
  17480. * A `string` representing the visible URL. Writing to this attribute initiates
  17481. * top-level navigation.
  17482. *
  17483. * Assigning `src` its own value will reload the current page.
  17484. *
  17485. * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
  17486. * world!`.
  17487. */
  17488. src: string;
  17489. /**
  17490. * A `string` that sets the user agent for the guest page before the page is
  17491. * navigated to. Once the page is loaded, use the `setUserAgent` method to change
  17492. * the user agent.
  17493. */
  17494. useragent: string;
  17495. /**
  17496. * A `string` which is a comma separated list of strings which specifies the web
  17497. * preferences to be set on the webview. The full list of supported preference
  17498. * strings can be found in BrowserWindow.
  17499. *
  17500. * The string follows the same format as the features string in `window.open`. A
  17501. * name by itself is given a `true` boolean value. A preference can be set to
  17502. * another value by including an `=`, followed by the value. Special values `yes`
  17503. * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
  17504. * `false`.
  17505. */
  17506. webpreferences: string;
  17507. }
  17508. interface WindowOpenHandlerResponse {
  17509. // Docs: https://electronjs.org/docs/api/structures/window-open-handler-response
  17510. /**
  17511. * Can be `allow` or `deny`. Controls whether new window should be created.
  17512. */
  17513. action: ('allow' | 'deny');
  17514. /**
  17515. * If specified, will be called instead of `new BrowserWindow` to create the new
  17516. * child window and event `did-create-window` will not be emitted. Constructed
  17517. * child window should use passed `options` object. This can be used for example to
  17518. * have the new window open as a BrowserView instead of in a separate window.
  17519. */
  17520. createWindow?: (options: BrowserWindowConstructorOptions) => WebContents;
  17521. /**
  17522. * By default, child windows are closed when their opener is closed. This can be
  17523. * changed by specifying `outlivesOpener: true`, in which case the opened window
  17524. * will not be closed when its opener is closed.
  17525. */
  17526. outlivesOpener?: boolean;
  17527. /**
  17528. * Allows customization of the created window.
  17529. */
  17530. overrideBrowserWindowOptions?: BrowserWindowConstructorOptions;
  17531. }
  17532. interface AboutPanelOptionsOptions {
  17533. /**
  17534. * The app's name.
  17535. */
  17536. applicationName?: string;
  17537. /**
  17538. * The app's version.
  17539. */
  17540. applicationVersion?: string;
  17541. /**
  17542. * Copyright information.
  17543. */
  17544. copyright?: string;
  17545. /**
  17546. * The app's build version number.
  17547. *
  17548. * @platform darwin
  17549. */
  17550. version?: string;
  17551. /**
  17552. * Credit information.
  17553. *
  17554. * @platform darwin,win32
  17555. */
  17556. credits?: string;
  17557. /**
  17558. * List of app authors.
  17559. *
  17560. * @platform linux
  17561. */
  17562. authors?: string[];
  17563. /**
  17564. * The app's website.
  17565. *
  17566. * @platform linux
  17567. */
  17568. website?: string;
  17569. /**
  17570. * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
  17571. * 64x64 pixels while retaining aspect ratio.
  17572. *
  17573. * @platform linux,win32
  17574. */
  17575. iconPath?: string;
  17576. }
  17577. interface AddRepresentationOptions {
  17578. /**
  17579. * The scale factor to add the image representation for.
  17580. */
  17581. scaleFactor?: number;
  17582. /**
  17583. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  17584. */
  17585. width?: number;
  17586. /**
  17587. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  17588. */
  17589. height?: number;
  17590. /**
  17591. * The buffer containing the raw image data.
  17592. */
  17593. buffer?: Buffer;
  17594. /**
  17595. * The data URL containing either a base 64 encoded PNG or JPEG image.
  17596. */
  17597. dataURL?: string;
  17598. }
  17599. interface AdjustSelectionOptions {
  17600. /**
  17601. * Amount to shift the start index of the current selection.
  17602. */
  17603. start?: number;
  17604. /**
  17605. * Amount to shift the end index of the current selection.
  17606. */
  17607. end?: number;
  17608. }
  17609. interface AnimationSettings {
  17610. /**
  17611. * Returns true if rich animations should be rendered. Looks at session type (e.g.
  17612. * remote desktop) and accessibility settings to give guidance for heavy
  17613. * animations.
  17614. */
  17615. shouldRenderRichAnimation: boolean;
  17616. /**
  17617. * Determines on a per-platform basis whether scroll animations (e.g. produced by
  17618. * home/end key) should be enabled.
  17619. */
  17620. scrollAnimationsEnabledBySystem: boolean;
  17621. /**
  17622. * Determines whether the user desires reduced motion based on platform APIs.
  17623. */
  17624. prefersReducedMotion: boolean;
  17625. }
  17626. interface AppDetailsOptions {
  17627. /**
  17628. * Window's App User Model ID. It has to be set, otherwise the other options will
  17629. * have no effect.
  17630. */
  17631. appId?: string;
  17632. /**
  17633. * Window's Relaunch Icon.
  17634. */
  17635. appIconPath?: string;
  17636. /**
  17637. * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
  17638. * Default is `0`.
  17639. */
  17640. appIconIndex?: number;
  17641. /**
  17642. * Window's Relaunch Command.
  17643. */
  17644. relaunchCommand?: string;
  17645. /**
  17646. * Window's Relaunch Display Name.
  17647. */
  17648. relaunchDisplayName?: string;
  17649. }
  17650. interface ApplicationInfoForProtocolReturnValue {
  17651. /**
  17652. * the display icon of the app handling the protocol.
  17653. */
  17654. icon: NativeImage;
  17655. /**
  17656. * installation path of the app handling the protocol.
  17657. */
  17658. path: string;
  17659. /**
  17660. * display name of the app handling the protocol.
  17661. */
  17662. name: string;
  17663. }
  17664. interface AuthenticationResponseDetails {
  17665. url: string;
  17666. }
  17667. interface AuthInfo {
  17668. isProxy: boolean;
  17669. scheme: string;
  17670. host: string;
  17671. port: number;
  17672. realm: string;
  17673. }
  17674. interface AutoResizeOptions {
  17675. /**
  17676. * If `true`, the view's width will grow and shrink together with the window.
  17677. * `false` by default.
  17678. */
  17679. width?: boolean;
  17680. /**
  17681. * If `true`, the view's height will grow and shrink together with the window.
  17682. * `false` by default.
  17683. */
  17684. height?: boolean;
  17685. /**
  17686. * If `true`, the view's x position and width will grow and shrink proportionally
  17687. * with the window. `false` by default.
  17688. */
  17689. horizontal?: boolean;
  17690. /**
  17691. * If `true`, the view's y position and height will grow and shrink proportionally
  17692. * with the window. `false` by default.
  17693. */
  17694. vertical?: boolean;
  17695. }
  17696. interface BeforeSendResponse {
  17697. cancel?: boolean;
  17698. /**
  17699. * When provided, request will be made with these headers.
  17700. */
  17701. requestHeaders?: Record<string, (string) | (string[])>;
  17702. }
  17703. interface BitmapOptions {
  17704. /**
  17705. * Defaults to 1.0.
  17706. */
  17707. scaleFactor?: number;
  17708. }
  17709. interface BlinkMemoryInfo {
  17710. /**
  17711. * Size of all allocated objects in Kilobytes.
  17712. */
  17713. allocated: number;
  17714. /**
  17715. * Total allocated space in Kilobytes.
  17716. */
  17717. total: number;
  17718. }
  17719. interface BluetoothPairingHandlerHandlerDetails {
  17720. deviceId: string;
  17721. /**
  17722. * The type of pairing prompt being requested. One of the following values:
  17723. */
  17724. pairingKind: ('confirm' | 'confirmPin' | 'providePin');
  17725. frame: WebFrameMain;
  17726. /**
  17727. * The pin value to verify if `pairingKind` is `confirmPin`.
  17728. */
  17729. pin?: string;
  17730. }
  17731. interface BrowserViewConstructorOptions {
  17732. /**
  17733. * Settings of web page's features.
  17734. */
  17735. webPreferences?: WebPreferences;
  17736. }
  17737. interface CallbackResponse {
  17738. cancel?: boolean;
  17739. /**
  17740. * The original request is prevented from being sent or completed and is instead
  17741. * redirected to the given URL.
  17742. */
  17743. redirectURL?: string;
  17744. }
  17745. interface CertificateTrustDialogOptions {
  17746. /**
  17747. * The certificate to trust/import.
  17748. */
  17749. certificate: Certificate;
  17750. /**
  17751. * The message to display to the user.
  17752. */
  17753. message: string;
  17754. }
  17755. interface ClearCodeCachesOptions {
  17756. /**
  17757. * An array of url corresponding to the resource whose generated code cache needs
  17758. * to be removed. If the list is empty then all entries in the cache directory will
  17759. * be removed.
  17760. */
  17761. urls?: string[];
  17762. }
  17763. interface ClearDataOptions {
  17764. /**
  17765. * The types of data to clear. By default, this will clear all types of data.
  17766. */
  17767. dataTypes?: Array<'backgroundFetch' | 'cache' | 'cookies' | 'downloads' | 'fileSystems' | 'indexedDB' | 'localStorage' | 'serviceWorkers' | 'webSQL'>;
  17768. /**
  17769. * Clear data for only these origins. Cannot be used with `excludeOrigins`.
  17770. */
  17771. origins?: string[];
  17772. /**
  17773. * Clear data for all origins except these ones. Cannot be used with `origins`.
  17774. */
  17775. excludeOrigins?: string[];
  17776. /**
  17777. * Skips deleting cookies that would close current network connections. (Default:
  17778. * `false`)
  17779. */
  17780. avoidClosingConnections?: boolean;
  17781. /**
  17782. * The behavior for matching data to origins.
  17783. */
  17784. originMatchingMode?: ('third-parties-included' | 'origin-in-all-contexts');
  17785. }
  17786. interface ClearStorageDataOptions {
  17787. /**
  17788. * Should follow `window.location.origin`’s representation `scheme://host:port`.
  17789. */
  17790. origin?: string;
  17791. /**
  17792. * The types of storages to clear, can be `cookies`, `filesystem`, `indexdb`,
  17793. * `localstorage`, `shadercache`, `websql`, `serviceworkers`, `cachestorage`. If
  17794. * not specified, clear all storage types.
  17795. */
  17796. storages?: Array<'cookies' | 'filesystem' | 'indexdb' | 'localstorage' | 'shadercache' | 'websql' | 'serviceworkers' | 'cachestorage'>;
  17797. /**
  17798. * The types of quotas to clear, can be `temporary`, `syncable`. If not specified,
  17799. * clear all quotas.
  17800. */
  17801. quotas?: Array<'temporary' | 'syncable'>;
  17802. }
  17803. interface ClientRequestConstructorOptions {
  17804. /**
  17805. * The HTTP request method. Defaults to the GET method.
  17806. */
  17807. method?: string;
  17808. /**
  17809. * The request URL. Must be provided in the absolute form with the protocol scheme
  17810. * specified as http or https.
  17811. */
  17812. url?: string;
  17813. /**
  17814. * Headers to be sent with the request.
  17815. */
  17816. headers?: Record<string, (string) | (string[])>;
  17817. /**
  17818. * The `Session` instance with which the request is associated.
  17819. */
  17820. session?: Session;
  17821. /**
  17822. * The name of the `partition` with which the request is associated. Defaults to
  17823. * the empty string. The `session` option supersedes `partition`. Thus if a
  17824. * `session` is explicitly specified, `partition` is ignored.
  17825. */
  17826. partition?: string;
  17827. /**
  17828. * Can be `include`, `omit` or `same-origin`. Whether to send credentials with this
  17829. * request. If set to `include`, credentials from the session associated with the
  17830. * request will be used. If set to `omit`, credentials will not be sent with the
  17831. * request (and the `'login'` event will not be triggered in the event of a 401).
  17832. * If set to `same-origin`, `origin` must also be specified. This matches the
  17833. * behavior of the fetch option of the same name. If this option is not specified,
  17834. * authentication data from the session will be sent, and cookies will not be sent
  17835. * (unless `useSessionCookies` is set).
  17836. */
  17837. credentials?: ('include' | 'omit' | 'same-origin');
  17838. /**
  17839. * Whether to send cookies with this request from the provided session. If
  17840. * `credentials` is specified, this option has no effect. Default is `false`.
  17841. */
  17842. useSessionCookies?: boolean;
  17843. /**
  17844. * Can be `http:` or `https:`. The protocol scheme in the form 'scheme:'. Defaults
  17845. * to 'http:'.
  17846. */
  17847. protocol?: ('http:' | 'https:');
  17848. /**
  17849. * The server host provided as a concatenation of the hostname and the port number
  17850. * 'hostname:port'.
  17851. */
  17852. host?: string;
  17853. /**
  17854. * The server host name.
  17855. */
  17856. hostname?: string;
  17857. /**
  17858. * The server's listening port number.
  17859. */
  17860. port?: number;
  17861. /**
  17862. * The path part of the request URL.
  17863. */
  17864. path?: string;
  17865. /**
  17866. * Can be `follow`, `error` or `manual`. The redirect mode for this request. When
  17867. * mode is `error`, any redirection will be aborted. When mode is `manual` the
  17868. * redirection will be cancelled unless `request.followRedirect` is invoked
  17869. * synchronously during the `redirect` event. Defaults to `follow`.
  17870. */
  17871. redirect?: ('follow' | 'error' | 'manual');
  17872. /**
  17873. * The origin URL of the request.
  17874. */
  17875. origin?: string;
  17876. /**
  17877. * can be `""`, `no-referrer`, `no-referrer-when-downgrade`, `origin`,
  17878. * `origin-when-cross-origin`, `unsafe-url`, `same-origin`, `strict-origin`, or
  17879. * `strict-origin-when-cross-origin`. Defaults to
  17880. * `strict-origin-when-cross-origin`.
  17881. */
  17882. referrerPolicy?: string;
  17883. /**
  17884. * can be `default`, `no-store`, `reload`, `no-cache`, `force-cache` or
  17885. * `only-if-cached`.
  17886. */
  17887. cache?: ('default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached');
  17888. }
  17889. interface CloseOpts {
  17890. /**
  17891. * if true, fire the `beforeunload` event before closing the page. If the page
  17892. * prevents the unload, the WebContents will not be closed. The
  17893. * `will-prevent-unload` will be fired if the page requests prevention of unload.
  17894. */
  17895. waitForBeforeUnload: boolean;
  17896. }
  17897. interface Config {
  17898. /**
  17899. * Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. The minimum SSL version to allow
  17900. * when connecting to remote servers. Defaults to `tls1`.
  17901. */
  17902. minVersion?: ('tls1' | 'tls1.1' | 'tls1.2' | 'tls1.3');
  17903. /**
  17904. * Can be `tls1.2` or `tls1.3`. The maximum SSL version to allow when connecting to
  17905. * remote servers. Defaults to `tls1.3`.
  17906. */
  17907. maxVersion?: ('tls1.2' | 'tls1.3');
  17908. /**
  17909. * List of cipher suites which should be explicitly prevented from being used in
  17910. * addition to those disabled by the net built-in policy. Supported literal forms:
  17911. * 0xAABB, where AA is `cipher_suite[0]` and BB is `cipher_suite[1]`, as defined in
  17912. * RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form
  17913. * will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify
  17914. * 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note
  17915. * that TLSv1.3 ciphers cannot be disabled using this mechanism.
  17916. */
  17917. disabledCipherSuites?: number[];
  17918. }
  17919. interface ConfigureHostResolverOptions {
  17920. /**
  17921. * Whether the built-in host resolver is used in preference to getaddrinfo. When
  17922. * enabled, the built-in resolver will attempt to use the system's DNS settings to
  17923. * do DNS lookups itself. Enabled by default on macOS, disabled by default on
  17924. * Windows and Linux.
  17925. */
  17926. enableBuiltInResolver?: boolean;
  17927. /**
  17928. * Can be 'off', 'automatic' or 'secure'. Configures the DNS-over-HTTP mode. When
  17929. * 'off', no DoH lookups will be performed. When 'automatic', DoH lookups will be
  17930. * performed first if DoH is available, and insecure DNS lookups will be performed
  17931. * as a fallback. When 'secure', only DoH lookups will be performed. Defaults to
  17932. * 'automatic'.
  17933. */
  17934. secureDnsMode?: ('off' | 'automatic' | 'secure');
  17935. /**
  17936. * A list of DNS-over-HTTP server templates. See RFC8484 § 3 for details on the
  17937. * template format. Most servers support the POST method; the template for such
  17938. * servers is simply a URI. Note that for some DNS providers, the resolver will
  17939. * automatically upgrade to DoH unless DoH is explicitly disabled, even if there
  17940. * are no DoH servers provided in this list.
  17941. */
  17942. secureDnsServers?: string[];
  17943. /**
  17944. * Controls whether additional DNS query types, e.g. HTTPS (DNS type 65) will be
  17945. * allowed besides the traditional A and AAAA queries when a request is being made
  17946. * via insecure DNS. Has no effect on Secure DNS which always allows additional
  17947. * types. Defaults to true.
  17948. */
  17949. enableAdditionalDnsQueryTypes?: boolean;
  17950. }
  17951. interface ConsoleMessageEvent extends DOMEvent {
  17952. /**
  17953. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  17954. * `error`.
  17955. */
  17956. level: number;
  17957. /**
  17958. * The actual console message
  17959. */
  17960. message: string;
  17961. /**
  17962. * The line number of the source that triggered this console message
  17963. */
  17964. line: number;
  17965. sourceId: string;
  17966. }
  17967. interface ContextMenuEvent extends DOMEvent {
  17968. params: Params;
  17969. }
  17970. interface ContextMenuParams {
  17971. /**
  17972. * x coordinate.
  17973. */
  17974. x: number;
  17975. /**
  17976. * y coordinate.
  17977. */
  17978. y: number;
  17979. /**
  17980. * Frame from which the context menu was invoked.
  17981. */
  17982. frame: WebFrameMain;
  17983. /**
  17984. * URL of the link that encloses the node the context menu was invoked on.
  17985. */
  17986. linkURL: string;
  17987. /**
  17988. * Text associated with the link. May be an empty string if the contents of the
  17989. * link are an image.
  17990. */
  17991. linkText: string;
  17992. /**
  17993. * URL of the top level page that the context menu was invoked on.
  17994. */
  17995. pageURL: string;
  17996. /**
  17997. * URL of the subframe that the context menu was invoked on.
  17998. */
  17999. frameURL: string;
  18000. /**
  18001. * Source URL for the element that the context menu was invoked on. Elements with
  18002. * source URLs are images, audio and video.
  18003. */
  18004. srcURL: string;
  18005. /**
  18006. * Type of the node the context menu was invoked on. Can be `none`, `image`,
  18007. * `audio`, `video`, `canvas`, `file` or `plugin`.
  18008. */
  18009. mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
  18010. /**
  18011. * Whether the context menu was invoked on an image which has non-empty contents.
  18012. */
  18013. hasImageContents: boolean;
  18014. /**
  18015. * Whether the context is editable.
  18016. */
  18017. isEditable: boolean;
  18018. /**
  18019. * Text of the selection that the context menu was invoked on.
  18020. */
  18021. selectionText: string;
  18022. /**
  18023. * Title text of the selection that the context menu was invoked on.
  18024. */
  18025. titleText: string;
  18026. /**
  18027. * Alt text of the selection that the context menu was invoked on.
  18028. */
  18029. altText: string;
  18030. /**
  18031. * Suggested filename to be used when saving file through 'Save Link As' option of
  18032. * context menu.
  18033. */
  18034. suggestedFilename: string;
  18035. /**
  18036. * Rect representing the coordinates in the document space of the selection.
  18037. */
  18038. selectionRect: Rectangle;
  18039. /**
  18040. * Start position of the selection text.
  18041. */
  18042. selectionStartOffset: number;
  18043. /**
  18044. * The referrer policy of the frame on which the menu is invoked.
  18045. */
  18046. referrerPolicy: Referrer;
  18047. /**
  18048. * The misspelled word under the cursor, if any.
  18049. */
  18050. misspelledWord: string;
  18051. /**
  18052. * An array of suggested words to show the user to replace the `misspelledWord`.
  18053. * Only available if there is a misspelled word and spellchecker is enabled.
  18054. */
  18055. dictionarySuggestions: string[];
  18056. /**
  18057. * The character encoding of the frame on which the menu was invoked.
  18058. */
  18059. frameCharset: string;
  18060. /**
  18061. * The source that the context menu was invoked on. Possible values include `none`,
  18062. * `button-button`, `field-set`, `input-button`, `input-checkbox`, `input-color`,
  18063. * `input-date`, `input-datetime-local`, `input-email`, `input-file`,
  18064. * `input-hidden`, `input-image`, `input-month`, `input-number`, `input-password`,
  18065. * `input-radio`, `input-range`, `input-reset`, `input-search`, `input-submit`,
  18066. * `input-telephone`, `input-text`, `input-time`, `input-url`, `input-week`,
  18067. * `output`, `reset-button`, `select-list`, `select-list`, `select-multiple`,
  18068. * `select-one`, `submit-button`, and `text-area`,
  18069. */
  18070. formControlType: ('none' | 'button-button' | 'field-set' | 'input-button' | 'input-checkbox' | 'input-color' | 'input-date' | 'input-datetime-local' | 'input-email' | 'input-file' | 'input-hidden' | 'input-image' | 'input-month' | 'input-number' | 'input-password' | 'input-radio' | 'input-range' | 'input-reset' | 'input-search' | 'input-submit' | 'input-telephone' | 'input-text' | 'input-time' | 'input-url' | 'input-week' | 'output' | 'reset-button' | 'select-list' | 'select-list' | 'select-multiple' | 'select-one' | 'submit-button' | 'text-area');
  18071. /**
  18072. * If the context is editable, whether or not spellchecking is enabled.
  18073. */
  18074. spellcheckEnabled: boolean;
  18075. /**
  18076. * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
  18077. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  18078. * `adjustSelection`, or `adjustSelectionReset`.
  18079. */
  18080. menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  18081. /**
  18082. * The flags for the media element the context menu was invoked on.
  18083. */
  18084. mediaFlags: MediaFlags;
  18085. /**
  18086. * These flags indicate whether the renderer believes it is able to perform the
  18087. * corresponding action.
  18088. */
  18089. editFlags: EditFlags;
  18090. }
  18091. interface ContinueActivityDetails {
  18092. /**
  18093. * A string identifying the URL of the webpage accessed by the activity on another
  18094. * device, if available.
  18095. */
  18096. webpageURL?: string;
  18097. }
  18098. interface CookiesGetFilter {
  18099. /**
  18100. * Retrieves cookies which are associated with `url`. Empty implies retrieving
  18101. * cookies of all URLs.
  18102. */
  18103. url?: string;
  18104. /**
  18105. * Filters cookies by name.
  18106. */
  18107. name?: string;
  18108. /**
  18109. * Retrieves cookies whose domains match or are subdomains of `domains`.
  18110. */
  18111. domain?: string;
  18112. /**
  18113. * Retrieves cookies whose path matches `path`.
  18114. */
  18115. path?: string;
  18116. /**
  18117. * Filters cookies by their Secure property.
  18118. */
  18119. secure?: boolean;
  18120. /**
  18121. * Filters out session or persistent cookies.
  18122. */
  18123. session?: boolean;
  18124. /**
  18125. * Filters cookies by httpOnly.
  18126. */
  18127. httpOnly?: boolean;
  18128. }
  18129. interface CookiesSetDetails {
  18130. /**
  18131. * The URL to associate the cookie with. The promise will be rejected if the URL is
  18132. * invalid.
  18133. */
  18134. url: string;
  18135. /**
  18136. * The name of the cookie. Empty by default if omitted.
  18137. */
  18138. name?: string;
  18139. /**
  18140. * The value of the cookie. Empty by default if omitted.
  18141. */
  18142. value?: string;
  18143. /**
  18144. * The domain of the cookie; this will be normalized with a preceding dot so that
  18145. * it's also valid for subdomains. Empty by default if omitted.
  18146. */
  18147. domain?: string;
  18148. /**
  18149. * The path of the cookie. Empty by default if omitted.
  18150. */
  18151. path?: string;
  18152. /**
  18153. * Whether the cookie should be marked as Secure. Defaults to false unless Same
  18154. * Site=None attribute is used.
  18155. */
  18156. secure?: boolean;
  18157. /**
  18158. * Whether the cookie should be marked as HTTP only. Defaults to false.
  18159. */
  18160. httpOnly?: boolean;
  18161. /**
  18162. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  18163. * If omitted then the cookie becomes a session cookie and will not be retained
  18164. * between sessions.
  18165. */
  18166. expirationDate?: number;
  18167. /**
  18168. * The Same Site policy to apply to this cookie. Can be `unspecified`,
  18169. * `no_restriction`, `lax` or `strict`. Default is `lax`.
  18170. */
  18171. sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  18172. }
  18173. interface CrashReporterStartOptions {
  18174. /**
  18175. * URL that crash reports will be sent to as POST. Required unless `uploadToServer`
  18176. * is `false`.
  18177. */
  18178. submitURL?: string;
  18179. /**
  18180. * Defaults to `app.name`.
  18181. */
  18182. productName?: string;
  18183. /**
  18184. * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
  18185. *
  18186. * @deprecated
  18187. */
  18188. companyName?: string;
  18189. /**
  18190. * Whether crash reports should be sent to the server. If false, crash reports will
  18191. * be collected and stored in the crashes directory, but not uploaded. Default is
  18192. * `true`.
  18193. */
  18194. uploadToServer?: boolean;
  18195. /**
  18196. * If true, crashes generated in the main process will not be forwarded to the
  18197. * system crash handler. Default is `false`.
  18198. */
  18199. ignoreSystemCrashHandler?: boolean;
  18200. /**
  18201. * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
  18202. *
  18203. * @platform darwin,win32
  18204. */
  18205. rateLimit?: boolean;
  18206. /**
  18207. * If true, crash reports will be compressed and uploaded with `Content-Encoding:
  18208. * gzip`. Default is `true`.
  18209. */
  18210. compress?: boolean;
  18211. /**
  18212. * Extra string key/value annotations that will be sent along with crash reports
  18213. * that are generated in the main process. Only string values are supported.
  18214. * Crashes generated in child processes will not contain these extra parameters to
  18215. * crash reports generated from child processes, call `addExtraParameter` from the
  18216. * child process.
  18217. */
  18218. extra?: Record<string, string>;
  18219. /**
  18220. * Extra string key/value annotations that will be sent along with any crash
  18221. * reports generated in any process. These annotations cannot be changed once the
  18222. * crash reporter has been started. If a key is present in both the global extra
  18223. * parameters and the process-specific extra parameters, then the global one will
  18224. * take precedence. By default, `productName` and the app version are included, as
  18225. * well as the Electron version.
  18226. */
  18227. globalExtra?: Record<string, string>;
  18228. }
  18229. interface CreateFromBitmapOptions {
  18230. width: number;
  18231. height: number;
  18232. /**
  18233. * Defaults to 1.0.
  18234. */
  18235. scaleFactor?: number;
  18236. }
  18237. interface CreateFromBufferOptions {
  18238. /**
  18239. * Required for bitmap buffers.
  18240. */
  18241. width?: number;
  18242. /**
  18243. * Required for bitmap buffers.
  18244. */
  18245. height?: number;
  18246. /**
  18247. * Defaults to 1.0.
  18248. */
  18249. scaleFactor?: number;
  18250. }
  18251. interface CreateInterruptedDownloadOptions {
  18252. /**
  18253. * Absolute path of the download.
  18254. */
  18255. path: string;
  18256. /**
  18257. * Complete URL chain for the download.
  18258. */
  18259. urlChain: string[];
  18260. mimeType?: string;
  18261. /**
  18262. * Start range for the download.
  18263. */
  18264. offset: number;
  18265. /**
  18266. * Total length of the download.
  18267. */
  18268. length: number;
  18269. /**
  18270. * Last-Modified header value.
  18271. */
  18272. lastModified?: string;
  18273. /**
  18274. * ETag header value.
  18275. */
  18276. eTag?: string;
  18277. /**
  18278. * Time when download was started in number of seconds since UNIX epoch.
  18279. */
  18280. startTime?: number;
  18281. }
  18282. interface Data {
  18283. text?: string;
  18284. html?: string;
  18285. image?: NativeImage;
  18286. rtf?: string;
  18287. /**
  18288. * The title of the URL at `text`.
  18289. */
  18290. bookmark?: string;
  18291. }
  18292. interface DefaultFontFamily {
  18293. /**
  18294. * Defaults to `Times New Roman`.
  18295. */
  18296. standard?: string;
  18297. /**
  18298. * Defaults to `Times New Roman`.
  18299. */
  18300. serif?: string;
  18301. /**
  18302. * Defaults to `Arial`.
  18303. */
  18304. sansSerif?: string;
  18305. /**
  18306. * Defaults to `Courier New`.
  18307. */
  18308. monospace?: string;
  18309. /**
  18310. * Defaults to `Script`.
  18311. */
  18312. cursive?: string;
  18313. /**
  18314. * Defaults to `Impact`.
  18315. */
  18316. fantasy?: string;
  18317. /**
  18318. * Defaults to `Latin Modern Math`.
  18319. */
  18320. math?: string;
  18321. }
  18322. interface Details {
  18323. /**
  18324. * Process type. One of the following values:
  18325. */
  18326. type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  18327. /**
  18328. * The reason the child process is gone. Possible values:
  18329. */
  18330. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  18331. /**
  18332. * The exit code for the process (e.g. status from waitpid if on posix, from
  18333. * GetExitCodeProcess on Windows).
  18334. */
  18335. exitCode: number;
  18336. /**
  18337. * The non-localized name of the process.
  18338. */
  18339. serviceName?: string;
  18340. /**
  18341. * The name of the process. Examples for utility: `Audio Service`, `Content
  18342. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  18343. */
  18344. name?: string;
  18345. }
  18346. interface DevicePermissionHandlerHandlerDetails {
  18347. /**
  18348. * The type of device that permission is being requested on, can be `hid`,
  18349. * `serial`, or `usb`.
  18350. */
  18351. deviceType: ('hid' | 'serial' | 'usb');
  18352. /**
  18353. * The origin URL of the device permission check.
  18354. */
  18355. origin: string;
  18356. /**
  18357. * the device that permission is being requested for.
  18358. */
  18359. device: (HIDDevice) | (SerialPort) | (USBDevice);
  18360. }
  18361. interface DevtoolsOpenUrlEvent extends DOMEvent {
  18362. /**
  18363. * URL of the link that was clicked or selected.
  18364. */
  18365. url: string;
  18366. }
  18367. interface DevtoolsSearchQueryEvent extends DOMEvent {
  18368. event: Event;
  18369. /**
  18370. * text to query for.
  18371. */
  18372. query: string;
  18373. }
  18374. interface DidChangeThemeColorEvent extends DOMEvent {
  18375. themeColor: string;
  18376. }
  18377. interface DidCreateWindowDetails {
  18378. /**
  18379. * URL for the created window.
  18380. */
  18381. url: string;
  18382. /**
  18383. * Name given to the created window in the `window.open()` call.
  18384. */
  18385. frameName: string;
  18386. /**
  18387. * The options used to create the BrowserWindow. They are merged in increasing
  18388. * precedence: parsed options from the `features` string from `window.open()`,
  18389. * security-related webPreferences inherited from the parent, and options given by
  18390. * `webContents.setWindowOpenHandler`. Unrecognized options are not filtered out.
  18391. */
  18392. options: BrowserWindowConstructorOptions;
  18393. /**
  18394. * The referrer that will be passed to the new window. May or may not result in the
  18395. * `Referer` header being sent, depending on the referrer policy.
  18396. */
  18397. referrer: Referrer;
  18398. /**
  18399. * The post data that will be sent to the new window, along with the appropriate
  18400. * headers that will be set. If no post data is to be sent, the value will be
  18401. * `null`. Only defined when the window is being created by a form that set
  18402. * `target=_blank`.
  18403. */
  18404. postBody?: PostBody;
  18405. /**
  18406. * Can be `default`, `foreground-tab`, `background-tab`, `new-window` or `other`.
  18407. */
  18408. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other');
  18409. }
  18410. interface DidFailLoadEvent extends DOMEvent {
  18411. errorCode: number;
  18412. errorDescription: string;
  18413. validatedURL: string;
  18414. isMainFrame: boolean;
  18415. }
  18416. interface DidFrameFinishLoadEvent extends DOMEvent {
  18417. isMainFrame: boolean;
  18418. }
  18419. interface DidFrameNavigateEvent extends DOMEvent {
  18420. url: string;
  18421. /**
  18422. * -1 for non HTTP navigations
  18423. */
  18424. httpResponseCode: number;
  18425. /**
  18426. * empty for non HTTP navigations,
  18427. */
  18428. httpStatusText: string;
  18429. isMainFrame: boolean;
  18430. frameProcessId: number;
  18431. frameRoutingId: number;
  18432. }
  18433. interface DidNavigateEvent extends DOMEvent {
  18434. url: string;
  18435. }
  18436. interface DidNavigateInPageEvent extends DOMEvent {
  18437. isMainFrame: boolean;
  18438. url: string;
  18439. }
  18440. interface DidRedirectNavigationEvent extends DOMEvent {
  18441. url: string;
  18442. isInPlace: boolean;
  18443. isMainFrame: boolean;
  18444. frameProcessId: number;
  18445. frameRoutingId: number;
  18446. }
  18447. interface DidStartNavigationEvent extends DOMEvent {
  18448. url: string;
  18449. isInPlace: boolean;
  18450. isMainFrame: boolean;
  18451. frameProcessId: number;
  18452. frameRoutingId: number;
  18453. }
  18454. interface DisplayBalloonOptions {
  18455. /**
  18456. * Icon to use when `iconType` is `custom`.
  18457. */
  18458. icon?: (NativeImage) | (string);
  18459. /**
  18460. * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
  18461. */
  18462. iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
  18463. title: string;
  18464. content: string;
  18465. /**
  18466. * The large version of the icon should be used. Default is `true`. Maps to
  18467. * `NIIF_LARGE_ICON`.
  18468. */
  18469. largeIcon?: boolean;
  18470. /**
  18471. * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
  18472. */
  18473. noSound?: boolean;
  18474. /**
  18475. * Do not display the balloon notification if the current user is in "quiet time".
  18476. * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
  18477. */
  18478. respectQuietTime?: boolean;
  18479. }
  18480. interface DisplayMediaRequestHandlerHandlerRequest {
  18481. /**
  18482. * Frame that is requesting access to media.
  18483. */
  18484. frame: WebFrameMain;
  18485. /**
  18486. * Origin of the page making the request.
  18487. */
  18488. securityOrigin: string;
  18489. /**
  18490. * true if the web content requested a video stream.
  18491. */
  18492. videoRequested: boolean;
  18493. /**
  18494. * true if the web content requested an audio stream.
  18495. */
  18496. audioRequested: boolean;
  18497. /**
  18498. * Whether a user gesture was active when this request was triggered.
  18499. */
  18500. userGesture: boolean;
  18501. }
  18502. interface DownloadURLOptions {
  18503. /**
  18504. * HTTP request headers.
  18505. */
  18506. headers?: Record<string, string>;
  18507. }
  18508. interface EnableNetworkEmulationOptions {
  18509. /**
  18510. * Whether to emulate network outage. Defaults to false.
  18511. */
  18512. offline?: boolean;
  18513. /**
  18514. * RTT in ms. Defaults to 0 which will disable latency throttling.
  18515. */
  18516. latency?: number;
  18517. /**
  18518. * Download rate in Bps. Defaults to 0 which will disable download throttling.
  18519. */
  18520. downloadThroughput?: number;
  18521. /**
  18522. * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
  18523. */
  18524. uploadThroughput?: number;
  18525. }
  18526. interface EntryAtIndex {
  18527. /**
  18528. * The URL of the navigation entry at the given index.
  18529. */
  18530. url: string;
  18531. /**
  18532. * The page title of the navigation entry at the given index.
  18533. */
  18534. title: string;
  18535. }
  18536. interface FeedURLOptions {
  18537. url: string;
  18538. /**
  18539. * HTTP request headers.
  18540. *
  18541. * @platform darwin
  18542. */
  18543. headers?: Record<string, string>;
  18544. /**
  18545. * Can be `json` or `default`, see the Squirrel.Mac README for more information.
  18546. *
  18547. * @platform darwin
  18548. */
  18549. serverType?: ('json' | 'default');
  18550. }
  18551. interface FileIconOptions {
  18552. size: ('small' | 'normal' | 'large');
  18553. }
  18554. interface FindInPageOptions {
  18555. /**
  18556. * Whether to search forward or backward, defaults to `true`.
  18557. */
  18558. forward?: boolean;
  18559. /**
  18560. * Whether to begin a new text finding session with this request. Should be `true`
  18561. * for initial requests, and `false` for follow-up requests. Defaults to `false`.
  18562. */
  18563. findNext?: boolean;
  18564. /**
  18565. * Whether search should be case-sensitive, defaults to `false`.
  18566. */
  18567. matchCase?: boolean;
  18568. }
  18569. interface FocusOptions {
  18570. /**
  18571. * Make the receiver the active app even if another app is currently active.
  18572. *
  18573. * @platform darwin
  18574. */
  18575. steal: boolean;
  18576. }
  18577. interface ForkOptions {
  18578. /**
  18579. * Environment key-value pairs. Default is `process.env`.
  18580. */
  18581. env?: Env;
  18582. /**
  18583. * List of string arguments passed to the executable.
  18584. */
  18585. execArgv?: string[];
  18586. /**
  18587. * Current working directory of the child process.
  18588. */
  18589. cwd?: string;
  18590. /**
  18591. * Allows configuring the mode for `stdout` and `stderr` of the child process.
  18592. * Default is `inherit`. String value can be one of `pipe`, `ignore`, `inherit`,
  18593. * for more details on these values you can refer to stdio documentation from
  18594. * Node.js. Currently this option only supports configuring `stdout` and `stderr`
  18595. * to either `pipe`, `inherit` or `ignore`. Configuring `stdin` to any property
  18596. * other than `ignore` is not supported and will result in an error. For example,
  18597. * the supported values will be processed as following:
  18598. */
  18599. stdio?: (Array<'pipe' | 'ignore' | 'inherit'>) | (string);
  18600. /**
  18601. * Name of the process that will appear in `name` property of `ProcessMetric`
  18602. * returned by `app.getAppMetrics` and `child-process-gone` event of `app`. Default
  18603. * is `Node Utility Process`.
  18604. */
  18605. serviceName?: string;
  18606. /**
  18607. * With this flag, the utility process will be launched via the `Electron Helper
  18608. * (Plugin).app` helper executable on macOS, which can be codesigned with
  18609. * `com.apple.security.cs.disable-library-validation` and
  18610. * `com.apple.security.cs.allow-unsigned-executable-memory` entitlements. This will
  18611. * allow the utility process to load unsigned libraries. Unless you specifically
  18612. * need this capability, it is best to leave this disabled. Default is `false`.
  18613. *
  18614. * @platform darwin
  18615. */
  18616. allowLoadingUnsignedLibraries?: boolean;
  18617. }
  18618. interface FoundInPageEvent extends DOMEvent {
  18619. result: FoundInPageResult;
  18620. }
  18621. interface FrameCreatedDetails {
  18622. frame: WebFrameMain;
  18623. }
  18624. interface FromPartitionOptions {
  18625. /**
  18626. * Whether to enable cache.
  18627. */
  18628. cache: boolean;
  18629. }
  18630. interface FromPathOptions {
  18631. /**
  18632. * Whether to enable cache.
  18633. */
  18634. cache: boolean;
  18635. }
  18636. interface HandlerDetails {
  18637. /**
  18638. * The _resolved_ version of the URL passed to `window.open()`. e.g. opening a
  18639. * window with `window.open('foo')` will yield something like
  18640. * `https://the-origin/the/current/path/foo`.
  18641. */
  18642. url: string;
  18643. /**
  18644. * Name of the window provided in `window.open()`
  18645. */
  18646. frameName: string;
  18647. /**
  18648. * Comma separated list of window features provided to `window.open()`.
  18649. */
  18650. features: string;
  18651. /**
  18652. * Can be `default`, `foreground-tab`, `background-tab`, `new-window` or `other`.
  18653. */
  18654. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other');
  18655. /**
  18656. * The referrer that will be passed to the new window. May or may not result in the
  18657. * `Referer` header being sent, depending on the referrer policy.
  18658. */
  18659. referrer: Referrer;
  18660. /**
  18661. * The post data that will be sent to the new window, along with the appropriate
  18662. * headers that will be set. If no post data is to be sent, the value will be
  18663. * `null`. Only defined when the window is being created by a form that set
  18664. * `target=_blank`.
  18665. */
  18666. postBody?: PostBody;
  18667. }
  18668. interface HeadersReceivedResponse {
  18669. cancel?: boolean;
  18670. /**
  18671. * When provided, the server is assumed to have responded with these headers.
  18672. */
  18673. responseHeaders?: Record<string, (string) | (string[])>;
  18674. /**
  18675. * Should be provided when overriding `responseHeaders` to change header status
  18676. * otherwise original response header's status will be used.
  18677. */
  18678. statusLine?: string;
  18679. }
  18680. interface HeapStatistics {
  18681. totalHeapSize: number;
  18682. totalHeapSizeExecutable: number;
  18683. totalPhysicalSize: number;
  18684. totalAvailableSize: number;
  18685. usedHeapSize: number;
  18686. heapSizeLimit: number;
  18687. mallocedMemory: number;
  18688. peakMallocedMemory: number;
  18689. doesZapGarbage: boolean;
  18690. }
  18691. interface HidDeviceAddedDetails {
  18692. device: HIDDevice;
  18693. frame: WebFrameMain;
  18694. }
  18695. interface HidDeviceRemovedDetails {
  18696. device: HIDDevice;
  18697. frame: WebFrameMain;
  18698. }
  18699. interface HidDeviceRevokedDetails {
  18700. device: HIDDevice;
  18701. /**
  18702. * The origin that the device has been revoked from.
  18703. */
  18704. origin?: string;
  18705. }
  18706. interface IgnoreMouseEventsOptions {
  18707. /**
  18708. * If true, forwards mouse move messages to Chromium, enabling mouse related events
  18709. * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
  18710. * forwarding is always disabled regardless of this value.
  18711. *
  18712. * @platform darwin,win32
  18713. */
  18714. forward?: boolean;
  18715. }
  18716. interface ImportCertificateOptions {
  18717. /**
  18718. * Path for the pkcs12 file.
  18719. */
  18720. certificate: string;
  18721. /**
  18722. * Passphrase for the certificate.
  18723. */
  18724. password: string;
  18725. }
  18726. interface Info {
  18727. /**
  18728. * Security origin for the isolated world.
  18729. */
  18730. securityOrigin?: string;
  18731. /**
  18732. * Content Security Policy for the isolated world.
  18733. */
  18734. csp?: string;
  18735. /**
  18736. * Name for isolated world. Useful in devtools.
  18737. */
  18738. name?: string;
  18739. }
  18740. interface Input {
  18741. /**
  18742. * Either `keyUp` or `keyDown`.
  18743. */
  18744. type: string;
  18745. /**
  18746. * Equivalent to KeyboardEvent.key.
  18747. */
  18748. key: string;
  18749. /**
  18750. * Equivalent to KeyboardEvent.code.
  18751. */
  18752. code: string;
  18753. /**
  18754. * Equivalent to KeyboardEvent.repeat.
  18755. */
  18756. isAutoRepeat: boolean;
  18757. /**
  18758. * Equivalent to KeyboardEvent.isComposing.
  18759. */
  18760. isComposing: boolean;
  18761. /**
  18762. * Equivalent to KeyboardEvent.shiftKey.
  18763. */
  18764. shift: boolean;
  18765. /**
  18766. * Equivalent to KeyboardEvent.controlKey.
  18767. */
  18768. control: boolean;
  18769. /**
  18770. * Equivalent to KeyboardEvent.altKey.
  18771. */
  18772. alt: boolean;
  18773. /**
  18774. * Equivalent to KeyboardEvent.metaKey.
  18775. */
  18776. meta: boolean;
  18777. /**
  18778. * Equivalent to KeyboardEvent.location.
  18779. */
  18780. location: number;
  18781. /**
  18782. * See InputEvent.modifiers.
  18783. */
  18784. modifiers: string[];
  18785. }
  18786. interface InsertCSSOptions {
  18787. /**
  18788. * Can be 'user' or 'author'. Sets the cascade origin of the inserted stylesheet.
  18789. * Default is 'author'.
  18790. */
  18791. cssOrigin?: ('user' | 'author');
  18792. }
  18793. interface IpcMessageEvent extends DOMEvent {
  18794. /**
  18795. * pair of `[processId, frameId]`.
  18796. */
  18797. frameId: [number, number];
  18798. channel: string;
  18799. args: any[];
  18800. }
  18801. interface Item {
  18802. /**
  18803. * The path to the file being dragged.
  18804. */
  18805. file: string;
  18806. /**
  18807. * The paths to the files being dragged. (`files` will override `file` field)
  18808. */
  18809. files?: string[];
  18810. /**
  18811. * The image must be non-empty on macOS.
  18812. */
  18813. icon: (NativeImage) | (string);
  18814. }
  18815. interface JumpListSettings {
  18816. /**
  18817. * The minimum number of items that will be shown in the Jump List (for a more
  18818. * detailed description of this value see the MSDN docs).
  18819. */
  18820. minItems: number;
  18821. /**
  18822. * Array of `JumpListItem` objects that correspond to items that the user has
  18823. * explicitly removed from custom categories in the Jump List. These items must not
  18824. * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
  18825. * Windows will not display any custom category that contains any of the removed
  18826. * items.
  18827. */
  18828. removedItems: JumpListItem[];
  18829. }
  18830. interface LoadCommitEvent extends DOMEvent {
  18831. url: string;
  18832. isMainFrame: boolean;
  18833. }
  18834. interface LoadExtensionOptions {
  18835. /**
  18836. * Whether to allow the extension to read local files over `file://` protocol and
  18837. * inject content scripts into `file://` pages. This is required e.g. for loading
  18838. * devtools extensions on `file://` URLs. Defaults to false.
  18839. */
  18840. allowFileAccess: boolean;
  18841. }
  18842. interface LoadFileOptions {
  18843. /**
  18844. * Passed to `url.format()`.
  18845. */
  18846. query?: Record<string, string>;
  18847. /**
  18848. * Passed to `url.format()`.
  18849. */
  18850. search?: string;
  18851. /**
  18852. * Passed to `url.format()`.
  18853. */
  18854. hash?: string;
  18855. }
  18856. interface LoadURLOptions {
  18857. /**
  18858. * An HTTP Referrer url.
  18859. */
  18860. httpReferrer?: (string) | (Referrer);
  18861. /**
  18862. * A user agent originating the request.
  18863. */
  18864. userAgent?: string;
  18865. /**
  18866. * Extra headers separated by "\n"
  18867. */
  18868. extraHeaders?: string;
  18869. postData?: Array<(UploadRawData) | (UploadFile)>;
  18870. /**
  18871. * Base url (with trailing path separator) for files to be loaded by the data url.
  18872. * This is needed only if the specified `url` is a data url and needs to load other
  18873. * files.
  18874. */
  18875. baseURLForDataURL?: string;
  18876. }
  18877. interface LoginItemSettings {
  18878. /**
  18879. * `true` if the app is set to open at login.
  18880. */
  18881. openAtLogin: boolean;
  18882. /**
  18883. * `true` if the app is set to open as hidden at login. This does not work on macOS
  18884. * 13 and up.
  18885. *
  18886. * @deprecated
  18887. * @platform darwin
  18888. */
  18889. openAsHidden: boolean;
  18890. /**
  18891. * `true` if the app was opened at login automatically.
  18892. *
  18893. * @platform darwin
  18894. */
  18895. wasOpenedAtLogin: boolean;
  18896. /**
  18897. * `true` if the app was opened as a hidden login item. This indicates that the app
  18898. * should not open any windows at startup. This setting is not available on MAS
  18899. * builds or on macOS 13 and up.
  18900. *
  18901. * @deprecated
  18902. * @platform darwin
  18903. */
  18904. wasOpenedAsHidden: boolean;
  18905. /**
  18906. * `true` if the app was opened as a login item that should restore the state from
  18907. * the previous session. This indicates that the app should restore the windows
  18908. * that were open the last time the app was closed. This setting is not available
  18909. * on MAS builds or on macOS 13 and up.
  18910. *
  18911. * @deprecated
  18912. * @platform darwin
  18913. */
  18914. restoreState: boolean;
  18915. /**
  18916. * can be one of `not-registered`, `enabled`, `requires-approval`, or `not-found`.
  18917. *
  18918. * @platform darwin
  18919. */
  18920. status: string;
  18921. /**
  18922. * `true` if app is set to open at login and its run key is not deactivated. This
  18923. * differs from `openAtLogin` as it ignores the `args` option, this property will
  18924. * be true if the given executable would be launched at login with **any**
  18925. * arguments.
  18926. *
  18927. * @platform win32
  18928. */
  18929. executableWillLaunchAtLogin: boolean;
  18930. launchItems: LaunchItems[];
  18931. }
  18932. interface LoginItemSettingsOptions {
  18933. /**
  18934. * Can be one of `mainAppService`, `agentService`, `daemonService`, or
  18935. * `loginItemService`. Defaults to `mainAppService`. Only available on macOS 13 and
  18936. * up. See app.setLoginItemSettings for more information about each type.
  18937. *
  18938. * @platform darwin
  18939. */
  18940. type?: string;
  18941. /**
  18942. * The name of the service. Required if `type` is non-default. Only available on
  18943. * macOS 13 and up.
  18944. *
  18945. * @platform darwin
  18946. */
  18947. serviceName?: string;
  18948. /**
  18949. * The executable path to compare against. Defaults to `process.execPath`.
  18950. *
  18951. * @platform win32
  18952. */
  18953. path?: string;
  18954. /**
  18955. * The command-line arguments to compare against. Defaults to an empty array.
  18956. *
  18957. * @platform win32
  18958. */
  18959. args?: string[];
  18960. }
  18961. interface MenuItemConstructorOptions {
  18962. /**
  18963. * Will be called with `click(menuItem, browserWindow, event)` when the menu item
  18964. * is clicked.
  18965. */
  18966. click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
  18967. /**
  18968. * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
  18969. * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
  18970. * `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`,
  18971. * `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`,
  18972. * `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`,
  18973. * `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`,
  18974. * `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`,
  18975. * `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`,
  18976. * `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
  18977. * - Define the action of the menu item, when specified the `click` property will
  18978. * be ignored. See roles.
  18979. */
  18980. role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'toggleSpellChecker' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'showSubstitutions' | 'toggleSmartQuotes' | 'toggleSmartDashes' | 'toggleTextReplacement' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'shareMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'showAllTabs' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  18981. /**
  18982. * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
  18983. */
  18984. type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  18985. label?: string;
  18986. sublabel?: string;
  18987. /**
  18988. * Hover text for this menu item.
  18989. *
  18990. * @platform darwin
  18991. */
  18992. toolTip?: string;
  18993. accelerator?: Accelerator;
  18994. icon?: (NativeImage) | (string);
  18995. /**
  18996. * If false, the menu item will be greyed out and unclickable.
  18997. */
  18998. enabled?: boolean;
  18999. /**
  19000. * default is `true`, and when `false` will prevent the accelerator from triggering
  19001. * the item if the item is not visible.
  19002. *
  19003. * @platform darwin
  19004. */
  19005. acceleratorWorksWhenHidden?: boolean;
  19006. /**
  19007. * If false, the menu item will be entirely hidden.
  19008. */
  19009. visible?: boolean;
  19010. /**
  19011. * Should only be specified for `checkbox` or `radio` type menu items.
  19012. */
  19013. checked?: boolean;
  19014. /**
  19015. * If false, the accelerator won't be registered with the system, but it will still
  19016. * be displayed. Defaults to true.
  19017. *
  19018. * @platform linux,win32
  19019. */
  19020. registerAccelerator?: boolean;
  19021. /**
  19022. * The item to share when the `role` is `shareMenu`.
  19023. *
  19024. * @platform darwin
  19025. */
  19026. sharingItem?: SharingItem;
  19027. /**
  19028. * Should be specified for `submenu` type menu items. If `submenu` is specified,
  19029. * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
  19030. * be automatically converted to one using `Menu.buildFromTemplate`.
  19031. */
  19032. submenu?: (MenuItemConstructorOptions[]) | (Menu);
  19033. /**
  19034. * Unique within a single menu. If defined then it can be used as a reference to
  19035. * this item by the position attribute.
  19036. */
  19037. id?: string;
  19038. /**
  19039. * Inserts this item before the item with the specified id. If the referenced item
  19040. * doesn't exist the item will be inserted at the end of the menu. Also implies
  19041. * that the menu item in question should be placed in the same “group” as the item.
  19042. */
  19043. before?: string[];
  19044. /**
  19045. * Inserts this item after the item with the specified id. If the referenced item
  19046. * doesn't exist the item will be inserted at the end of the menu.
  19047. */
  19048. after?: string[];
  19049. /**
  19050. * Provides a means for a single context menu to declare the placement of their
  19051. * containing group before the containing group of the item with the specified id.
  19052. */
  19053. beforeGroupContaining?: string[];
  19054. /**
  19055. * Provides a means for a single context menu to declare the placement of their
  19056. * containing group after the containing group of the item with the specified id.
  19057. */
  19058. afterGroupContaining?: string[];
  19059. }
  19060. interface MessageBoxOptions {
  19061. /**
  19062. * Content of the message box.
  19063. */
  19064. message: string;
  19065. /**
  19066. * Can be `none`, `info`, `error`, `question` or `warning`. On Windows, `question`
  19067. * displays the same icon as `info`, unless you set an icon using the `icon`
  19068. * option. On macOS, both `warning` and `error` display the same warning icon.
  19069. */
  19070. type?: ('none' | 'info' | 'error' | 'question' | 'warning');
  19071. /**
  19072. * Array of texts for buttons. On Windows, an empty array will result in one button
  19073. * labeled "OK".
  19074. */
  19075. buttons?: string[];
  19076. /**
  19077. * Index of the button in the buttons array which will be selected by default when
  19078. * the message box opens.
  19079. */
  19080. defaultId?: number;
  19081. /**
  19082. * Pass an instance of AbortSignal to optionally close the message box, the message
  19083. * box will behave as if it was cancelled by the user. On macOS, `signal` does not
  19084. * work with message boxes that do not have a parent window, since those message
  19085. * boxes run synchronously due to platform limitations.
  19086. */
  19087. signal?: AbortSignal;
  19088. /**
  19089. * Title of the message box, some platforms will not show it.
  19090. */
  19091. title?: string;
  19092. /**
  19093. * Extra information of the message.
  19094. */
  19095. detail?: string;
  19096. /**
  19097. * If provided, the message box will include a checkbox with the given label.
  19098. */
  19099. checkboxLabel?: string;
  19100. /**
  19101. * Initial checked state of the checkbox. `false` by default.
  19102. */
  19103. checkboxChecked?: boolean;
  19104. icon?: (NativeImage) | (string);
  19105. /**
  19106. * Custom width of the text in the message box.
  19107. *
  19108. * @platform darwin
  19109. */
  19110. textWidth?: number;
  19111. /**
  19112. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  19113. * default this is assigned to the first button with "cancel" or "no" as the label.
  19114. * If no such labeled buttons exist and this option is not set, `0` will be used as
  19115. * the return value.
  19116. */
  19117. cancelId?: number;
  19118. /**
  19119. * On Windows Electron will try to figure out which one of the `buttons` are common
  19120. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  19121. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  19122. * you don't like this behavior, you can set `noLink` to `true`.
  19123. */
  19124. noLink?: boolean;
  19125. /**
  19126. * Normalize the keyboard access keys across platforms. Default is `false`.
  19127. * Enabling this assumes `&` is used in the button labels for the placement of the
  19128. * keyboard shortcut access key and labels will be converted so they work correctly
  19129. * on each platform, `&` characters are removed on macOS, converted to `_` on
  19130. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  19131. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  19132. * via `Alt-W` on Windows and Linux.
  19133. */
  19134. normalizeAccessKeys?: boolean;
  19135. }
  19136. interface MessageBoxReturnValue {
  19137. /**
  19138. * The index of the clicked button.
  19139. */
  19140. response: number;
  19141. /**
  19142. * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
  19143. */
  19144. checkboxChecked: boolean;
  19145. }
  19146. interface MessageBoxSyncOptions {
  19147. /**
  19148. * Content of the message box.
  19149. */
  19150. message: string;
  19151. /**
  19152. * Can be `none`, `info`, `error`, `question` or `warning`. On Windows, `question`
  19153. * displays the same icon as `info`, unless you set an icon using the `icon`
  19154. * option. On macOS, both `warning` and `error` display the same warning icon.
  19155. */
  19156. type?: ('none' | 'info' | 'error' | 'question' | 'warning');
  19157. /**
  19158. * Array of texts for buttons. On Windows, an empty array will result in one button
  19159. * labeled "OK".
  19160. */
  19161. buttons?: string[];
  19162. /**
  19163. * Index of the button in the buttons array which will be selected by default when
  19164. * the message box opens.
  19165. */
  19166. defaultId?: number;
  19167. /**
  19168. * Title of the message box, some platforms will not show it.
  19169. */
  19170. title?: string;
  19171. /**
  19172. * Extra information of the message.
  19173. */
  19174. detail?: string;
  19175. icon?: (NativeImage) | (string);
  19176. /**
  19177. * Custom width of the text in the message box.
  19178. *
  19179. * @platform darwin
  19180. */
  19181. textWidth?: number;
  19182. /**
  19183. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  19184. * default this is assigned to the first button with "cancel" or "no" as the label.
  19185. * If no such labeled buttons exist and this option is not set, `0` will be used as
  19186. * the return value.
  19187. */
  19188. cancelId?: number;
  19189. /**
  19190. * On Windows Electron will try to figure out which one of the `buttons` are common
  19191. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  19192. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  19193. * you don't like this behavior, you can set `noLink` to `true`.
  19194. */
  19195. noLink?: boolean;
  19196. /**
  19197. * Normalize the keyboard access keys across platforms. Default is `false`.
  19198. * Enabling this assumes `&` is used in the button labels for the placement of the
  19199. * keyboard shortcut access key and labels will be converted so they work correctly
  19200. * on each platform, `&` characters are removed on macOS, converted to `_` on
  19201. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  19202. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  19203. * via `Alt-W` on Windows and Linux.
  19204. */
  19205. normalizeAccessKeys?: boolean;
  19206. }
  19207. interface MessageDetails {
  19208. /**
  19209. * The actual console message
  19210. */
  19211. message: string;
  19212. /**
  19213. * The version ID of the service worker that sent the log message
  19214. */
  19215. versionId: number;
  19216. /**
  19217. * The type of source for this message. Can be `javascript`, `xml`, `network`,
  19218. * `console-api`, `storage`, `rendering`, `security`, `deprecation`, `worker`,
  19219. * `violation`, `intervention`, `recommendation` or `other`.
  19220. */
  19221. source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
  19222. /**
  19223. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  19224. * `error`.
  19225. */
  19226. level: number;
  19227. /**
  19228. * The URL the message came from
  19229. */
  19230. sourceUrl: string;
  19231. /**
  19232. * The line number of the source that triggered this console message
  19233. */
  19234. lineNumber: number;
  19235. }
  19236. interface MessageEvent {
  19237. data: any;
  19238. ports: MessagePortMain[];
  19239. }
  19240. interface MoveToApplicationsFolderOptions {
  19241. /**
  19242. * A handler for potential conflict in move failure.
  19243. */
  19244. conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
  19245. }
  19246. interface NotificationConstructorOptions {
  19247. /**
  19248. * A title for the notification, which will be displayed at the top of the
  19249. * notification window when it is shown.
  19250. */
  19251. title?: string;
  19252. /**
  19253. * A subtitle for the notification, which will be displayed below the title.
  19254. *
  19255. * @platform darwin
  19256. */
  19257. subtitle?: string;
  19258. /**
  19259. * The body text of the notification, which will be displayed below the title or
  19260. * subtitle.
  19261. */
  19262. body?: string;
  19263. /**
  19264. * Whether or not to suppress the OS notification noise when showing the
  19265. * notification.
  19266. */
  19267. silent?: boolean;
  19268. /**
  19269. * An icon to use in the notification.
  19270. */
  19271. icon?: (string) | (NativeImage);
  19272. /**
  19273. * Whether or not to add an inline reply option to the notification.
  19274. *
  19275. * @platform darwin
  19276. */
  19277. hasReply?: boolean;
  19278. /**
  19279. * The timeout duration of the notification. Can be 'default' or 'never'.
  19280. *
  19281. * @platform linux,win32
  19282. */
  19283. timeoutType?: ('default' | 'never');
  19284. /**
  19285. * The placeholder to write in the inline reply input field.
  19286. *
  19287. * @platform darwin
  19288. */
  19289. replyPlaceholder?: string;
  19290. /**
  19291. * The name of the sound file to play when the notification is shown.
  19292. *
  19293. * @platform darwin
  19294. */
  19295. sound?: string;
  19296. /**
  19297. * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
  19298. *
  19299. * @platform linux
  19300. */
  19301. urgency?: ('normal' | 'critical' | 'low');
  19302. /**
  19303. * Actions to add to the notification. Please read the available actions and
  19304. * limitations in the `NotificationAction` documentation.
  19305. *
  19306. * @platform darwin
  19307. */
  19308. actions?: NotificationAction[];
  19309. /**
  19310. * A custom title for the close button of an alert. An empty string will cause the
  19311. * default localized text to be used.
  19312. *
  19313. * @platform darwin
  19314. */
  19315. closeButtonText?: string;
  19316. /**
  19317. * A custom description of the Notification on Windows superseding all properties
  19318. * above. Provides full customization of design and behavior of the notification.
  19319. *
  19320. * @platform win32
  19321. */
  19322. toastXml?: string;
  19323. }
  19324. interface OnBeforeRedirectListenerDetails {
  19325. id: number;
  19326. url: string;
  19327. method: string;
  19328. webContentsId?: number;
  19329. webContents?: WebContents;
  19330. frame?: WebFrameMain;
  19331. /**
  19332. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  19333. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  19334. */
  19335. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  19336. referrer: string;
  19337. timestamp: number;
  19338. redirectURL: string;
  19339. statusCode: number;
  19340. statusLine: string;
  19341. /**
  19342. * The server IP address that the request was actually sent to.
  19343. */
  19344. ip?: string;
  19345. fromCache: boolean;
  19346. responseHeaders?: Record<string, string[]>;
  19347. }
  19348. interface OnBeforeRequestListenerDetails {
  19349. id: number;
  19350. url: string;
  19351. method: string;
  19352. webContentsId?: number;
  19353. webContents?: WebContents;
  19354. frame?: WebFrameMain;
  19355. /**
  19356. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  19357. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  19358. */
  19359. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  19360. referrer: string;
  19361. timestamp: number;
  19362. uploadData: UploadData[];
  19363. }
  19364. interface OnBeforeSendHeadersListenerDetails {
  19365. id: number;
  19366. url: string;
  19367. method: string;
  19368. webContentsId?: number;
  19369. webContents?: WebContents;
  19370. frame?: WebFrameMain;
  19371. /**
  19372. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  19373. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  19374. */
  19375. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  19376. referrer: string;
  19377. timestamp: number;
  19378. uploadData?: UploadData[];
  19379. requestHeaders: Record<string, string>;
  19380. }
  19381. interface OnCompletedListenerDetails {
  19382. id: number;
  19383. url: string;
  19384. method: string;
  19385. webContentsId?: number;
  19386. webContents?: WebContents;
  19387. frame?: WebFrameMain;
  19388. /**
  19389. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  19390. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  19391. */
  19392. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  19393. referrer: string;
  19394. timestamp: number;
  19395. responseHeaders?: Record<string, string[]>;
  19396. fromCache: boolean;
  19397. statusCode: number;
  19398. statusLine: string;
  19399. error: string;
  19400. }
  19401. interface OnErrorOccurredListenerDetails {
  19402. id: number;
  19403. url: string;
  19404. method: string;
  19405. webContentsId?: number;
  19406. webContents?: WebContents;
  19407. frame?: WebFrameMain;
  19408. /**
  19409. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  19410. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  19411. */
  19412. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  19413. referrer: string;
  19414. timestamp: number;
  19415. fromCache: boolean;
  19416. /**
  19417. * The error description.
  19418. */
  19419. error: string;
  19420. }
  19421. interface OnHeadersReceivedListenerDetails {
  19422. id: number;
  19423. url: string;
  19424. method: string;
  19425. webContentsId?: number;
  19426. webContents?: WebContents;
  19427. frame?: WebFrameMain;
  19428. /**
  19429. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  19430. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  19431. */
  19432. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  19433. referrer: string;
  19434. timestamp: number;
  19435. statusLine: string;
  19436. statusCode: number;
  19437. responseHeaders?: Record<string, string[]>;
  19438. }
  19439. interface OnResponseStartedListenerDetails {
  19440. id: number;
  19441. url: string;
  19442. method: string;
  19443. webContentsId?: number;
  19444. webContents?: WebContents;
  19445. frame?: WebFrameMain;
  19446. /**
  19447. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  19448. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  19449. */
  19450. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  19451. referrer: string;
  19452. timestamp: number;
  19453. responseHeaders?: Record<string, string[]>;
  19454. /**
  19455. * Indicates whether the response was fetched from disk cache.
  19456. */
  19457. fromCache: boolean;
  19458. statusCode: number;
  19459. statusLine: string;
  19460. }
  19461. interface OnSendHeadersListenerDetails {
  19462. id: number;
  19463. url: string;
  19464. method: string;
  19465. webContentsId?: number;
  19466. webContents?: WebContents;
  19467. frame?: WebFrameMain;
  19468. /**
  19469. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  19470. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  19471. */
  19472. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  19473. referrer: string;
  19474. timestamp: number;
  19475. requestHeaders: Record<string, string>;
  19476. }
  19477. interface OpenDevToolsOptions {
  19478. /**
  19479. * Opens the devtools with specified dock state, can be `left`, `right`, `bottom`,
  19480. * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
  19481. * possible to dock back. In `detach` mode it's not.
  19482. */
  19483. mode: ('left' | 'right' | 'bottom' | 'undocked' | 'detach');
  19484. /**
  19485. * Whether to bring the opened devtools window to the foreground. The default is
  19486. * `true`.
  19487. */
  19488. activate?: boolean;
  19489. /**
  19490. * A title for the DevTools window (only in `undocked` or `detach` mode).
  19491. */
  19492. title?: string;
  19493. }
  19494. interface OpenDialogOptions {
  19495. title?: string;
  19496. defaultPath?: string;
  19497. /**
  19498. * Custom label for the confirmation button, when left empty the default label will
  19499. * be used.
  19500. */
  19501. buttonLabel?: string;
  19502. filters?: FileFilter[];
  19503. /**
  19504. * Contains which features the dialog should use. The following values are
  19505. * supported:
  19506. */
  19507. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  19508. /**
  19509. * Message to display above input boxes.
  19510. *
  19511. * @platform darwin
  19512. */
  19513. message?: string;
  19514. /**
  19515. * Create security scoped bookmarks when packaged for the Mac App Store.
  19516. *
  19517. * @platform darwin,mas
  19518. */
  19519. securityScopedBookmarks?: boolean;
  19520. }
  19521. interface OpenDialogReturnValue {
  19522. /**
  19523. * whether or not the dialog was canceled.
  19524. */
  19525. canceled: boolean;
  19526. /**
  19527. * An array of file paths chosen by the user. If the dialog is cancelled this will
  19528. * be an empty array.
  19529. */
  19530. filePaths: string[];
  19531. /**
  19532. * An array matching the `filePaths` array of base64 encoded strings which contains
  19533. * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
  19534. * this to be populated. (For return values, see table here.)
  19535. *
  19536. * @platform darwin,mas
  19537. */
  19538. bookmarks?: string[];
  19539. }
  19540. interface OpenDialogSyncOptions {
  19541. title?: string;
  19542. defaultPath?: string;
  19543. /**
  19544. * Custom label for the confirmation button, when left empty the default label will
  19545. * be used.
  19546. */
  19547. buttonLabel?: string;
  19548. filters?: FileFilter[];
  19549. /**
  19550. * Contains which features the dialog should use. The following values are
  19551. * supported:
  19552. */
  19553. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  19554. /**
  19555. * Message to display above input boxes.
  19556. *
  19557. * @platform darwin
  19558. */
  19559. message?: string;
  19560. /**
  19561. * Create security scoped bookmarks when packaged for the Mac App Store.
  19562. *
  19563. * @platform darwin,mas
  19564. */
  19565. securityScopedBookmarks?: boolean;
  19566. }
  19567. interface OpenExternalOptions {
  19568. /**
  19569. * `true` to bring the opened application to the foreground. The default is `true`.
  19570. *
  19571. * @platform darwin
  19572. */
  19573. activate?: boolean;
  19574. /**
  19575. * The working directory.
  19576. *
  19577. * @platform win32
  19578. */
  19579. workingDirectory?: string;
  19580. /**
  19581. * Indicates a user initiated launch that enables tracking of frequently used
  19582. * programs and other behaviors. The default is `false`.
  19583. *
  19584. * @platform win32
  19585. */
  19586. logUsage?: boolean;
  19587. }
  19588. interface Options {
  19589. }
  19590. interface Opts {
  19591. /**
  19592. * Keep the page hidden instead of visible. Default is `false`.
  19593. */
  19594. stayHidden?: boolean;
  19595. /**
  19596. * Keep the system awake instead of allowing it to sleep. Default is `false`.
  19597. */
  19598. stayAwake?: boolean;
  19599. }
  19600. interface PageFaviconUpdatedEvent extends DOMEvent {
  19601. /**
  19602. * Array of URLs.
  19603. */
  19604. favicons: string[];
  19605. }
  19606. interface PageTitleUpdatedEvent extends DOMEvent {
  19607. title: string;
  19608. explicitSet: boolean;
  19609. }
  19610. interface Parameters {
  19611. /**
  19612. * Specify the screen type to emulate (default: `desktop`):
  19613. */
  19614. screenPosition: ('desktop' | 'mobile');
  19615. /**
  19616. * Set the emulated screen size (screenPosition == mobile).
  19617. */
  19618. screenSize: Size;
  19619. /**
  19620. * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
  19621. * 0 }`).
  19622. */
  19623. viewPosition: Point;
  19624. /**
  19625. * Set the device scale factor (if zero defaults to original device scale factor)
  19626. * (default: `0`).
  19627. */
  19628. deviceScaleFactor: number;
  19629. /**
  19630. * Set the emulated view size (empty means no override)
  19631. */
  19632. viewSize: Size;
  19633. /**
  19634. * Scale of emulated view inside available space (not in fit to view mode)
  19635. * (default: `1`).
  19636. */
  19637. scale: number;
  19638. }
  19639. interface Payment {
  19640. /**
  19641. * The identifier of the purchased product.
  19642. */
  19643. productIdentifier: string;
  19644. /**
  19645. * The quantity purchased.
  19646. */
  19647. quantity: number;
  19648. /**
  19649. * An opaque identifier for the user’s account on your system.
  19650. */
  19651. applicationUsername: string;
  19652. /**
  19653. * The details of the discount offer to apply to the payment.
  19654. */
  19655. paymentDiscount?: PaymentDiscount;
  19656. }
  19657. interface PermissionCheckHandlerHandlerDetails {
  19658. /**
  19659. * The origin of the frame embedding the frame that made the permission check.
  19660. * Only set for cross-origin sub frames making permission checks.
  19661. */
  19662. embeddingOrigin?: string;
  19663. /**
  19664. * The security origin of the `media` check.
  19665. */
  19666. securityOrigin?: string;
  19667. /**
  19668. * The type of media access being requested, can be `video`, `audio` or `unknown`
  19669. */
  19670. mediaType?: ('video' | 'audio' | 'unknown');
  19671. /**
  19672. * The last URL the requesting frame loaded. This is not provided for cross-origin
  19673. * sub frames making permission checks.
  19674. */
  19675. requestingUrl?: string;
  19676. /**
  19677. * Whether the frame making the request is the main frame
  19678. */
  19679. isMainFrame: boolean;
  19680. }
  19681. interface PluginCrashedEvent extends DOMEvent {
  19682. name: string;
  19683. version: string;
  19684. }
  19685. interface PopupOptions {
  19686. /**
  19687. * Default is the focused window.
  19688. */
  19689. window?: BrowserWindow;
  19690. /**
  19691. * Default is the current mouse cursor position. Must be declared if `y` is
  19692. * declared.
  19693. */
  19694. x?: number;
  19695. /**
  19696. * Default is the current mouse cursor position. Must be declared if `x` is
  19697. * declared.
  19698. */
  19699. y?: number;
  19700. /**
  19701. * The index of the menu item to be positioned under the mouse cursor at the
  19702. * specified coordinates. Default is -1.
  19703. *
  19704. * @platform darwin
  19705. */
  19706. positioningItem?: number;
  19707. /**
  19708. * This should map to the `menuSourceType` provided by the `context-menu` event. It
  19709. * is not recommended to set this value manually, only provide values you receive
  19710. * from other APIs or leave it `undefined`. Can be `none`, `mouse`, `keyboard`,
  19711. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  19712. * `adjustSelection`, or `adjustSelectionReset`.
  19713. *
  19714. * @platform win32,linux
  19715. */
  19716. sourceType?: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  19717. /**
  19718. * Called when menu is closed.
  19719. */
  19720. callback?: () => void;
  19721. }
  19722. interface PreconnectOptions {
  19723. /**
  19724. * URL for preconnect. Only the origin is relevant for opening the socket.
  19725. */
  19726. url: string;
  19727. /**
  19728. * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
  19729. */
  19730. numSockets?: number;
  19731. }
  19732. interface PrintToPDFOptions {
  19733. /**
  19734. * Paper orientation.`true` for landscape, `false` for portrait. Defaults to false.
  19735. */
  19736. landscape?: boolean;
  19737. /**
  19738. * Whether to display header and footer. Defaults to false.
  19739. */
  19740. displayHeaderFooter?: boolean;
  19741. /**
  19742. * Whether to print background graphics. Defaults to false.
  19743. */
  19744. printBackground?: boolean;
  19745. /**
  19746. * Scale of the webpage rendering. Defaults to 1.
  19747. */
  19748. scale?: number;
  19749. /**
  19750. * Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`,
  19751. * `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing
  19752. * `height` and `width` in inches. Defaults to `Letter`.
  19753. */
  19754. pageSize?: (('A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid' | 'Ledger')) | (Size);
  19755. margins?: Margins;
  19756. /**
  19757. * Page ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which
  19758. * means print all pages.
  19759. */
  19760. pageRanges?: string;
  19761. /**
  19762. * HTML template for the print header. Should be valid HTML markup with following
  19763. * classes used to inject printing values into them: `date` (formatted print date),
  19764. * `title` (document title), `url` (document location), `pageNumber` (current page
  19765. * number) and `totalPages` (total pages in the document). For example, `<span
  19766. * class=title></span>` would generate span containing the title.
  19767. */
  19768. headerTemplate?: string;
  19769. /**
  19770. * HTML template for the print footer. Should use the same format as the
  19771. * `headerTemplate`.
  19772. */
  19773. footerTemplate?: string;
  19774. /**
  19775. * Whether or not to prefer page size as defined by css. Defaults to false, in
  19776. * which case the content will be scaled to fit the paper size.
  19777. */
  19778. preferCSSPageSize?: boolean;
  19779. /**
  19780. * Whether or not to generate a tagged (accessible) PDF. Defaults to false. As this
  19781. * property is experimental, the generated PDF may not adhere fully to PDF/UA and
  19782. * WCAG standards.
  19783. *
  19784. * @experimental
  19785. */
  19786. generateTaggedPDF?: boolean;
  19787. /**
  19788. * Whether or not to generate a PDF document outline from content headers. Defaults
  19789. * to false.
  19790. *
  19791. * @experimental
  19792. */
  19793. generateDocumentOutline?: boolean;
  19794. }
  19795. interface Privileges {
  19796. /**
  19797. * Default false.
  19798. */
  19799. standard?: boolean;
  19800. /**
  19801. * Default false.
  19802. */
  19803. secure?: boolean;
  19804. /**
  19805. * Default false.
  19806. */
  19807. bypassCSP?: boolean;
  19808. /**
  19809. * Default false.
  19810. */
  19811. allowServiceWorkers?: boolean;
  19812. /**
  19813. * Default false.
  19814. */
  19815. supportFetchAPI?: boolean;
  19816. /**
  19817. * Default false.
  19818. */
  19819. corsEnabled?: boolean;
  19820. /**
  19821. * Default false.
  19822. */
  19823. stream?: boolean;
  19824. /**
  19825. * Enable V8 code cache for the scheme, only works when `standard` is also set to
  19826. * true. Default false.
  19827. */
  19828. codeCache?: boolean;
  19829. }
  19830. interface ProgressBarOptions {
  19831. /**
  19832. * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
  19833. * `paused`.
  19834. *
  19835. * @platform win32
  19836. */
  19837. mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
  19838. }
  19839. interface Provider {
  19840. spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
  19841. }
  19842. interface PurchaseProductOpts {
  19843. /**
  19844. * The number of items the user wants to purchase.
  19845. */
  19846. quantity?: number;
  19847. /**
  19848. * The string that associates the transaction with a user account on your service
  19849. * (applicationUsername).
  19850. */
  19851. username?: string;
  19852. }
  19853. interface ReadBookmark {
  19854. title: string;
  19855. url: string;
  19856. }
  19857. interface RegistrationCompletedDetails {
  19858. /**
  19859. * The base URL that a service worker is registered for
  19860. */
  19861. scope: string;
  19862. }
  19863. interface RelaunchOptions {
  19864. args?: string[];
  19865. execPath?: string;
  19866. }
  19867. interface RenderProcessGoneEvent extends DOMEvent {
  19868. details: RenderProcessGoneDetails;
  19869. }
  19870. interface Request {
  19871. hostname: string;
  19872. certificate: Certificate;
  19873. validatedCertificate: Certificate;
  19874. /**
  19875. * `true` if Chromium recognises the root CA as a standard root. If it isn't then
  19876. * it's probably the case that this certificate was generated by a MITM proxy whose
  19877. * root has been installed locally (for example, by a corporate proxy). This should
  19878. * not be trusted if the `verificationResult` is not `OK`.
  19879. */
  19880. isIssuedByKnownRoot: boolean;
  19881. /**
  19882. * `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`.
  19883. */
  19884. verificationResult: string;
  19885. /**
  19886. * Error code.
  19887. */
  19888. errorCode: number;
  19889. }
  19890. interface ResizeOptions {
  19891. /**
  19892. * Defaults to the image's width.
  19893. */
  19894. width?: number;
  19895. /**
  19896. * Defaults to the image's height.
  19897. */
  19898. height?: number;
  19899. /**
  19900. * The desired quality of the resize image. Possible values include `good`,
  19901. * `better`, or `best`. The default is `best`. These values express a desired
  19902. * quality/speed tradeoff. They are translated into an algorithm-specific method
  19903. * that depends on the capabilities (CPU, GPU) of the underlying platform. It is
  19904. * possible for all three methods to be mapped to the same algorithm on a given
  19905. * platform.
  19906. */
  19907. quality?: ('good' | 'better' | 'best');
  19908. }
  19909. interface ResolveHostOptions {
  19910. /**
  19911. * Requested DNS query type. If unspecified, resolver will pick A or AAAA (or both)
  19912. * based on IPv4/IPv6 settings:
  19913. */
  19914. queryType?: ('A' | 'AAAA');
  19915. /**
  19916. * The source to use for resolved addresses. Default allows the resolver to pick an
  19917. * appropriate source. Only affects use of big external sources (e.g. calling the
  19918. * system for resolution or using DNS). Even if a source is specified, results can
  19919. * still come from cache, resolving "localhost" or IP literals, etc. One of the
  19920. * following values:
  19921. */
  19922. source?: ('any' | 'system' | 'dns' | 'mdns' | 'localOnly');
  19923. /**
  19924. * Indicates what DNS cache entries, if any, can be used to provide a response. One
  19925. * of the following values:
  19926. */
  19927. cacheUsage?: ('allowed' | 'staleAllowed' | 'disallowed');
  19928. /**
  19929. * Controls the resolver's Secure DNS behavior for this request. One of the
  19930. * following values:
  19931. */
  19932. secureDnsPolicy?: ('allow' | 'disable');
  19933. }
  19934. interface ResourceUsage {
  19935. images: MemoryUsageDetails;
  19936. scripts: MemoryUsageDetails;
  19937. cssStyleSheets: MemoryUsageDetails;
  19938. xslStyleSheets: MemoryUsageDetails;
  19939. fonts: MemoryUsageDetails;
  19940. other: MemoryUsageDetails;
  19941. }
  19942. interface Response {
  19943. /**
  19944. * `false` should be passed in if the dialog is canceled. If the `pairingKind` is
  19945. * `confirm` or `confirmPin`, this value should indicate if the pairing is
  19946. * confirmed. If the `pairingKind` is `providePin` the value should be `true` when
  19947. * a value is provided.
  19948. */
  19949. confirmed: boolean;
  19950. /**
  19951. * When the `pairingKind` is `providePin` this value should be the required pin for
  19952. * the Bluetooth device.
  19953. */
  19954. pin?: (string) | (null);
  19955. }
  19956. interface Result {
  19957. requestId: number;
  19958. /**
  19959. * Position of the active match.
  19960. */
  19961. activeMatchOrdinal: number;
  19962. /**
  19963. * Number of Matches.
  19964. */
  19965. matches: number;
  19966. /**
  19967. * Coordinates of first match region.
  19968. */
  19969. selectionArea: Rectangle;
  19970. finalUpdate: boolean;
  19971. }
  19972. interface SaveDialogOptions {
  19973. /**
  19974. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  19975. */
  19976. title?: string;
  19977. /**
  19978. * Absolute directory path, absolute file path, or file name to use by default.
  19979. */
  19980. defaultPath?: string;
  19981. /**
  19982. * Custom label for the confirmation button, when left empty the default label will
  19983. * be used.
  19984. */
  19985. buttonLabel?: string;
  19986. filters?: FileFilter[];
  19987. /**
  19988. * Message to display above text fields.
  19989. *
  19990. * @platform darwin
  19991. */
  19992. message?: string;
  19993. /**
  19994. * Custom label for the text displayed in front of the filename text field.
  19995. *
  19996. * @platform darwin
  19997. */
  19998. nameFieldLabel?: string;
  19999. /**
  20000. * Show the tags input box, defaults to `true`.
  20001. *
  20002. * @platform darwin
  20003. */
  20004. showsTagField?: boolean;
  20005. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  20006. /**
  20007. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  20008. * option is enabled and the file doesn't already exist a blank file will be
  20009. * created at the chosen path.
  20010. *
  20011. * @platform darwin,mas
  20012. */
  20013. securityScopedBookmarks?: boolean;
  20014. }
  20015. interface SaveDialogReturnValue {
  20016. /**
  20017. * whether or not the dialog was canceled.
  20018. */
  20019. canceled: boolean;
  20020. /**
  20021. * If the dialog is canceled, this will be an empty string.
  20022. */
  20023. filePath: string;
  20024. /**
  20025. * Base64 encoded string which contains the security scoped bookmark data for the
  20026. * saved file. `securityScopedBookmarks` must be enabled for this to be present.
  20027. * (For return values, see table here.)
  20028. *
  20029. * @platform darwin,mas
  20030. */
  20031. bookmark?: string;
  20032. }
  20033. interface SaveDialogSyncOptions {
  20034. /**
  20035. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  20036. */
  20037. title?: string;
  20038. /**
  20039. * Absolute directory path, absolute file path, or file name to use by default.
  20040. */
  20041. defaultPath?: string;
  20042. /**
  20043. * Custom label for the confirmation button, when left empty the default label will
  20044. * be used.
  20045. */
  20046. buttonLabel?: string;
  20047. filters?: FileFilter[];
  20048. /**
  20049. * Message to display above text fields.
  20050. *
  20051. * @platform darwin
  20052. */
  20053. message?: string;
  20054. /**
  20055. * Custom label for the text displayed in front of the filename text field.
  20056. *
  20057. * @platform darwin
  20058. */
  20059. nameFieldLabel?: string;
  20060. /**
  20061. * Show the tags input box, defaults to `true`.
  20062. *
  20063. * @platform darwin
  20064. */
  20065. showsTagField?: boolean;
  20066. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  20067. /**
  20068. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  20069. * option is enabled and the file doesn't already exist a blank file will be
  20070. * created at the chosen path.
  20071. *
  20072. * @platform darwin,mas
  20073. */
  20074. securityScopedBookmarks?: boolean;
  20075. }
  20076. interface SelectHidDeviceDetails {
  20077. deviceList: HIDDevice[];
  20078. frame: WebFrameMain;
  20079. }
  20080. interface SelectUsbDeviceDetails {
  20081. deviceList: USBDevice[];
  20082. frame: WebFrameMain;
  20083. }
  20084. interface SerialPortRevokedDetails {
  20085. port: SerialPort;
  20086. frame: WebFrameMain;
  20087. /**
  20088. * The origin that the device has been revoked from.
  20089. */
  20090. origin: string;
  20091. }
  20092. interface Settings {
  20093. /**
  20094. * `true` to open the app at login, `false` to remove the app as a login item.
  20095. * Defaults to `false`.
  20096. */
  20097. openAtLogin?: boolean;
  20098. /**
  20099. * `true` to open the app as hidden. Defaults to `false`. The user can edit this
  20100. * setting from the System Preferences so
  20101. * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
  20102. * opened to know the current value. This setting is not available on MAS builds or
  20103. * on macOS 13 and up.
  20104. *
  20105. * @deprecated
  20106. * @platform darwin
  20107. */
  20108. openAsHidden?: boolean;
  20109. /**
  20110. * The type of service to add as a login item. Defaults to `mainAppService`. Only
  20111. * available on macOS 13 and up.
  20112. *
  20113. * @platform darwin
  20114. */
  20115. type?: ('mainAppService' | 'agentService' | 'daemonService' | 'loginItemService');
  20116. /**
  20117. * The name of the service. Required if `type` is non-default. Only available on
  20118. * macOS 13 and up.
  20119. *
  20120. * @platform darwin
  20121. */
  20122. serviceName?: string;
  20123. /**
  20124. * The executable to launch at login. Defaults to `process.execPath`.
  20125. *
  20126. * @platform win32
  20127. */
  20128. path?: string;
  20129. /**
  20130. * The command-line arguments to pass to the executable. Defaults to an empty
  20131. * array. Take care to wrap paths in quotes.
  20132. *
  20133. * @platform win32
  20134. */
  20135. args?: string[];
  20136. /**
  20137. * `true` will change the startup approved registry key and `enable / disable` the
  20138. * App in Task Manager and Windows Settings. Defaults to `true`.
  20139. *
  20140. * @platform win32
  20141. */
  20142. enabled?: boolean;
  20143. /**
  20144. * value name to write into registry. Defaults to the app's AppUserModelId().
  20145. *
  20146. * @platform win32
  20147. */
  20148. name?: string;
  20149. }
  20150. interface SourcesOptions {
  20151. /**
  20152. * An array of strings that lists the types of desktop sources to be captured,
  20153. * available types can be `screen` and `window`.
  20154. */
  20155. types: Array<'screen' | 'window'>;
  20156. /**
  20157. * The size that the media source thumbnail should be scaled to. Default is `150` x
  20158. * `150`. Set width or height to 0 when you do not need the thumbnails. This will
  20159. * save the processing time required for capturing the content of each window and
  20160. * screen.
  20161. */
  20162. thumbnailSize?: Size;
  20163. /**
  20164. * Set to true to enable fetching window icons. The default value is false. When
  20165. * false the appIcon property of the sources return null. Same if a source has the
  20166. * type screen.
  20167. */
  20168. fetchWindowIcons?: boolean;
  20169. }
  20170. interface StartLoggingOptions {
  20171. /**
  20172. * What kinds of data should be captured. By default, only metadata about requests
  20173. * will be captured. Setting this to `includeSensitive` will include cookies and
  20174. * authentication data. Setting it to `everything` will include all bytes
  20175. * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
  20176. */
  20177. captureMode?: ('default' | 'includeSensitive' | 'everything');
  20178. /**
  20179. * When the log grows beyond this size, logging will automatically stop. Defaults
  20180. * to unlimited.
  20181. */
  20182. maxFileSize?: number;
  20183. }
  20184. interface Streams {
  20185. video?: (Video) | (WebFrameMain);
  20186. /**
  20187. * If a string is specified, can be `loopback` or `loopbackWithMute`. Specifying a
  20188. * loopback device will capture system audio, and is currently only supported on
  20189. * Windows. If a WebFrameMain is specified, will capture audio from that frame.
  20190. */
  20191. audio?: (('loopback' | 'loopbackWithMute')) | (WebFrameMain);
  20192. /**
  20193. * If `audio` is a WebFrameMain and this is set to `true`, then local playback of
  20194. * audio will not be muted (e.g. using `MediaRecorder` to record `WebFrameMain`
  20195. * with this flag set to `true` will allow audio to pass through to the speakers
  20196. * while recording). Default is `false`.
  20197. */
  20198. enableLocalEcho?: boolean;
  20199. }
  20200. interface SystemMemoryInfo {
  20201. /**
  20202. * The total amount of physical memory in Kilobytes available to the system.
  20203. */
  20204. total: number;
  20205. /**
  20206. * The total amount of memory not being used by applications or disk cache.
  20207. */
  20208. free: number;
  20209. /**
  20210. * The total amount of swap memory in Kilobytes available to the system.
  20211. *
  20212. * @platform win32,linux
  20213. */
  20214. swapTotal: number;
  20215. /**
  20216. * The free amount of swap memory in Kilobytes available to the system.
  20217. *
  20218. * @platform win32,linux
  20219. */
  20220. swapFree: number;
  20221. }
  20222. interface TitleBarOverlay {
  20223. /**
  20224. * The CSS color of the Window Controls Overlay when enabled. Default is the system
  20225. * color.
  20226. *
  20227. * @platform win32,linux
  20228. */
  20229. color?: string;
  20230. /**
  20231. * The CSS color of the symbols on the Window Controls Overlay when enabled.
  20232. * Default is the system color.
  20233. *
  20234. * @platform win32
  20235. */
  20236. symbolColor?: string;
  20237. /**
  20238. * The height of the title bar and Window Controls Overlay in pixels. Default is
  20239. * system height.
  20240. */
  20241. height?: number;
  20242. }
  20243. interface TitleBarOverlayOptions {
  20244. /**
  20245. * The CSS color of the Window Controls Overlay when enabled.
  20246. */
  20247. color?: string;
  20248. /**
  20249. * The CSS color of the symbols on the Window Controls Overlay when enabled.
  20250. */
  20251. symbolColor?: string;
  20252. /**
  20253. * The height of the title bar and Window Controls Overlay in pixels.
  20254. */
  20255. height?: number;
  20256. }
  20257. interface TitleOptions {
  20258. /**
  20259. * The font family variant to display, can be `monospaced` or `monospacedDigit`.
  20260. * `monospaced` is available in macOS 10.15+ When left blank, the title uses the
  20261. * default system font.
  20262. */
  20263. fontType?: ('monospaced' | 'monospacedDigit');
  20264. }
  20265. interface ToBitmapOptions {
  20266. /**
  20267. * Defaults to 1.0.
  20268. */
  20269. scaleFactor?: number;
  20270. }
  20271. interface ToDataURLOptions {
  20272. /**
  20273. * Defaults to 1.0.
  20274. */
  20275. scaleFactor?: number;
  20276. }
  20277. interface ToPNGOptions {
  20278. /**
  20279. * Defaults to 1.0.
  20280. */
  20281. scaleFactor?: number;
  20282. }
  20283. interface TouchBarButtonConstructorOptions {
  20284. /**
  20285. * Button text.
  20286. */
  20287. label?: string;
  20288. /**
  20289. * A short description of the button for use by screenreaders like VoiceOver.
  20290. */
  20291. accessibilityLabel?: string;
  20292. /**
  20293. * Button background color in hex format, i.e `#ABCDEF`.
  20294. */
  20295. backgroundColor?: string;
  20296. /**
  20297. * Button icon.
  20298. */
  20299. icon?: (NativeImage) | (string);
  20300. /**
  20301. * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
  20302. */
  20303. iconPosition?: ('left' | 'right' | 'overlay');
  20304. /**
  20305. * Function to call when the button is clicked.
  20306. */
  20307. click?: () => void;
  20308. /**
  20309. * Whether the button is in an enabled state. Default is `true`.
  20310. */
  20311. enabled?: boolean;
  20312. }
  20313. interface TouchBarColorPickerConstructorOptions {
  20314. /**
  20315. * Array of hex color strings to appear as possible colors to select.
  20316. */
  20317. availableColors?: string[];
  20318. /**
  20319. * The selected hex color in the picker, i.e `#ABCDEF`.
  20320. */
  20321. selectedColor?: string;
  20322. /**
  20323. * Function to call when a color is selected.
  20324. */
  20325. change?: (color: string) => void;
  20326. }
  20327. interface TouchBarConstructorOptions {
  20328. items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
  20329. escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
  20330. }
  20331. interface TouchBarGroupConstructorOptions {
  20332. /**
  20333. * Items to display as a group.
  20334. */
  20335. items: TouchBar;
  20336. }
  20337. interface TouchBarLabelConstructorOptions {
  20338. /**
  20339. * Text to display.
  20340. */
  20341. label?: string;
  20342. /**
  20343. * A short description of the button for use by screenreaders like VoiceOver.
  20344. */
  20345. accessibilityLabel?: string;
  20346. /**
  20347. * Hex color of text, i.e `#ABCDEF`.
  20348. */
  20349. textColor?: string;
  20350. }
  20351. interface TouchBarPopoverConstructorOptions {
  20352. /**
  20353. * Popover button text.
  20354. */
  20355. label?: string;
  20356. /**
  20357. * Popover button icon.
  20358. */
  20359. icon?: NativeImage;
  20360. /**
  20361. * Items to display in the popover.
  20362. */
  20363. items: TouchBar;
  20364. /**
  20365. * `true` to display a close button on the left of the popover, `false` to not show
  20366. * it. Default is `true`.
  20367. */
  20368. showCloseButton?: boolean;
  20369. }
  20370. interface TouchBarScrubberConstructorOptions {
  20371. /**
  20372. * An array of items to place in this scrubber.
  20373. */
  20374. items: ScrubberItem[];
  20375. /**
  20376. * Called when the user taps an item that was not the last tapped item.
  20377. */
  20378. select?: (selectedIndex: number) => void;
  20379. /**
  20380. * Called when the user taps any item.
  20381. */
  20382. highlight?: (highlightedIndex: number) => void;
  20383. /**
  20384. * Selected item style. Can be `background`, `outline` or `none`. Defaults to
  20385. * `none`.
  20386. */
  20387. selectedStyle?: ('background' | 'outline' | 'none');
  20388. /**
  20389. * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
  20390. * to `none`.
  20391. */
  20392. overlayStyle?: ('background' | 'outline' | 'none');
  20393. /**
  20394. * Whether to show arrow buttons. Defaults to `false` and is only shown if `items`
  20395. * is non-empty.
  20396. */
  20397. showArrowButtons?: boolean;
  20398. /**
  20399. * Can be `fixed` or `free`. The default is `free`.
  20400. */
  20401. mode?: ('fixed' | 'free');
  20402. /**
  20403. * Defaults to `true`.
  20404. */
  20405. continuous?: boolean;
  20406. }
  20407. interface TouchBarSegmentedControlConstructorOptions {
  20408. /**
  20409. * Style of the segments:
  20410. */
  20411. segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
  20412. /**
  20413. * The selection mode of the control:
  20414. */
  20415. mode?: ('single' | 'multiple' | 'buttons');
  20416. /**
  20417. * An array of segments to place in this control.
  20418. */
  20419. segments: SegmentedControlSegment[];
  20420. /**
  20421. * The index of the currently selected segment, will update automatically with user
  20422. * interaction. When the mode is `multiple` it will be the last selected item.
  20423. */
  20424. selectedIndex?: number;
  20425. /**
  20426. * Called when the user selects a new segment.
  20427. */
  20428. change?: (selectedIndex: number, isSelected: boolean) => void;
  20429. }
  20430. interface TouchBarSliderConstructorOptions {
  20431. /**
  20432. * Label text.
  20433. */
  20434. label?: string;
  20435. /**
  20436. * Selected value.
  20437. */
  20438. value?: number;
  20439. /**
  20440. * Minimum value.
  20441. */
  20442. minValue?: number;
  20443. /**
  20444. * Maximum value.
  20445. */
  20446. maxValue?: number;
  20447. /**
  20448. * Function to call when the slider is changed.
  20449. */
  20450. change?: (newValue: number) => void;
  20451. }
  20452. interface TouchBarSpacerConstructorOptions {
  20453. /**
  20454. * Size of spacer, possible values are:
  20455. */
  20456. size?: ('small' | 'large' | 'flexible');
  20457. }
  20458. interface TraceBufferUsageReturnValue {
  20459. value: number;
  20460. percentage: number;
  20461. }
  20462. interface UdpPortRange {
  20463. /**
  20464. * The minimum UDP port number that WebRTC should use.
  20465. */
  20466. min: number;
  20467. /**
  20468. * The maximum UDP port number that WebRTC should use.
  20469. */
  20470. max: number;
  20471. }
  20472. interface UpdateTargetUrlEvent extends DOMEvent {
  20473. url: string;
  20474. }
  20475. interface UploadProgress {
  20476. /**
  20477. * Whether the request is currently active. If this is false no other properties
  20478. * will be set
  20479. */
  20480. active: boolean;
  20481. /**
  20482. * Whether the upload has started. If this is false both `current` and `total` will
  20483. * be set to 0.
  20484. */
  20485. started: boolean;
  20486. /**
  20487. * The number of bytes that have been uploaded so far
  20488. */
  20489. current: number;
  20490. /**
  20491. * The number of bytes that will be uploaded this request
  20492. */
  20493. total: number;
  20494. }
  20495. interface UsbDeviceRevokedDetails {
  20496. device: USBDevice;
  20497. /**
  20498. * The origin that the device has been revoked from.
  20499. */
  20500. origin?: string;
  20501. }
  20502. interface USBProtectedClassesHandlerHandlerDetails {
  20503. /**
  20504. * The current list of protected USB classes. Possible class values include:
  20505. */
  20506. protectedClasses: Array<'audio' | 'audio-video' | 'hid' | 'mass-storage' | 'smart-card' | 'video' | 'wireless'>;
  20507. }
  20508. interface VisibleOnAllWorkspacesOptions {
  20509. /**
  20510. * Sets whether the window should be visible above fullscreen windows.
  20511. *
  20512. * @platform darwin
  20513. */
  20514. visibleOnFullScreen?: boolean;
  20515. /**
  20516. * Calling setVisibleOnAllWorkspaces will by default transform the process type
  20517. * between UIElementApplication and ForegroundApplication to ensure the correct
  20518. * behavior. However, this will hide the window and dock for a short time every
  20519. * time it is called. If your window is already of type UIElementApplication, you
  20520. * can bypass this transformation by passing true to skipTransformProcessType.
  20521. *
  20522. * @platform darwin
  20523. */
  20524. skipTransformProcessType?: boolean;
  20525. }
  20526. interface WebContentsAudioStateChangedEventParams {
  20527. /**
  20528. * True if one or more frames or child `webContents` are emitting audio.
  20529. */
  20530. audible: boolean;
  20531. }
  20532. interface WebContentsDidRedirectNavigationEventParams {
  20533. /**
  20534. * The URL the frame is navigating to.
  20535. */
  20536. url: string;
  20537. /**
  20538. * Whether the navigation happened without changing document. Examples of same
  20539. * document navigations are reference fragment navigations, pushState/replaceState,
  20540. * and same page history navigation.
  20541. */
  20542. isSameDocument: boolean;
  20543. /**
  20544. * True if the navigation is taking place in a main frame.
  20545. */
  20546. isMainFrame: boolean;
  20547. /**
  20548. * The frame to be navigated.
  20549. */
  20550. frame: WebFrameMain;
  20551. /**
  20552. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  20553. * `window.open` with a frame's name), or null if the navigation was not initiated
  20554. * by a frame. This can also be null if the initiating frame was deleted before the
  20555. * event was emitted.
  20556. */
  20557. initiator?: WebFrameMain;
  20558. }
  20559. interface WebContentsDidStartNavigationEventParams {
  20560. /**
  20561. * The URL the frame is navigating to.
  20562. */
  20563. url: string;
  20564. /**
  20565. * Whether the navigation happened without changing document. Examples of same
  20566. * document navigations are reference fragment navigations, pushState/replaceState,
  20567. * and same page history navigation.
  20568. */
  20569. isSameDocument: boolean;
  20570. /**
  20571. * True if the navigation is taking place in a main frame.
  20572. */
  20573. isMainFrame: boolean;
  20574. /**
  20575. * The frame to be navigated.
  20576. */
  20577. frame: WebFrameMain;
  20578. /**
  20579. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  20580. * `window.open` with a frame's name), or null if the navigation was not initiated
  20581. * by a frame. This can also be null if the initiating frame was deleted before the
  20582. * event was emitted.
  20583. */
  20584. initiator?: WebFrameMain;
  20585. }
  20586. interface WebContentsPrintOptions {
  20587. /**
  20588. * Don't ask user for print settings. Default is `false`.
  20589. */
  20590. silent?: boolean;
  20591. /**
  20592. * Prints the background color and image of the web page. Default is `false`.
  20593. */
  20594. printBackground?: boolean;
  20595. /**
  20596. * Set the printer device name to use. Must be the system-defined name and not the
  20597. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  20598. */
  20599. deviceName?: string;
  20600. /**
  20601. * Set whether the printed web page will be in color or grayscale. Default is
  20602. * `true`.
  20603. */
  20604. color?: boolean;
  20605. margins?: Margins;
  20606. /**
  20607. * Whether the web page should be printed in landscape mode. Default is `false`.
  20608. */
  20609. landscape?: boolean;
  20610. /**
  20611. * The scale factor of the web page.
  20612. */
  20613. scaleFactor?: number;
  20614. /**
  20615. * The number of pages to print per page sheet.
  20616. */
  20617. pagesPerSheet?: number;
  20618. /**
  20619. * Whether the web page should be collated.
  20620. */
  20621. collate?: boolean;
  20622. /**
  20623. * The number of copies of the web page to print.
  20624. */
  20625. copies?: number;
  20626. /**
  20627. * The page range to print. On macOS, only one range is honored.
  20628. */
  20629. pageRanges?: PageRanges[];
  20630. /**
  20631. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  20632. * `longEdge`.
  20633. */
  20634. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  20635. dpi?: Record<string, number>;
  20636. /**
  20637. * string to be printed as page header.
  20638. */
  20639. header?: string;
  20640. /**
  20641. * string to be printed as page footer.
  20642. */
  20643. footer?: string;
  20644. /**
  20645. * Specify page size of the printed document. Can be `A0`, `A1`, `A2`, `A3`, `A4`,
  20646. * `A5`, `A6`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and
  20647. * `width`.
  20648. */
  20649. pageSize?: (('A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid')) | (Size);
  20650. }
  20651. interface WebContentsViewConstructorOptions {
  20652. /**
  20653. * Settings of web page's features.
  20654. */
  20655. webPreferences?: WebPreferences;
  20656. /**
  20657. * If present, the given WebContents will be adopted by the WebContentsView. A
  20658. * WebContents may only be presented in one WebContentsView at a time.
  20659. */
  20660. webContents?: WebContents;
  20661. }
  20662. interface WebContentsWillFrameNavigateEventParams {
  20663. /**
  20664. * The URL the frame is navigating to.
  20665. */
  20666. url: string;
  20667. /**
  20668. * This event does not fire for same document navigations using window.history api
  20669. * and reference fragment navigations. This property is always set to `false` for
  20670. * this event.
  20671. */
  20672. isSameDocument: boolean;
  20673. /**
  20674. * True if the navigation is taking place in a main frame.
  20675. */
  20676. isMainFrame: boolean;
  20677. /**
  20678. * The frame to be navigated.
  20679. */
  20680. frame: WebFrameMain;
  20681. /**
  20682. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  20683. * `window.open` with a frame's name), or null if the navigation was not initiated
  20684. * by a frame. This can also be null if the initiating frame was deleted before the
  20685. * event was emitted.
  20686. */
  20687. initiator?: WebFrameMain;
  20688. }
  20689. interface WebContentsWillNavigateEventParams {
  20690. /**
  20691. * The URL the frame is navigating to.
  20692. */
  20693. url: string;
  20694. /**
  20695. * This event does not fire for same document navigations using window.history api
  20696. * and reference fragment navigations. This property is always set to `false` for
  20697. * this event.
  20698. */
  20699. isSameDocument: boolean;
  20700. /**
  20701. * True if the navigation is taking place in a main frame.
  20702. */
  20703. isMainFrame: boolean;
  20704. /**
  20705. * The frame to be navigated.
  20706. */
  20707. frame: WebFrameMain;
  20708. /**
  20709. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  20710. * `window.open` with a frame's name), or null if the navigation was not initiated
  20711. * by a frame. This can also be null if the initiating frame was deleted before the
  20712. * event was emitted.
  20713. */
  20714. initiator?: WebFrameMain;
  20715. }
  20716. interface WebContentsWillRedirectEventParams {
  20717. /**
  20718. * The URL the frame is navigating to.
  20719. */
  20720. url: string;
  20721. /**
  20722. * Whether the navigation happened without changing document. Examples of same
  20723. * document navigations are reference fragment navigations, pushState/replaceState,
  20724. * and same page history navigation.
  20725. */
  20726. isSameDocument: boolean;
  20727. /**
  20728. * True if the navigation is taking place in a main frame.
  20729. */
  20730. isMainFrame: boolean;
  20731. /**
  20732. * The frame to be navigated.
  20733. */
  20734. frame: WebFrameMain;
  20735. /**
  20736. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  20737. * `window.open` with a frame's name), or null if the navigation was not initiated
  20738. * by a frame. This can also be null if the initiating frame was deleted before the
  20739. * event was emitted.
  20740. */
  20741. initiator?: WebFrameMain;
  20742. }
  20743. interface WebRTCUDPPortRange {
  20744. /**
  20745. * The minimum UDP port number that WebRTC should use.
  20746. */
  20747. min: number;
  20748. /**
  20749. * The maximum UDP port number that WebRTC should use.
  20750. */
  20751. max: number;
  20752. }
  20753. interface WebviewTagPrintOptions {
  20754. /**
  20755. * Don't ask user for print settings. Default is `false`.
  20756. */
  20757. silent?: boolean;
  20758. /**
  20759. * Prints the background color and image of the web page. Default is `false`.
  20760. */
  20761. printBackground?: boolean;
  20762. /**
  20763. * Set the printer device name to use. Must be the system-defined name and not the
  20764. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  20765. */
  20766. deviceName?: string;
  20767. /**
  20768. * Set whether the printed web page will be in color or grayscale. Default is
  20769. * `true`.
  20770. */
  20771. color?: boolean;
  20772. margins?: Margins;
  20773. /**
  20774. * Whether the web page should be printed in landscape mode. Default is `false`.
  20775. */
  20776. landscape?: boolean;
  20777. /**
  20778. * The scale factor of the web page.
  20779. */
  20780. scaleFactor?: number;
  20781. /**
  20782. * The number of pages to print per page sheet.
  20783. */
  20784. pagesPerSheet?: number;
  20785. /**
  20786. * Whether the web page should be collated.
  20787. */
  20788. collate?: boolean;
  20789. /**
  20790. * The number of copies of the web page to print.
  20791. */
  20792. copies?: number;
  20793. /**
  20794. * The page range to print.
  20795. */
  20796. pageRanges?: PageRanges[];
  20797. /**
  20798. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  20799. * `longEdge`.
  20800. */
  20801. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  20802. dpi?: Record<string, number>;
  20803. /**
  20804. * string to be printed as page header.
  20805. */
  20806. header?: string;
  20807. /**
  20808. * string to be printed as page footer.
  20809. */
  20810. footer?: string;
  20811. /**
  20812. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  20813. * `Letter`, `Tabloid` or an Object containing `height` in microns.
  20814. */
  20815. pageSize?: (('A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid')) | (Size);
  20816. }
  20817. interface WillFrameNavigateEvent extends DOMEvent {
  20818. url: string;
  20819. isMainFrame: boolean;
  20820. frameProcessId: number;
  20821. frameRoutingId: number;
  20822. }
  20823. interface WillNavigateEvent extends DOMEvent {
  20824. url: string;
  20825. }
  20826. interface WillResizeDetails {
  20827. /**
  20828. * The edge of the window being dragged for resizing. Can be `bottom`, `left`,
  20829. * `right`, `top-left`, `top-right`, `bottom-left` or `bottom-right`.
  20830. */
  20831. edge: ('bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right');
  20832. }
  20833. interface EditFlags {
  20834. /**
  20835. * Whether the renderer believes it can undo.
  20836. */
  20837. canUndo: boolean;
  20838. /**
  20839. * Whether the renderer believes it can redo.
  20840. */
  20841. canRedo: boolean;
  20842. /**
  20843. * Whether the renderer believes it can cut.
  20844. */
  20845. canCut: boolean;
  20846. /**
  20847. * Whether the renderer believes it can copy.
  20848. */
  20849. canCopy: boolean;
  20850. /**
  20851. * Whether the renderer believes it can paste.
  20852. */
  20853. canPaste: boolean;
  20854. /**
  20855. * Whether the renderer believes it can delete.
  20856. */
  20857. canDelete: boolean;
  20858. /**
  20859. * Whether the renderer believes it can select all.
  20860. */
  20861. canSelectAll: boolean;
  20862. /**
  20863. * Whether the renderer believes it can edit text richly.
  20864. */
  20865. canEditRichly: boolean;
  20866. }
  20867. interface Env {
  20868. }
  20869. interface FoundInPageResult {
  20870. requestId: number;
  20871. /**
  20872. * Position of the active match.
  20873. */
  20874. activeMatchOrdinal: number;
  20875. /**
  20876. * Number of Matches.
  20877. */
  20878. matches: number;
  20879. /**
  20880. * Coordinates of first match region.
  20881. */
  20882. selectionArea: Rectangle;
  20883. finalUpdate: boolean;
  20884. }
  20885. interface LaunchItems {
  20886. /**
  20887. * name value of a registry entry.
  20888. *
  20889. * @platform win32
  20890. */
  20891. name: string;
  20892. /**
  20893. * The executable to an app that corresponds to a registry entry.
  20894. *
  20895. * @platform win32
  20896. */
  20897. path: string;
  20898. /**
  20899. * the command-line arguments to pass to the executable.
  20900. *
  20901. * @platform win32
  20902. */
  20903. args: string[];
  20904. /**
  20905. * one of `user` or `machine`. Indicates whether the registry entry is under
  20906. * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  20907. *
  20908. * @platform win32
  20909. */
  20910. scope: string;
  20911. /**
  20912. * `true` if the app registry key is startup approved and therefore shows as
  20913. * `enabled` in Task Manager and Windows settings.
  20914. *
  20915. * @platform win32
  20916. */
  20917. enabled: boolean;
  20918. }
  20919. interface Margins {
  20920. /**
  20921. * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
  20922. * you will also need to specify `top`, `bottom`, `left`, and `right`.
  20923. */
  20924. marginType?: ('default' | 'none' | 'printableArea' | 'custom');
  20925. /**
  20926. * The top margin of the printed web page, in pixels.
  20927. */
  20928. top?: number;
  20929. /**
  20930. * The bottom margin of the printed web page, in pixels.
  20931. */
  20932. bottom?: number;
  20933. /**
  20934. * The left margin of the printed web page, in pixels.
  20935. */
  20936. left?: number;
  20937. /**
  20938. * The right margin of the printed web page, in pixels.
  20939. */
  20940. right?: number;
  20941. }
  20942. interface MediaFlags {
  20943. /**
  20944. * Whether the media element has crashed.
  20945. */
  20946. inError: boolean;
  20947. /**
  20948. * Whether the media element is paused.
  20949. */
  20950. isPaused: boolean;
  20951. /**
  20952. * Whether the media element is muted.
  20953. */
  20954. isMuted: boolean;
  20955. /**
  20956. * Whether the media element has audio.
  20957. */
  20958. hasAudio: boolean;
  20959. /**
  20960. * Whether the media element is looping.
  20961. */
  20962. isLooping: boolean;
  20963. /**
  20964. * Whether the media element's controls are visible.
  20965. */
  20966. isControlsVisible: boolean;
  20967. /**
  20968. * Whether the media element's controls are toggleable.
  20969. */
  20970. canToggleControls: boolean;
  20971. /**
  20972. * Whether the media element can be printed.
  20973. */
  20974. canPrint: boolean;
  20975. /**
  20976. * Whether or not the media element can be downloaded.
  20977. */
  20978. canSave: boolean;
  20979. /**
  20980. * Whether the media element can show picture-in-picture.
  20981. */
  20982. canShowPictureInPicture: boolean;
  20983. /**
  20984. * Whether the media element is currently showing picture-in-picture.
  20985. */
  20986. isShowingPictureInPicture: boolean;
  20987. /**
  20988. * Whether the media element can be rotated.
  20989. */
  20990. canRotate: boolean;
  20991. /**
  20992. * Whether the media element can be looped.
  20993. */
  20994. canLoop: boolean;
  20995. }
  20996. interface PageRanges {
  20997. /**
  20998. * Index of the first page to print (0-based).
  20999. */
  21000. from: number;
  21001. /**
  21002. * Index of the last page to print (inclusive) (0-based).
  21003. */
  21004. to: number;
  21005. }
  21006. interface Params {
  21007. /**
  21008. * x coordinate.
  21009. */
  21010. x: number;
  21011. /**
  21012. * y coordinate.
  21013. */
  21014. y: number;
  21015. /**
  21016. * URL of the link that encloses the node the context menu was invoked on.
  21017. */
  21018. linkURL: string;
  21019. /**
  21020. * Text associated with the link. May be an empty string if the contents of the
  21021. * link are an image.
  21022. */
  21023. linkText: string;
  21024. /**
  21025. * URL of the top level page that the context menu was invoked on.
  21026. */
  21027. pageURL: string;
  21028. /**
  21029. * URL of the subframe that the context menu was invoked on.
  21030. */
  21031. frameURL: string;
  21032. /**
  21033. * Source URL for the element that the context menu was invoked on. Elements with
  21034. * source URLs are images, audio and video.
  21035. */
  21036. srcURL: string;
  21037. /**
  21038. * Type of the node the context menu was invoked on. Can be `none`, `image`,
  21039. * `audio`, `video`, `canvas`, `file` or `plugin`.
  21040. */
  21041. mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
  21042. /**
  21043. * Whether the context menu was invoked on an image which has non-empty contents.
  21044. */
  21045. hasImageContents: boolean;
  21046. /**
  21047. * Whether the context is editable.
  21048. */
  21049. isEditable: boolean;
  21050. /**
  21051. * Text of the selection that the context menu was invoked on.
  21052. */
  21053. selectionText: string;
  21054. /**
  21055. * Title text of the selection that the context menu was invoked on.
  21056. */
  21057. titleText: string;
  21058. /**
  21059. * Alt text of the selection that the context menu was invoked on.
  21060. */
  21061. altText: string;
  21062. /**
  21063. * Suggested filename to be used when saving file through 'Save Link As' option of
  21064. * context menu.
  21065. */
  21066. suggestedFilename: string;
  21067. /**
  21068. * Rect representing the coordinates in the document space of the selection.
  21069. */
  21070. selectionRect: Rectangle;
  21071. /**
  21072. * Start position of the selection text.
  21073. */
  21074. selectionStartOffset: number;
  21075. /**
  21076. * The referrer policy of the frame on which the menu is invoked.
  21077. */
  21078. referrerPolicy: Referrer;
  21079. /**
  21080. * The misspelled word under the cursor, if any.
  21081. */
  21082. misspelledWord: string;
  21083. /**
  21084. * An array of suggested words to show the user to replace the `misspelledWord`.
  21085. * Only available if there is a misspelled word and spellchecker is enabled.
  21086. */
  21087. dictionarySuggestions: string[];
  21088. /**
  21089. * The character encoding of the frame on which the menu was invoked.
  21090. */
  21091. frameCharset: string;
  21092. /**
  21093. * The source that the context menu was invoked on. Possible values include `none`,
  21094. * `button-button`, `field-set`, `input-button`, `input-checkbox`, `input-color`,
  21095. * `input-date`, `input-datetime-local`, `input-email`, `input-file`,
  21096. * `input-hidden`, `input-image`, `input-month`, `input-number`, `input-password`,
  21097. * `input-radio`, `input-range`, `input-reset`, `input-search`, `input-submit`,
  21098. * `input-telephone`, `input-text`, `input-time`, `input-url`, `input-week`,
  21099. * `output`, `reset-button`, `select-list`, `select-list`, `select-multiple`,
  21100. * `select-one`, `submit-button`, and `text-area`,
  21101. */
  21102. formControlType: ('none' | 'button-button' | 'field-set' | 'input-button' | 'input-checkbox' | 'input-color' | 'input-date' | 'input-datetime-local' | 'input-email' | 'input-file' | 'input-hidden' | 'input-image' | 'input-month' | 'input-number' | 'input-password' | 'input-radio' | 'input-range' | 'input-reset' | 'input-search' | 'input-submit' | 'input-telephone' | 'input-text' | 'input-time' | 'input-url' | 'input-week' | 'output' | 'reset-button' | 'select-list' | 'select-list' | 'select-multiple' | 'select-one' | 'submit-button' | 'text-area');
  21103. /**
  21104. * If the context is editable, whether or not spellchecking is enabled.
  21105. */
  21106. spellcheckEnabled: boolean;
  21107. /**
  21108. * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
  21109. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  21110. * `adjustSelection`, or `adjustSelectionReset`.
  21111. */
  21112. menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  21113. /**
  21114. * The flags for the media element the context menu was invoked on.
  21115. */
  21116. mediaFlags: MediaFlags;
  21117. /**
  21118. * These flags indicate whether the renderer believes it is able to perform the
  21119. * corresponding action.
  21120. */
  21121. editFlags: EditFlags;
  21122. }
  21123. interface Video {
  21124. /**
  21125. * The id of the stream being granted. This will usually come from a
  21126. * DesktopCapturerSource object.
  21127. */
  21128. id: string;
  21129. /**
  21130. * The name of the stream being granted. This will usually come from a
  21131. * DesktopCapturerSource object.
  21132. */
  21133. name: string;
  21134. }
  21135. namespace Common {
  21136. type Event<Params extends object = {}> = Electron.Event<Params>;
  21137. const clipboard: Clipboard;
  21138. type Clipboard = Electron.Clipboard;
  21139. const crashReporter: CrashReporter;
  21140. type CrashReporter = Electron.CrashReporter;
  21141. const nativeImage: typeof NativeImage;
  21142. type NativeImage = Electron.NativeImage;
  21143. const shell: Shell;
  21144. type Shell = Electron.Shell;
  21145. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  21146. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  21147. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  21148. type AnimationSettings = Electron.AnimationSettings;
  21149. type AppDetailsOptions = Electron.AppDetailsOptions;
  21150. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  21151. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  21152. type AuthInfo = Electron.AuthInfo;
  21153. type AutoResizeOptions = Electron.AutoResizeOptions;
  21154. type BeforeSendResponse = Electron.BeforeSendResponse;
  21155. type BitmapOptions = Electron.BitmapOptions;
  21156. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  21157. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  21158. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  21159. type CallbackResponse = Electron.CallbackResponse;
  21160. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  21161. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  21162. type ClearDataOptions = Electron.ClearDataOptions;
  21163. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  21164. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  21165. type CloseOpts = Electron.CloseOpts;
  21166. type Config = Electron.Config;
  21167. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  21168. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  21169. type ContextMenuEvent = Electron.ContextMenuEvent;
  21170. type ContextMenuParams = Electron.ContextMenuParams;
  21171. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  21172. type CookiesGetFilter = Electron.CookiesGetFilter;
  21173. type CookiesSetDetails = Electron.CookiesSetDetails;
  21174. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  21175. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  21176. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  21177. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  21178. type Data = Electron.Data;
  21179. type DefaultFontFamily = Electron.DefaultFontFamily;
  21180. type Details = Electron.Details;
  21181. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  21182. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  21183. type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
  21184. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  21185. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  21186. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  21187. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  21188. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  21189. type DidNavigateEvent = Electron.DidNavigateEvent;
  21190. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  21191. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  21192. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  21193. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  21194. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  21195. type DownloadURLOptions = Electron.DownloadURLOptions;
  21196. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  21197. type EntryAtIndex = Electron.EntryAtIndex;
  21198. type FeedURLOptions = Electron.FeedURLOptions;
  21199. type FileIconOptions = Electron.FileIconOptions;
  21200. type FindInPageOptions = Electron.FindInPageOptions;
  21201. type FocusOptions = Electron.FocusOptions;
  21202. type ForkOptions = Electron.ForkOptions;
  21203. type FoundInPageEvent = Electron.FoundInPageEvent;
  21204. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  21205. type FromPartitionOptions = Electron.FromPartitionOptions;
  21206. type FromPathOptions = Electron.FromPathOptions;
  21207. type HandlerDetails = Electron.HandlerDetails;
  21208. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  21209. type HeapStatistics = Electron.HeapStatistics;
  21210. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  21211. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  21212. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  21213. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  21214. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  21215. type Info = Electron.Info;
  21216. type Input = Electron.Input;
  21217. type InsertCSSOptions = Electron.InsertCSSOptions;
  21218. type IpcMessageEvent = Electron.IpcMessageEvent;
  21219. type Item = Electron.Item;
  21220. type JumpListSettings = Electron.JumpListSettings;
  21221. type LoadCommitEvent = Electron.LoadCommitEvent;
  21222. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  21223. type LoadFileOptions = Electron.LoadFileOptions;
  21224. type LoadURLOptions = Electron.LoadURLOptions;
  21225. type LoginItemSettings = Electron.LoginItemSettings;
  21226. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  21227. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  21228. type MessageBoxOptions = Electron.MessageBoxOptions;
  21229. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  21230. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  21231. type MessageDetails = Electron.MessageDetails;
  21232. type MessageEvent = Electron.MessageEvent;
  21233. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  21234. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  21235. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  21236. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  21237. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  21238. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  21239. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  21240. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  21241. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  21242. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  21243. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  21244. type OpenDialogOptions = Electron.OpenDialogOptions;
  21245. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  21246. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  21247. type OpenExternalOptions = Electron.OpenExternalOptions;
  21248. type Options = Electron.Options;
  21249. type Opts = Electron.Opts;
  21250. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  21251. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  21252. type Parameters = Electron.Parameters;
  21253. type Payment = Electron.Payment;
  21254. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  21255. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  21256. type PopupOptions = Electron.PopupOptions;
  21257. type PreconnectOptions = Electron.PreconnectOptions;
  21258. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  21259. type Privileges = Electron.Privileges;
  21260. type ProgressBarOptions = Electron.ProgressBarOptions;
  21261. type Provider = Electron.Provider;
  21262. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  21263. type ReadBookmark = Electron.ReadBookmark;
  21264. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  21265. type RelaunchOptions = Electron.RelaunchOptions;
  21266. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  21267. type Request = Electron.Request;
  21268. type ResizeOptions = Electron.ResizeOptions;
  21269. type ResolveHostOptions = Electron.ResolveHostOptions;
  21270. type ResourceUsage = Electron.ResourceUsage;
  21271. type Response = Electron.Response;
  21272. type Result = Electron.Result;
  21273. type SaveDialogOptions = Electron.SaveDialogOptions;
  21274. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  21275. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  21276. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  21277. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  21278. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  21279. type Settings = Electron.Settings;
  21280. type SourcesOptions = Electron.SourcesOptions;
  21281. type StartLoggingOptions = Electron.StartLoggingOptions;
  21282. type Streams = Electron.Streams;
  21283. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  21284. type TitleBarOverlay = Electron.TitleBarOverlay;
  21285. type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
  21286. type TitleOptions = Electron.TitleOptions;
  21287. type ToBitmapOptions = Electron.ToBitmapOptions;
  21288. type ToDataURLOptions = Electron.ToDataURLOptions;
  21289. type ToPNGOptions = Electron.ToPNGOptions;
  21290. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  21291. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  21292. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  21293. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  21294. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  21295. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  21296. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  21297. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  21298. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  21299. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  21300. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  21301. type UdpPortRange = Electron.UdpPortRange;
  21302. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  21303. type UploadProgress = Electron.UploadProgress;
  21304. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  21305. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  21306. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  21307. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  21308. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  21309. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  21310. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  21311. type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
  21312. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  21313. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  21314. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  21315. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  21316. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  21317. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  21318. type WillNavigateEvent = Electron.WillNavigateEvent;
  21319. type WillResizeDetails = Electron.WillResizeDetails;
  21320. type EditFlags = Electron.EditFlags;
  21321. type Env = Electron.Env;
  21322. type FoundInPageResult = Electron.FoundInPageResult;
  21323. type LaunchItems = Electron.LaunchItems;
  21324. type Margins = Electron.Margins;
  21325. type MediaFlags = Electron.MediaFlags;
  21326. type PageRanges = Electron.PageRanges;
  21327. type Params = Electron.Params;
  21328. type Video = Electron.Video;
  21329. type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
  21330. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  21331. type BluetoothDevice = Electron.BluetoothDevice;
  21332. type Certificate = Electron.Certificate;
  21333. type CertificatePrincipal = Electron.CertificatePrincipal;
  21334. type Cookie = Electron.Cookie;
  21335. type CPUUsage = Electron.CPUUsage;
  21336. type CrashReport = Electron.CrashReport;
  21337. type CustomScheme = Electron.CustomScheme;
  21338. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  21339. type Display = Electron.Display;
  21340. type Extension = Electron.Extension;
  21341. type ExtensionInfo = Electron.ExtensionInfo;
  21342. type FileFilter = Electron.FileFilter;
  21343. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  21344. type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
  21345. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  21346. type HIDDevice = Electron.HIDDevice;
  21347. type InputEvent = Electron.InputEvent;
  21348. type IpcMainEvent = Electron.IpcMainEvent;
  21349. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  21350. type IpcRendererEvent = Electron.IpcRendererEvent;
  21351. type JumpListCategory = Electron.JumpListCategory;
  21352. type JumpListItem = Electron.JumpListItem;
  21353. type KeyboardEvent = Electron.KeyboardEvent;
  21354. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  21355. type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
  21356. type MemoryInfo = Electron.MemoryInfo;
  21357. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  21358. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  21359. type MouseInputEvent = Electron.MouseInputEvent;
  21360. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  21361. type NotificationAction = Electron.NotificationAction;
  21362. type NotificationResponse = Electron.NotificationResponse;
  21363. type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
  21364. type PaymentDiscount = Electron.PaymentDiscount;
  21365. type PermissionRequest = Electron.PermissionRequest;
  21366. type Point = Electron.Point;
  21367. type PostBody = Electron.PostBody;
  21368. type PrinterInfo = Electron.PrinterInfo;
  21369. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  21370. type ProcessMetric = Electron.ProcessMetric;
  21371. type Product = Electron.Product;
  21372. type ProductDiscount = Electron.ProductDiscount;
  21373. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  21374. type ProtocolRequest = Electron.ProtocolRequest;
  21375. type ProtocolResponse = Electron.ProtocolResponse;
  21376. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  21377. type ProxyConfig = Electron.ProxyConfig;
  21378. type Rectangle = Electron.Rectangle;
  21379. type Referrer = Electron.Referrer;
  21380. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  21381. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  21382. type ResolvedHost = Electron.ResolvedHost;
  21383. type ScrubberItem = Electron.ScrubberItem;
  21384. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  21385. type SerialPort = Electron.SerialPort;
  21386. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  21387. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  21388. type SharingItem = Electron.SharingItem;
  21389. type ShortcutDetails = Electron.ShortcutDetails;
  21390. type Size = Electron.Size;
  21391. type Task = Electron.Task;
  21392. type ThumbarButton = Electron.ThumbarButton;
  21393. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  21394. type TraceConfig = Electron.TraceConfig;
  21395. type Transaction = Electron.Transaction;
  21396. type UploadData = Electron.UploadData;
  21397. type UploadFile = Electron.UploadFile;
  21398. type UploadRawData = Electron.UploadRawData;
  21399. type USBDevice = Electron.USBDevice;
  21400. type UserDefaultTypes = Electron.UserDefaultTypes;
  21401. type WebPreferences = Electron.WebPreferences;
  21402. type WebRequestFilter = Electron.WebRequestFilter;
  21403. type WebSource = Electron.WebSource;
  21404. type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
  21405. }
  21406. namespace Main {
  21407. type Event<Params extends object = {}> = Electron.Event<Params>;
  21408. const app: App;
  21409. type App = Electron.App;
  21410. const autoUpdater: AutoUpdater;
  21411. type AutoUpdater = Electron.AutoUpdater;
  21412. class BaseWindow extends Electron.BaseWindow {}
  21413. class BrowserView extends Electron.BrowserView {}
  21414. class BrowserWindow extends Electron.BrowserWindow {}
  21415. type ClientRequest = Electron.ClientRequest;
  21416. type CommandLine = Electron.CommandLine;
  21417. const contentTracing: ContentTracing;
  21418. type ContentTracing = Electron.ContentTracing;
  21419. type Cookies = Electron.Cookies;
  21420. type Debugger = Electron.Debugger;
  21421. const desktopCapturer: DesktopCapturer;
  21422. type DesktopCapturer = Electron.DesktopCapturer;
  21423. const dialog: Dialog;
  21424. type Dialog = Electron.Dialog;
  21425. type Dock = Electron.Dock;
  21426. type DownloadItem = Electron.DownloadItem;
  21427. const globalShortcut: GlobalShortcut;
  21428. type GlobalShortcut = Electron.GlobalShortcut;
  21429. const inAppPurchase: InAppPurchase;
  21430. type InAppPurchase = Electron.InAppPurchase;
  21431. type IncomingMessage = Electron.IncomingMessage;
  21432. const ipcMain: IpcMain;
  21433. type IpcMain = Electron.IpcMain;
  21434. class Menu extends Electron.Menu {}
  21435. class MenuItem extends Electron.MenuItem {}
  21436. class MessageChannelMain extends Electron.MessageChannelMain {}
  21437. type MessagePortMain = Electron.MessagePortMain;
  21438. const nativeTheme: NativeTheme;
  21439. type NativeTheme = Electron.NativeTheme;
  21440. type NavigationHistory = Electron.NavigationHistory;
  21441. const net: Net;
  21442. type Net = Electron.Net;
  21443. const netLog: NetLog;
  21444. type NetLog = Electron.NetLog;
  21445. class Notification extends Electron.Notification {}
  21446. const powerMonitor: PowerMonitor;
  21447. type PowerMonitor = Electron.PowerMonitor;
  21448. const powerSaveBlocker: PowerSaveBlocker;
  21449. type PowerSaveBlocker = Electron.PowerSaveBlocker;
  21450. const protocol: Protocol;
  21451. type Protocol = Electron.Protocol;
  21452. const pushNotifications: PushNotifications;
  21453. type PushNotifications = Electron.PushNotifications;
  21454. const safeStorage: SafeStorage;
  21455. type SafeStorage = Electron.SafeStorage;
  21456. const screen: Screen;
  21457. type Screen = Electron.Screen;
  21458. type ServiceWorkers = Electron.ServiceWorkers;
  21459. const session: typeof Session;
  21460. type Session = Electron.Session;
  21461. class ShareMenu extends Electron.ShareMenu {}
  21462. const systemPreferences: SystemPreferences;
  21463. type SystemPreferences = Electron.SystemPreferences;
  21464. class TouchBar extends Electron.TouchBar {}
  21465. type TouchBarButton = Electron.TouchBarButton;
  21466. type TouchBarColorPicker = Electron.TouchBarColorPicker;
  21467. type TouchBarGroup = Electron.TouchBarGroup;
  21468. type TouchBarLabel = Electron.TouchBarLabel;
  21469. type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
  21470. type TouchBarPopover = Electron.TouchBarPopover;
  21471. type TouchBarScrubber = Electron.TouchBarScrubber;
  21472. type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
  21473. type TouchBarSlider = Electron.TouchBarSlider;
  21474. type TouchBarSpacer = Electron.TouchBarSpacer;
  21475. class Tray extends Electron.Tray {}
  21476. const utilityProcess: typeof UtilityProcess;
  21477. type UtilityProcess = Electron.UtilityProcess;
  21478. class View extends Electron.View {}
  21479. const webContents: typeof WebContents;
  21480. type WebContents = Electron.WebContents;
  21481. class WebContentsView extends Electron.WebContentsView {}
  21482. const webFrameMain: typeof WebFrameMain;
  21483. type WebFrameMain = Electron.WebFrameMain;
  21484. type WebRequest = Electron.WebRequest;
  21485. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  21486. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  21487. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  21488. type AnimationSettings = Electron.AnimationSettings;
  21489. type AppDetailsOptions = Electron.AppDetailsOptions;
  21490. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  21491. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  21492. type AuthInfo = Electron.AuthInfo;
  21493. type AutoResizeOptions = Electron.AutoResizeOptions;
  21494. type BeforeSendResponse = Electron.BeforeSendResponse;
  21495. type BitmapOptions = Electron.BitmapOptions;
  21496. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  21497. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  21498. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  21499. type CallbackResponse = Electron.CallbackResponse;
  21500. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  21501. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  21502. type ClearDataOptions = Electron.ClearDataOptions;
  21503. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  21504. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  21505. type CloseOpts = Electron.CloseOpts;
  21506. type Config = Electron.Config;
  21507. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  21508. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  21509. type ContextMenuEvent = Electron.ContextMenuEvent;
  21510. type ContextMenuParams = Electron.ContextMenuParams;
  21511. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  21512. type CookiesGetFilter = Electron.CookiesGetFilter;
  21513. type CookiesSetDetails = Electron.CookiesSetDetails;
  21514. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  21515. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  21516. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  21517. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  21518. type Data = Electron.Data;
  21519. type DefaultFontFamily = Electron.DefaultFontFamily;
  21520. type Details = Electron.Details;
  21521. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  21522. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  21523. type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
  21524. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  21525. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  21526. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  21527. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  21528. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  21529. type DidNavigateEvent = Electron.DidNavigateEvent;
  21530. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  21531. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  21532. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  21533. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  21534. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  21535. type DownloadURLOptions = Electron.DownloadURLOptions;
  21536. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  21537. type EntryAtIndex = Electron.EntryAtIndex;
  21538. type FeedURLOptions = Electron.FeedURLOptions;
  21539. type FileIconOptions = Electron.FileIconOptions;
  21540. type FindInPageOptions = Electron.FindInPageOptions;
  21541. type FocusOptions = Electron.FocusOptions;
  21542. type ForkOptions = Electron.ForkOptions;
  21543. type FoundInPageEvent = Electron.FoundInPageEvent;
  21544. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  21545. type FromPartitionOptions = Electron.FromPartitionOptions;
  21546. type FromPathOptions = Electron.FromPathOptions;
  21547. type HandlerDetails = Electron.HandlerDetails;
  21548. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  21549. type HeapStatistics = Electron.HeapStatistics;
  21550. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  21551. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  21552. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  21553. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  21554. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  21555. type Info = Electron.Info;
  21556. type Input = Electron.Input;
  21557. type InsertCSSOptions = Electron.InsertCSSOptions;
  21558. type IpcMessageEvent = Electron.IpcMessageEvent;
  21559. type Item = Electron.Item;
  21560. type JumpListSettings = Electron.JumpListSettings;
  21561. type LoadCommitEvent = Electron.LoadCommitEvent;
  21562. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  21563. type LoadFileOptions = Electron.LoadFileOptions;
  21564. type LoadURLOptions = Electron.LoadURLOptions;
  21565. type LoginItemSettings = Electron.LoginItemSettings;
  21566. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  21567. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  21568. type MessageBoxOptions = Electron.MessageBoxOptions;
  21569. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  21570. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  21571. type MessageDetails = Electron.MessageDetails;
  21572. type MessageEvent = Electron.MessageEvent;
  21573. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  21574. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  21575. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  21576. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  21577. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  21578. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  21579. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  21580. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  21581. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  21582. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  21583. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  21584. type OpenDialogOptions = Electron.OpenDialogOptions;
  21585. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  21586. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  21587. type OpenExternalOptions = Electron.OpenExternalOptions;
  21588. type Options = Electron.Options;
  21589. type Opts = Electron.Opts;
  21590. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  21591. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  21592. type Parameters = Electron.Parameters;
  21593. type Payment = Electron.Payment;
  21594. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  21595. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  21596. type PopupOptions = Electron.PopupOptions;
  21597. type PreconnectOptions = Electron.PreconnectOptions;
  21598. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  21599. type Privileges = Electron.Privileges;
  21600. type ProgressBarOptions = Electron.ProgressBarOptions;
  21601. type Provider = Electron.Provider;
  21602. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  21603. type ReadBookmark = Electron.ReadBookmark;
  21604. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  21605. type RelaunchOptions = Electron.RelaunchOptions;
  21606. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  21607. type Request = Electron.Request;
  21608. type ResizeOptions = Electron.ResizeOptions;
  21609. type ResolveHostOptions = Electron.ResolveHostOptions;
  21610. type ResourceUsage = Electron.ResourceUsage;
  21611. type Response = Electron.Response;
  21612. type Result = Electron.Result;
  21613. type SaveDialogOptions = Electron.SaveDialogOptions;
  21614. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  21615. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  21616. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  21617. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  21618. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  21619. type Settings = Electron.Settings;
  21620. type SourcesOptions = Electron.SourcesOptions;
  21621. type StartLoggingOptions = Electron.StartLoggingOptions;
  21622. type Streams = Electron.Streams;
  21623. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  21624. type TitleBarOverlay = Electron.TitleBarOverlay;
  21625. type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
  21626. type TitleOptions = Electron.TitleOptions;
  21627. type ToBitmapOptions = Electron.ToBitmapOptions;
  21628. type ToDataURLOptions = Electron.ToDataURLOptions;
  21629. type ToPNGOptions = Electron.ToPNGOptions;
  21630. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  21631. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  21632. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  21633. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  21634. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  21635. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  21636. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  21637. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  21638. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  21639. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  21640. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  21641. type UdpPortRange = Electron.UdpPortRange;
  21642. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  21643. type UploadProgress = Electron.UploadProgress;
  21644. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  21645. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  21646. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  21647. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  21648. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  21649. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  21650. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  21651. type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
  21652. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  21653. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  21654. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  21655. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  21656. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  21657. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  21658. type WillNavigateEvent = Electron.WillNavigateEvent;
  21659. type WillResizeDetails = Electron.WillResizeDetails;
  21660. type EditFlags = Electron.EditFlags;
  21661. type Env = Electron.Env;
  21662. type FoundInPageResult = Electron.FoundInPageResult;
  21663. type LaunchItems = Electron.LaunchItems;
  21664. type Margins = Electron.Margins;
  21665. type MediaFlags = Electron.MediaFlags;
  21666. type PageRanges = Electron.PageRanges;
  21667. type Params = Electron.Params;
  21668. type Video = Electron.Video;
  21669. type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
  21670. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  21671. type BluetoothDevice = Electron.BluetoothDevice;
  21672. type Certificate = Electron.Certificate;
  21673. type CertificatePrincipal = Electron.CertificatePrincipal;
  21674. type Cookie = Electron.Cookie;
  21675. type CPUUsage = Electron.CPUUsage;
  21676. type CrashReport = Electron.CrashReport;
  21677. type CustomScheme = Electron.CustomScheme;
  21678. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  21679. type Display = Electron.Display;
  21680. type Extension = Electron.Extension;
  21681. type ExtensionInfo = Electron.ExtensionInfo;
  21682. type FileFilter = Electron.FileFilter;
  21683. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  21684. type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
  21685. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  21686. type HIDDevice = Electron.HIDDevice;
  21687. type InputEvent = Electron.InputEvent;
  21688. type IpcMainEvent = Electron.IpcMainEvent;
  21689. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  21690. type IpcRendererEvent = Electron.IpcRendererEvent;
  21691. type JumpListCategory = Electron.JumpListCategory;
  21692. type JumpListItem = Electron.JumpListItem;
  21693. type KeyboardEvent = Electron.KeyboardEvent;
  21694. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  21695. type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
  21696. type MemoryInfo = Electron.MemoryInfo;
  21697. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  21698. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  21699. type MouseInputEvent = Electron.MouseInputEvent;
  21700. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  21701. type NotificationAction = Electron.NotificationAction;
  21702. type NotificationResponse = Electron.NotificationResponse;
  21703. type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
  21704. type PaymentDiscount = Electron.PaymentDiscount;
  21705. type PermissionRequest = Electron.PermissionRequest;
  21706. type Point = Electron.Point;
  21707. type PostBody = Electron.PostBody;
  21708. type PrinterInfo = Electron.PrinterInfo;
  21709. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  21710. type ProcessMetric = Electron.ProcessMetric;
  21711. type Product = Electron.Product;
  21712. type ProductDiscount = Electron.ProductDiscount;
  21713. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  21714. type ProtocolRequest = Electron.ProtocolRequest;
  21715. type ProtocolResponse = Electron.ProtocolResponse;
  21716. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  21717. type ProxyConfig = Electron.ProxyConfig;
  21718. type Rectangle = Electron.Rectangle;
  21719. type Referrer = Electron.Referrer;
  21720. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  21721. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  21722. type ResolvedHost = Electron.ResolvedHost;
  21723. type ScrubberItem = Electron.ScrubberItem;
  21724. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  21725. type SerialPort = Electron.SerialPort;
  21726. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  21727. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  21728. type SharingItem = Electron.SharingItem;
  21729. type ShortcutDetails = Electron.ShortcutDetails;
  21730. type Size = Electron.Size;
  21731. type Task = Electron.Task;
  21732. type ThumbarButton = Electron.ThumbarButton;
  21733. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  21734. type TraceConfig = Electron.TraceConfig;
  21735. type Transaction = Electron.Transaction;
  21736. type UploadData = Electron.UploadData;
  21737. type UploadFile = Electron.UploadFile;
  21738. type UploadRawData = Electron.UploadRawData;
  21739. type USBDevice = Electron.USBDevice;
  21740. type UserDefaultTypes = Electron.UserDefaultTypes;
  21741. type WebPreferences = Electron.WebPreferences;
  21742. type WebRequestFilter = Electron.WebRequestFilter;
  21743. type WebSource = Electron.WebSource;
  21744. type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
  21745. }
  21746. namespace Renderer {
  21747. type Event<Params extends object = {}> = Electron.Event<Params>;
  21748. const contextBridge: ContextBridge;
  21749. type ContextBridge = Electron.ContextBridge;
  21750. const ipcRenderer: IpcRenderer;
  21751. type IpcRenderer = Electron.IpcRenderer;
  21752. const webFrame: WebFrame;
  21753. type WebFrame = Electron.WebFrame;
  21754. const webUtils: WebUtils;
  21755. type WebUtils = Electron.WebUtils;
  21756. type WebviewTag = Electron.WebviewTag;
  21757. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  21758. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  21759. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  21760. type AnimationSettings = Electron.AnimationSettings;
  21761. type AppDetailsOptions = Electron.AppDetailsOptions;
  21762. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  21763. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  21764. type AuthInfo = Electron.AuthInfo;
  21765. type AutoResizeOptions = Electron.AutoResizeOptions;
  21766. type BeforeSendResponse = Electron.BeforeSendResponse;
  21767. type BitmapOptions = Electron.BitmapOptions;
  21768. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  21769. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  21770. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  21771. type CallbackResponse = Electron.CallbackResponse;
  21772. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  21773. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  21774. type ClearDataOptions = Electron.ClearDataOptions;
  21775. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  21776. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  21777. type CloseOpts = Electron.CloseOpts;
  21778. type Config = Electron.Config;
  21779. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  21780. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  21781. type ContextMenuEvent = Electron.ContextMenuEvent;
  21782. type ContextMenuParams = Electron.ContextMenuParams;
  21783. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  21784. type CookiesGetFilter = Electron.CookiesGetFilter;
  21785. type CookiesSetDetails = Electron.CookiesSetDetails;
  21786. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  21787. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  21788. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  21789. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  21790. type Data = Electron.Data;
  21791. type DefaultFontFamily = Electron.DefaultFontFamily;
  21792. type Details = Electron.Details;
  21793. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  21794. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  21795. type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
  21796. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  21797. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  21798. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  21799. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  21800. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  21801. type DidNavigateEvent = Electron.DidNavigateEvent;
  21802. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  21803. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  21804. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  21805. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  21806. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  21807. type DownloadURLOptions = Electron.DownloadURLOptions;
  21808. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  21809. type EntryAtIndex = Electron.EntryAtIndex;
  21810. type FeedURLOptions = Electron.FeedURLOptions;
  21811. type FileIconOptions = Electron.FileIconOptions;
  21812. type FindInPageOptions = Electron.FindInPageOptions;
  21813. type FocusOptions = Electron.FocusOptions;
  21814. type ForkOptions = Electron.ForkOptions;
  21815. type FoundInPageEvent = Electron.FoundInPageEvent;
  21816. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  21817. type FromPartitionOptions = Electron.FromPartitionOptions;
  21818. type FromPathOptions = Electron.FromPathOptions;
  21819. type HandlerDetails = Electron.HandlerDetails;
  21820. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  21821. type HeapStatistics = Electron.HeapStatistics;
  21822. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  21823. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  21824. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  21825. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  21826. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  21827. type Info = Electron.Info;
  21828. type Input = Electron.Input;
  21829. type InsertCSSOptions = Electron.InsertCSSOptions;
  21830. type IpcMessageEvent = Electron.IpcMessageEvent;
  21831. type Item = Electron.Item;
  21832. type JumpListSettings = Electron.JumpListSettings;
  21833. type LoadCommitEvent = Electron.LoadCommitEvent;
  21834. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  21835. type LoadFileOptions = Electron.LoadFileOptions;
  21836. type LoadURLOptions = Electron.LoadURLOptions;
  21837. type LoginItemSettings = Electron.LoginItemSettings;
  21838. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  21839. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  21840. type MessageBoxOptions = Electron.MessageBoxOptions;
  21841. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  21842. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  21843. type MessageDetails = Electron.MessageDetails;
  21844. type MessageEvent = Electron.MessageEvent;
  21845. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  21846. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  21847. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  21848. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  21849. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  21850. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  21851. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  21852. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  21853. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  21854. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  21855. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  21856. type OpenDialogOptions = Electron.OpenDialogOptions;
  21857. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  21858. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  21859. type OpenExternalOptions = Electron.OpenExternalOptions;
  21860. type Options = Electron.Options;
  21861. type Opts = Electron.Opts;
  21862. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  21863. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  21864. type Parameters = Electron.Parameters;
  21865. type Payment = Electron.Payment;
  21866. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  21867. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  21868. type PopupOptions = Electron.PopupOptions;
  21869. type PreconnectOptions = Electron.PreconnectOptions;
  21870. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  21871. type Privileges = Electron.Privileges;
  21872. type ProgressBarOptions = Electron.ProgressBarOptions;
  21873. type Provider = Electron.Provider;
  21874. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  21875. type ReadBookmark = Electron.ReadBookmark;
  21876. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  21877. type RelaunchOptions = Electron.RelaunchOptions;
  21878. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  21879. type Request = Electron.Request;
  21880. type ResizeOptions = Electron.ResizeOptions;
  21881. type ResolveHostOptions = Electron.ResolveHostOptions;
  21882. type ResourceUsage = Electron.ResourceUsage;
  21883. type Response = Electron.Response;
  21884. type Result = Electron.Result;
  21885. type SaveDialogOptions = Electron.SaveDialogOptions;
  21886. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  21887. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  21888. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  21889. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  21890. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  21891. type Settings = Electron.Settings;
  21892. type SourcesOptions = Electron.SourcesOptions;
  21893. type StartLoggingOptions = Electron.StartLoggingOptions;
  21894. type Streams = Electron.Streams;
  21895. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  21896. type TitleBarOverlay = Electron.TitleBarOverlay;
  21897. type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
  21898. type TitleOptions = Electron.TitleOptions;
  21899. type ToBitmapOptions = Electron.ToBitmapOptions;
  21900. type ToDataURLOptions = Electron.ToDataURLOptions;
  21901. type ToPNGOptions = Electron.ToPNGOptions;
  21902. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  21903. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  21904. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  21905. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  21906. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  21907. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  21908. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  21909. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  21910. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  21911. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  21912. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  21913. type UdpPortRange = Electron.UdpPortRange;
  21914. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  21915. type UploadProgress = Electron.UploadProgress;
  21916. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  21917. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  21918. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  21919. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  21920. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  21921. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  21922. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  21923. type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
  21924. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  21925. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  21926. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  21927. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  21928. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  21929. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  21930. type WillNavigateEvent = Electron.WillNavigateEvent;
  21931. type WillResizeDetails = Electron.WillResizeDetails;
  21932. type EditFlags = Electron.EditFlags;
  21933. type Env = Electron.Env;
  21934. type FoundInPageResult = Electron.FoundInPageResult;
  21935. type LaunchItems = Electron.LaunchItems;
  21936. type Margins = Electron.Margins;
  21937. type MediaFlags = Electron.MediaFlags;
  21938. type PageRanges = Electron.PageRanges;
  21939. type Params = Electron.Params;
  21940. type Video = Electron.Video;
  21941. type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
  21942. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  21943. type BluetoothDevice = Electron.BluetoothDevice;
  21944. type Certificate = Electron.Certificate;
  21945. type CertificatePrincipal = Electron.CertificatePrincipal;
  21946. type Cookie = Electron.Cookie;
  21947. type CPUUsage = Electron.CPUUsage;
  21948. type CrashReport = Electron.CrashReport;
  21949. type CustomScheme = Electron.CustomScheme;
  21950. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  21951. type Display = Electron.Display;
  21952. type Extension = Electron.Extension;
  21953. type ExtensionInfo = Electron.ExtensionInfo;
  21954. type FileFilter = Electron.FileFilter;
  21955. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  21956. type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
  21957. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  21958. type HIDDevice = Electron.HIDDevice;
  21959. type InputEvent = Electron.InputEvent;
  21960. type IpcMainEvent = Electron.IpcMainEvent;
  21961. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  21962. type IpcRendererEvent = Electron.IpcRendererEvent;
  21963. type JumpListCategory = Electron.JumpListCategory;
  21964. type JumpListItem = Electron.JumpListItem;
  21965. type KeyboardEvent = Electron.KeyboardEvent;
  21966. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  21967. type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
  21968. type MemoryInfo = Electron.MemoryInfo;
  21969. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  21970. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  21971. type MouseInputEvent = Electron.MouseInputEvent;
  21972. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  21973. type NotificationAction = Electron.NotificationAction;
  21974. type NotificationResponse = Electron.NotificationResponse;
  21975. type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
  21976. type PaymentDiscount = Electron.PaymentDiscount;
  21977. type PermissionRequest = Electron.PermissionRequest;
  21978. type Point = Electron.Point;
  21979. type PostBody = Electron.PostBody;
  21980. type PrinterInfo = Electron.PrinterInfo;
  21981. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  21982. type ProcessMetric = Electron.ProcessMetric;
  21983. type Product = Electron.Product;
  21984. type ProductDiscount = Electron.ProductDiscount;
  21985. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  21986. type ProtocolRequest = Electron.ProtocolRequest;
  21987. type ProtocolResponse = Electron.ProtocolResponse;
  21988. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  21989. type ProxyConfig = Electron.ProxyConfig;
  21990. type Rectangle = Electron.Rectangle;
  21991. type Referrer = Electron.Referrer;
  21992. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  21993. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  21994. type ResolvedHost = Electron.ResolvedHost;
  21995. type ScrubberItem = Electron.ScrubberItem;
  21996. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  21997. type SerialPort = Electron.SerialPort;
  21998. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  21999. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  22000. type SharingItem = Electron.SharingItem;
  22001. type ShortcutDetails = Electron.ShortcutDetails;
  22002. type Size = Electron.Size;
  22003. type Task = Electron.Task;
  22004. type ThumbarButton = Electron.ThumbarButton;
  22005. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  22006. type TraceConfig = Electron.TraceConfig;
  22007. type Transaction = Electron.Transaction;
  22008. type UploadData = Electron.UploadData;
  22009. type UploadFile = Electron.UploadFile;
  22010. type UploadRawData = Electron.UploadRawData;
  22011. type USBDevice = Electron.USBDevice;
  22012. type UserDefaultTypes = Electron.UserDefaultTypes;
  22013. type WebPreferences = Electron.WebPreferences;
  22014. type WebRequestFilter = Electron.WebRequestFilter;
  22015. type WebSource = Electron.WebSource;
  22016. type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
  22017. }
  22018. namespace Utility {
  22019. type Event<Params extends object = {}> = Electron.Event<Params>;
  22020. type ClientRequest = Electron.ClientRequest;
  22021. type IncomingMessage = Electron.IncomingMessage;
  22022. const net: Net;
  22023. type Net = Electron.Net;
  22024. const systemPreferences: SystemPreferences;
  22025. type SystemPreferences = Electron.SystemPreferences;
  22026. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  22027. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  22028. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  22029. type AnimationSettings = Electron.AnimationSettings;
  22030. type AppDetailsOptions = Electron.AppDetailsOptions;
  22031. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  22032. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  22033. type AuthInfo = Electron.AuthInfo;
  22034. type AutoResizeOptions = Electron.AutoResizeOptions;
  22035. type BeforeSendResponse = Electron.BeforeSendResponse;
  22036. type BitmapOptions = Electron.BitmapOptions;
  22037. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  22038. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  22039. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  22040. type CallbackResponse = Electron.CallbackResponse;
  22041. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  22042. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  22043. type ClearDataOptions = Electron.ClearDataOptions;
  22044. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  22045. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  22046. type CloseOpts = Electron.CloseOpts;
  22047. type Config = Electron.Config;
  22048. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  22049. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  22050. type ContextMenuEvent = Electron.ContextMenuEvent;
  22051. type ContextMenuParams = Electron.ContextMenuParams;
  22052. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  22053. type CookiesGetFilter = Electron.CookiesGetFilter;
  22054. type CookiesSetDetails = Electron.CookiesSetDetails;
  22055. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  22056. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  22057. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  22058. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  22059. type Data = Electron.Data;
  22060. type DefaultFontFamily = Electron.DefaultFontFamily;
  22061. type Details = Electron.Details;
  22062. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  22063. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  22064. type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
  22065. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  22066. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  22067. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  22068. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  22069. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  22070. type DidNavigateEvent = Electron.DidNavigateEvent;
  22071. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  22072. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  22073. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  22074. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  22075. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  22076. type DownloadURLOptions = Electron.DownloadURLOptions;
  22077. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  22078. type EntryAtIndex = Electron.EntryAtIndex;
  22079. type FeedURLOptions = Electron.FeedURLOptions;
  22080. type FileIconOptions = Electron.FileIconOptions;
  22081. type FindInPageOptions = Electron.FindInPageOptions;
  22082. type FocusOptions = Electron.FocusOptions;
  22083. type ForkOptions = Electron.ForkOptions;
  22084. type FoundInPageEvent = Electron.FoundInPageEvent;
  22085. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  22086. type FromPartitionOptions = Electron.FromPartitionOptions;
  22087. type FromPathOptions = Electron.FromPathOptions;
  22088. type HandlerDetails = Electron.HandlerDetails;
  22089. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  22090. type HeapStatistics = Electron.HeapStatistics;
  22091. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  22092. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  22093. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  22094. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  22095. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  22096. type Info = Electron.Info;
  22097. type Input = Electron.Input;
  22098. type InsertCSSOptions = Electron.InsertCSSOptions;
  22099. type IpcMessageEvent = Electron.IpcMessageEvent;
  22100. type Item = Electron.Item;
  22101. type JumpListSettings = Electron.JumpListSettings;
  22102. type LoadCommitEvent = Electron.LoadCommitEvent;
  22103. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  22104. type LoadFileOptions = Electron.LoadFileOptions;
  22105. type LoadURLOptions = Electron.LoadURLOptions;
  22106. type LoginItemSettings = Electron.LoginItemSettings;
  22107. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  22108. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  22109. type MessageBoxOptions = Electron.MessageBoxOptions;
  22110. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  22111. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  22112. type MessageDetails = Electron.MessageDetails;
  22113. type MessageEvent = Electron.MessageEvent;
  22114. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  22115. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  22116. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  22117. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  22118. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  22119. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  22120. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  22121. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  22122. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  22123. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  22124. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  22125. type OpenDialogOptions = Electron.OpenDialogOptions;
  22126. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  22127. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  22128. type OpenExternalOptions = Electron.OpenExternalOptions;
  22129. type Options = Electron.Options;
  22130. type Opts = Electron.Opts;
  22131. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  22132. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  22133. type Parameters = Electron.Parameters;
  22134. type Payment = Electron.Payment;
  22135. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  22136. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  22137. type PopupOptions = Electron.PopupOptions;
  22138. type PreconnectOptions = Electron.PreconnectOptions;
  22139. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  22140. type Privileges = Electron.Privileges;
  22141. type ProgressBarOptions = Electron.ProgressBarOptions;
  22142. type Provider = Electron.Provider;
  22143. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  22144. type ReadBookmark = Electron.ReadBookmark;
  22145. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  22146. type RelaunchOptions = Electron.RelaunchOptions;
  22147. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  22148. type Request = Electron.Request;
  22149. type ResizeOptions = Electron.ResizeOptions;
  22150. type ResolveHostOptions = Electron.ResolveHostOptions;
  22151. type ResourceUsage = Electron.ResourceUsage;
  22152. type Response = Electron.Response;
  22153. type Result = Electron.Result;
  22154. type SaveDialogOptions = Electron.SaveDialogOptions;
  22155. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  22156. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  22157. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  22158. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  22159. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  22160. type Settings = Electron.Settings;
  22161. type SourcesOptions = Electron.SourcesOptions;
  22162. type StartLoggingOptions = Electron.StartLoggingOptions;
  22163. type Streams = Electron.Streams;
  22164. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  22165. type TitleBarOverlay = Electron.TitleBarOverlay;
  22166. type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
  22167. type TitleOptions = Electron.TitleOptions;
  22168. type ToBitmapOptions = Electron.ToBitmapOptions;
  22169. type ToDataURLOptions = Electron.ToDataURLOptions;
  22170. type ToPNGOptions = Electron.ToPNGOptions;
  22171. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  22172. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  22173. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  22174. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  22175. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  22176. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  22177. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  22178. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  22179. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  22180. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  22181. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  22182. type UdpPortRange = Electron.UdpPortRange;
  22183. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  22184. type UploadProgress = Electron.UploadProgress;
  22185. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  22186. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  22187. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  22188. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  22189. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  22190. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  22191. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  22192. type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
  22193. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  22194. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  22195. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  22196. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  22197. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  22198. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  22199. type WillNavigateEvent = Electron.WillNavigateEvent;
  22200. type WillResizeDetails = Electron.WillResizeDetails;
  22201. type EditFlags = Electron.EditFlags;
  22202. type Env = Electron.Env;
  22203. type FoundInPageResult = Electron.FoundInPageResult;
  22204. type LaunchItems = Electron.LaunchItems;
  22205. type Margins = Electron.Margins;
  22206. type MediaFlags = Electron.MediaFlags;
  22207. type PageRanges = Electron.PageRanges;
  22208. type Params = Electron.Params;
  22209. type Video = Electron.Video;
  22210. type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
  22211. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  22212. type BluetoothDevice = Electron.BluetoothDevice;
  22213. type Certificate = Electron.Certificate;
  22214. type CertificatePrincipal = Electron.CertificatePrincipal;
  22215. type Cookie = Electron.Cookie;
  22216. type CPUUsage = Electron.CPUUsage;
  22217. type CrashReport = Electron.CrashReport;
  22218. type CustomScheme = Electron.CustomScheme;
  22219. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  22220. type Display = Electron.Display;
  22221. type Extension = Electron.Extension;
  22222. type ExtensionInfo = Electron.ExtensionInfo;
  22223. type FileFilter = Electron.FileFilter;
  22224. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  22225. type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
  22226. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  22227. type HIDDevice = Electron.HIDDevice;
  22228. type InputEvent = Electron.InputEvent;
  22229. type IpcMainEvent = Electron.IpcMainEvent;
  22230. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  22231. type IpcRendererEvent = Electron.IpcRendererEvent;
  22232. type JumpListCategory = Electron.JumpListCategory;
  22233. type JumpListItem = Electron.JumpListItem;
  22234. type KeyboardEvent = Electron.KeyboardEvent;
  22235. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  22236. type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
  22237. type MemoryInfo = Electron.MemoryInfo;
  22238. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  22239. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  22240. type MouseInputEvent = Electron.MouseInputEvent;
  22241. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  22242. type NotificationAction = Electron.NotificationAction;
  22243. type NotificationResponse = Electron.NotificationResponse;
  22244. type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
  22245. type PaymentDiscount = Electron.PaymentDiscount;
  22246. type PermissionRequest = Electron.PermissionRequest;
  22247. type Point = Electron.Point;
  22248. type PostBody = Electron.PostBody;
  22249. type PrinterInfo = Electron.PrinterInfo;
  22250. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  22251. type ProcessMetric = Electron.ProcessMetric;
  22252. type Product = Electron.Product;
  22253. type ProductDiscount = Electron.ProductDiscount;
  22254. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  22255. type ProtocolRequest = Electron.ProtocolRequest;
  22256. type ProtocolResponse = Electron.ProtocolResponse;
  22257. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  22258. type ProxyConfig = Electron.ProxyConfig;
  22259. type Rectangle = Electron.Rectangle;
  22260. type Referrer = Electron.Referrer;
  22261. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  22262. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  22263. type ResolvedHost = Electron.ResolvedHost;
  22264. type ScrubberItem = Electron.ScrubberItem;
  22265. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  22266. type SerialPort = Electron.SerialPort;
  22267. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  22268. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  22269. type SharingItem = Electron.SharingItem;
  22270. type ShortcutDetails = Electron.ShortcutDetails;
  22271. type Size = Electron.Size;
  22272. type Task = Electron.Task;
  22273. type ThumbarButton = Electron.ThumbarButton;
  22274. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  22275. type TraceConfig = Electron.TraceConfig;
  22276. type Transaction = Electron.Transaction;
  22277. type UploadData = Electron.UploadData;
  22278. type UploadFile = Electron.UploadFile;
  22279. type UploadRawData = Electron.UploadRawData;
  22280. type USBDevice = Electron.USBDevice;
  22281. type UserDefaultTypes = Electron.UserDefaultTypes;
  22282. type WebPreferences = Electron.WebPreferences;
  22283. type WebRequestFilter = Electron.WebRequestFilter;
  22284. type WebSource = Electron.WebSource;
  22285. type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
  22286. }
  22287. namespace CrossProcessExports {
  22288. type Event<Params extends object = {}> = Electron.Event<Params>;
  22289. const app: App;
  22290. type App = Electron.App;
  22291. const autoUpdater: AutoUpdater;
  22292. type AutoUpdater = Electron.AutoUpdater;
  22293. class BaseWindow extends Electron.BaseWindow {}
  22294. class BrowserView extends Electron.BrowserView {}
  22295. class BrowserWindow extends Electron.BrowserWindow {}
  22296. type ClientRequest = Electron.ClientRequest;
  22297. const clipboard: Clipboard;
  22298. type Clipboard = Electron.Clipboard;
  22299. type CommandLine = Electron.CommandLine;
  22300. const contentTracing: ContentTracing;
  22301. type ContentTracing = Electron.ContentTracing;
  22302. const contextBridge: ContextBridge;
  22303. type ContextBridge = Electron.ContextBridge;
  22304. type Cookies = Electron.Cookies;
  22305. const crashReporter: CrashReporter;
  22306. type CrashReporter = Electron.CrashReporter;
  22307. type Debugger = Electron.Debugger;
  22308. const desktopCapturer: DesktopCapturer;
  22309. type DesktopCapturer = Electron.DesktopCapturer;
  22310. const dialog: Dialog;
  22311. type Dialog = Electron.Dialog;
  22312. type Dock = Electron.Dock;
  22313. type DownloadItem = Electron.DownloadItem;
  22314. const globalShortcut: GlobalShortcut;
  22315. type GlobalShortcut = Electron.GlobalShortcut;
  22316. const inAppPurchase: InAppPurchase;
  22317. type InAppPurchase = Electron.InAppPurchase;
  22318. type IncomingMessage = Electron.IncomingMessage;
  22319. const ipcMain: IpcMain;
  22320. type IpcMain = Electron.IpcMain;
  22321. const ipcRenderer: IpcRenderer;
  22322. type IpcRenderer = Electron.IpcRenderer;
  22323. class Menu extends Electron.Menu {}
  22324. class MenuItem extends Electron.MenuItem {}
  22325. class MessageChannelMain extends Electron.MessageChannelMain {}
  22326. type MessagePortMain = Electron.MessagePortMain;
  22327. const nativeImage: typeof NativeImage;
  22328. type NativeImage = Electron.NativeImage;
  22329. const nativeTheme: NativeTheme;
  22330. type NativeTheme = Electron.NativeTheme;
  22331. type NavigationHistory = Electron.NavigationHistory;
  22332. const net: Net;
  22333. type Net = Electron.Net;
  22334. const netLog: NetLog;
  22335. type NetLog = Electron.NetLog;
  22336. class Notification extends Electron.Notification {}
  22337. const powerMonitor: PowerMonitor;
  22338. type PowerMonitor = Electron.PowerMonitor;
  22339. const powerSaveBlocker: PowerSaveBlocker;
  22340. type PowerSaveBlocker = Electron.PowerSaveBlocker;
  22341. const protocol: Protocol;
  22342. type Protocol = Electron.Protocol;
  22343. const pushNotifications: PushNotifications;
  22344. type PushNotifications = Electron.PushNotifications;
  22345. const safeStorage: SafeStorage;
  22346. type SafeStorage = Electron.SafeStorage;
  22347. const screen: Screen;
  22348. type Screen = Electron.Screen;
  22349. type ServiceWorkers = Electron.ServiceWorkers;
  22350. const session: typeof Session;
  22351. type Session = Electron.Session;
  22352. class ShareMenu extends Electron.ShareMenu {}
  22353. const shell: Shell;
  22354. type Shell = Electron.Shell;
  22355. const systemPreferences: SystemPreferences;
  22356. type SystemPreferences = Electron.SystemPreferences;
  22357. class TouchBar extends Electron.TouchBar {}
  22358. type TouchBarButton = Electron.TouchBarButton;
  22359. type TouchBarColorPicker = Electron.TouchBarColorPicker;
  22360. type TouchBarGroup = Electron.TouchBarGroup;
  22361. type TouchBarLabel = Electron.TouchBarLabel;
  22362. type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
  22363. type TouchBarPopover = Electron.TouchBarPopover;
  22364. type TouchBarScrubber = Electron.TouchBarScrubber;
  22365. type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
  22366. type TouchBarSlider = Electron.TouchBarSlider;
  22367. type TouchBarSpacer = Electron.TouchBarSpacer;
  22368. class Tray extends Electron.Tray {}
  22369. const utilityProcess: typeof UtilityProcess;
  22370. type UtilityProcess = Electron.UtilityProcess;
  22371. class View extends Electron.View {}
  22372. const webContents: typeof WebContents;
  22373. type WebContents = Electron.WebContents;
  22374. class WebContentsView extends Electron.WebContentsView {}
  22375. const webFrame: WebFrame;
  22376. type WebFrame = Electron.WebFrame;
  22377. const webFrameMain: typeof WebFrameMain;
  22378. type WebFrameMain = Electron.WebFrameMain;
  22379. type WebRequest = Electron.WebRequest;
  22380. const webUtils: WebUtils;
  22381. type WebUtils = Electron.WebUtils;
  22382. type WebviewTag = Electron.WebviewTag;
  22383. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  22384. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  22385. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  22386. type AnimationSettings = Electron.AnimationSettings;
  22387. type AppDetailsOptions = Electron.AppDetailsOptions;
  22388. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  22389. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  22390. type AuthInfo = Electron.AuthInfo;
  22391. type AutoResizeOptions = Electron.AutoResizeOptions;
  22392. type BeforeSendResponse = Electron.BeforeSendResponse;
  22393. type BitmapOptions = Electron.BitmapOptions;
  22394. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  22395. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  22396. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  22397. type CallbackResponse = Electron.CallbackResponse;
  22398. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  22399. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  22400. type ClearDataOptions = Electron.ClearDataOptions;
  22401. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  22402. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  22403. type CloseOpts = Electron.CloseOpts;
  22404. type Config = Electron.Config;
  22405. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  22406. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  22407. type ContextMenuEvent = Electron.ContextMenuEvent;
  22408. type ContextMenuParams = Electron.ContextMenuParams;
  22409. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  22410. type CookiesGetFilter = Electron.CookiesGetFilter;
  22411. type CookiesSetDetails = Electron.CookiesSetDetails;
  22412. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  22413. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  22414. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  22415. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  22416. type Data = Electron.Data;
  22417. type DefaultFontFamily = Electron.DefaultFontFamily;
  22418. type Details = Electron.Details;
  22419. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  22420. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  22421. type DevtoolsSearchQueryEvent = Electron.DevtoolsSearchQueryEvent;
  22422. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  22423. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  22424. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  22425. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  22426. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  22427. type DidNavigateEvent = Electron.DidNavigateEvent;
  22428. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  22429. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  22430. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  22431. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  22432. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  22433. type DownloadURLOptions = Electron.DownloadURLOptions;
  22434. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  22435. type EntryAtIndex = Electron.EntryAtIndex;
  22436. type FeedURLOptions = Electron.FeedURLOptions;
  22437. type FileIconOptions = Electron.FileIconOptions;
  22438. type FindInPageOptions = Electron.FindInPageOptions;
  22439. type FocusOptions = Electron.FocusOptions;
  22440. type ForkOptions = Electron.ForkOptions;
  22441. type FoundInPageEvent = Electron.FoundInPageEvent;
  22442. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  22443. type FromPartitionOptions = Electron.FromPartitionOptions;
  22444. type FromPathOptions = Electron.FromPathOptions;
  22445. type HandlerDetails = Electron.HandlerDetails;
  22446. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  22447. type HeapStatistics = Electron.HeapStatistics;
  22448. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  22449. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  22450. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  22451. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  22452. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  22453. type Info = Electron.Info;
  22454. type Input = Electron.Input;
  22455. type InsertCSSOptions = Electron.InsertCSSOptions;
  22456. type IpcMessageEvent = Electron.IpcMessageEvent;
  22457. type Item = Electron.Item;
  22458. type JumpListSettings = Electron.JumpListSettings;
  22459. type LoadCommitEvent = Electron.LoadCommitEvent;
  22460. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  22461. type LoadFileOptions = Electron.LoadFileOptions;
  22462. type LoadURLOptions = Electron.LoadURLOptions;
  22463. type LoginItemSettings = Electron.LoginItemSettings;
  22464. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  22465. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  22466. type MessageBoxOptions = Electron.MessageBoxOptions;
  22467. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  22468. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  22469. type MessageDetails = Electron.MessageDetails;
  22470. type MessageEvent = Electron.MessageEvent;
  22471. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  22472. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  22473. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  22474. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  22475. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  22476. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  22477. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  22478. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  22479. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  22480. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  22481. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  22482. type OpenDialogOptions = Electron.OpenDialogOptions;
  22483. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  22484. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  22485. type OpenExternalOptions = Electron.OpenExternalOptions;
  22486. type Options = Electron.Options;
  22487. type Opts = Electron.Opts;
  22488. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  22489. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  22490. type Parameters = Electron.Parameters;
  22491. type Payment = Electron.Payment;
  22492. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  22493. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  22494. type PopupOptions = Electron.PopupOptions;
  22495. type PreconnectOptions = Electron.PreconnectOptions;
  22496. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  22497. type Privileges = Electron.Privileges;
  22498. type ProgressBarOptions = Electron.ProgressBarOptions;
  22499. type Provider = Electron.Provider;
  22500. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  22501. type ReadBookmark = Electron.ReadBookmark;
  22502. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  22503. type RelaunchOptions = Electron.RelaunchOptions;
  22504. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  22505. type Request = Electron.Request;
  22506. type ResizeOptions = Electron.ResizeOptions;
  22507. type ResolveHostOptions = Electron.ResolveHostOptions;
  22508. type ResourceUsage = Electron.ResourceUsage;
  22509. type Response = Electron.Response;
  22510. type Result = Electron.Result;
  22511. type SaveDialogOptions = Electron.SaveDialogOptions;
  22512. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  22513. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  22514. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  22515. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  22516. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  22517. type Settings = Electron.Settings;
  22518. type SourcesOptions = Electron.SourcesOptions;
  22519. type StartLoggingOptions = Electron.StartLoggingOptions;
  22520. type Streams = Electron.Streams;
  22521. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  22522. type TitleBarOverlay = Electron.TitleBarOverlay;
  22523. type TitleBarOverlayOptions = Electron.TitleBarOverlayOptions;
  22524. type TitleOptions = Electron.TitleOptions;
  22525. type ToBitmapOptions = Electron.ToBitmapOptions;
  22526. type ToDataURLOptions = Electron.ToDataURLOptions;
  22527. type ToPNGOptions = Electron.ToPNGOptions;
  22528. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  22529. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  22530. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  22531. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  22532. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  22533. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  22534. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  22535. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  22536. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  22537. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  22538. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  22539. type UdpPortRange = Electron.UdpPortRange;
  22540. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  22541. type UploadProgress = Electron.UploadProgress;
  22542. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  22543. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  22544. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  22545. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  22546. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  22547. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  22548. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  22549. type WebContentsViewConstructorOptions = Electron.WebContentsViewConstructorOptions;
  22550. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  22551. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  22552. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  22553. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  22554. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  22555. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  22556. type WillNavigateEvent = Electron.WillNavigateEvent;
  22557. type WillResizeDetails = Electron.WillResizeDetails;
  22558. type EditFlags = Electron.EditFlags;
  22559. type Env = Electron.Env;
  22560. type FoundInPageResult = Electron.FoundInPageResult;
  22561. type LaunchItems = Electron.LaunchItems;
  22562. type Margins = Electron.Margins;
  22563. type MediaFlags = Electron.MediaFlags;
  22564. type PageRanges = Electron.PageRanges;
  22565. type Params = Electron.Params;
  22566. type Video = Electron.Video;
  22567. type BaseWindowConstructorOptions = Electron.BaseWindowConstructorOptions;
  22568. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  22569. type BluetoothDevice = Electron.BluetoothDevice;
  22570. type Certificate = Electron.Certificate;
  22571. type CertificatePrincipal = Electron.CertificatePrincipal;
  22572. type Cookie = Electron.Cookie;
  22573. type CPUUsage = Electron.CPUUsage;
  22574. type CrashReport = Electron.CrashReport;
  22575. type CustomScheme = Electron.CustomScheme;
  22576. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  22577. type Display = Electron.Display;
  22578. type Extension = Electron.Extension;
  22579. type ExtensionInfo = Electron.ExtensionInfo;
  22580. type FileFilter = Electron.FileFilter;
  22581. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  22582. type FilesystemPermissionRequest = Electron.FilesystemPermissionRequest;
  22583. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  22584. type HIDDevice = Electron.HIDDevice;
  22585. type InputEvent = Electron.InputEvent;
  22586. type IpcMainEvent = Electron.IpcMainEvent;
  22587. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  22588. type IpcRendererEvent = Electron.IpcRendererEvent;
  22589. type JumpListCategory = Electron.JumpListCategory;
  22590. type JumpListItem = Electron.JumpListItem;
  22591. type KeyboardEvent = Electron.KeyboardEvent;
  22592. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  22593. type MediaAccessPermissionRequest = Electron.MediaAccessPermissionRequest;
  22594. type MemoryInfo = Electron.MemoryInfo;
  22595. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  22596. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  22597. type MouseInputEvent = Electron.MouseInputEvent;
  22598. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  22599. type NotificationAction = Electron.NotificationAction;
  22600. type NotificationResponse = Electron.NotificationResponse;
  22601. type OpenExternalPermissionRequest = Electron.OpenExternalPermissionRequest;
  22602. type PaymentDiscount = Electron.PaymentDiscount;
  22603. type PermissionRequest = Electron.PermissionRequest;
  22604. type Point = Electron.Point;
  22605. type PostBody = Electron.PostBody;
  22606. type PrinterInfo = Electron.PrinterInfo;
  22607. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  22608. type ProcessMetric = Electron.ProcessMetric;
  22609. type Product = Electron.Product;
  22610. type ProductDiscount = Electron.ProductDiscount;
  22611. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  22612. type ProtocolRequest = Electron.ProtocolRequest;
  22613. type ProtocolResponse = Electron.ProtocolResponse;
  22614. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  22615. type ProxyConfig = Electron.ProxyConfig;
  22616. type Rectangle = Electron.Rectangle;
  22617. type Referrer = Electron.Referrer;
  22618. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  22619. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  22620. type ResolvedHost = Electron.ResolvedHost;
  22621. type ScrubberItem = Electron.ScrubberItem;
  22622. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  22623. type SerialPort = Electron.SerialPort;
  22624. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  22625. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  22626. type SharingItem = Electron.SharingItem;
  22627. type ShortcutDetails = Electron.ShortcutDetails;
  22628. type Size = Electron.Size;
  22629. type Task = Electron.Task;
  22630. type ThumbarButton = Electron.ThumbarButton;
  22631. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  22632. type TraceConfig = Electron.TraceConfig;
  22633. type Transaction = Electron.Transaction;
  22634. type UploadData = Electron.UploadData;
  22635. type UploadFile = Electron.UploadFile;
  22636. type UploadRawData = Electron.UploadRawData;
  22637. type USBDevice = Electron.USBDevice;
  22638. type UserDefaultTypes = Electron.UserDefaultTypes;
  22639. type WebPreferences = Electron.WebPreferences;
  22640. type WebRequestFilter = Electron.WebRequestFilter;
  22641. type WebSource = Electron.WebSource;
  22642. type WindowOpenHandlerResponse = Electron.WindowOpenHandlerResponse;
  22643. }
  22644. const app: App;
  22645. const autoUpdater: AutoUpdater;
  22646. const clipboard: Clipboard;
  22647. const contentTracing: ContentTracing;
  22648. const contextBridge: ContextBridge;
  22649. const crashReporter: CrashReporter;
  22650. const desktopCapturer: DesktopCapturer;
  22651. const dialog: Dialog;
  22652. const globalShortcut: GlobalShortcut;
  22653. const inAppPurchase: InAppPurchase;
  22654. const ipcMain: IpcMain;
  22655. const ipcRenderer: IpcRenderer;
  22656. const nativeImage: typeof NativeImage;
  22657. const nativeTheme: NativeTheme;
  22658. const net: Net;
  22659. const netLog: NetLog;
  22660. const parentPort: ParentPort;
  22661. const powerMonitor: PowerMonitor;
  22662. const powerSaveBlocker: PowerSaveBlocker;
  22663. const protocol: Protocol;
  22664. const pushNotifications: PushNotifications;
  22665. const safeStorage: SafeStorage;
  22666. const screen: Screen;
  22667. const session: typeof Session;
  22668. const shell: Shell;
  22669. const systemPreferences: SystemPreferences;
  22670. const utilityProcess: typeof UtilityProcess;
  22671. const webContents: typeof WebContents;
  22672. const webFrame: WebFrame;
  22673. const webFrameMain: typeof WebFrameMain;
  22674. const webUtils: WebUtils;
  22675. }
  22676. declare module 'electron' {
  22677. export = Electron.CrossProcessExports;
  22678. }
  22679. declare module 'electron/main' {
  22680. export = Electron.Main;
  22681. }
  22682. declare module 'electron/common' {
  22683. export = Electron.Common;
  22684. }
  22685. declare module 'electron/renderer' {
  22686. export = Electron.Renderer;
  22687. }
  22688. declare module 'electron/utility' {
  22689. export = Electron.Utility;
  22690. }
  22691. interface NodeRequireFunction {
  22692. (moduleName: 'electron'): typeof Electron.CrossProcessExports;
  22693. (moduleName: 'electron/main'): typeof Electron.Main;
  22694. (moduleName: 'electron/common'): typeof Electron.Common;
  22695. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  22696. (moduleName: 'electron/utility'): typeof Electron.Utility;
  22697. }
  22698. interface NodeRequire {
  22699. (moduleName: 'electron'): typeof Electron.CrossProcessExports;
  22700. (moduleName: 'electron/main'): typeof Electron.Main;
  22701. (moduleName: 'electron/common'): typeof Electron.Common;
  22702. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  22703. (moduleName: 'electron/utility'): typeof Electron.Utility;
  22704. }
  22705. interface File {
  22706. /**
  22707. * The real path to the file on the users filesystem
  22708. */
  22709. path: string;
  22710. }
  22711. declare module 'original-fs' {
  22712. import * as fs from 'fs';
  22713. export = fs;
  22714. }
  22715. declare module 'node:original-fs' {
  22716. import * as fs from 'fs';
  22717. export = fs;
  22718. }
  22719. interface Document {
  22720. createElement(tagName: 'webview'): Electron.WebviewTag;
  22721. }
  22722. declare namespace NodeJS {
  22723. interface Process extends NodeJS.EventEmitter {
  22724. // Docs: https://electronjs.org/docs/api/process
  22725. /**
  22726. * Emitted when Electron has loaded its internal initialization script and is
  22727. * beginning to load the web page or the main script.
  22728. */
  22729. on(event: 'loaded', listener: Function): this;
  22730. off(event: 'loaded', listener: Function): this;
  22731. once(event: 'loaded', listener: Function): this;
  22732. addListener(event: 'loaded', listener: Function): this;
  22733. removeListener(event: 'loaded', listener: Function): this;
  22734. /**
  22735. * Causes the main thread of the current process crash.
  22736. */
  22737. crash(): void;
  22738. /**
  22739. * * `allocated` Integer - Size of all allocated objects in Kilobytes.
  22740. * * `total` Integer - Total allocated space in Kilobytes.
  22741. *
  22742. * Returns an object with Blink memory information. It can be useful for debugging
  22743. * rendering / DOM related memory issues. Note that all values are reported in
  22744. * Kilobytes.
  22745. */
  22746. getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
  22747. getCPUUsage(): Electron.CPUUsage;
  22748. /**
  22749. * The number of milliseconds since epoch, or `null` if the information is
  22750. * unavailable
  22751. *
  22752. * Indicates the creation time of the application. The time is represented as
  22753. * number of milliseconds since epoch. It returns null if it is unable to get the
  22754. * process creation time.
  22755. */
  22756. getCreationTime(): (number) | (null);
  22757. /**
  22758. * * `totalHeapSize` Integer
  22759. * * `totalHeapSizeExecutable` Integer
  22760. * * `totalPhysicalSize` Integer
  22761. * * `totalAvailableSize` Integer
  22762. * * `usedHeapSize` Integer
  22763. * * `heapSizeLimit` Integer
  22764. * * `mallocedMemory` Integer
  22765. * * `peakMallocedMemory` Integer
  22766. * * `doesZapGarbage` boolean
  22767. *
  22768. * Returns an object with V8 heap statistics. Note that all statistics are reported
  22769. * in Kilobytes.
  22770. */
  22771. getHeapStatistics(): Electron.HeapStatistics;
  22772. /**
  22773. * Resolves with a ProcessMemoryInfo
  22774. *
  22775. * Returns an object giving memory usage statistics about the current process. Note
  22776. * that all statistics are reported in Kilobytes. This api should be called after
  22777. * app ready.
  22778. *
  22779. * Chromium does not provide `residentSet` value for macOS. This is because macOS
  22780. * performs in-memory compression of pages that haven't been recently used. As a
  22781. * result the resident set size value is not what one would expect. `private`
  22782. * memory is more representative of the actual pre-compression memory usage of the
  22783. * process on macOS.
  22784. */
  22785. getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
  22786. /**
  22787. * * `total` Integer - The total amount of physical memory in Kilobytes available
  22788. * to the system.
  22789. * * `free` Integer - The total amount of memory not being used by applications or
  22790. * disk cache.
  22791. * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
  22792. * Kilobytes available to the system.
  22793. * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
  22794. * Kilobytes available to the system.
  22795. *
  22796. * Returns an object giving memory usage statistics about the entire system. Note
  22797. * that all statistics are reported in Kilobytes.
  22798. */
  22799. getSystemMemoryInfo(): Electron.SystemMemoryInfo;
  22800. /**
  22801. * The version of the host operating system.
  22802. *
  22803. * Example:
  22804. *
  22805. * **Note:** It returns the actual operating system version instead of kernel
  22806. * version on macOS unlike `os.release()`.
  22807. */
  22808. getSystemVersion(): string;
  22809. /**
  22810. * Causes the main thread of the current process hang.
  22811. */
  22812. hang(): void;
  22813. /**
  22814. * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
  22815. * whichever is lower for the current process.
  22816. *
  22817. * @platform darwin,linux
  22818. */
  22819. setFdLimit(maxDescriptors: number): void;
  22820. /**
  22821. * Indicates whether the snapshot has been created successfully.
  22822. *
  22823. * Takes a V8 heap snapshot and saves it to `filePath`.
  22824. */
  22825. takeHeapSnapshot(filePath: string): boolean;
  22826. /**
  22827. * A `string` representing Chrome's version string.
  22828. *
  22829. */
  22830. readonly chrome: string;
  22831. /**
  22832. * A `string` (optional) representing a globally unique ID of the current
  22833. * JavaScript context. Each frame has its own JavaScript context. When
  22834. * contextIsolation is enabled, the isolated world also has a separate JavaScript
  22835. * context. This property is only available in the renderer process.
  22836. *
  22837. */
  22838. readonly contextId?: string;
  22839. /**
  22840. * A `boolean` that indicates whether the current renderer context has
  22841. * `contextIsolation` enabled. It is `undefined` in the main process.
  22842. *
  22843. */
  22844. readonly contextIsolated: boolean;
  22845. /**
  22846. * A `boolean`. When the app is started by being passed as parameter to the default
  22847. * Electron executable, this property is `true` in the main process, otherwise it
  22848. * is `undefined`. For example when running the app with `electron .`, it is
  22849. * `true`, even if the app is packaged (`isPackaged`) is `true`. This can be useful
  22850. * to determine how many arguments will need to be sliced off from `process.argv`.
  22851. *
  22852. */
  22853. readonly defaultApp: boolean;
  22854. /**
  22855. * A `string` representing Electron's version string.
  22856. *
  22857. */
  22858. readonly electron: string;
  22859. /**
  22860. * A `boolean`, `true` when the current renderer context is the "main" renderer
  22861. * frame. If you want the ID of the current frame you should use
  22862. * `webFrame.routingId`.
  22863. *
  22864. */
  22865. readonly isMainFrame: boolean;
  22866. /**
  22867. * A `boolean`. For Mac App Store build, this property is `true`, for other builds
  22868. * it is `undefined`.
  22869. *
  22870. */
  22871. readonly mas: boolean;
  22872. /**
  22873. * A `boolean` that controls ASAR support inside your application. Setting this to
  22874. * `true` will disable the support for `asar` archives in Node's built-in modules.
  22875. */
  22876. noAsar: boolean;
  22877. /**
  22878. * A `boolean` that controls whether or not deprecation warnings are printed to
  22879. * `stderr`. Setting this to `true` will silence deprecation warnings. This
  22880. * property is used instead of the `--no-deprecation` command line flag.
  22881. */
  22882. noDeprecation: boolean;
  22883. /**
  22884. * A `Electron.ParentPort` property if this is a `UtilityProcess` (or `null`
  22885. * otherwise) allowing communication with the parent process.
  22886. */
  22887. parentPort: Electron.ParentPort;
  22888. /**
  22889. * A `string` representing the path to the resources directory.
  22890. *
  22891. */
  22892. readonly resourcesPath: string;
  22893. /**
  22894. * A `boolean`. When the renderer process is sandboxed, this property is `true`,
  22895. * otherwise it is `undefined`.
  22896. *
  22897. */
  22898. readonly sandboxed: boolean;
  22899. /**
  22900. * A `boolean` that controls whether or not deprecation warnings will be thrown as
  22901. * exceptions. Setting this to `true` will throw errors for deprecations. This
  22902. * property is used instead of the `--throw-deprecation` command line flag.
  22903. */
  22904. throwDeprecation: boolean;
  22905. /**
  22906. * A `boolean` that controls whether or not deprecations printed to `stderr`
  22907. * include their stack trace. Setting this to `true` will print stack traces for
  22908. * deprecations. This property is instead of the `--trace-deprecation` command line
  22909. * flag.
  22910. */
  22911. traceDeprecation: boolean;
  22912. /**
  22913. * A `boolean` that controls whether or not process warnings printed to `stderr`
  22914. * include their stack trace. Setting this to `true` will print stack traces for
  22915. * process warnings (including deprecations). This property is instead of the
  22916. * `--trace-warnings` command line flag.
  22917. */
  22918. traceProcessWarnings: boolean;
  22919. /**
  22920. * A `string` representing the current process's type, can be:
  22921. *
  22922. * * `browser` - The main process
  22923. * * `renderer` - A renderer process
  22924. * * `worker` - In a web worker
  22925. * * `utility` - In a node process launched as a service
  22926. *
  22927. */
  22928. readonly type: ('browser' | 'renderer' | 'worker' | 'utility');
  22929. /**
  22930. * A `boolean`. If the app is running as a Windows Store app (appx), this property
  22931. * is `true`, for otherwise it is `undefined`.
  22932. *
  22933. */
  22934. readonly windowsStore: boolean;
  22935. }
  22936. interface ProcessVersions {
  22937. readonly electron: string;
  22938. readonly chrome: string;
  22939. }
  22940. }