Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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 653KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185
  1. // Type definitions for Electron 13.5.1
  2. // Project: http://electronjs.org/
  3. // Definitions by: The Electron Team <https://github.com/electron/electron>
  4. // Definitions: https://github.com/electron/electron-typescript-definitions
  5. /// <reference types="node" />
  6. type GlobalEvent = Event & { returnValue: any };
  7. declare namespace Electron {
  8. const NodeEventEmitter: typeof import('events').EventEmitter;
  9. class Accelerator extends String {
  10. }
  11. interface App extends NodeJS.EventEmitter {
  12. // Docs: https://electronjs.org/docs/api/app
  13. /**
  14. * Emitted when Chrome's accessibility support changes. This event fires when
  15. * assistive technologies, such as screen readers, are enabled or disabled. See
  16. * https://www.chromium.org/developers/design-documents/accessibility for more
  17. * details.
  18. *
  19. * @platform darwin,win32
  20. */
  21. on(event: 'accessibility-support-changed', listener: (event: Event,
  22. /**
  23. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  24. */
  25. accessibilitySupportEnabled: boolean) => void): this;
  26. once(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. addListener(event: 'accessibility-support-changed', listener: (event: Event,
  32. /**
  33. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  34. */
  35. accessibilitySupportEnabled: boolean) => void): this;
  36. removeListener(event: 'accessibility-support-changed', listener: (event: Event,
  37. /**
  38. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  39. */
  40. accessibilitySupportEnabled: boolean) => void): this;
  41. /**
  42. * Emitted when the application is activated. Various actions can trigger this
  43. * event, such as launching the application for the first time, attempting to
  44. * re-launch the application when it's already running, or clicking on the
  45. * application's dock or taskbar icon.
  46. *
  47. * @platform darwin
  48. */
  49. on(event: 'activate', listener: (event: Event,
  50. hasVisibleWindows: boolean) => void): this;
  51. once(event: 'activate', listener: (event: Event,
  52. hasVisibleWindows: boolean) => void): this;
  53. addListener(event: 'activate', listener: (event: Event,
  54. hasVisibleWindows: boolean) => void): this;
  55. removeListener(event: 'activate', listener: (event: Event,
  56. hasVisibleWindows: boolean) => void): this;
  57. /**
  58. * Emitted during Handoff after an activity from this device was successfully
  59. * resumed on another one.
  60. *
  61. * @platform darwin
  62. */
  63. on(event: 'activity-was-continued', listener: (event: Event,
  64. /**
  65. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  66. */
  67. type: string,
  68. /**
  69. * Contains app-specific state stored by the activity.
  70. */
  71. userInfo: unknown) => void): this;
  72. once(event: 'activity-was-continued', listener: (event: Event,
  73. /**
  74. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  75. */
  76. type: string,
  77. /**
  78. * Contains app-specific state stored by the activity.
  79. */
  80. userInfo: unknown) => void): this;
  81. addListener(event: 'activity-was-continued', listener: (event: Event,
  82. /**
  83. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  84. */
  85. type: string,
  86. /**
  87. * Contains app-specific state stored by the activity.
  88. */
  89. userInfo: unknown) => void): this;
  90. removeListener(event: 'activity-was-continued', listener: (event: Event,
  91. /**
  92. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  93. */
  94. type: string,
  95. /**
  96. * Contains app-specific state stored by the activity.
  97. */
  98. userInfo: unknown) => void): this;
  99. /**
  100. * Emitted before the application starts closing its windows. Calling
  101. * `event.preventDefault()` will prevent the default behavior, which is terminating
  102. * the application.
  103. *
  104. * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
  105. * then `before-quit` is emitted *after* emitting `close` event on all windows and
  106. * closing them.
  107. *
  108. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  109. * a shutdown/restart of the system or a user logout.
  110. */
  111. on(event: 'before-quit', listener: (event: Event) => void): this;
  112. once(event: 'before-quit', listener: (event: Event) => void): this;
  113. addListener(event: 'before-quit', listener: (event: Event) => void): this;
  114. removeListener(event: 'before-quit', listener: (event: Event) => void): this;
  115. /**
  116. * Emitted when a browserWindow gets blurred.
  117. */
  118. on(event: 'browser-window-blur', listener: (event: Event,
  119. window: BrowserWindow) => void): this;
  120. once(event: 'browser-window-blur', listener: (event: Event,
  121. window: BrowserWindow) => void): this;
  122. addListener(event: 'browser-window-blur', listener: (event: Event,
  123. window: BrowserWindow) => void): this;
  124. removeListener(event: 'browser-window-blur', listener: (event: Event,
  125. window: BrowserWindow) => void): this;
  126. /**
  127. * Emitted when a new browserWindow is created.
  128. */
  129. on(event: 'browser-window-created', listener: (event: Event,
  130. window: BrowserWindow) => void): this;
  131. once(event: 'browser-window-created', listener: (event: Event,
  132. window: BrowserWindow) => void): this;
  133. addListener(event: 'browser-window-created', listener: (event: Event,
  134. window: BrowserWindow) => void): this;
  135. removeListener(event: 'browser-window-created', listener: (event: Event,
  136. window: BrowserWindow) => void): this;
  137. /**
  138. * Emitted when a browserWindow gets focused.
  139. */
  140. on(event: 'browser-window-focus', listener: (event: Event,
  141. window: BrowserWindow) => void): this;
  142. once(event: 'browser-window-focus', listener: (event: Event,
  143. window: BrowserWindow) => void): this;
  144. addListener(event: 'browser-window-focus', listener: (event: Event,
  145. window: BrowserWindow) => void): this;
  146. removeListener(event: 'browser-window-focus', listener: (event: Event,
  147. window: BrowserWindow) => void): this;
  148. /**
  149. * Emitted when failed to verify the `certificate` for `url`, to trust the
  150. * certificate you should prevent the default behavior with
  151. * `event.preventDefault()` and call `callback(true)`.
  152. */
  153. on(event: 'certificate-error', listener: (event: Event,
  154. webContents: WebContents,
  155. url: string,
  156. /**
  157. * The error code
  158. */
  159. error: string,
  160. certificate: Certificate,
  161. callback: (isTrusted: boolean) => void) => void): this;
  162. once(event: 'certificate-error', listener: (event: Event,
  163. webContents: WebContents,
  164. url: string,
  165. /**
  166. * The error code
  167. */
  168. error: string,
  169. certificate: Certificate,
  170. callback: (isTrusted: boolean) => void) => void): this;
  171. addListener(event: 'certificate-error', listener: (event: Event,
  172. webContents: WebContents,
  173. url: string,
  174. /**
  175. * The error code
  176. */
  177. error: string,
  178. certificate: Certificate,
  179. callback: (isTrusted: boolean) => void) => void): this;
  180. removeListener(event: 'certificate-error', listener: (event: Event,
  181. webContents: WebContents,
  182. url: string,
  183. /**
  184. * The error code
  185. */
  186. error: string,
  187. certificate: Certificate,
  188. callback: (isTrusted: boolean) => void) => void): this;
  189. /**
  190. * Emitted when the child process unexpectedly disappears. This is normally because
  191. * it was crashed or killed. It does not include renderer processes.
  192. */
  193. on(event: 'child-process-gone', listener: (event: Event,
  194. details: Details) => void): this;
  195. once(event: 'child-process-gone', listener: (event: Event,
  196. details: Details) => void): this;
  197. addListener(event: 'child-process-gone', listener: (event: Event,
  198. details: Details) => void): this;
  199. removeListener(event: 'child-process-gone', listener: (event: Event,
  200. details: Details) => void): this;
  201. /**
  202. * Emitted during Handoff when an activity from a different device wants to be
  203. * resumed. You should call `event.preventDefault()` if you want to handle this
  204. * event.
  205. *
  206. * A user activity can be continued only in an app that has the same developer Team
  207. * ID as the activity's source app and that supports the activity's type. Supported
  208. * activity types are specified in the app's `Info.plist` under the
  209. * `NSUserActivityTypes` key.
  210. *
  211. * @platform darwin
  212. */
  213. on(event: 'continue-activity', listener: (event: Event,
  214. /**
  215. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  216. */
  217. type: string,
  218. /**
  219. * Contains app-specific state stored by the activity on another device.
  220. */
  221. userInfo: unknown) => void): this;
  222. once(event: 'continue-activity', listener: (event: Event,
  223. /**
  224. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  225. */
  226. type: string,
  227. /**
  228. * Contains app-specific state stored by the activity on another device.
  229. */
  230. userInfo: unknown) => void): this;
  231. addListener(event: 'continue-activity', listener: (event: Event,
  232. /**
  233. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  234. */
  235. type: string,
  236. /**
  237. * Contains app-specific state stored by the activity on another device.
  238. */
  239. userInfo: unknown) => void): this;
  240. removeListener(event: 'continue-activity', listener: (event: Event,
  241. /**
  242. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  243. */
  244. type: string,
  245. /**
  246. * Contains app-specific state stored by the activity on another device.
  247. */
  248. userInfo: unknown) => void): this;
  249. /**
  250. * Emitted during Handoff when an activity from a different device fails to be
  251. * resumed.
  252. *
  253. * @platform darwin
  254. */
  255. on(event: 'continue-activity-error', listener: (event: Event,
  256. /**
  257. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  258. */
  259. type: string,
  260. /**
  261. * A string with the error's localized description.
  262. */
  263. error: string) => void): this;
  264. once(event: 'continue-activity-error', listener: (event: Event,
  265. /**
  266. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  267. */
  268. type: string,
  269. /**
  270. * A string with the error's localized description.
  271. */
  272. error: string) => void): this;
  273. addListener(event: 'continue-activity-error', listener: (event: Event,
  274. /**
  275. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  276. */
  277. type: string,
  278. /**
  279. * A string with the error's localized description.
  280. */
  281. error: string) => void): this;
  282. removeListener(event: 'continue-activity-error', listener: (event: Event,
  283. /**
  284. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  285. */
  286. type: string,
  287. /**
  288. * A string with the error's localized description.
  289. */
  290. error: string) => void): this;
  291. /**
  292. * Emitted when `desktopCapturer.getSources()` is called in the renderer process of
  293. * `webContents`. Calling `event.preventDefault()` will make it return empty
  294. * sources.
  295. */
  296. on(event: 'desktop-capturer-get-sources', listener: (event: Event,
  297. webContents: WebContents) => void): this;
  298. once(event: 'desktop-capturer-get-sources', listener: (event: Event,
  299. webContents: WebContents) => void): this;
  300. addListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
  301. webContents: WebContents) => void): this;
  302. removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
  303. webContents: WebContents) => void): this;
  304. /**
  305. * Emitted when mac application become active. Difference from `activate` event is
  306. * that `did-become-active` is emitted every time the app becomes active, not only
  307. * when Dock icon is clicked or application is re-launched.
  308. *
  309. * @platform darwin
  310. */
  311. on(event: 'did-become-active', listener: (event: Event) => void): this;
  312. once(event: 'did-become-active', listener: (event: Event) => void): this;
  313. addListener(event: 'did-become-active', listener: (event: Event) => void): this;
  314. removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
  315. /**
  316. * Emitted whenever there is a GPU info update.
  317. */
  318. on(event: 'gpu-info-update', listener: Function): this;
  319. once(event: 'gpu-info-update', listener: Function): this;
  320. addListener(event: 'gpu-info-update', listener: Function): this;
  321. removeListener(event: 'gpu-info-update', listener: Function): this;
  322. /**
  323. * Emitted when the GPU process crashes or is killed.
  324. *
  325. * **Deprecated:** This event is superceded by the `child-process-gone` event which
  326. * contains more information about why the child process disappeared. It isn't
  327. * always because it crashed. The `killed` boolean can be replaced by checking
  328. * `reason === 'killed'` when you switch to that event.
  329. *
  330. * @deprecated
  331. */
  332. on(event: 'gpu-process-crashed', listener: (event: Event,
  333. killed: boolean) => void): this;
  334. once(event: 'gpu-process-crashed', listener: (event: Event,
  335. killed: boolean) => void): this;
  336. addListener(event: 'gpu-process-crashed', listener: (event: Event,
  337. killed: boolean) => void): this;
  338. removeListener(event: 'gpu-process-crashed', listener: (event: Event,
  339. killed: boolean) => void): this;
  340. /**
  341. * Emitted when `webContents` wants to do basic auth.
  342. *
  343. * The default behavior is to cancel all authentications. To override this you
  344. * should prevent the default behavior with `event.preventDefault()` and call
  345. * `callback(username, password)` with the credentials.
  346. *
  347. * If `callback` is called without a username or password, the authentication
  348. * request will be cancelled and the authentication error will be returned to the
  349. * page.
  350. */
  351. on(event: 'login', listener: (event: Event,
  352. webContents: WebContents,
  353. authenticationResponseDetails: AuthenticationResponseDetails,
  354. authInfo: AuthInfo,
  355. callback: (username?: string, password?: string) => void) => void): this;
  356. once(event: 'login', listener: (event: Event,
  357. webContents: WebContents,
  358. authenticationResponseDetails: AuthenticationResponseDetails,
  359. authInfo: AuthInfo,
  360. callback: (username?: string, password?: string) => void) => void): this;
  361. addListener(event: 'login', listener: (event: Event,
  362. webContents: WebContents,
  363. authenticationResponseDetails: AuthenticationResponseDetails,
  364. authInfo: AuthInfo,
  365. callback: (username?: string, password?: string) => void) => void): this;
  366. removeListener(event: 'login', listener: (event: Event,
  367. webContents: WebContents,
  368. authenticationResponseDetails: AuthenticationResponseDetails,
  369. authInfo: AuthInfo,
  370. callback: (username?: string, password?: string) => void) => void): this;
  371. /**
  372. * Emitted when the user clicks the native macOS new tab button. The new tab button
  373. * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
  374. *
  375. * @platform darwin
  376. */
  377. on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  378. once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  379. addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  380. removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  381. /**
  382. * Emitted when the user wants to open a file with the application. The `open-file`
  383. * event is usually emitted when the application is already open and the OS wants
  384. * to reuse the application to open the file. `open-file` is also emitted when a
  385. * file is dropped onto the dock and the application is not yet running. Make sure
  386. * to listen for the `open-file` event very early in your application startup to
  387. * handle this case (even before the `ready` event is emitted).
  388. *
  389. * You should call `event.preventDefault()` if you want to handle this event.
  390. *
  391. * On Windows, you have to parse `process.argv` (in the main process) to get the
  392. * filepath.
  393. *
  394. * @platform darwin
  395. */
  396. on(event: 'open-file', listener: (event: Event,
  397. path: string) => void): this;
  398. once(event: 'open-file', listener: (event: Event,
  399. path: string) => void): this;
  400. addListener(event: 'open-file', listener: (event: Event,
  401. path: string) => void): this;
  402. removeListener(event: 'open-file', listener: (event: Event,
  403. path: string) => void): this;
  404. /**
  405. * Emitted when the user wants to open a URL with the application. Your
  406. * application's `Info.plist` file must define the URL scheme within the
  407. * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
  408. *
  409. You should call `event.preventDefault()` if you want to handle this event.
  410. *
  411. * @platform darwin
  412. */
  413. on(event: 'open-url', listener: (event: Event,
  414. url: string) => void): this;
  415. once(event: 'open-url', listener: (event: Event,
  416. url: string) => void): this;
  417. addListener(event: 'open-url', listener: (event: Event,
  418. url: string) => void): this;
  419. removeListener(event: 'open-url', listener: (event: Event,
  420. url: string) => void): this;
  421. /**
  422. * Emitted when the application is quitting.
  423. *
  424. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  425. * a shutdown/restart of the system or a user logout.
  426. */
  427. on(event: 'quit', listener: (event: Event,
  428. exitCode: number) => void): this;
  429. once(event: 'quit', listener: (event: Event,
  430. exitCode: number) => void): this;
  431. addListener(event: 'quit', listener: (event: Event,
  432. exitCode: number) => void): this;
  433. removeListener(event: 'quit', listener: (event: Event,
  434. exitCode: number) => void): this;
  435. /**
  436. * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
  437. * holds the `userInfo` of the `NSUserNotification` or information from
  438. * `UNNotificationResponse` that was used to open the application, if it was
  439. * launched from Notification Center. You can also call `app.isReady()` to check if
  440. * this event has already fired and `app.whenReady()` to get a Promise that is
  441. * fulfilled when Electron is initialized.
  442. */
  443. on(event: 'ready', listener: (event: Event,
  444. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  445. once(event: 'ready', listener: (event: Event,
  446. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  447. addListener(event: 'ready', listener: (event: Event,
  448. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  449. removeListener(event: 'ready', listener: (event: Event,
  450. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  451. /**
  452. * Emitted when `remote.getBuiltin()` is called in the renderer process of
  453. * `webContents`. Calling `event.preventDefault()` will prevent the module from
  454. * being returned. Custom value can be returned by setting `event.returnValue`.
  455. *
  456. * @deprecated
  457. */
  458. on(event: 'remote-get-builtin', listener: (event: Event,
  459. webContents: WebContents,
  460. moduleName: string) => void): this;
  461. once(event: 'remote-get-builtin', listener: (event: Event,
  462. webContents: WebContents,
  463. moduleName: string) => void): this;
  464. addListener(event: 'remote-get-builtin', listener: (event: Event,
  465. webContents: WebContents,
  466. moduleName: string) => void): this;
  467. removeListener(event: 'remote-get-builtin', listener: (event: Event,
  468. webContents: WebContents,
  469. moduleName: string) => void): this;
  470. /**
  471. * Emitted when `remote.getCurrentWebContents()` is called in the renderer process
  472. * of `webContents`. Calling `event.preventDefault()` will prevent the object from
  473. * being returned. Custom value can be returned by setting `event.returnValue`.
  474. *
  475. * @deprecated
  476. */
  477. on(event: 'remote-get-current-web-contents', listener: (event: Event,
  478. webContents: WebContents) => void): this;
  479. once(event: 'remote-get-current-web-contents', listener: (event: Event,
  480. webContents: WebContents) => void): this;
  481. addListener(event: 'remote-get-current-web-contents', listener: (event: Event,
  482. webContents: WebContents) => void): this;
  483. removeListener(event: 'remote-get-current-web-contents', listener: (event: Event,
  484. webContents: WebContents) => void): this;
  485. /**
  486. * Emitted when `remote.getCurrentWindow()` is called in the renderer process of
  487. * `webContents`. Calling `event.preventDefault()` will prevent the object from
  488. * being returned. Custom value can be returned by setting `event.returnValue`.
  489. *
  490. * @deprecated
  491. */
  492. on(event: 'remote-get-current-window', listener: (event: Event,
  493. webContents: WebContents) => void): this;
  494. once(event: 'remote-get-current-window', listener: (event: Event,
  495. webContents: WebContents) => void): this;
  496. addListener(event: 'remote-get-current-window', listener: (event: Event,
  497. webContents: WebContents) => void): this;
  498. removeListener(event: 'remote-get-current-window', listener: (event: Event,
  499. webContents: WebContents) => void): this;
  500. /**
  501. * Emitted when `remote.getGlobal()` is called in the renderer process of
  502. * `webContents`. Calling `event.preventDefault()` will prevent the global from
  503. * being returned. Custom value can be returned by setting `event.returnValue`.
  504. *
  505. * @deprecated
  506. */
  507. on(event: 'remote-get-global', listener: (event: Event,
  508. webContents: WebContents,
  509. globalName: string) => void): this;
  510. once(event: 'remote-get-global', listener: (event: Event,
  511. webContents: WebContents,
  512. globalName: string) => void): this;
  513. addListener(event: 'remote-get-global', listener: (event: Event,
  514. webContents: WebContents,
  515. globalName: string) => void): this;
  516. removeListener(event: 'remote-get-global', listener: (event: Event,
  517. webContents: WebContents,
  518. globalName: string) => void): this;
  519. /**
  520. * Emitted when `remote.require()` is called in the renderer process of
  521. * `webContents`. Calling `event.preventDefault()` will prevent the module from
  522. * being returned. Custom value can be returned by setting `event.returnValue`.
  523. *
  524. * @deprecated
  525. */
  526. on(event: 'remote-require', listener: (event: Event,
  527. webContents: WebContents,
  528. moduleName: string) => void): this;
  529. once(event: 'remote-require', listener: (event: Event,
  530. webContents: WebContents,
  531. moduleName: string) => void): this;
  532. addListener(event: 'remote-require', listener: (event: Event,
  533. webContents: WebContents,
  534. moduleName: string) => void): this;
  535. removeListener(event: 'remote-require', listener: (event: Event,
  536. webContents: WebContents,
  537. moduleName: string) => void): this;
  538. /**
  539. * Emitted when the renderer process unexpectedly disappears. This is normally
  540. * because it was crashed or killed.
  541. */
  542. on(event: 'render-process-gone', listener: (event: Event,
  543. webContents: WebContents,
  544. details: RenderProcessGoneDetails) => void): this;
  545. once(event: 'render-process-gone', listener: (event: Event,
  546. webContents: WebContents,
  547. details: RenderProcessGoneDetails) => void): this;
  548. addListener(event: 'render-process-gone', listener: (event: Event,
  549. webContents: WebContents,
  550. details: RenderProcessGoneDetails) => void): this;
  551. removeListener(event: 'render-process-gone', listener: (event: Event,
  552. webContents: WebContents,
  553. details: RenderProcessGoneDetails) => void): this;
  554. /**
  555. * Emitted when the renderer process of `webContents` crashes or is killed.
  556. *
  557. * **Deprecated:** This event is superceded by the `render-process-gone` event
  558. * which contains more information about why the render process disappeared. It
  559. * isn't always because it crashed. The `killed` boolean can be replaced by
  560. * checking `reason === 'killed'` when you switch to that event.
  561. *
  562. * @deprecated
  563. */
  564. on(event: 'renderer-process-crashed', listener: (event: Event,
  565. webContents: WebContents,
  566. killed: boolean) => void): this;
  567. once(event: 'renderer-process-crashed', listener: (event: Event,
  568. webContents: WebContents,
  569. killed: boolean) => void): this;
  570. addListener(event: 'renderer-process-crashed', listener: (event: Event,
  571. webContents: WebContents,
  572. killed: boolean) => void): this;
  573. removeListener(event: 'renderer-process-crashed', listener: (event: Event,
  574. webContents: WebContents,
  575. killed: boolean) => void): this;
  576. /**
  577. * This event will be emitted inside the primary instance of your application when
  578. * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
  579. *
  580. * `argv` is an Array of the second instance's command line arguments, and
  581. * `workingDirectory` is its current working directory. Usually applications
  582. * respond to this by making their primary window focused and non-minimized.
  583. *
  584. * **Note:** If the second instance is started by a different user than the first,
  585. * the `argv` array will not include the arguments.
  586. *
  587. * This event is guaranteed to be emitted after the `ready` event of `app` gets
  588. * emitted.
  589. *
  590. * **Note:** Extra command line arguments might be added by Chromium, such as
  591. * `--original-process-start-time`.
  592. */
  593. on(event: 'second-instance', listener: (event: Event,
  594. /**
  595. * An array of the second instance's command line arguments
  596. */
  597. argv: string[],
  598. /**
  599. * The second instance's working directory
  600. */
  601. workingDirectory: string) => void): this;
  602. once(event: 'second-instance', listener: (event: Event,
  603. /**
  604. * An array of the second instance's command line arguments
  605. */
  606. argv: string[],
  607. /**
  608. * The second instance's working directory
  609. */
  610. workingDirectory: string) => void): this;
  611. addListener(event: 'second-instance', listener: (event: Event,
  612. /**
  613. * An array of the second instance's command line arguments
  614. */
  615. argv: string[],
  616. /**
  617. * The second instance's working directory
  618. */
  619. workingDirectory: string) => void): this;
  620. removeListener(event: 'second-instance', listener: (event: Event,
  621. /**
  622. * An array of the second instance's command line arguments
  623. */
  624. argv: string[],
  625. /**
  626. * The second instance's working directory
  627. */
  628. workingDirectory: string) => void): this;
  629. /**
  630. * Emitted when a client certificate is requested.
  631. *
  632. * The `url` corresponds to the navigation entry requesting the client certificate
  633. * and `callback` can be called with an entry filtered from the list. Using
  634. * `event.preventDefault()` prevents the application from using the first
  635. * certificate from the store.
  636. */
  637. on(event: 'select-client-certificate', listener: (event: Event,
  638. webContents: WebContents,
  639. url: string,
  640. certificateList: Certificate[],
  641. callback: (certificate?: Certificate) => void) => void): this;
  642. once(event: 'select-client-certificate', listener: (event: Event,
  643. webContents: WebContents,
  644. url: string,
  645. certificateList: Certificate[],
  646. callback: (certificate?: Certificate) => void) => void): this;
  647. addListener(event: 'select-client-certificate', listener: (event: Event,
  648. webContents: WebContents,
  649. url: string,
  650. certificateList: Certificate[],
  651. callback: (certificate?: Certificate) => void) => void): this;
  652. removeListener(event: 'select-client-certificate', listener: (event: Event,
  653. webContents: WebContents,
  654. url: string,
  655. certificateList: Certificate[],
  656. callback: (certificate?: Certificate) => void) => void): this;
  657. /**
  658. * Emitted when Electron has created a new `session`.
  659. */
  660. on(event: 'session-created', listener: (session: Session) => void): this;
  661. once(event: 'session-created', listener: (session: Session) => void): this;
  662. addListener(event: 'session-created', listener: (session: Session) => void): this;
  663. removeListener(event: 'session-created', listener: (session: Session) => void): this;
  664. /**
  665. * Emitted when Handoff is about to be resumed on another device. If you need to
  666. * update the state to be transferred, you should call `event.preventDefault()`
  667. * immediately, construct a new `userInfo` dictionary and call
  668. * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
  669. * fail and `continue-activity-error` will be called.
  670. *
  671. * @platform darwin
  672. */
  673. on(event: 'update-activity-state', listener: (event: Event,
  674. /**
  675. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  676. */
  677. type: string,
  678. /**
  679. * Contains app-specific state stored by the activity.
  680. */
  681. userInfo: unknown) => void): this;
  682. once(event: 'update-activity-state', listener: (event: Event,
  683. /**
  684. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  685. */
  686. type: string,
  687. /**
  688. * Contains app-specific state stored by the activity.
  689. */
  690. userInfo: unknown) => void): this;
  691. addListener(event: 'update-activity-state', listener: (event: Event,
  692. /**
  693. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  694. */
  695. type: string,
  696. /**
  697. * Contains app-specific state stored by the activity.
  698. */
  699. userInfo: unknown) => void): this;
  700. removeListener(event: 'update-activity-state', listener: (event: Event,
  701. /**
  702. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  703. */
  704. type: string,
  705. /**
  706. * Contains app-specific state stored by the activity.
  707. */
  708. userInfo: unknown) => void): this;
  709. /**
  710. * Emitted when a new webContents is created.
  711. */
  712. on(event: 'web-contents-created', listener: (event: Event,
  713. webContents: WebContents) => void): this;
  714. once(event: 'web-contents-created', listener: (event: Event,
  715. webContents: WebContents) => void): this;
  716. addListener(event: 'web-contents-created', listener: (event: Event,
  717. webContents: WebContents) => void): this;
  718. removeListener(event: 'web-contents-created', listener: (event: Event,
  719. webContents: WebContents) => void): this;
  720. /**
  721. * Emitted during Handoff before an activity from a different device wants to be
  722. * resumed. You should call `event.preventDefault()` if you want to handle this
  723. * event.
  724. *
  725. * @platform darwin
  726. */
  727. on(event: 'will-continue-activity', listener: (event: Event,
  728. /**
  729. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  730. */
  731. type: string) => void): this;
  732. once(event: 'will-continue-activity', listener: (event: Event,
  733. /**
  734. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  735. */
  736. type: string) => void): this;
  737. addListener(event: 'will-continue-activity', listener: (event: Event,
  738. /**
  739. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  740. */
  741. type: string) => void): this;
  742. removeListener(event: 'will-continue-activity', listener: (event: Event,
  743. /**
  744. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  745. */
  746. type: string) => void): this;
  747. /**
  748. * Emitted when the application has finished basic startup. On Windows and Linux,
  749. * the `will-finish-launching` event is the same as the `ready` event; on macOS,
  750. * this event represents the `applicationWillFinishLaunching` notification of
  751. * `NSApplication`. You would usually set up listeners for the `open-file` and
  752. * `open-url` events here, and start the crash reporter and auto updater.
  753. *
  754. In most cases, you should do everything in the `ready` event handler.
  755. */
  756. on(event: 'will-finish-launching', listener: Function): this;
  757. once(event: 'will-finish-launching', listener: Function): this;
  758. addListener(event: 'will-finish-launching', listener: Function): this;
  759. removeListener(event: 'will-finish-launching', listener: Function): this;
  760. /**
  761. * Emitted when all windows have been closed and the application will quit. Calling
  762. * `event.preventDefault()` will prevent the default behavior, which is terminating
  763. * the application.
  764. *
  765. * See the description of the `window-all-closed` event for the differences between
  766. * the `will-quit` and `window-all-closed` events.
  767. *
  768. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  769. * a shutdown/restart of the system or a user logout.
  770. */
  771. on(event: 'will-quit', listener: (event: Event) => void): this;
  772. once(event: 'will-quit', listener: (event: Event) => void): this;
  773. addListener(event: 'will-quit', listener: (event: Event) => void): this;
  774. removeListener(event: 'will-quit', listener: (event: Event) => void): this;
  775. /**
  776. * Emitted when all windows have been closed.
  777. *
  778. * If you do not subscribe to this event and all windows are closed, the default
  779. * behavior is to quit the app; however, if you subscribe, you control whether the
  780. * app quits or not. If the user pressed `Cmd + Q`, or the developer called
  781. * `app.quit()`, Electron will first try to close all the windows and then emit the
  782. * `will-quit` event, and in this case the `window-all-closed` event would not be
  783. * emitted.
  784. */
  785. on(event: 'window-all-closed', listener: Function): this;
  786. once(event: 'window-all-closed', listener: Function): this;
  787. addListener(event: 'window-all-closed', listener: Function): this;
  788. removeListener(event: 'window-all-closed', listener: Function): this;
  789. /**
  790. * Adds `path` to the recent documents list.
  791. *
  792. * This list is managed by the OS. On Windows, you can visit the list from the task
  793. * bar, and on macOS, you can visit it from dock menu.
  794. *
  795. * @platform darwin,win32
  796. */
  797. addRecentDocument(path: string): void;
  798. /**
  799. * Clears the recent documents list.
  800. *
  801. * @platform darwin,win32
  802. */
  803. clearRecentDocuments(): void;
  804. /**
  805. * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
  806. * basis if the GPU processes crashes too frequently. This function disables that
  807. * behavior.
  808. This method can only be called before app is ready.
  809. */
  810. disableDomainBlockingFor3DAPIs(): void;
  811. /**
  812. * Disables hardware acceleration for current app.
  813. *
  814. This method can only be called before app is ready.
  815. */
  816. disableHardwareAcceleration(): void;
  817. /**
  818. * Enables full sandbox mode on the app. This means that all renderers will be
  819. * launched sandboxed, regardless of the value of the `sandbox` flag in
  820. * WebPreferences.
  821. This method can only be called before app is ready.
  822. */
  823. enableSandbox(): void;
  824. /**
  825. * Exits immediately with `exitCode`. `exitCode` defaults to 0.
  826. *
  827. * All windows will be closed immediately without asking the user, and the
  828. * `before-quit` and `will-quit` events will not be emitted.
  829. */
  830. exit(exitCode?: number): void;
  831. /**
  832. * On Linux, focuses on the first visible window. On macOS, makes the application
  833. * the active app. On Windows, focuses on the application's first window.
  834. *
  835. You should seek to use the `steal` option as sparingly as possible.
  836. */
  837. focus(options?: FocusOptions): void;
  838. /**
  839. * Resolve with an object containing the following:
  840. *
  841. * * `icon` NativeImage - the display icon of the app handling the protocol.
  842. * * `path` String - installation path of the app handling the protocol.
  843. * * `name` String - display name of the app handling the protocol.
  844. *
  845. * This method returns a promise that contains the application name, icon and path
  846. * of the default handler for the protocol (aka URI scheme) of a URL.
  847. *
  848. * @platform darwin,win32
  849. */
  850. getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
  851. /**
  852. * Name of the application handling the protocol, or an empty string if there is no
  853. * handler. For instance, if Electron is the default handler of the URL, this could
  854. * be `Electron` on Windows and Mac. However, don't rely on the precise format
  855. * which is not guaranteed to remain unchanged. Expect a different format on Linux,
  856. * possibly with a `.desktop` suffix.
  857. *
  858. * This method returns the application name of the default handler for the protocol
  859. * (aka URI scheme) of a URL.
  860. */
  861. getApplicationNameForProtocol(url: string): string;
  862. /**
  863. * Array of `ProcessMetric` objects that correspond to memory and CPU usage
  864. * statistics of all the processes associated with the app.
  865. */
  866. getAppMetrics(): ProcessMetric[];
  867. /**
  868. * The current application directory.
  869. */
  870. getAppPath(): string;
  871. /**
  872. * The current value displayed in the counter badge.
  873. *
  874. * @platform linux,darwin
  875. */
  876. getBadgeCount(): number;
  877. /**
  878. * The type of the currently running activity.
  879. *
  880. * @platform darwin
  881. */
  882. getCurrentActivityType(): string;
  883. /**
  884. * fulfilled with the app's icon, which is a NativeImage.
  885. *
  886. * Fetches a path's associated icon.
  887. *
  888. * On _Windows_, there a 2 kinds of icons:
  889. *
  890. * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
  891. * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
  892. *
  893. * On _Linux_ and _macOS_, icons depend on the application associated with file
  894. * mime type.
  895. */
  896. getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
  897. /**
  898. * The Graphics Feature Status from `chrome://gpu/`.
  899. *
  900. * **Note:** This information is only usable after the `gpu-info-update` event is
  901. * emitted.
  902. */
  903. getGPUFeatureStatus(): GPUFeatureStatus;
  904. /**
  905. * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
  906. * containing all the GPU Information as in chromium's GPUInfo object. This
  907. * includes the version and driver information that's shown on `chrome://gpu` page.
  908. *
  909. * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
  910. * fewer attributes than when requested with `complete`. Here's an example of basic
  911. * response:
  912. *
  913. * Using `basic` should be preferred if only basic information like `vendorId` or
  914. * `driverId` is needed.
  915. */
  916. getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
  917. /**
  918. * * `minItems` Integer - The minimum number of items that will be shown in the
  919. * Jump List (for a more detailed description of this value see the MSDN docs).
  920. * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
  921. * correspond to items that the user has explicitly removed from custom categories
  922. * in the Jump List. These items must not be re-added to the Jump List in the
  923. * **next** call to `app.setJumpList()`, Windows will not display any custom
  924. * category that contains any of the removed items.
  925. *
  926. * @platform win32
  927. */
  928. getJumpListSettings(): JumpListSettings;
  929. /**
  930. * The current application locale, fetched using Chromium's `l10n_util` library.
  931. * Possible return values are documented here.
  932. *
  933. * To set the locale, you'll want to use a command line switch at app startup,
  934. * which may be found here.
  935. *
  936. * **Note:** When distributing your packaged app, you have to also ship the
  937. * `locales` folder.
  938. *
  939. * **Note:** On Windows, you have to call it after the `ready` events gets emitted.
  940. */
  941. getLocale(): string;
  942. /**
  943. * User operating system's locale two-letter ISO 3166 country code. The value is
  944. * taken from native OS APIs.
  945. *
  946. **Note:** When unable to detect locale country code, it returns empty string.
  947. */
  948. getLocaleCountryCode(): string;
  949. /**
  950. * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
  951. * you need to pass the same arguments here for `openAtLogin` to be set correctly.
  952. *
  953. *
  954. * * `openAtLogin` Boolean - `true` if the app is set to open at login.
  955. * * `openAsHidden` Boolean _macOS_ - `true` if the app is set to open as hidden at
  956. * login. This setting is not available on MAS builds.
  957. * * `wasOpenedAtLogin` Boolean _macOS_ - `true` if the app was opened at login
  958. * automatically. This setting is not available on MAS builds.
  959. * * `wasOpenedAsHidden` Boolean _macOS_ - `true` if the app was opened as a hidden
  960. * login item. This indicates that the app should not open any windows at startup.
  961. * This setting is not available on MAS builds.
  962. * * `restoreState` Boolean _macOS_ - `true` if the app was opened as a login item
  963. * that should restore the state from the previous session. This indicates that the
  964. * app should restore the windows that were open the last time the app was closed.
  965. * This setting is not available on MAS builds.
  966. * * `executableWillLaunchAtLogin` Boolean _Windows_ - `true` if app is set to open
  967. * at login and its run key is not deactivated. This differs from `openAtLogin` as
  968. * it ignores the `args` option, this property will be true if the given executable
  969. * would be launched at login with **any** arguments.
  970. * * `launchItems` Object[] _Windows_
  971. * * `name` String _Windows_ - name value of a registry entry.
  972. * * `path` String _Windows_ - The executable to an app that corresponds to a
  973. * registry entry.
  974. * * `args` String[] _Windows_ - the command-line arguments to pass to the
  975. * executable.
  976. * * `scope` String _Windows_ - one of `user` or `machine`. Indicates whether the
  977. * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  978. * * `enabled` Boolean _Windows_ - `true` if the app registry key is startup
  979. * approved and therefore shows as `enabled` in Task Manager and Windows settings.
  980. *
  981. * @platform darwin,win32
  982. */
  983. getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
  984. /**
  985. * The current application's name, which is the name in the application's
  986. * `package.json` file.
  987. *
  988. * Usually the `name` field of `package.json` is a short lowercase name, according
  989. * to the npm modules spec. You should usually also specify a `productName` field,
  990. * which is your application's full capitalized name, and which will be preferred
  991. * over `name` by Electron.
  992. */
  993. getName(): string;
  994. /**
  995. * A path to a special directory or file associated with `name`. On failure, an
  996. * `Error` is thrown.
  997. *
  998. * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
  999. * called first, a default log directory will be created equivalent to calling
  1000. * `app.setAppLogsPath()` without a `path` parameter.
  1001. */
  1002. getPath(name: 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps'): string;
  1003. /**
  1004. * The version of the loaded application. If no version is found in the
  1005. * application's `package.json` file, the version of the current bundle or
  1006. * executable is returned.
  1007. */
  1008. getVersion(): string;
  1009. /**
  1010. * This method returns whether or not this instance of your app is currently
  1011. * holding the single instance lock. You can request the lock with
  1012. * `app.requestSingleInstanceLock()` and release with
  1013. * `app.releaseSingleInstanceLock()`
  1014. */
  1015. hasSingleInstanceLock(): boolean;
  1016. /**
  1017. * Hides all application windows without minimizing them.
  1018. *
  1019. * @platform darwin
  1020. */
  1021. hide(): void;
  1022. /**
  1023. * Imports the certificate in pkcs12 format into the platform certificate store.
  1024. * `callback` is called with the `result` of import operation, a value of `0`
  1025. * indicates success while any other value indicates failure according to Chromium
  1026. * net_error_list.
  1027. *
  1028. * @platform linux
  1029. */
  1030. importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
  1031. /**
  1032. * Invalidates the current Handoff user activity.
  1033. *
  1034. * @platform darwin
  1035. */
  1036. invalidateCurrentActivity(): void;
  1037. /**
  1038. * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
  1039. * will return `true` if the use of assistive technologies, such as screen readers,
  1040. * has been detected. See
  1041. * https://www.chromium.org/developers/design-documents/accessibility for more
  1042. * details.
  1043. *
  1044. * @platform darwin,win32
  1045. */
  1046. isAccessibilitySupportEnabled(): boolean;
  1047. /**
  1048. * Whether the current executable is the default handler for a protocol (aka URI
  1049. * scheme).
  1050. *
  1051. * **Note:** On macOS, you can use this method to check if the app has been
  1052. * registered as the default protocol handler for a protocol. You can also verify
  1053. * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
  1054. * macOS machine. Please refer to Apple's documentation for details.
  1055. *
  1056. * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
  1057. * internally.
  1058. */
  1059. isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1060. /**
  1061. * whether or not the current OS version allows for native emoji pickers.
  1062. */
  1063. isEmojiPanelSupported(): boolean;
  1064. /**
  1065. * Whether the application is currently running from the systems Application
  1066. * folder. Use in combination with `app.moveToApplicationsFolder()`
  1067. *
  1068. * @platform darwin
  1069. */
  1070. isInApplicationsFolder(): boolean;
  1071. /**
  1072. * `true` if Electron has finished initializing, `false` otherwise. See also
  1073. * `app.whenReady()`.
  1074. */
  1075. isReady(): boolean;
  1076. /**
  1077. * whether `Secure Keyboard Entry` is enabled.
  1078. *
  1079. By default this API will return `false`.
  1080. *
  1081. * @platform darwin
  1082. */
  1083. isSecureKeyboardEntryEnabled(): boolean;
  1084. /**
  1085. * Whether the current desktop environment is Unity launcher.
  1086. *
  1087. * @platform linux
  1088. */
  1089. isUnityRunning(): boolean;
  1090. /**
  1091. * Whether the move was successful. Please note that if the move is successful,
  1092. * your application will quit and relaunch.
  1093. *
  1094. * No confirmation dialog will be presented by default. If you wish to allow the
  1095. * user to confirm the operation, you may do so using the `dialog` API.
  1096. *
  1097. * **NOTE:** This method throws errors if anything other than the user causes the
  1098. * move to fail. For instance if the user cancels the authorization dialog, this
  1099. * method returns false. If we fail to perform the copy, then this method will
  1100. * throw an error. The message in the error should be informative and tell you
  1101. * exactly what went wrong.
  1102. *
  1103. * By default, if an app of the same name as the one being moved exists in the
  1104. * Applications directory and is _not_ running, the existing app will be trashed
  1105. * and the active app moved into its place. If it _is_ running, the pre-existing
  1106. * running app will assume focus and the previously active app will quit itself.
  1107. * This behavior can be changed by providing the optional conflict handler, where
  1108. * the boolean returned by the handler determines whether or not the move conflict
  1109. * is resolved with default behavior. i.e. returning `false` will ensure no
  1110. * further action is taken, returning `true` will result in the default behavior
  1111. * and the method continuing.
  1112. *
  1113. * For example:
  1114. *
  1115. * Would mean that if an app already exists in the user directory, if the user
  1116. * chooses to 'Continue Move' then the function would continue with its default
  1117. * behavior and the existing app will be trashed and the active app moved into its
  1118. * place.
  1119. *
  1120. * @platform darwin
  1121. */
  1122. moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
  1123. /**
  1124. * Try to close all windows. The `before-quit` event will be emitted first. If all
  1125. * windows are successfully closed, the `will-quit` event will be emitted and by
  1126. * default the application will terminate.
  1127. *
  1128. * This method guarantees that all `beforeunload` and `unload` event handlers are
  1129. * correctly executed. It is possible that a window cancels the quitting by
  1130. * returning `false` in the `beforeunload` event handler.
  1131. */
  1132. quit(): void;
  1133. /**
  1134. * Relaunches the app when current instance exits.
  1135. *
  1136. * By default, the new instance will use the same working directory and command
  1137. * line arguments with current instance. When `args` is specified, the `args` will
  1138. * be passed as command line arguments instead. When `execPath` is specified, the
  1139. * `execPath` will be executed for relaunch instead of current app.
  1140. *
  1141. * Note that this method does not quit the app when executed, you have to call
  1142. * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
  1143. *
  1144. * When `app.relaunch` is called for multiple times, multiple instances will be
  1145. * started after current instance exited.
  1146. *
  1147. * An example of restarting current instance immediately and adding a new command
  1148. * line argument to the new instance:
  1149. */
  1150. relaunch(options?: RelaunchOptions): void;
  1151. /**
  1152. * Releases all locks that were created by `requestSingleInstanceLock`. This will
  1153. * allow multiple instances of the application to once again run side by side.
  1154. */
  1155. releaseSingleInstanceLock(): void;
  1156. /**
  1157. * Whether the call succeeded.
  1158. *
  1159. * This method checks if the current executable as the default handler for a
  1160. * protocol (aka URI scheme). If so, it will remove the app as the default handler.
  1161. *
  1162. * @platform darwin,win32
  1163. */
  1164. removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1165. /**
  1166. * The return value of this method indicates whether or not this instance of your
  1167. * application successfully obtained the lock. If it failed to obtain the lock,
  1168. * you can assume that another instance of your application is already running with
  1169. * the lock and exit immediately.
  1170. *
  1171. * I.e. This method returns `true` if your process is the primary instance of your
  1172. * application and your app should continue loading. It returns `false` if your
  1173. * process should immediately quit as it has sent its parameters to another
  1174. * instance that has already acquired the lock.
  1175. *
  1176. * On macOS, the system enforces single instance automatically when users try to
  1177. * open a second instance of your app in Finder, and the `open-file` and `open-url`
  1178. * events will be emitted for that. However when users start your app in command
  1179. * line, the system's single instance mechanism will be bypassed, and you have to
  1180. * use this method to ensure single instance.
  1181. *
  1182. * An example of activating the window of primary instance when a second instance
  1183. * starts:
  1184. */
  1185. requestSingleInstanceLock(): boolean;
  1186. /**
  1187. * Marks the current Handoff user activity as inactive without invalidating it.
  1188. *
  1189. * @platform darwin
  1190. */
  1191. resignCurrentActivity(): void;
  1192. /**
  1193. * Set the about panel options. This will override the values defined in the app's
  1194. * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
  1195. * must be set in order to be shown; there are no defaults.
  1196. *
  1197. * If you do not set `credits` but still wish to surface them in your app, AppKit
  1198. * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
  1199. * that order, in the bundle returned by the NSBundle class method main. The first
  1200. * file found is used, and if none is found, the info area is left blank. See Apple
  1201. * documentation for more information.
  1202. */
  1203. setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
  1204. /**
  1205. * Manually enables Chrome's accessibility support, allowing to expose
  1206. * accessibility switch to users in application settings. See Chromium's
  1207. * accessibility docs for more details. Disabled by default.
  1208. *
  1209. * This API must be called after the `ready` event is emitted.
  1210. *
  1211. * **Note:** Rendering accessibility tree can significantly affect the performance
  1212. * of your app. It should not be enabled by default.
  1213. *
  1214. * @platform darwin,win32
  1215. */
  1216. setAccessibilitySupportEnabled(enabled: boolean): void;
  1217. /**
  1218. * Sets the activation policy for a given app.
  1219. *
  1220. * Activation policy types:
  1221. *
  1222. * * 'regular' - The application is an ordinary app that appears in the Dock and
  1223. * may have a user interface.
  1224. * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
  1225. * menu bar, but it may be activated programmatically or by clicking on one of its
  1226. * windows.
  1227. * * 'prohibited' - The application doesn’t appear in the Dock and may not create
  1228. * windows or be activated.
  1229. *
  1230. * @platform darwin
  1231. */
  1232. setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
  1233. /**
  1234. * Sets or creates a directory your app's logs which can then be manipulated with
  1235. * `app.getPath()` or `app.setPath(pathName, newPath)`.
  1236. *
  1237. * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
  1238. * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
  1239. * `userData` directory on _Linux_ and _Windows_.
  1240. */
  1241. setAppLogsPath(path?: string): void;
  1242. /**
  1243. * Changes the Application User Model ID to `id`.
  1244. *
  1245. * @platform win32
  1246. */
  1247. setAppUserModelId(id: string): void;
  1248. /**
  1249. * Whether the call succeeded.
  1250. *
  1251. * Sets the current executable as the default handler for a protocol (aka URI
  1252. * scheme). It allows you to integrate your app deeper into the operating system.
  1253. * Once registered, all links with `your-protocol://` will be opened with the
  1254. * current executable. The whole link, including protocol, will be passed to your
  1255. * application as a parameter.
  1256. *
  1257. * **Note:** On macOS, you can only register protocols that have been added to your
  1258. * app's `info.plist`, which cannot be modified at runtime. However, you can change
  1259. * the file during build time via Electron Forge, Electron Packager, or by editing
  1260. * `info.plist` with a text editor. Please refer to Apple's documentation for
  1261. * details.
  1262. *
  1263. * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
  1264. * will return `true` for all calls but the registry key it sets won't be
  1265. * accessible by other applications. In order to register your Windows Store
  1266. * application as a default protocol handler you must declare the protocol in your
  1267. * manifest.
  1268. *
  1269. * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
  1270. * internally.
  1271. */
  1272. setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1273. /**
  1274. * Whether the call succeeded.
  1275. *
  1276. * Sets the counter badge for current app. Setting the count to `0` will hide the
  1277. * badge.
  1278. *
  1279. * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
  1280. *
  1281. * **Note:** Unity launcher requires a `.desktop` file to work. For more
  1282. * information, please read the Unity integration documentation.
  1283. *
  1284. * @platform linux,darwin
  1285. */
  1286. setBadgeCount(count?: number): boolean;
  1287. /**
  1288. * Sets or removes a custom Jump List for the application, and returns one of the
  1289. * following strings:
  1290. *
  1291. * * `ok` - Nothing went wrong.
  1292. * * `error` - One or more errors occurred, enable runtime logging to figure out
  1293. * the likely cause.
  1294. * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
  1295. * category in the Jump List. Separators are only allowed in the standard `Tasks`
  1296. * category.
  1297. * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
  1298. * Jump List for a file type the app isn't registered to handle.
  1299. * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
  1300. * Jump List due to user privacy or group policy settings.
  1301. *
  1302. * If `categories` is `null` the previously set custom Jump List (if any) will be
  1303. * replaced by the standard Jump List for the app (managed by Windows).
  1304. *
  1305. * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
  1306. * property set then its `type` is assumed to be `tasks`. If the `name` property is
  1307. * set but the `type` property is omitted then the `type` is assumed to be
  1308. * `custom`.
  1309. *
  1310. * **Note:** Users can remove items from custom categories, and Windows will not
  1311. * allow a removed item to be added back into a custom category until **after** the
  1312. * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
  1313. * removed item to a custom category earlier than that will result in the entire
  1314. * custom category being omitted from the Jump List. The list of removed items can
  1315. * be obtained using `app.getJumpListSettings()`.
  1316. *
  1317. * **Note:** The maximum length of a Jump List item's `description` property is 260
  1318. * characters. Beyond this limit, the item will not be added to the Jump List, nor
  1319. * will it be displayed.
  1320. *
  1321. Here's a very simple example of creating a custom Jump List:
  1322. *
  1323. * @platform win32
  1324. */
  1325. setJumpList(categories: (JumpListCategory[]) | (null)): void;
  1326. /**
  1327. * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
  1328. * want to set the launch path to Update.exe, and pass arguments that specify your
  1329. * application name. For example:
  1330. *
  1331. * @platform darwin,win32
  1332. */
  1333. setLoginItemSettings(settings: Settings): void;
  1334. /**
  1335. * Overrides the current application's name.
  1336. *
  1337. * **Note:** This function overrides the name used internally by Electron; it does
  1338. * not affect the name that the OS uses.
  1339. */
  1340. setName(name: string): void;
  1341. /**
  1342. * Overrides the `path` to a special directory or file associated with `name`. If
  1343. * the path specifies a directory that does not exist, an `Error` is thrown. In
  1344. * that case, the directory should be created with `fs.mkdirSync` or similar.
  1345. *
  1346. * You can only override paths of a `name` defined in `app.getPath`.
  1347. *
  1348. * By default, web pages' cookies and caches will be stored under the `userData`
  1349. * directory. If you want to change this location, you have to override the
  1350. * `userData` path before the `ready` event of the `app` module is emitted.
  1351. */
  1352. setPath(name: string, path: string): void;
  1353. /**
  1354. * Set the `Secure Keyboard Entry` is enabled in your application.
  1355. *
  1356. * By using this API, important information such as password and other sensitive
  1357. * information can be prevented from being intercepted by other processes.
  1358. *
  1359. * See Apple's documentation for more details.
  1360. *
  1361. * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
  1362. * when it is no longer needed.
  1363. *
  1364. * @platform darwin
  1365. */
  1366. setSecureKeyboardEntryEnabled(enabled: boolean): void;
  1367. /**
  1368. * Creates an `NSUserActivity` and sets it as the current activity. The activity is
  1369. * eligible for Handoff to another device afterward.
  1370. *
  1371. * @platform darwin
  1372. */
  1373. setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
  1374. /**
  1375. * Adds `tasks` to the Tasks category of the Jump List on Windows.
  1376. *
  1377. * `tasks` is an array of `Task` objects.
  1378. *
  1379. * Whether the call succeeded.
  1380. *
  1381. * **Note:** If you'd like to customize the Jump List even more use
  1382. * `app.setJumpList(categories)` instead.
  1383. *
  1384. * @platform win32
  1385. */
  1386. setUserTasks(tasks: Task[]): boolean;
  1387. /**
  1388. * Shows application windows after they were hidden. Does not automatically focus
  1389. * them.
  1390. *
  1391. * @platform darwin
  1392. */
  1393. show(): void;
  1394. /**
  1395. * Show the app's about panel options. These options can be overridden with
  1396. * `app.setAboutPanelOptions(options)`.
  1397. */
  1398. showAboutPanel(): void;
  1399. /**
  1400. * Show the platform's native emoji picker.
  1401. *
  1402. * @platform darwin,win32
  1403. */
  1404. showEmojiPanel(): void;
  1405. /**
  1406. * This function **must** be called once you have finished accessing the security
  1407. * scoped file. If you do not remember to stop accessing the bookmark, kernel
  1408. * resources will be leaked and your app will lose its ability to reach outside the
  1409. * sandbox completely, until your app is restarted.
  1410. *
  1411. * Start accessing a security scoped resource. With this method Electron
  1412. * applications that are packaged for the Mac App Store may reach outside their
  1413. * sandbox to access files chosen by the user. See Apple's documentation for a
  1414. * description of how this system works.
  1415. *
  1416. * @platform mas
  1417. */
  1418. startAccessingSecurityScopedResource(bookmarkData: string): Function;
  1419. /**
  1420. * Updates the current activity if its type matches `type`, merging the entries
  1421. * from `userInfo` into its current `userInfo` dictionary.
  1422. *
  1423. * @platform darwin
  1424. */
  1425. updateCurrentActivity(type: string, userInfo: any): void;
  1426. /**
  1427. * fulfilled when Electron is initialized. May be used as a convenient alternative
  1428. * to checking `app.isReady()` and subscribing to the `ready` event if the app is
  1429. * not ready yet.
  1430. */
  1431. whenReady(): Promise<void>;
  1432. /**
  1433. * A `Boolean` property that's `true` if Chrome's accessibility support is enabled,
  1434. * `false` otherwise. This property will be `true` if the use of assistive
  1435. * technologies, such as screen readers, has been detected. Setting this property
  1436. * to `true` manually enables Chrome's accessibility support, allowing developers
  1437. * to expose accessibility switch to users in application settings.
  1438. *
  1439. * See Chromium's accessibility docs for more details. Disabled by default.
  1440. *
  1441. * This API must be called after the `ready` event is emitted.
  1442. *
  1443. * **Note:** Rendering accessibility tree can significantly affect the performance
  1444. * of your app. It should not be enabled by default.
  1445. *
  1446. * @platform darwin,win32
  1447. */
  1448. accessibilitySupportEnabled: boolean;
  1449. /**
  1450. * A `Boolean` which when `true` disables the overrides that Electron has in place
  1451. * to ensure renderer processes are restarted on every navigation. The current
  1452. * default value for this property is `true`.
  1453. *
  1454. * The intention is for these overrides to become disabled by default and then at
  1455. * some point in the future this property will be removed. This property impacts
  1456. * which native modules you can use in the renderer process. For more information
  1457. * on the direction Electron is going with renderer process restarts and usage of
  1458. * native modules in the renderer process please check out this Tracking Issue.
  1459. */
  1460. allowRendererProcessReuse: boolean;
  1461. /**
  1462. * A `Menu | null` property that returns `Menu` if one has been set and `null`
  1463. * otherwise. Users can pass a Menu to set this property.
  1464. */
  1465. applicationMenu: (Menu) | (null);
  1466. /**
  1467. * An `Integer` property that returns the badge count for current app. Setting the
  1468. * count to `0` will hide the badge.
  1469. *
  1470. * On macOS, setting this with any nonzero integer shows on the dock icon. On
  1471. * Linux, this property only works for Unity launcher.
  1472. *
  1473. * **Note:** Unity launcher requires a `.desktop` file to work. For more
  1474. * information, please read the Unity integration documentation.
  1475. *
  1476. * **Note:** On macOS, you need to ensure that your application has the permission
  1477. * to display notifications for this property to take effect.
  1478. *
  1479. * @platform linux,darwin
  1480. */
  1481. badgeCount: number;
  1482. /**
  1483. * A `CommandLine` object that allows you to read and manipulate the command line
  1484. * arguments that Chromium uses.
  1485. *
  1486. */
  1487. readonly commandLine: CommandLine;
  1488. /**
  1489. * A `Dock` `| undefined` object that allows you to perform actions on your app
  1490. * icon in the user's dock on macOS.
  1491. *
  1492. * @platform darwin
  1493. */
  1494. readonly dock: Dock;
  1495. /**
  1496. * A `Boolean` property that returns `true` if the app is packaged, `false`
  1497. * otherwise. For many apps, this property can be used to distinguish development
  1498. * and production environments.
  1499. *
  1500. */
  1501. readonly isPackaged: boolean;
  1502. /**
  1503. * A `String` property that indicates the current application's name, which is the
  1504. * name in the application's `package.json` file.
  1505. *
  1506. * Usually the `name` field of `package.json` is a short lowercase name, according
  1507. * to the npm modules spec. You should usually also specify a `productName` field,
  1508. * which is your application's full capitalized name, and which will be preferred
  1509. * over `name` by Electron.
  1510. */
  1511. name: string;
  1512. /**
  1513. * A `Boolean` which when `true` indicates that the app is currently running under
  1514. * the Rosetta Translator Environment.
  1515. *
  1516. * You can use this property to prompt users to download the arm64 version of your
  1517. * application when they are running the x64 version under Rosetta incorrectly.
  1518. *
  1519. * @platform darwin
  1520. */
  1521. readonly runningUnderRosettaTranslation: boolean;
  1522. /**
  1523. * A `String` which is the user agent string Electron will use as a global
  1524. * fallback.
  1525. *
  1526. * This is the user agent that will be used when no user agent is set at the
  1527. * `webContents` or `session` level. It is useful for ensuring that your entire
  1528. * app has the same user agent. Set to a custom value as early as possible in your
  1529. * app's initialization to ensure that your overridden value is used.
  1530. */
  1531. userAgentFallback: string;
  1532. }
  1533. interface AutoUpdater extends NodeJS.EventEmitter {
  1534. // Docs: https://electronjs.org/docs/api/auto-updater
  1535. /**
  1536. * This event is emitted after a user calls `quitAndInstall()`.
  1537. *
  1538. * When this API is called, the `before-quit` event is not emitted before all
  1539. * windows are closed. As a result you should listen to this event if you wish to
  1540. * perform actions before the windows are closed while a process is quitting, as
  1541. * well as listening to `before-quit`.
  1542. */
  1543. on(event: 'before-quit-for-update', listener: Function): this;
  1544. once(event: 'before-quit-for-update', listener: Function): this;
  1545. addListener(event: 'before-quit-for-update', listener: Function): this;
  1546. removeListener(event: 'before-quit-for-update', listener: Function): this;
  1547. /**
  1548. * Emitted when checking if an update has started.
  1549. */
  1550. on(event: 'checking-for-update', listener: Function): this;
  1551. once(event: 'checking-for-update', listener: Function): this;
  1552. addListener(event: 'checking-for-update', listener: Function): this;
  1553. removeListener(event: 'checking-for-update', listener: Function): this;
  1554. /**
  1555. * Emitted when there is an error while updating.
  1556. */
  1557. on(event: 'error', listener: (error: Error) => void): this;
  1558. once(event: 'error', listener: (error: Error) => void): this;
  1559. addListener(event: 'error', listener: (error: Error) => void): this;
  1560. removeListener(event: 'error', listener: (error: Error) => void): this;
  1561. /**
  1562. * Emitted when there is an available update. The update is downloaded
  1563. * automatically.
  1564. */
  1565. on(event: 'update-available', listener: Function): this;
  1566. once(event: 'update-available', listener: Function): this;
  1567. addListener(event: 'update-available', listener: Function): this;
  1568. removeListener(event: 'update-available', listener: Function): this;
  1569. /**
  1570. * Emitted when an update has been downloaded.
  1571. *
  1572. * On Windows only `releaseName` is available.
  1573. *
  1574. * **Note:** It is not strictly necessary to handle this event. A successfully
  1575. * downloaded update will still be applied the next time the application starts.
  1576. */
  1577. on(event: 'update-downloaded', listener: (event: Event,
  1578. releaseNotes: string,
  1579. releaseName: string,
  1580. releaseDate: Date,
  1581. updateURL: string) => void): this;
  1582. once(event: 'update-downloaded', listener: (event: Event,
  1583. releaseNotes: string,
  1584. releaseName: string,
  1585. releaseDate: Date,
  1586. updateURL: string) => void): this;
  1587. addListener(event: 'update-downloaded', listener: (event: Event,
  1588. releaseNotes: string,
  1589. releaseName: string,
  1590. releaseDate: Date,
  1591. updateURL: string) => void): this;
  1592. removeListener(event: 'update-downloaded', listener: (event: Event,
  1593. releaseNotes: string,
  1594. releaseName: string,
  1595. releaseDate: Date,
  1596. updateURL: string) => void): this;
  1597. /**
  1598. * Emitted when there is no available update.
  1599. */
  1600. on(event: 'update-not-available', listener: Function): this;
  1601. once(event: 'update-not-available', listener: Function): this;
  1602. addListener(event: 'update-not-available', listener: Function): this;
  1603. removeListener(event: 'update-not-available', listener: Function): this;
  1604. /**
  1605. * Asks the server whether there is an update. You must call `setFeedURL` before
  1606. * using this API.
  1607. */
  1608. checkForUpdates(): void;
  1609. /**
  1610. * The current update feed URL.
  1611. */
  1612. getFeedURL(): string;
  1613. /**
  1614. * Restarts the app and installs the update after it has been downloaded. It should
  1615. * only be called after `update-downloaded` has been emitted.
  1616. *
  1617. * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
  1618. * windows first, and automatically call `app.quit()` after all windows have been
  1619. * closed.
  1620. *
  1621. * **Note:** It is not strictly necessary to call this function to apply an update,
  1622. * as a successfully downloaded update will always be applied the next time the
  1623. * application starts.
  1624. */
  1625. quitAndInstall(): void;
  1626. /**
  1627. * Sets the `url` and initialize the auto updater.
  1628. */
  1629. setFeedURL(options: FeedURLOptions): void;
  1630. }
  1631. interface BluetoothDevice {
  1632. // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
  1633. deviceId: string;
  1634. deviceName: string;
  1635. }
  1636. class BrowserView {
  1637. // Docs: https://electronjs.org/docs/api/browser-view
  1638. /**
  1639. * BrowserView
  1640. */
  1641. constructor(options?: BrowserViewConstructorOptions);
  1642. /**
  1643. * The `bounds` of this BrowserView instance as `Object`.
  1644. *
  1645. * @experimental
  1646. */
  1647. getBounds(): Rectangle;
  1648. setAutoResize(options: AutoResizeOptions): void;
  1649. setBackgroundColor(color: string): void;
  1650. /**
  1651. * Resizes and moves the view to the supplied bounds relative to the window.
  1652. *
  1653. * @experimental
  1654. */
  1655. setBounds(bounds: Rectangle): void;
  1656. webContents: WebContents;
  1657. }
  1658. class BrowserWindow extends NodeEventEmitter {
  1659. // Docs: https://electronjs.org/docs/api/browser-window
  1660. /**
  1661. * Emitted when the window is set or unset to show always on top of other windows.
  1662. */
  1663. on(event: 'always-on-top-changed', listener: (event: Event,
  1664. isAlwaysOnTop: boolean) => void): this;
  1665. once(event: 'always-on-top-changed', listener: (event: Event,
  1666. isAlwaysOnTop: boolean) => void): this;
  1667. addListener(event: 'always-on-top-changed', listener: (event: Event,
  1668. isAlwaysOnTop: boolean) => void): this;
  1669. removeListener(event: 'always-on-top-changed', listener: (event: Event,
  1670. isAlwaysOnTop: boolean) => void): this;
  1671. /**
  1672. * Emitted when an App Command is invoked. These are typically related to keyboard
  1673. * media keys or browser commands, as well as the "Back" button built into some
  1674. * mice on Windows.
  1675. *
  1676. * Commands are lowercased, underscores are replaced with hyphens, and the
  1677. * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
  1678. * emitted as `browser-backward`.
  1679. *
  1680. * The following app commands are explicitly supported on Linux:
  1681. *
  1682. * `browser-backward`
  1683. * `browser-forward`
  1684. *
  1685. * @platform win32,linux
  1686. */
  1687. on(event: 'app-command', listener: (event: Event,
  1688. command: string) => void): this;
  1689. once(event: 'app-command', listener: (event: Event,
  1690. command: string) => void): this;
  1691. addListener(event: 'app-command', listener: (event: Event,
  1692. command: string) => void): this;
  1693. removeListener(event: 'app-command', listener: (event: Event,
  1694. command: string) => void): this;
  1695. /**
  1696. * Emitted when the window loses focus.
  1697. */
  1698. on(event: 'blur', listener: Function): this;
  1699. once(event: 'blur', listener: Function): this;
  1700. addListener(event: 'blur', listener: Function): this;
  1701. removeListener(event: 'blur', listener: Function): this;
  1702. /**
  1703. * Emitted when the window is going to be closed. It's emitted before the
  1704. * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
  1705. * will cancel the close.
  1706. *
  1707. * Usually you would want to use the `beforeunload` handler to decide whether the
  1708. * window should be closed, which will also be called when the window is reloaded.
  1709. * In Electron, returning any value other than `undefined` would cancel the close.
  1710. * For example:
  1711. *
  1712. * _**Note**: There is a subtle difference between the behaviors of
  1713. * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
  1714. * handler)`. It is recommended to always set the `event.returnValue` explicitly,
  1715. * instead of only returning a value, as the former works more consistently within
  1716. * Electron._
  1717. */
  1718. on(event: 'close', listener: (event: Event) => void): this;
  1719. once(event: 'close', listener: (event: Event) => void): this;
  1720. addListener(event: 'close', listener: (event: Event) => void): this;
  1721. removeListener(event: 'close', listener: (event: Event) => void): this;
  1722. /**
  1723. * Emitted when the window is closed. After you have received this event you should
  1724. * remove the reference to the window and avoid using it any more.
  1725. */
  1726. on(event: 'closed', listener: Function): this;
  1727. once(event: 'closed', listener: Function): this;
  1728. addListener(event: 'closed', listener: Function): this;
  1729. removeListener(event: 'closed', listener: Function): this;
  1730. /**
  1731. * Emitted when the window enters a full-screen state.
  1732. */
  1733. on(event: 'enter-full-screen', listener: Function): this;
  1734. once(event: 'enter-full-screen', listener: Function): this;
  1735. addListener(event: 'enter-full-screen', listener: Function): this;
  1736. removeListener(event: 'enter-full-screen', listener: Function): this;
  1737. /**
  1738. * Emitted when the window enters a full-screen state triggered by HTML API.
  1739. */
  1740. on(event: 'enter-html-full-screen', listener: Function): this;
  1741. once(event: 'enter-html-full-screen', listener: Function): this;
  1742. addListener(event: 'enter-html-full-screen', listener: Function): this;
  1743. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  1744. /**
  1745. * Emitted when the window gains focus.
  1746. */
  1747. on(event: 'focus', listener: Function): this;
  1748. once(event: 'focus', listener: Function): this;
  1749. addListener(event: 'focus', listener: Function): this;
  1750. removeListener(event: 'focus', listener: Function): this;
  1751. /**
  1752. * Emitted when the window is hidden.
  1753. */
  1754. on(event: 'hide', listener: Function): this;
  1755. once(event: 'hide', listener: Function): this;
  1756. addListener(event: 'hide', listener: Function): this;
  1757. removeListener(event: 'hide', listener: Function): this;
  1758. /**
  1759. * Emitted when the window leaves a full-screen state.
  1760. */
  1761. on(event: 'leave-full-screen', listener: Function): this;
  1762. once(event: 'leave-full-screen', listener: Function): this;
  1763. addListener(event: 'leave-full-screen', listener: Function): this;
  1764. removeListener(event: 'leave-full-screen', listener: Function): this;
  1765. /**
  1766. * Emitted when the window leaves a full-screen state triggered by HTML API.
  1767. */
  1768. on(event: 'leave-html-full-screen', listener: Function): this;
  1769. once(event: 'leave-html-full-screen', listener: Function): this;
  1770. addListener(event: 'leave-html-full-screen', listener: Function): this;
  1771. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  1772. /**
  1773. * Emitted when window is maximized.
  1774. */
  1775. on(event: 'maximize', listener: Function): this;
  1776. once(event: 'maximize', listener: Function): this;
  1777. addListener(event: 'maximize', listener: Function): this;
  1778. removeListener(event: 'maximize', listener: Function): this;
  1779. /**
  1780. * Emitted when the window is minimized.
  1781. */
  1782. on(event: 'minimize', listener: Function): this;
  1783. once(event: 'minimize', listener: Function): this;
  1784. addListener(event: 'minimize', listener: Function): this;
  1785. removeListener(event: 'minimize', listener: Function): this;
  1786. /**
  1787. * Emitted when the window is being moved to a new position.
  1788. */
  1789. on(event: 'move', listener: Function): this;
  1790. once(event: 'move', listener: Function): this;
  1791. addListener(event: 'move', listener: Function): this;
  1792. removeListener(event: 'move', listener: Function): this;
  1793. /**
  1794. * Emitted once when the window is moved to a new position.
  1795. *
  1796. __Note__: On macOS this event is an alias of `move`.
  1797. *
  1798. * @platform darwin,win32
  1799. */
  1800. on(event: 'moved', listener: Function): this;
  1801. once(event: 'moved', listener: Function): this;
  1802. addListener(event: 'moved', listener: Function): this;
  1803. removeListener(event: 'moved', listener: Function): this;
  1804. /**
  1805. * Emitted when the native new tab button is clicked.
  1806. *
  1807. * @platform darwin
  1808. */
  1809. on(event: 'new-window-for-tab', listener: Function): this;
  1810. once(event: 'new-window-for-tab', listener: Function): this;
  1811. addListener(event: 'new-window-for-tab', listener: Function): this;
  1812. removeListener(event: 'new-window-for-tab', listener: Function): this;
  1813. /**
  1814. * Emitted when the document changed its title, calling `event.preventDefault()`
  1815. * will prevent the native window's title from changing. `explicitSet` is false
  1816. * when title is synthesized from file URL.
  1817. */
  1818. on(event: 'page-title-updated', listener: (event: Event,
  1819. title: string,
  1820. explicitSet: boolean) => void): this;
  1821. once(event: 'page-title-updated', listener: (event: Event,
  1822. title: string,
  1823. explicitSet: boolean) => void): this;
  1824. addListener(event: 'page-title-updated', listener: (event: Event,
  1825. title: string,
  1826. explicitSet: boolean) => void): this;
  1827. removeListener(event: 'page-title-updated', listener: (event: Event,
  1828. title: string,
  1829. explicitSet: boolean) => void): this;
  1830. /**
  1831. * Emitted when the web page has been rendered (while not being shown) and window
  1832. * can be displayed without a visual flash.
  1833. *
  1834. * Please note that using this event implies that the renderer will be considered
  1835. * "visible" and paint even though `show` is false. This event will never fire if
  1836. * you use `paintWhenInitiallyHidden: false`
  1837. */
  1838. on(event: 'ready-to-show', listener: Function): this;
  1839. once(event: 'ready-to-show', listener: Function): this;
  1840. addListener(event: 'ready-to-show', listener: Function): this;
  1841. removeListener(event: 'ready-to-show', listener: Function): this;
  1842. /**
  1843. * Emitted after the window has been resized.
  1844. */
  1845. on(event: 'resize', listener: Function): this;
  1846. once(event: 'resize', listener: Function): this;
  1847. addListener(event: 'resize', listener: Function): this;
  1848. removeListener(event: 'resize', listener: Function): this;
  1849. /**
  1850. * Emitted once when the window has finished being resized.
  1851. *
  1852. * This is usually emitted when the window has been resized manually. On macOS,
  1853. * resizing the window with `setBounds`/`setSize` and setting the `animate`
  1854. * parameter to `true` will also emit this event once resizing has finished.
  1855. *
  1856. * @platform darwin,win32
  1857. */
  1858. on(event: 'resized', listener: Function): this;
  1859. once(event: 'resized', listener: Function): this;
  1860. addListener(event: 'resized', listener: Function): this;
  1861. removeListener(event: 'resized', listener: Function): this;
  1862. /**
  1863. * Emitted when the unresponsive web page becomes responsive again.
  1864. */
  1865. on(event: 'responsive', listener: Function): this;
  1866. once(event: 'responsive', listener: Function): this;
  1867. addListener(event: 'responsive', listener: Function): this;
  1868. removeListener(event: 'responsive', listener: Function): this;
  1869. /**
  1870. * Emitted when the window is restored from a minimized state.
  1871. */
  1872. on(event: 'restore', listener: Function): this;
  1873. once(event: 'restore', listener: Function): this;
  1874. addListener(event: 'restore', listener: Function): this;
  1875. removeListener(event: 'restore', listener: Function): this;
  1876. /**
  1877. * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
  1878. * is ended. The `rotation` value on each emission is the angle in degrees rotated
  1879. * since the last emission. The last emitted event upon a rotation gesture will
  1880. * always be of value `0`. Counter-clockwise rotation values are positive, while
  1881. * clockwise ones are negative.
  1882. *
  1883. * @platform darwin
  1884. */
  1885. on(event: 'rotate-gesture', listener: (event: Event,
  1886. rotation: number) => void): this;
  1887. once(event: 'rotate-gesture', listener: (event: Event,
  1888. rotation: number) => void): this;
  1889. addListener(event: 'rotate-gesture', listener: (event: Event,
  1890. rotation: number) => void): this;
  1891. removeListener(event: 'rotate-gesture', listener: (event: Event,
  1892. rotation: number) => void): this;
  1893. /**
  1894. * Emitted when scroll wheel event phase has begun.
  1895. *
  1896. * @platform darwin
  1897. */
  1898. on(event: 'scroll-touch-begin', listener: Function): this;
  1899. once(event: 'scroll-touch-begin', listener: Function): this;
  1900. addListener(event: 'scroll-touch-begin', listener: Function): this;
  1901. removeListener(event: 'scroll-touch-begin', listener: Function): this;
  1902. /**
  1903. * Emitted when scroll wheel event phase filed upon reaching the edge of element.
  1904. *
  1905. * @platform darwin
  1906. */
  1907. on(event: 'scroll-touch-edge', listener: Function): this;
  1908. once(event: 'scroll-touch-edge', listener: Function): this;
  1909. addListener(event: 'scroll-touch-edge', listener: Function): this;
  1910. removeListener(event: 'scroll-touch-edge', listener: Function): this;
  1911. /**
  1912. * Emitted when scroll wheel event phase has ended.
  1913. *
  1914. * @platform darwin
  1915. */
  1916. on(event: 'scroll-touch-end', listener: Function): this;
  1917. once(event: 'scroll-touch-end', listener: Function): this;
  1918. addListener(event: 'scroll-touch-end', listener: Function): this;
  1919. removeListener(event: 'scroll-touch-end', listener: Function): this;
  1920. /**
  1921. * Emitted when window session is going to end due to force shutdown or machine
  1922. * restart or session log off.
  1923. *
  1924. * @platform win32
  1925. */
  1926. on(event: 'session-end', listener: Function): this;
  1927. once(event: 'session-end', listener: Function): this;
  1928. addListener(event: 'session-end', listener: Function): this;
  1929. removeListener(event: 'session-end', listener: Function): this;
  1930. /**
  1931. * Emitted when the window opens a sheet.
  1932. *
  1933. * @platform darwin
  1934. */
  1935. on(event: 'sheet-begin', listener: Function): this;
  1936. once(event: 'sheet-begin', listener: Function): this;
  1937. addListener(event: 'sheet-begin', listener: Function): this;
  1938. removeListener(event: 'sheet-begin', listener: Function): this;
  1939. /**
  1940. * Emitted when the window has closed a sheet.
  1941. *
  1942. * @platform darwin
  1943. */
  1944. on(event: 'sheet-end', listener: Function): this;
  1945. once(event: 'sheet-end', listener: Function): this;
  1946. addListener(event: 'sheet-end', listener: Function): this;
  1947. removeListener(event: 'sheet-end', listener: Function): this;
  1948. /**
  1949. * Emitted when the window is shown.
  1950. */
  1951. on(event: 'show', listener: Function): this;
  1952. once(event: 'show', listener: Function): this;
  1953. addListener(event: 'show', listener: Function): this;
  1954. removeListener(event: 'show', listener: Function): this;
  1955. /**
  1956. * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
  1957. * `left`.
  1958. *
  1959. * The method underlying this event is built to handle older macOS-style trackpad
  1960. * swiping, where the content on the screen doesn't move with the swipe. Most macOS
  1961. * trackpads are not configured to allow this kind of swiping anymore, so in order
  1962. * for it to emit properly the 'Swipe between pages' preference in `System
  1963. * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
  1964. * fingers'.
  1965. *
  1966. * @platform darwin
  1967. */
  1968. on(event: 'swipe', listener: (event: Event,
  1969. direction: string) => void): this;
  1970. once(event: 'swipe', listener: (event: Event,
  1971. direction: string) => void): this;
  1972. addListener(event: 'swipe', listener: (event: Event,
  1973. direction: string) => void): this;
  1974. removeListener(event: 'swipe', listener: (event: Event,
  1975. direction: string) => void): this;
  1976. /**
  1977. * Emitted when the system context menu is triggered on the window, this is
  1978. * normally only triggered when the user right clicks on the non-client area of
  1979. * your window. This is the window titlebar or any area you have declared as
  1980. * `-webkit-app-region: drag` in a frameless window.
  1981. *
  1982. Calling `event.preventDefault()` will prevent the menu from being displayed.
  1983. *
  1984. * @platform win32
  1985. */
  1986. on(event: 'system-context-menu', listener: (event: Event,
  1987. /**
  1988. * The screen coordinates the context menu was triggered at
  1989. */
  1990. point: Point) => void): this;
  1991. once(event: 'system-context-menu', listener: (event: Event,
  1992. /**
  1993. * The screen coordinates the context menu was triggered at
  1994. */
  1995. point: Point) => void): this;
  1996. addListener(event: 'system-context-menu', listener: (event: Event,
  1997. /**
  1998. * The screen coordinates the context menu was triggered at
  1999. */
  2000. point: Point) => void): this;
  2001. removeListener(event: 'system-context-menu', listener: (event: Event,
  2002. /**
  2003. * The screen coordinates the context menu was triggered at
  2004. */
  2005. point: Point) => void): this;
  2006. /**
  2007. * Emitted when the window exits from a maximized state.
  2008. */
  2009. on(event: 'unmaximize', listener: Function): this;
  2010. once(event: 'unmaximize', listener: Function): this;
  2011. addListener(event: 'unmaximize', listener: Function): this;
  2012. removeListener(event: 'unmaximize', listener: Function): this;
  2013. /**
  2014. * Emitted when the web page becomes unresponsive.
  2015. */
  2016. on(event: 'unresponsive', listener: Function): this;
  2017. once(event: 'unresponsive', listener: Function): this;
  2018. addListener(event: 'unresponsive', listener: Function): this;
  2019. removeListener(event: 'unresponsive', listener: Function): this;
  2020. /**
  2021. * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
  2022. * will prevent the window from being moved.
  2023. *
  2024. * Note that this is only emitted when the window is being resized manually.
  2025. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2026. *
  2027. * @platform darwin,win32
  2028. */
  2029. on(event: 'will-move', listener: (event: Event,
  2030. /**
  2031. * Location the window is being moved to.
  2032. */
  2033. newBounds: Rectangle) => void): this;
  2034. once(event: 'will-move', listener: (event: Event,
  2035. /**
  2036. * Location the window is being moved to.
  2037. */
  2038. newBounds: Rectangle) => void): this;
  2039. addListener(event: 'will-move', listener: (event: Event,
  2040. /**
  2041. * Location the window is being moved to.
  2042. */
  2043. newBounds: Rectangle) => void): this;
  2044. removeListener(event: 'will-move', listener: (event: Event,
  2045. /**
  2046. * Location the window is being moved to.
  2047. */
  2048. newBounds: Rectangle) => void): this;
  2049. /**
  2050. * Emitted before the window is resized. Calling `event.preventDefault()` will
  2051. * prevent the window from being resized.
  2052. *
  2053. * Note that this is only emitted when the window is being resized manually.
  2054. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2055. *
  2056. * @platform darwin,win32
  2057. */
  2058. on(event: 'will-resize', listener: (event: Event,
  2059. /**
  2060. * Size the window is being resized to.
  2061. */
  2062. newBounds: Rectangle) => void): this;
  2063. once(event: 'will-resize', listener: (event: Event,
  2064. /**
  2065. * Size the window is being resized to.
  2066. */
  2067. newBounds: Rectangle) => void): this;
  2068. addListener(event: 'will-resize', listener: (event: Event,
  2069. /**
  2070. * Size the window is being resized to.
  2071. */
  2072. newBounds: Rectangle) => void): this;
  2073. removeListener(event: 'will-resize', listener: (event: Event,
  2074. /**
  2075. * Size the window is being resized to.
  2076. */
  2077. newBounds: Rectangle) => void): this;
  2078. /**
  2079. * BrowserWindow
  2080. */
  2081. constructor(options?: BrowserWindowConstructorOptions);
  2082. /**
  2083. * The window that owns the given `browserView`. If the given view is not attached
  2084. * to any window, returns `null`.
  2085. */
  2086. static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
  2087. /**
  2088. * The window with the given `id`.
  2089. */
  2090. static fromId(id: number): (BrowserWindow) | (null);
  2091. /**
  2092. * The window that owns the given `webContents` or `null` if the contents are not
  2093. * owned by a window.
  2094. */
  2095. static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
  2096. /**
  2097. * An array of all opened browser windows.
  2098. */
  2099. static getAllWindows(): BrowserWindow[];
  2100. /**
  2101. * The window that is focused in this application, otherwise returns `null`.
  2102. */
  2103. static getFocusedWindow(): (BrowserWindow) | (null);
  2104. /**
  2105. * Replacement API for setBrowserView supporting work with multi browser views.
  2106. *
  2107. * @experimental
  2108. */
  2109. addBrowserView(browserView: BrowserView): void;
  2110. /**
  2111. * Adds a window as a tab on this window, after the tab for the window instance.
  2112. *
  2113. * @platform darwin
  2114. */
  2115. addTabbedWindow(browserWindow: BrowserWindow): void;
  2116. /**
  2117. * Removes focus from the window.
  2118. */
  2119. blur(): void;
  2120. blurWebView(): void;
  2121. /**
  2122. * Resolves with a NativeImage
  2123. *
  2124. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  2125. * whole visible page. If the page is not visible, `rect` may be empty.
  2126. */
  2127. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  2128. /**
  2129. * Moves window to the center of the screen.
  2130. */
  2131. center(): void;
  2132. /**
  2133. * Try to close the window. This has the same effect as a user manually clicking
  2134. * the close button of the window. The web page may cancel the close though. See
  2135. * the close event.
  2136. */
  2137. close(): void;
  2138. /**
  2139. * Closes the currently open Quick Look panel.
  2140. *
  2141. * @platform darwin
  2142. */
  2143. closeFilePreview(): void;
  2144. /**
  2145. * Force closing the window, the `unload` and `beforeunload` event won't be emitted
  2146. * for the web page, and `close` event will also not be emitted for this window,
  2147. * but it guarantees the `closed` event will be emitted.
  2148. */
  2149. destroy(): void;
  2150. /**
  2151. * Starts or stops flashing the window to attract user's attention.
  2152. */
  2153. flashFrame(flag: boolean): void;
  2154. /**
  2155. * Focuses on the window.
  2156. */
  2157. focus(): void;
  2158. focusOnWebView(): void;
  2159. /**
  2160. * Gets the background color of the window. See Setting `backgroundColor`.
  2161. */
  2162. getBackgroundColor(): string;
  2163. /**
  2164. * The `bounds` of the window as `Object`.
  2165. */
  2166. getBounds(): Rectangle;
  2167. /**
  2168. * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
  2169. * Throws an error if multiple `BrowserView`s are attached.
  2170. *
  2171. * @experimental
  2172. */
  2173. getBrowserView(): (BrowserView) | (null);
  2174. /**
  2175. * an array of all BrowserViews that have been attached with `addBrowserView` or
  2176. * `setBrowserView`.
  2177. *
  2178. * **Note:** The BrowserView API is currently experimental and may change or be
  2179. * removed in future Electron releases.
  2180. *
  2181. * @experimental
  2182. */
  2183. getBrowserViews(): BrowserView[];
  2184. /**
  2185. * All child windows.
  2186. */
  2187. getChildWindows(): BrowserWindow[];
  2188. /**
  2189. * The `bounds` of the window's client area as `Object`.
  2190. */
  2191. getContentBounds(): Rectangle;
  2192. /**
  2193. * Contains the window's client area's width and height.
  2194. */
  2195. getContentSize(): number[];
  2196. /**
  2197. * Contains the window's maximum width and height.
  2198. */
  2199. getMaximumSize(): number[];
  2200. /**
  2201. * Window id in the format of DesktopCapturerSource's id. For example
  2202. * "window:1324:0".
  2203. *
  2204. * More precisely the format is `window:id:other_id` where `id` is `HWND` on
  2205. * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
  2206. * Linux. `other_id` is used to identify web contents (tabs) so within the same top
  2207. * level window.
  2208. */
  2209. getMediaSourceId(): string;
  2210. /**
  2211. * Contains the window's minimum width and height.
  2212. */
  2213. getMinimumSize(): number[];
  2214. /**
  2215. * The platform-specific handle of the window.
  2216. *
  2217. * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
  2218. * `Window` (`unsigned long`) on Linux.
  2219. */
  2220. getNativeWindowHandle(): Buffer;
  2221. /**
  2222. * Contains the window bounds of the normal state
  2223. *
  2224. * **Note:** whatever the current state of the window : maximized, minimized or in
  2225. * fullscreen, this function always returns the position and size of the window in
  2226. * normal state. In normal state, getBounds and getNormalBounds returns the same
  2227. * `Rectangle`.
  2228. */
  2229. getNormalBounds(): Rectangle;
  2230. /**
  2231. * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
  2232. * 1.
  2233. */
  2234. getOpacity(): number;
  2235. /**
  2236. * The parent window.
  2237. */
  2238. getParentWindow(): BrowserWindow;
  2239. /**
  2240. * Contains the window's current position.
  2241. */
  2242. getPosition(): number[];
  2243. /**
  2244. * The pathname of the file the window represents.
  2245. *
  2246. * @platform darwin
  2247. */
  2248. getRepresentedFilename(): string;
  2249. /**
  2250. * Contains the window's width and height.
  2251. */
  2252. getSize(): number[];
  2253. /**
  2254. * The title of the native window.
  2255. *
  2256. * **Note:** The title of the web page can be different from the title of the
  2257. * native window.
  2258. */
  2259. getTitle(): string;
  2260. /**
  2261. * The custom position for the traffic light buttons in frameless window.
  2262. *
  2263. * @platform darwin
  2264. */
  2265. getTrafficLightPosition(): Point;
  2266. /**
  2267. * Whether the window has a shadow.
  2268. */
  2269. hasShadow(): boolean;
  2270. /**
  2271. * Hides the window.
  2272. */
  2273. hide(): void;
  2274. /**
  2275. * Hooks a windows message. The `callback` is called when the message is received
  2276. * in the WndProc.
  2277. *
  2278. * @platform win32
  2279. */
  2280. hookWindowMessage(message: number, callback: (wParam: any, lParam: any) => void): void;
  2281. /**
  2282. * Whether the window is always on top of other windows.
  2283. */
  2284. isAlwaysOnTop(): boolean;
  2285. /**
  2286. * Whether the window can be manually closed by user.
  2287. *
  2288. On Linux always returns `true`.
  2289. *
  2290. * @platform darwin,win32
  2291. */
  2292. isClosable(): boolean;
  2293. /**
  2294. * Whether the window is destroyed.
  2295. */
  2296. isDestroyed(): boolean;
  2297. /**
  2298. * Whether the window's document has been edited.
  2299. *
  2300. * @platform darwin
  2301. */
  2302. isDocumentEdited(): boolean;
  2303. /**
  2304. * whether the window is enabled.
  2305. */
  2306. isEnabled(): boolean;
  2307. /**
  2308. * Whether the window is focused.
  2309. */
  2310. isFocused(): boolean;
  2311. /**
  2312. * Whether the window is in fullscreen mode.
  2313. */
  2314. isFullScreen(): boolean;
  2315. /**
  2316. * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
  2317. * window.
  2318. */
  2319. isFullScreenable(): boolean;
  2320. /**
  2321. * Whether the window is in kiosk mode.
  2322. */
  2323. isKiosk(): boolean;
  2324. /**
  2325. * Whether the window can be manually maximized by user.
  2326. *
  2327. On Linux always returns `true`.
  2328. *
  2329. * @platform darwin,win32
  2330. */
  2331. isMaximizable(): boolean;
  2332. /**
  2333. * Whether the window is maximized.
  2334. */
  2335. isMaximized(): boolean;
  2336. /**
  2337. * Whether menu bar automatically hides itself.
  2338. */
  2339. isMenuBarAutoHide(): boolean;
  2340. /**
  2341. * Whether the menu bar is visible.
  2342. */
  2343. isMenuBarVisible(): boolean;
  2344. /**
  2345. * Whether the window can be manually minimized by the user.
  2346. *
  2347. On Linux always returns `true`.
  2348. *
  2349. * @platform darwin,win32
  2350. */
  2351. isMinimizable(): boolean;
  2352. /**
  2353. * Whether the window is minimized.
  2354. */
  2355. isMinimized(): boolean;
  2356. /**
  2357. * Whether current window is a modal window.
  2358. */
  2359. isModal(): boolean;
  2360. /**
  2361. * Whether the window can be moved by user.
  2362. On Linux always returns `true`.
  2363. *
  2364. * @platform darwin,win32
  2365. */
  2366. isMovable(): boolean;
  2367. /**
  2368. * Whether the window is in normal state (not maximized, not minimized, not in
  2369. * fullscreen mode).
  2370. */
  2371. isNormal(): boolean;
  2372. /**
  2373. * Whether the window can be manually resized by the user.
  2374. */
  2375. isResizable(): boolean;
  2376. /**
  2377. * Whether the window is in simple (pre-Lion) fullscreen mode.
  2378. *
  2379. * @platform darwin
  2380. */
  2381. isSimpleFullScreen(): boolean;
  2382. /**
  2383. * Whether the window is in Windows 10 tablet mode.
  2384. *
  2385. * Since Windows 10 users can use their PC as tablet, under this mode apps can
  2386. * choose to optimize their UI for tablets, such as enlarging the titlebar and
  2387. * hiding titlebar buttons.
  2388. *
  2389. * This API returns whether the window is in tablet mode, and the `resize` event
  2390. * can be be used to listen to changes to tablet mode.
  2391. *
  2392. * @platform win32
  2393. */
  2394. isTabletMode(): boolean;
  2395. /**
  2396. * Whether the window is visible to the user.
  2397. */
  2398. isVisible(): boolean;
  2399. /**
  2400. * Whether the window is visible on all workspaces.
  2401. *
  2402. **Note:** This API always returns false on Windows.
  2403. */
  2404. isVisibleOnAllWorkspaces(): boolean;
  2405. /**
  2406. * `true` or `false` depending on whether the message is hooked.
  2407. *
  2408. * @platform win32
  2409. */
  2410. isWindowMessageHooked(message: number): boolean;
  2411. /**
  2412. * the promise will resolve when the page has finished loading (see
  2413. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  2414. *
  2415. * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
  2416. * relative to the root of your application. See the `webContents` docs for more
  2417. * information.
  2418. */
  2419. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  2420. /**
  2421. * the promise will resolve when the page has finished loading (see
  2422. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  2423. *
  2424. * Same as `webContents.loadURL(url[, options])`.
  2425. *
  2426. * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
  2427. * file using the `file://` protocol.
  2428. *
  2429. * To ensure that file URLs are properly formatted, it is recommended to use Node's
  2430. * `url.format` method:
  2431. *
  2432. * You can load a URL using a `POST` request with URL-encoded data by doing the
  2433. * following:
  2434. */
  2435. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  2436. /**
  2437. * Maximizes the window. This will also show (but not focus) the window if it isn't
  2438. * being displayed already.
  2439. */
  2440. maximize(): void;
  2441. /**
  2442. * Merges all windows into one window with multiple tabs when native tabs are
  2443. * enabled and there is more than one open window.
  2444. *
  2445. * @platform darwin
  2446. */
  2447. mergeAllWindows(): void;
  2448. /**
  2449. * Minimizes the window. On some platforms the minimized window will be shown in
  2450. * the Dock.
  2451. */
  2452. minimize(): void;
  2453. /**
  2454. * Moves window above the source window in the sense of z-order. If the
  2455. * `mediaSourceId` is not of type window or if the window does not exist then this
  2456. * method throws an error.
  2457. */
  2458. moveAbove(mediaSourceId: string): void;
  2459. /**
  2460. * Moves the current tab into a new window if native tabs are enabled and there is
  2461. * more than one tab in the current window.
  2462. *
  2463. * @platform darwin
  2464. */
  2465. moveTabToNewWindow(): void;
  2466. /**
  2467. * Moves window to top(z-order) regardless of focus
  2468. */
  2469. moveTop(): void;
  2470. /**
  2471. * Uses Quick Look to preview a file at a given path.
  2472. *
  2473. * @platform darwin
  2474. */
  2475. previewFile(path: string, displayName?: string): void;
  2476. /**
  2477. * Same as `webContents.reload`.
  2478. */
  2479. reload(): void;
  2480. removeBrowserView(browserView: BrowserView): void;
  2481. /**
  2482. * Remove the window's menu bar.
  2483. *
  2484. * @platform linux,win32
  2485. */
  2486. removeMenu(): void;
  2487. /**
  2488. * Restores the window from minimized state to its previous state.
  2489. */
  2490. restore(): void;
  2491. /**
  2492. * Selects the next tab when native tabs are enabled and there are other tabs in
  2493. * the window.
  2494. *
  2495. * @platform darwin
  2496. */
  2497. selectNextTab(): void;
  2498. /**
  2499. * Selects the previous tab when native tabs are enabled and there are other tabs
  2500. * in the window.
  2501. *
  2502. * @platform darwin
  2503. */
  2504. selectPreviousTab(): void;
  2505. /**
  2506. * Sets whether the window should show always on top of other windows. After
  2507. * setting this, the window is still a normal window, not a toolbox window which
  2508. * can not be focused on.
  2509. */
  2510. setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
  2511. /**
  2512. * Sets the properties for the window's taskbar button.
  2513. *
  2514. * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
  2515. * together. If one of those properties is not set, then neither will be used.
  2516. *
  2517. * @platform win32
  2518. */
  2519. setAppDetails(options: AppDetailsOptions): void;
  2520. /**
  2521. * This will make a window maintain an aspect ratio. The extra size allows a
  2522. * developer to have space, specified in pixels, not included within the aspect
  2523. * ratio calculations. This API already takes into account the difference between a
  2524. * window's size and its content size.
  2525. *
  2526. * Consider a normal window with an HD video player and associated controls.
  2527. * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
  2528. * on the right edge and 50 pixels of controls below the player. In order to
  2529. * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
  2530. * the player itself we would call this function with arguments of 16/9 and {
  2531. * width: 40, height: 50 }. The second argument doesn't care where the extra width
  2532. * and height are within the content view--only that they exist. Sum any extra
  2533. * width and height areas you have within the overall content view.
  2534. *
  2535. * The aspect ratio is not respected when window is resized programmatically with
  2536. * APIs like `win.setSize`.
  2537. */
  2538. setAspectRatio(aspectRatio: number, extraSize?: Size): void;
  2539. /**
  2540. * Controls whether to hide cursor when typing.
  2541. *
  2542. * @platform darwin
  2543. */
  2544. setAutoHideCursor(autoHide: boolean): void;
  2545. /**
  2546. * Sets whether the window menu bar should hide itself automatically. Once set the
  2547. * menu bar will only show when users press the single `Alt` key.
  2548. *
  2549. * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
  2550. * hide it immediately.
  2551. */
  2552. setAutoHideMenuBar(hide: boolean): void;
  2553. /**
  2554. * Sets the background color of the window. See Setting `backgroundColor`.
  2555. */
  2556. setBackgroundColor(backgroundColor: string): void;
  2557. /**
  2558. * Resizes and moves the window to the supplied bounds. Any properties that are not
  2559. * supplied will default to their current values.
  2560. */
  2561. setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
  2562. setBrowserView(browserView: (BrowserView) | (null)): void;
  2563. /**
  2564. * Sets whether the window can be manually closed by user. On Linux does nothing.
  2565. *
  2566. * @platform darwin,win32
  2567. */
  2568. setClosable(closable: boolean): void;
  2569. /**
  2570. * Resizes and moves the window's client area (e.g. the web page) to the supplied
  2571. * bounds.
  2572. */
  2573. setContentBounds(bounds: Rectangle, animate?: boolean): void;
  2574. /**
  2575. * Prevents the window contents from being captured by other apps.
  2576. *
  2577. * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
  2578. * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
  2579. * version 2004 and up the window will be removed from capture entirely, older
  2580. * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
  2581. *
  2582. * @platform darwin,win32
  2583. */
  2584. setContentProtection(enable: boolean): void;
  2585. /**
  2586. * Resizes the window's client area (e.g. the web page) to `width` and `height`.
  2587. */
  2588. setContentSize(width: number, height: number, animate?: boolean): void;
  2589. /**
  2590. * Specifies whether the window’s document has been edited, and the icon in title
  2591. * bar will become gray when set to `true`.
  2592. *
  2593. * @platform darwin
  2594. */
  2595. setDocumentEdited(edited: boolean): void;
  2596. /**
  2597. * Disable or enable the window.
  2598. */
  2599. setEnabled(enable: boolean): void;
  2600. /**
  2601. * Changes whether the window can be focused.
  2602. *
  2603. On macOS it does not remove the focus from the window.
  2604. *
  2605. * @platform darwin,win32
  2606. */
  2607. setFocusable(focusable: boolean): void;
  2608. /**
  2609. * Sets whether the window should be in fullscreen mode.
  2610. */
  2611. setFullScreen(flag: boolean): void;
  2612. /**
  2613. * Sets whether the maximize/zoom window button toggles fullscreen mode or
  2614. * maximizes the window.
  2615. */
  2616. setFullScreenable(fullscreenable: boolean): void;
  2617. /**
  2618. * Sets whether the window should have a shadow.
  2619. */
  2620. setHasShadow(hasShadow: boolean): void;
  2621. /**
  2622. * Changes window icon.
  2623. *
  2624. * @platform win32,linux
  2625. */
  2626. setIcon(icon: (NativeImage) | (string)): void;
  2627. /**
  2628. * Makes the window ignore all mouse events.
  2629. *
  2630. * All mouse events happened in this window will be passed to the window below this
  2631. * window, but if this window has focus, it will still receive keyboard events.
  2632. */
  2633. setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
  2634. /**
  2635. * Enters or leaves kiosk mode.
  2636. */
  2637. setKiosk(flag: boolean): void;
  2638. /**
  2639. * Sets whether the window can be manually maximized by user. On Linux does
  2640. * nothing.
  2641. *
  2642. * @platform darwin,win32
  2643. */
  2644. setMaximizable(maximizable: boolean): void;
  2645. /**
  2646. * Sets the maximum size of window to `width` and `height`.
  2647. */
  2648. setMaximumSize(width: number, height: number): void;
  2649. /**
  2650. * Sets the `menu` as the window's menu bar.
  2651. *
  2652. * @platform linux,win32
  2653. */
  2654. setMenu(menu: (Menu) | (null)): void;
  2655. /**
  2656. * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
  2657. * can still bring up the menu bar by pressing the single `Alt` key.
  2658. *
  2659. * @platform win32,linux
  2660. */
  2661. setMenuBarVisibility(visible: boolean): void;
  2662. /**
  2663. * Sets whether the window can be manually minimized by user. On Linux does
  2664. * nothing.
  2665. *
  2666. * @platform darwin,win32
  2667. */
  2668. setMinimizable(minimizable: boolean): void;
  2669. /**
  2670. * Sets the minimum size of window to `width` and `height`.
  2671. */
  2672. setMinimumSize(width: number, height: number): void;
  2673. /**
  2674. * Sets whether the window can be moved by user. On Linux does nothing.
  2675. *
  2676. * @platform darwin,win32
  2677. */
  2678. setMovable(movable: boolean): void;
  2679. /**
  2680. * Sets the opacity of the window. On Linux, does nothing. Out of bound number
  2681. * values are clamped to the [0, 1] range.
  2682. *
  2683. * @platform win32,darwin
  2684. */
  2685. setOpacity(opacity: number): void;
  2686. /**
  2687. * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
  2688. * convey some sort of application status or to passively notify the user.
  2689. *
  2690. * @platform win32
  2691. */
  2692. setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
  2693. /**
  2694. * Sets `parent` as current window's parent window, passing `null` will turn
  2695. * current window into a top-level window.
  2696. */
  2697. setParentWindow(parent: (BrowserWindow) | (null)): void;
  2698. /**
  2699. * Moves window to `x` and `y`.
  2700. */
  2701. setPosition(x: number, y: number, animate?: boolean): void;
  2702. /**
  2703. * Sets progress value in progress bar. Valid range is [0, 1.0].
  2704. *
  2705. * Remove progress bar when progress < 0; Change to indeterminate mode when
  2706. * progress > 1.
  2707. *
  2708. * On Linux platform, only supports Unity desktop environment, you need to specify
  2709. * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
  2710. * it will assume `{app.name}.desktop`.
  2711. *
  2712. * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
  2713. * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
  2714. * mode set (but with a value within the valid range), `normal` will be assumed.
  2715. */
  2716. setProgressBar(progress: number, options?: ProgressBarOptions): void;
  2717. /**
  2718. * Sets the pathname of the file the window represents, and the icon of the file
  2719. * will show in window's title bar.
  2720. *
  2721. * @platform darwin
  2722. */
  2723. setRepresentedFilename(filename: string): void;
  2724. /**
  2725. * Sets whether the window can be manually resized by the user.
  2726. */
  2727. setResizable(resizable: boolean): void;
  2728. /**
  2729. * Setting a window shape determines the area within the window where the system
  2730. * permits drawing and user interaction. Outside of the given region, no pixels
  2731. * will be drawn and no mouse events will be registered. Mouse events outside of
  2732. * the region will not be received by that window, but will fall through to
  2733. * whatever is behind the window.
  2734. *
  2735. * @experimental
  2736. * @platform win32,linux
  2737. */
  2738. setShape(rects: Rectangle[]): void;
  2739. /**
  2740. * Changes the attachment point for sheets on macOS. By default, sheets are
  2741. * attached just below the window frame, but you may want to display them beneath a
  2742. * HTML-rendered toolbar. For example:
  2743. *
  2744. * @platform darwin
  2745. */
  2746. setSheetOffset(offsetY: number, offsetX?: number): void;
  2747. /**
  2748. * Enters or leaves simple fullscreen mode.
  2749. *
  2750. * Simple fullscreen mode emulates the native fullscreen behavior found in versions
  2751. * of macOS prior to Lion (10.7).
  2752. *
  2753. * @platform darwin
  2754. */
  2755. setSimpleFullScreen(flag: boolean): void;
  2756. /**
  2757. * Resizes the window to `width` and `height`. If `width` or `height` are below any
  2758. * set minimum size constraints the window will snap to its minimum size.
  2759. */
  2760. setSize(width: number, height: number, animate?: boolean): void;
  2761. /**
  2762. * Makes the window not show in the taskbar.
  2763. */
  2764. setSkipTaskbar(skip: boolean): void;
  2765. /**
  2766. * Whether the buttons were added successfully
  2767. *
  2768. * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
  2769. * of a window in a taskbar button layout. Returns a `Boolean` object indicates
  2770. * whether the thumbnail has been added successfully.
  2771. *
  2772. * The number of buttons in thumbnail toolbar should be no greater than 7 due to
  2773. * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
  2774. * removed due to the platform's limitation. But you can call the API with an empty
  2775. * array to clean the buttons.
  2776. *
  2777. * The `buttons` is an array of `Button` objects:
  2778. *
  2779. * * `Button` Object
  2780. * * `icon` NativeImage - The icon showing in thumbnail toolbar.
  2781. * * `click` Function
  2782. * * `tooltip` String (optional) - The text of the button's tooltip.
  2783. * * `flags` String[] (optional) - Control specific states and behaviors of the
  2784. * button. By default, it is `['enabled']`.
  2785. *
  2786. * The `flags` is an array that can include following `String`s:
  2787. *
  2788. * * `enabled` - The button is active and available to the user.
  2789. * * `disabled` - The button is disabled. It is present, but has a visual state
  2790. * indicating it will not respond to user action.
  2791. * * `dismissonclick` - When the button is clicked, the thumbnail window closes
  2792. * immediately.
  2793. * * `nobackground` - Do not draw a button border, use only the image.
  2794. * * `hidden` - The button is not shown to the user.
  2795. * * `noninteractive` - The button is enabled but not interactive; no pressed
  2796. * button state is drawn. This value is intended for instances where the button is
  2797. * used in a notification.
  2798. *
  2799. * @platform win32
  2800. */
  2801. setThumbarButtons(buttons: ThumbarButton[]): boolean;
  2802. /**
  2803. * Sets the region of the window to show as the thumbnail image displayed when
  2804. * hovering over the window in the taskbar. You can reset the thumbnail to be the
  2805. * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
  2806. * }`.
  2807. *
  2808. * @platform win32
  2809. */
  2810. setThumbnailClip(region: Rectangle): void;
  2811. /**
  2812. * Sets the toolTip that is displayed when hovering over the window thumbnail in
  2813. * the taskbar.
  2814. *
  2815. * @platform win32
  2816. */
  2817. setThumbnailToolTip(toolTip: string): void;
  2818. /**
  2819. * Changes the title of native window to `title`.
  2820. */
  2821. setTitle(title: string): void;
  2822. /**
  2823. * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
  2824. * error if `browserView` is not attached to `win`.
  2825. *
  2826. * @experimental
  2827. */
  2828. setTopBrowserView(browserView: BrowserView): void;
  2829. /**
  2830. * Sets the touchBar layout for the current window. Specifying `null` or
  2831. * `undefined` clears the touch bar. This method only has an effect if the machine
  2832. * has a touch bar and is running on macOS 10.12.1+.
  2833. *
  2834. * **Note:** The TouchBar API is currently experimental and may change or be
  2835. * removed in future Electron releases.
  2836. *
  2837. * @platform darwin
  2838. */
  2839. setTouchBar(touchBar: (TouchBar) | (null)): void;
  2840. /**
  2841. * Set a custom position for the traffic light buttons in frameless window.
  2842. *
  2843. * @platform darwin
  2844. */
  2845. setTrafficLightPosition(position: Point): void;
  2846. /**
  2847. * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
  2848. * will remove the vibrancy effect on the window.
  2849. *
  2850. * Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
  2851. * have been deprecated and will be removed in an upcoming version of macOS.
  2852. *
  2853. * @platform darwin
  2854. */
  2855. setVibrancy(type: (('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
  2856. /**
  2857. * Sets whether the window should be visible on all workspaces.
  2858. *
  2859. **Note:** This API does nothing on Windows.
  2860. */
  2861. setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
  2862. /**
  2863. * Sets whether the window traffic light buttons should be visible.
  2864. *
  2865. * @platform darwin
  2866. */
  2867. setWindowButtonVisibility(visible: boolean): void;
  2868. /**
  2869. * Shows and gives focus to the window.
  2870. */
  2871. show(): void;
  2872. /**
  2873. * Same as `webContents.showDefinitionForSelection()`.
  2874. *
  2875. * @platform darwin
  2876. */
  2877. showDefinitionForSelection(): void;
  2878. /**
  2879. * Shows the window but doesn't focus on it.
  2880. */
  2881. showInactive(): void;
  2882. /**
  2883. * Toggles the visibility of the tab bar if native tabs are enabled and there is
  2884. * only one tab in the current window.
  2885. *
  2886. * @platform darwin
  2887. */
  2888. toggleTabBar(): void;
  2889. /**
  2890. * Unhooks all of the window messages.
  2891. *
  2892. * @platform win32
  2893. */
  2894. unhookAllWindowMessages(): void;
  2895. /**
  2896. * Unhook the window message.
  2897. *
  2898. * @platform win32
  2899. */
  2900. unhookWindowMessage(message: number): void;
  2901. /**
  2902. * Unmaximizes the window.
  2903. */
  2904. unmaximize(): void;
  2905. accessibleTitle: string;
  2906. autoHideMenuBar: boolean;
  2907. closable: boolean;
  2908. documentEdited: boolean;
  2909. excludedFromShownWindowsMenu: boolean;
  2910. fullScreen: boolean;
  2911. fullScreenable: boolean;
  2912. readonly id: number;
  2913. kiosk: boolean;
  2914. maximizable: boolean;
  2915. menuBarVisible: boolean;
  2916. minimizable: boolean;
  2917. movable: boolean;
  2918. representedFilename: string;
  2919. resizable: boolean;
  2920. shadow: boolean;
  2921. simpleFullScreen: boolean;
  2922. title: string;
  2923. visibleOnAllWorkspaces: boolean;
  2924. readonly webContents: WebContents;
  2925. }
  2926. class BrowserWindowProxy {
  2927. // Docs: https://electronjs.org/docs/api/browser-window-proxy
  2928. /**
  2929. * Removes focus from the child window.
  2930. */
  2931. blur(): void;
  2932. /**
  2933. * Forcefully closes the child window without calling its unload event.
  2934. */
  2935. close(): void;
  2936. /**
  2937. * Evaluates the code in the child window.
  2938. */
  2939. eval(code: string): void;
  2940. /**
  2941. * Focuses the child window (brings the window to front).
  2942. */
  2943. focus(): void;
  2944. /**
  2945. * Sends a message to the child window with the specified origin or `*` for no
  2946. * origin preference.
  2947. *
  2948. * In addition to these methods, the child window implements `window.opener` object
  2949. * with no properties and a single method.
  2950. */
  2951. postMessage(message: any, targetOrigin: string): void;
  2952. /**
  2953. * Invokes the print dialog on the child window.
  2954. */
  2955. print(): void;
  2956. closed: boolean;
  2957. }
  2958. interface Certificate {
  2959. // Docs: https://electronjs.org/docs/api/structures/certificate
  2960. /**
  2961. * PEM encoded data
  2962. */
  2963. data: string;
  2964. /**
  2965. * Fingerprint of the certificate
  2966. */
  2967. fingerprint: string;
  2968. /**
  2969. * Issuer principal
  2970. */
  2971. issuer: CertificatePrincipal;
  2972. /**
  2973. * Issuer certificate (if not self-signed)
  2974. */
  2975. issuerCert: Certificate;
  2976. /**
  2977. * Issuer's Common Name
  2978. */
  2979. issuerName: string;
  2980. /**
  2981. * Hex value represented string
  2982. */
  2983. serialNumber: string;
  2984. /**
  2985. * Subject principal
  2986. */
  2987. subject: CertificatePrincipal;
  2988. /**
  2989. * Subject's Common Name
  2990. */
  2991. subjectName: string;
  2992. /**
  2993. * End date of the certificate being valid in seconds
  2994. */
  2995. validExpiry: number;
  2996. /**
  2997. * Start date of the certificate being valid in seconds
  2998. */
  2999. validStart: number;
  3000. }
  3001. interface CertificatePrincipal {
  3002. // Docs: https://electronjs.org/docs/api/structures/certificate-principal
  3003. /**
  3004. * Common Name.
  3005. */
  3006. commonName: string;
  3007. /**
  3008. * Country or region.
  3009. */
  3010. country: string;
  3011. /**
  3012. * Locality.
  3013. */
  3014. locality: string;
  3015. /**
  3016. * Organization names.
  3017. */
  3018. organizations: string[];
  3019. /**
  3020. * Organization Unit names.
  3021. */
  3022. organizationUnits: string[];
  3023. /**
  3024. * State or province.
  3025. */
  3026. state: string;
  3027. }
  3028. class ClientRequest extends NodeEventEmitter {
  3029. // Docs: https://electronjs.org/docs/api/client-request
  3030. /**
  3031. * Emitted when the `request` is aborted. The `abort` event will not be fired if
  3032. * the `request` is already closed.
  3033. */
  3034. on(event: 'abort', listener: Function): this;
  3035. once(event: 'abort', listener: Function): this;
  3036. addListener(event: 'abort', listener: Function): this;
  3037. removeListener(event: 'abort', listener: Function): this;
  3038. /**
  3039. * Emitted as the last event in the HTTP request-response transaction. The `close`
  3040. * event indicates that no more events will be emitted on either the `request` or
  3041. * `response` objects.
  3042. */
  3043. on(event: 'close', listener: Function): this;
  3044. once(event: 'close', listener: Function): this;
  3045. addListener(event: 'close', listener: Function): this;
  3046. removeListener(event: 'close', listener: Function): this;
  3047. /**
  3048. * Emitted when the `net` module fails to issue a network request. Typically when
  3049. * the `request` object emits an `error` event, a `close` event will subsequently
  3050. * follow and no response object will be provided.
  3051. */
  3052. on(event: 'error', listener: (
  3053. /**
  3054. * an error object providing some information about the failure.
  3055. */
  3056. error: Error) => void): this;
  3057. once(event: 'error', listener: (
  3058. /**
  3059. * an error object providing some information about the failure.
  3060. */
  3061. error: Error) => void): this;
  3062. addListener(event: 'error', listener: (
  3063. /**
  3064. * an error object providing some information about the failure.
  3065. */
  3066. error: Error) => void): this;
  3067. removeListener(event: 'error', listener: (
  3068. /**
  3069. * an error object providing some information about the failure.
  3070. */
  3071. error: Error) => void): this;
  3072. /**
  3073. * Emitted just after the last chunk of the `request`'s data has been written into
  3074. * the `request` object.
  3075. */
  3076. on(event: 'finish', listener: Function): this;
  3077. once(event: 'finish', listener: Function): this;
  3078. addListener(event: 'finish', listener: Function): this;
  3079. removeListener(event: 'finish', listener: Function): this;
  3080. /**
  3081. * Emitted when an authenticating proxy is asking for user credentials.
  3082. *
  3083. * The `callback` function is expected to be called back with user credentials:
  3084. *
  3085. * * `username` String
  3086. * * `password` String
  3087. *
  3088. * Providing empty credentials will cancel the request and report an authentication
  3089. * error on the response object:
  3090. */
  3091. on(event: 'login', listener: (authInfo: AuthInfo,
  3092. callback: (username?: string, password?: string) => void) => void): this;
  3093. once(event: 'login', listener: (authInfo: AuthInfo,
  3094. callback: (username?: string, password?: string) => void) => void): this;
  3095. addListener(event: 'login', listener: (authInfo: AuthInfo,
  3096. callback: (username?: string, password?: string) => void) => void): this;
  3097. removeListener(event: 'login', listener: (authInfo: AuthInfo,
  3098. callback: (username?: string, password?: string) => void) => void): this;
  3099. /**
  3100. * Emitted when the server returns a redirect response (e.g. 301 Moved
  3101. * Permanently). Calling `request.followRedirect` will continue with the
  3102. * redirection. If this event is handled, `request.followRedirect` must be called
  3103. * **synchronously**, otherwise the request will be cancelled.
  3104. */
  3105. on(event: 'redirect', listener: (statusCode: number,
  3106. method: string,
  3107. redirectUrl: string,
  3108. responseHeaders: Record<string, string[]>) => void): this;
  3109. once(event: 'redirect', listener: (statusCode: number,
  3110. method: string,
  3111. redirectUrl: string,
  3112. responseHeaders: Record<string, string[]>) => void): this;
  3113. addListener(event: 'redirect', listener: (statusCode: number,
  3114. method: string,
  3115. redirectUrl: string,
  3116. responseHeaders: Record<string, string[]>) => void): this;
  3117. removeListener(event: 'redirect', listener: (statusCode: number,
  3118. method: string,
  3119. redirectUrl: string,
  3120. responseHeaders: Record<string, string[]>) => void): this;
  3121. on(event: 'response', listener: (
  3122. /**
  3123. * An object representing the HTTP response message.
  3124. */
  3125. response: IncomingMessage) => void): this;
  3126. once(event: 'response', listener: (
  3127. /**
  3128. * An object representing the HTTP response message.
  3129. */
  3130. response: IncomingMessage) => void): this;
  3131. addListener(event: 'response', listener: (
  3132. /**
  3133. * An object representing the HTTP response message.
  3134. */
  3135. response: IncomingMessage) => void): this;
  3136. removeListener(event: 'response', listener: (
  3137. /**
  3138. * An object representing the HTTP response message.
  3139. */
  3140. response: IncomingMessage) => void): this;
  3141. /**
  3142. * ClientRequest
  3143. */
  3144. constructor(options: (ClientRequestConstructorOptions) | (string));
  3145. /**
  3146. * Cancels an ongoing HTTP transaction. If the request has already emitted the
  3147. * `close` event, the abort operation will have no effect. Otherwise an ongoing
  3148. * event will emit `abort` and `close` events. Additionally, if there is an ongoing
  3149. * response object,it will emit the `aborted` event.
  3150. */
  3151. abort(): void;
  3152. /**
  3153. * Sends the last chunk of the request data. Subsequent write or end operations
  3154. * will not be allowed. The `finish` event is emitted just after the end operation.
  3155. */
  3156. end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  3157. /**
  3158. * Continues any pending redirection. Can only be called during a `'redirect'`
  3159. * event.
  3160. */
  3161. followRedirect(): void;
  3162. /**
  3163. * The value of a previously set extra header name.
  3164. */
  3165. getHeader(name: string): string;
  3166. /**
  3167. * * `active` Boolean - Whether the request is currently active. If this is false
  3168. * no other properties will be set
  3169. * * `started` Boolean - Whether the upload has started. If this is false both
  3170. * `current` and `total` will be set to 0.
  3171. * * `current` Integer - The number of bytes that have been uploaded so far
  3172. * * `total` Integer - The number of bytes that will be uploaded this request
  3173. *
  3174. * You can use this method in conjunction with `POST` requests to get the progress
  3175. * of a file upload or other data transfer.
  3176. */
  3177. getUploadProgress(): UploadProgress;
  3178. /**
  3179. * Removes a previously set extra header name. This method can be called only
  3180. * before first write. Trying to call it after the first write will throw an error.
  3181. */
  3182. removeHeader(name: string): void;
  3183. /**
  3184. * Adds an extra HTTP header. The header name will be issued as-is without
  3185. * lowercasing. It can be called only before first write. Calling this method after
  3186. * the first write will throw an error. If the passed value is not a `String`, its
  3187. * `toString()` method will be called to obtain the final value.
  3188. *
  3189. * Certain headers are restricted from being set by apps. These headers are listed
  3190. * below. More information on restricted headers can be found in Chromium's header
  3191. * utils.
  3192. *
  3193. * * `Content-Length`
  3194. * * `Host`
  3195. * * `Trailer` or `Te`
  3196. * * `Upgrade`
  3197. * * `Cookie2`
  3198. * * `Keep-Alive`
  3199. * * `Transfer-Encoding`
  3200. *
  3201. * Additionally, setting the `Connection` header to the value `upgrade` is also
  3202. * disallowed.
  3203. */
  3204. setHeader(name: string, value: string): void;
  3205. /**
  3206. * `callback` is essentially a dummy function introduced in the purpose of keeping
  3207. * similarity with the Node.js API. It is called asynchronously in the next tick
  3208. * after `chunk` content have been delivered to the Chromium networking layer.
  3209. * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
  3210. * content have been flushed on the wire before `callback` is called.
  3211. *
  3212. * Adds a chunk of data to the request body. The first write operation may cause
  3213. * the request headers to be issued on the wire. After the first write operation,
  3214. * it is not allowed to add or remove a custom header.
  3215. */
  3216. write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  3217. chunkedEncoding: boolean;
  3218. }
  3219. interface Clipboard {
  3220. // Docs: https://electronjs.org/docs/api/clipboard
  3221. /**
  3222. * An array of supported formats for the clipboard `type`.
  3223. */
  3224. availableFormats(type?: 'selection' | 'clipboard'): string[];
  3225. /**
  3226. * Clears the clipboard content.
  3227. */
  3228. clear(type?: 'selection' | 'clipboard'): void;
  3229. /**
  3230. * Whether the clipboard supports the specified `format`.
  3231. *
  3232. * @experimental
  3233. */
  3234. has(format: string, type?: 'selection' | 'clipboard'): boolean;
  3235. /**
  3236. * Reads `format` type from the clipboard.
  3237. *
  3238. * @experimental
  3239. */
  3240. read(format: string): string;
  3241. /**
  3242. * * `title` String
  3243. * * `url` String
  3244. *
  3245. * Returns an Object containing `title` and `url` keys representing the bookmark in
  3246. * the clipboard. The `title` and `url` values will be empty strings when the
  3247. * bookmark is unavailable.
  3248. *
  3249. * @platform darwin,win32
  3250. */
  3251. readBookmark(): ReadBookmark;
  3252. /**
  3253. * Reads `format` type from the clipboard.
  3254. *
  3255. * @experimental
  3256. */
  3257. readBuffer(format: string): Buffer;
  3258. /**
  3259. * The text on the find pasteboard, which is the pasteboard that holds information
  3260. * about the current state of the active application’s find panel.
  3261. *
  3262. * This method uses synchronous IPC when called from the renderer process. The
  3263. * cached value is reread from the find pasteboard whenever the application is
  3264. * activated.
  3265. *
  3266. * @platform darwin
  3267. */
  3268. readFindText(): string;
  3269. /**
  3270. * The content in the clipboard as markup.
  3271. */
  3272. readHTML(type?: 'selection' | 'clipboard'): string;
  3273. /**
  3274. * The image content in the clipboard.
  3275. */
  3276. readImage(type?: 'selection' | 'clipboard'): NativeImage;
  3277. /**
  3278. * The content in the clipboard as RTF.
  3279. */
  3280. readRTF(type?: 'selection' | 'clipboard'): string;
  3281. /**
  3282. * The content in the clipboard as plain text.
  3283. */
  3284. readText(type?: 'selection' | 'clipboard'): string;
  3285. /**
  3286. * Writes `data` to the clipboard.
  3287. */
  3288. write(data: Data, type?: 'selection' | 'clipboard'): void;
  3289. /**
  3290. * Writes the `title` and `url` into the clipboard as a bookmark.
  3291. *
  3292. * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
  3293. * can use `clipboard.write` to write both a bookmark and fallback text to the
  3294. * clipboard.
  3295. *
  3296. * @platform darwin,win32
  3297. */
  3298. writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
  3299. /**
  3300. * Writes the `buffer` into the clipboard as `format`.
  3301. *
  3302. * @experimental
  3303. */
  3304. writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
  3305. /**
  3306. * Writes the `text` into the find pasteboard (the pasteboard that holds
  3307. * information about the current state of the active application’s find panel) as
  3308. * plain text. This method uses synchronous IPC when called from the renderer
  3309. * process.
  3310. *
  3311. * @platform darwin
  3312. */
  3313. writeFindText(text: string): void;
  3314. /**
  3315. * Writes `markup` to the clipboard.
  3316. */
  3317. writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
  3318. /**
  3319. * Writes `image` to the clipboard.
  3320. */
  3321. writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
  3322. /**
  3323. * Writes the `text` into the clipboard in RTF.
  3324. */
  3325. writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
  3326. /**
  3327. * Writes the `text` into the clipboard as plain text.
  3328. */
  3329. writeText(text: string, type?: 'selection' | 'clipboard'): void;
  3330. }
  3331. class CommandLine {
  3332. // Docs: https://electronjs.org/docs/api/command-line
  3333. /**
  3334. * Append an argument to Chromium's command line. The argument will be quoted
  3335. * correctly. Switches will precede arguments regardless of appending order.
  3336. *
  3337. * If you're appending an argument like `--switch=value`, consider using
  3338. * `appendSwitch('switch', 'value')` instead.
  3339. *
  3340. * **Note:** This will not affect `process.argv`. The intended usage of this
  3341. * function is to control Chromium's behavior.
  3342. */
  3343. appendArgument(value: string): void;
  3344. /**
  3345. * Append a switch (with optional `value`) to Chromium's command line.
  3346. *
  3347. * **Note:** This will not affect `process.argv`. The intended usage of this
  3348. * function is to control Chromium's behavior.
  3349. */
  3350. appendSwitch(the_switch: string, value?: string): void;
  3351. /**
  3352. * The command-line switch value.
  3353. *
  3354. * **Note:** When the switch is not present or has no value, it returns empty
  3355. * string.
  3356. */
  3357. getSwitchValue(the_switch: string): string;
  3358. /**
  3359. * Whether the command-line switch is present.
  3360. */
  3361. hasSwitch(the_switch: string): boolean;
  3362. }
  3363. interface ContentTracing {
  3364. // Docs: https://electronjs.org/docs/api/content-tracing
  3365. /**
  3366. * resolves with an array of category groups once all child processes have
  3367. * acknowledged the `getCategories` request
  3368. *
  3369. * Get a set of category groups. The category groups can change as new code paths
  3370. * are reached. See also the list of built-in tracing categories.
  3371. *
  3372. * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
  3373. * This category can be used to capture Electron-specific tracing events.
  3374. */
  3375. getCategories(): Promise<string[]>;
  3376. /**
  3377. * Resolves with an object containing the `value` and `percentage` of trace buffer
  3378. * maximum usage
  3379. *
  3380. * * `value` Number
  3381. * * `percentage` Number
  3382. *
  3383. * Get the maximum usage across processes of trace buffer as a percentage of the
  3384. * full state.
  3385. */
  3386. getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
  3387. /**
  3388. * resolved once all child processes have acknowledged the `startRecording`
  3389. * request.
  3390. *
  3391. * Start recording on all processes.
  3392. *
  3393. * Recording begins immediately locally and asynchronously on child processes as
  3394. * soon as they receive the EnableRecording request.
  3395. *
  3396. * If a recording is already running, the promise will be immediately resolved, as
  3397. * only one trace operation can be in progress at a time.
  3398. */
  3399. startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
  3400. /**
  3401. * resolves with a path to a file that contains the traced data once all child
  3402. * processes have acknowledged the `stopRecording` request
  3403. *
  3404. * Stop recording on all processes.
  3405. *
  3406. * Child processes typically cache trace data and only rarely flush and send trace
  3407. * data back to the main process. This helps to minimize the runtime overhead of
  3408. * tracing since sending trace data over IPC can be an expensive operation. So, to
  3409. * end tracing, Chromium asynchronously asks all child processes to flush any
  3410. * pending trace data.
  3411. *
  3412. * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
  3413. * or not provided, trace data will be written to a temporary file, and the path
  3414. * will be returned in the promise.
  3415. */
  3416. stopRecording(resultFilePath?: string): Promise<string>;
  3417. }
  3418. interface ContextBridge {
  3419. // Docs: https://electronjs.org/docs/api/context-bridge
  3420. exposeInMainWorld(apiKey: string, api: any): void;
  3421. }
  3422. interface Cookie {
  3423. // Docs: https://electronjs.org/docs/api/structures/cookie
  3424. /**
  3425. * The domain of the cookie; this will be normalized with a preceding dot so that
  3426. * it's also valid for subdomains.
  3427. */
  3428. domain?: string;
  3429. /**
  3430. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  3431. * Not provided for session cookies.
  3432. */
  3433. expirationDate?: number;
  3434. /**
  3435. * Whether the cookie is a host-only cookie; this will only be `true` if no domain
  3436. * was passed.
  3437. */
  3438. hostOnly?: boolean;
  3439. /**
  3440. * Whether the cookie is marked as HTTP only.
  3441. */
  3442. httpOnly?: boolean;
  3443. /**
  3444. * The name of the cookie.
  3445. */
  3446. name: string;
  3447. /**
  3448. * The path of the cookie.
  3449. */
  3450. path?: string;
  3451. /**
  3452. * The Same Site policy applied to this cookie. Can be `unspecified`,
  3453. * `no_restriction`, `lax` or `strict`.
  3454. */
  3455. sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  3456. /**
  3457. * Whether the cookie is marked as secure.
  3458. */
  3459. secure?: boolean;
  3460. /**
  3461. * Whether the cookie is a session cookie or a persistent cookie with an expiration
  3462. * date.
  3463. */
  3464. session?: boolean;
  3465. /**
  3466. * The value of the cookie.
  3467. */
  3468. value: string;
  3469. }
  3470. class Cookies extends NodeEventEmitter {
  3471. // Docs: https://electronjs.org/docs/api/cookies
  3472. /**
  3473. * Emitted when a cookie is changed because it was added, edited, removed, or
  3474. * expired.
  3475. */
  3476. on(event: 'changed', listener: (event: Event,
  3477. /**
  3478. * The cookie that was changed.
  3479. */
  3480. cookie: Cookie,
  3481. /**
  3482. * The cause of the change with one of the following values:
  3483. */
  3484. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3485. /**
  3486. * `true` if the cookie was removed, `false` otherwise.
  3487. */
  3488. removed: boolean) => void): this;
  3489. once(event: 'changed', listener: (event: Event,
  3490. /**
  3491. * The cookie that was changed.
  3492. */
  3493. cookie: Cookie,
  3494. /**
  3495. * The cause of the change with one of the following values:
  3496. */
  3497. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3498. /**
  3499. * `true` if the cookie was removed, `false` otherwise.
  3500. */
  3501. removed: boolean) => void): this;
  3502. addListener(event: 'changed', listener: (event: Event,
  3503. /**
  3504. * The cookie that was changed.
  3505. */
  3506. cookie: Cookie,
  3507. /**
  3508. * The cause of the change with one of the following values:
  3509. */
  3510. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3511. /**
  3512. * `true` if the cookie was removed, `false` otherwise.
  3513. */
  3514. removed: boolean) => void): this;
  3515. removeListener(event: 'changed', listener: (event: Event,
  3516. /**
  3517. * The cookie that was changed.
  3518. */
  3519. cookie: Cookie,
  3520. /**
  3521. * The cause of the change with one of the following values:
  3522. */
  3523. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3524. /**
  3525. * `true` if the cookie was removed, `false` otherwise.
  3526. */
  3527. removed: boolean) => void): this;
  3528. /**
  3529. * A promise which resolves when the cookie store has been flushed
  3530. *
  3531. Writes any unwritten cookies data to disk.
  3532. */
  3533. flushStore(): Promise<void>;
  3534. /**
  3535. * A promise which resolves an array of cookie objects.
  3536. *
  3537. * Sends a request to get all cookies matching `filter`, and resolves a promise
  3538. * with the response.
  3539. */
  3540. get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
  3541. /**
  3542. * A promise which resolves when the cookie has been removed
  3543. *
  3544. Removes the cookies matching `url` and `name`
  3545. */
  3546. remove(url: string, name: string): Promise<void>;
  3547. /**
  3548. * A promise which resolves when the cookie has been set
  3549. *
  3550. Sets a cookie with `details`.
  3551. */
  3552. set(details: CookiesSetDetails): Promise<void>;
  3553. }
  3554. interface CPUUsage {
  3555. // Docs: https://electronjs.org/docs/api/structures/cpu-usage
  3556. /**
  3557. * The number of average idle CPU wakeups per second since the last call to
  3558. * getCPUUsage. First call returns 0. Will always return 0 on Windows.
  3559. */
  3560. idleWakeupsPerSecond: number;
  3561. /**
  3562. * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
  3563. */
  3564. percentCPUUsage: number;
  3565. }
  3566. interface CrashReport {
  3567. // Docs: https://electronjs.org/docs/api/structures/crash-report
  3568. date: Date;
  3569. id: string;
  3570. }
  3571. interface CrashReporter {
  3572. // Docs: https://electronjs.org/docs/api/crash-reporter
  3573. /**
  3574. * Set an extra parameter to be sent with the crash report. The values specified
  3575. * here will be sent in addition to any values set via the `extra` option when
  3576. * `start` was called.
  3577. *
  3578. * Parameters added in this fashion (or via the `extra` parameter to
  3579. * `crashReporter.start`) are specific to the calling process. Adding extra
  3580. * parameters in the main process will not cause those parameters to be sent along
  3581. * with crashes from renderer or other child processes. Similarly, adding extra
  3582. * parameters in a renderer process will not result in those parameters being sent
  3583. * with crashes that occur in other renderer processes or in the main process.
  3584. *
  3585. * **Note:** Parameters have limits on the length of the keys and values. Key names
  3586. * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
  3587. * Keys with names longer than the maximum will be silently ignored. Key values
  3588. * longer than the maximum length will be truncated.
  3589. *
  3590. * **Note:** On linux values that are longer than 127 bytes will be chunked into
  3591. * multiple keys, each 127 bytes in length. E.g. `addExtraParameter('foo',
  3592. * 'a'.repeat(130))` will result in two chunked keys `foo__1` and `foo__2`, the
  3593. * first will contain the first 127 bytes and the second will contain the remaining
  3594. * 3 bytes. On your crash reporting backend you should stitch together keys in
  3595. * this format.
  3596. */
  3597. addExtraParameter(key: string, value: string): void;
  3598. /**
  3599. * The date and ID of the last crash report. Only crash reports that have been
  3600. * uploaded will be returned; even if a crash report is present on disk it will not
  3601. * be returned until it is uploaded. In the case that there are no uploaded
  3602. * reports, `null` is returned.
  3603. *
  3604. **Note:** This method is only available in the main process.
  3605. */
  3606. getLastCrashReport(): CrashReport;
  3607. /**
  3608. * The current 'extra' parameters of the crash reporter.
  3609. */
  3610. getParameters(): Record<string, string>;
  3611. /**
  3612. * Returns all uploaded crash reports. Each report contains the date and uploaded
  3613. * ID.
  3614. **Note:** This method is only available in the main process.
  3615. */
  3616. getUploadedReports(): CrashReport[];
  3617. /**
  3618. * Whether reports should be submitted to the server. Set through the `start`
  3619. * method or `setUploadToServer`.
  3620. *
  3621. **Note:** This method is only available in the main process.
  3622. */
  3623. getUploadToServer(): boolean;
  3624. /**
  3625. * Remove an extra parameter from the current set of parameters. Future crashes
  3626. * will not include this parameter.
  3627. */
  3628. removeExtraParameter(key: string): void;
  3629. /**
  3630. * This would normally be controlled by user preferences. This has no effect if
  3631. * called before `start` is called.
  3632. *
  3633. **Note:** This method is only available in the main process.
  3634. */
  3635. setUploadToServer(uploadToServer: boolean): void;
  3636. /**
  3637. * This method must be called before using any other `crashReporter` APIs. Once
  3638. * initialized this way, the crashpad handler collects crashes from all
  3639. * subsequently created processes. The crash reporter cannot be disabled once
  3640. * started.
  3641. *
  3642. * This method should be called as early as possible in app startup, preferably
  3643. * before `app.on('ready')`. If the crash reporter is not initialized at the time a
  3644. * renderer process is created, then that renderer process will not be monitored by
  3645. * the crash reporter.
  3646. *
  3647. * **Note:** You can test out the crash reporter by generating a crash using
  3648. * `process.crash()`.
  3649. *
  3650. * **Note:** If you need to send additional/updated `extra` parameters after your
  3651. * first call `start` you can call `addExtraParameter`.
  3652. *
  3653. * **Note:** Parameters passed in `extra`, `globalExtra` or set with
  3654. * `addExtraParameter` have limits on the length of the keys and values. Key names
  3655. * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
  3656. * with names longer than the maximum will be silently ignored. Key values longer
  3657. * than the maximum length will be truncated.
  3658. *
  3659. **Note:** This method is only available in the main process.
  3660. */
  3661. start(options: CrashReporterStartOptions): void;
  3662. }
  3663. interface CustomScheme {
  3664. // Docs: https://electronjs.org/docs/api/structures/custom-scheme
  3665. privileges?: Privileges;
  3666. /**
  3667. * Custom schemes to be registered with options.
  3668. */
  3669. scheme: string;
  3670. }
  3671. class Debugger extends NodeEventEmitter {
  3672. // Docs: https://electronjs.org/docs/api/debugger
  3673. /**
  3674. * Emitted when the debugging session is terminated. This happens either when
  3675. * `webContents` is closed or devtools is invoked for the attached `webContents`.
  3676. */
  3677. on(event: 'detach', listener: (event: Event,
  3678. /**
  3679. * Reason for detaching debugger.
  3680. */
  3681. reason: string) => void): this;
  3682. once(event: 'detach', listener: (event: Event,
  3683. /**
  3684. * Reason for detaching debugger.
  3685. */
  3686. reason: string) => void): this;
  3687. addListener(event: 'detach', listener: (event: Event,
  3688. /**
  3689. * Reason for detaching debugger.
  3690. */
  3691. reason: string) => void): this;
  3692. removeListener(event: 'detach', listener: (event: Event,
  3693. /**
  3694. * Reason for detaching debugger.
  3695. */
  3696. reason: string) => void): this;
  3697. /**
  3698. * Emitted whenever the debugging target issues an instrumentation event.
  3699. */
  3700. on(event: 'message', listener: (event: Event,
  3701. /**
  3702. * Method name.
  3703. */
  3704. method: string,
  3705. /**
  3706. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3707. * protocol.
  3708. */
  3709. params: any,
  3710. /**
  3711. * Unique identifier of attached debugging session, will match the value sent from
  3712. * `debugger.sendCommand`.
  3713. */
  3714. sessionId: string) => void): this;
  3715. once(event: 'message', listener: (event: Event,
  3716. /**
  3717. * Method name.
  3718. */
  3719. method: string,
  3720. /**
  3721. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3722. * protocol.
  3723. */
  3724. params: any,
  3725. /**
  3726. * Unique identifier of attached debugging session, will match the value sent from
  3727. * `debugger.sendCommand`.
  3728. */
  3729. sessionId: string) => void): this;
  3730. addListener(event: 'message', listener: (event: Event,
  3731. /**
  3732. * Method name.
  3733. */
  3734. method: string,
  3735. /**
  3736. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3737. * protocol.
  3738. */
  3739. params: any,
  3740. /**
  3741. * Unique identifier of attached debugging session, will match the value sent from
  3742. * `debugger.sendCommand`.
  3743. */
  3744. sessionId: string) => void): this;
  3745. removeListener(event: 'message', listener: (event: Event,
  3746. /**
  3747. * Method name.
  3748. */
  3749. method: string,
  3750. /**
  3751. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3752. * protocol.
  3753. */
  3754. params: any,
  3755. /**
  3756. * Unique identifier of attached debugging session, will match the value sent from
  3757. * `debugger.sendCommand`.
  3758. */
  3759. sessionId: string) => void): this;
  3760. /**
  3761. * Attaches the debugger to the `webContents`.
  3762. */
  3763. attach(protocolVersion?: string): void;
  3764. /**
  3765. * Detaches the debugger from the `webContents`.
  3766. */
  3767. detach(): void;
  3768. /**
  3769. * Whether a debugger is attached to the `webContents`.
  3770. */
  3771. isAttached(): boolean;
  3772. /**
  3773. * A promise that resolves with the response defined by the 'returns' attribute of
  3774. * the command description in the remote debugging protocol or is rejected
  3775. * indicating the failure of the command.
  3776. *
  3777. Send given command to the debugging target.
  3778. */
  3779. sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
  3780. }
  3781. interface DesktopCapturer {
  3782. // Docs: https://electronjs.org/docs/api/desktop-capturer
  3783. /**
  3784. * Resolves with an array of `DesktopCapturerSource` objects, each
  3785. * `DesktopCapturerSource` represents a screen or an individual window that can be
  3786. * captured.
  3787. *
  3788. * **Note** Capturing the screen contents requires user consent on macOS 10.15
  3789. * Catalina or higher, which can detected by
  3790. * `systemPreferences.getMediaAccessStatus`.
  3791. */
  3792. getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
  3793. }
  3794. interface DesktopCapturerSource {
  3795. // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
  3796. /**
  3797. * An icon image of the application that owns the window or null if the source has
  3798. * a type screen. The size of the icon is not known in advance and depends on what
  3799. * the application provides.
  3800. */
  3801. appIcon: NativeImage;
  3802. /**
  3803. * A unique identifier that will correspond to the `id` of the matching Display
  3804. * returned by the Screen API. On some platforms, this is equivalent to the `XX`
  3805. * portion of the `id` field above and on others it will differ. It will be an
  3806. * empty string if not available.
  3807. */
  3808. display_id: string;
  3809. /**
  3810. * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
  3811. * constraint when calling [`navigator.webkitGetUserMedia`]. The format of the
  3812. * identifier will be `window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle.
  3813. * YY is 1 for the current process, and 0 for all others. ZZ is a sequential number
  3814. * that represents the screen, and it does not equal to the index in the source's
  3815. * name.
  3816. */
  3817. id: string;
  3818. /**
  3819. * A screen source will be named either `Entire Screen` or `Screen <index>`, while
  3820. * the name of a window source will match the window title.
  3821. */
  3822. name: string;
  3823. /**
  3824. * A thumbnail image. **Note:** There is no guarantee that the size of the
  3825. * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
  3826. * to `desktopCapturer.getSources`. The actual size depends on the scale of the
  3827. * screen or window.
  3828. */
  3829. thumbnail: NativeImage;
  3830. }
  3831. interface Dialog {
  3832. // Docs: https://electronjs.org/docs/api/dialog
  3833. /**
  3834. * resolves when the certificate trust dialog is shown.
  3835. *
  3836. * On macOS, this displays a modal dialog that shows a message and certificate
  3837. * information, and gives the user the option of trusting/importing the
  3838. * certificate. If you provide a `browserWindow` argument the dialog will be
  3839. * attached to the parent window, making it modal.
  3840. *
  3841. * On Windows the options are more limited, due to the Win32 APIs used:
  3842. *
  3843. * * The `message` argument is not used, as the OS provides its own confirmation
  3844. * dialog.
  3845. * * The `browserWindow` argument is ignored since it is not possible to make this
  3846. * confirmation dialog modal.
  3847. *
  3848. * @platform darwin,win32
  3849. */
  3850. showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
  3851. /**
  3852. * resolves when the certificate trust dialog is shown.
  3853. *
  3854. * On macOS, this displays a modal dialog that shows a message and certificate
  3855. * information, and gives the user the option of trusting/importing the
  3856. * certificate. If you provide a `browserWindow` argument the dialog will be
  3857. * attached to the parent window, making it modal.
  3858. *
  3859. * On Windows the options are more limited, due to the Win32 APIs used:
  3860. *
  3861. * * The `message` argument is not used, as the OS provides its own confirmation
  3862. * dialog.
  3863. * * The `browserWindow` argument is ignored since it is not possible to make this
  3864. * confirmation dialog modal.
  3865. *
  3866. * @platform darwin,win32
  3867. */
  3868. showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
  3869. /**
  3870. * Displays a modal dialog that shows an error message.
  3871. *
  3872. * This API can be called safely before the `ready` event the `app` module emits,
  3873. * it is usually used to report errors in early stage of startup. If called before
  3874. * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
  3875. * dialog will appear.
  3876. */
  3877. showErrorBox(title: string, content: string): void;
  3878. /**
  3879. * resolves with a promise containing the following properties:
  3880. *
  3881. * * `response` Number - The index of the clicked button.
  3882. * * `checkboxChecked` Boolean - The checked state of the checkbox if
  3883. * `checkboxLabel` was set. Otherwise `false`.
  3884. *
  3885. * Shows a message box.
  3886. *
  3887. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3888. * window, making it modal.
  3889. */
  3890. showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  3891. /**
  3892. * resolves with a promise containing the following properties:
  3893. *
  3894. * * `response` Number - The index of the clicked button.
  3895. * * `checkboxChecked` Boolean - The checked state of the checkbox if
  3896. * `checkboxLabel` was set. Otherwise `false`.
  3897. *
  3898. * Shows a message box.
  3899. *
  3900. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3901. * window, making it modal.
  3902. */
  3903. showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  3904. /**
  3905. * the index of the clicked button.
  3906. *
  3907. * Shows a message box, it will block the process until the message box is closed.
  3908. * It returns the index of the clicked button.
  3909. *
  3910. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3911. * window, making it modal. If `browserWindow` is not shown dialog will not be
  3912. * attached to it. In such case it will be displayed as an independent window.
  3913. */
  3914. showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
  3915. /**
  3916. * the index of the clicked button.
  3917. *
  3918. * Shows a message box, it will block the process until the message box is closed.
  3919. * It returns the index of the clicked button.
  3920. *
  3921. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3922. * window, making it modal. If `browserWindow` is not shown dialog will not be
  3923. * attached to it. In such case it will be displayed as an independent window.
  3924. */
  3925. showMessageBoxSync(options: MessageBoxSyncOptions): number;
  3926. /**
  3927. * Resolve with an object containing the following:
  3928. *
  3929. * * `canceled` Boolean - whether or not the dialog was canceled.
  3930. * * `filePaths` String[] - An array of file paths chosen by the user. If the
  3931. * dialog is cancelled this will be an empty array.
  3932. * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
  3933. * `filePaths` array of base64 encoded strings which contains security scoped
  3934. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  3935. * populated. (For return values, see table here.)
  3936. *
  3937. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3938. * window, making it modal.
  3939. *
  3940. * The `filters` specifies an array of file types that can be displayed or selected
  3941. * when you want to limit the user to a specific type. For example:
  3942. *
  3943. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  3944. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  3945. * `'*'` wildcard (no other wildcard is supported).
  3946. *
  3947. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  3948. * and a directory selector, so if you set `properties` to `['openFile',
  3949. * 'openDirectory']` on these platforms, a directory selector will be shown.
  3950. */
  3951. showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  3952. /**
  3953. * Resolve with an object containing the following:
  3954. *
  3955. * * `canceled` Boolean - whether or not the dialog was canceled.
  3956. * * `filePaths` String[] - An array of file paths chosen by the user. If the
  3957. * dialog is cancelled this will be an empty array.
  3958. * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
  3959. * `filePaths` array of base64 encoded strings which contains security scoped
  3960. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  3961. * populated. (For return values, see table here.)
  3962. *
  3963. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3964. * window, making it modal.
  3965. *
  3966. * The `filters` specifies an array of file types that can be displayed or selected
  3967. * when you want to limit the user to a specific type. For example:
  3968. *
  3969. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  3970. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  3971. * `'*'` wildcard (no other wildcard is supported).
  3972. *
  3973. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  3974. * and a directory selector, so if you set `properties` to `['openFile',
  3975. * 'openDirectory']` on these platforms, a directory selector will be shown.
  3976. */
  3977. showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  3978. /**
  3979. * the file paths chosen by the user; if the dialog is cancelled it returns
  3980. * `undefined`.
  3981. *
  3982. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3983. * window, making it modal.
  3984. *
  3985. * The `filters` specifies an array of file types that can be displayed or selected
  3986. * when you want to limit the user to a specific type. For example:
  3987. *
  3988. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  3989. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  3990. * `'*'` wildcard (no other wildcard is supported).
  3991. *
  3992. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  3993. * and a directory selector, so if you set `properties` to `['openFile',
  3994. * 'openDirectory']` on these platforms, a directory selector will be shown.
  3995. */
  3996. showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
  3997. /**
  3998. * the file paths chosen by the user; if the dialog is cancelled it returns
  3999. * `undefined`.
  4000. *
  4001. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4002. * window, making it modal.
  4003. *
  4004. * The `filters` specifies an array of file types that can be displayed or selected
  4005. * when you want to limit the user to a specific type. For example:
  4006. *
  4007. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  4008. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  4009. * `'*'` wildcard (no other wildcard is supported).
  4010. *
  4011. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  4012. * and a directory selector, so if you set `properties` to `['openFile',
  4013. * 'openDirectory']` on these platforms, a directory selector will be shown.
  4014. */
  4015. showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
  4016. /**
  4017. * Resolve with an object containing the following:
  4018. *
  4019. * * `canceled` Boolean - whether or not the dialog was canceled.
  4020. * * `filePath` String (optional) - If the dialog is canceled, this will be
  4021. * `undefined`.
  4022. * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
  4023. * contains the security scoped bookmark data for the saved file.
  4024. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  4025. * values, see table here.)
  4026. *
  4027. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4028. * window, making it modal.
  4029. *
  4030. * The `filters` specifies an array of file types that can be displayed, see
  4031. * `dialog.showOpenDialog` for an example.
  4032. *
  4033. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  4034. * issues when expanding and collapsing the dialog.
  4035. */
  4036. showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  4037. /**
  4038. * Resolve with an object containing the following:
  4039. *
  4040. * * `canceled` Boolean - whether or not the dialog was canceled.
  4041. * * `filePath` String (optional) - If the dialog is canceled, this will be
  4042. * `undefined`.
  4043. * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
  4044. * contains the security scoped bookmark data for the saved file.
  4045. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  4046. * values, see table here.)
  4047. *
  4048. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4049. * window, making it modal.
  4050. *
  4051. * The `filters` specifies an array of file types that can be displayed, see
  4052. * `dialog.showOpenDialog` for an example.
  4053. *
  4054. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  4055. * issues when expanding and collapsing the dialog.
  4056. */
  4057. showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  4058. /**
  4059. * the path of the file chosen by the user; if the dialog is cancelled it returns
  4060. * `undefined`.
  4061. *
  4062. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4063. * window, making it modal.
  4064. *
  4065. * The `filters` specifies an array of file types that can be displayed, see
  4066. * `dialog.showOpenDialog` for an example.
  4067. */
  4068. showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
  4069. /**
  4070. * the path of the file chosen by the user; if the dialog is cancelled it returns
  4071. * `undefined`.
  4072. *
  4073. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4074. * window, making it modal.
  4075. *
  4076. * The `filters` specifies an array of file types that can be displayed, see
  4077. * `dialog.showOpenDialog` for an example.
  4078. */
  4079. showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
  4080. }
  4081. interface Display {
  4082. // Docs: https://electronjs.org/docs/api/structures/display
  4083. /**
  4084. * Can be `available`, `unavailable`, `unknown`.
  4085. */
  4086. accelerometerSupport: ('available' | 'unavailable' | 'unknown');
  4087. /**
  4088. * the bounds of the display in DIP points.
  4089. */
  4090. bounds: Rectangle;
  4091. /**
  4092. * The number of bits per pixel.
  4093. */
  4094. colorDepth: number;
  4095. /**
  4096. * represent a color space (three-dimensional object which contains all realizable
  4097. * color combinations) for the purpose of color conversions
  4098. */
  4099. colorSpace: string;
  4100. /**
  4101. * The number of bits per color component.
  4102. */
  4103. depthPerComponent: number;
  4104. /**
  4105. * The display refresh rate.
  4106. */
  4107. displayFrequency: number;
  4108. /**
  4109. * Unique identifier associated with the display.
  4110. */
  4111. id: number;
  4112. /**
  4113. * `true` for an internal display and `false` for an external display
  4114. */
  4115. internal: boolean;
  4116. /**
  4117. * Whether or not the display is a monochrome display.
  4118. */
  4119. monochrome: boolean;
  4120. /**
  4121. * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
  4122. */
  4123. rotation: number;
  4124. /**
  4125. * Output device's pixel scale factor.
  4126. */
  4127. scaleFactor: number;
  4128. size: Size;
  4129. /**
  4130. * Can be `available`, `unavailable`, `unknown`.
  4131. */
  4132. touchSupport: ('available' | 'unavailable' | 'unknown');
  4133. /**
  4134. * the work area of the display in DIP points.
  4135. */
  4136. workArea: Rectangle;
  4137. workAreaSize: Size;
  4138. }
  4139. class Dock {
  4140. // Docs: https://electronjs.org/docs/api/dock
  4141. /**
  4142. * an ID representing the request.
  4143. *
  4144. * When `critical` is passed, the dock icon will bounce until either the
  4145. * application becomes active or the request is canceled.
  4146. *
  4147. * When `informational` is passed, the dock icon will bounce for one second.
  4148. * However, the request remains active until either the application becomes active
  4149. * or the request is canceled.
  4150. *
  4151. * **Nota Bene:** This method can only be used while the app is not focused; when
  4152. * the app is focused it will return -1.
  4153. *
  4154. * @platform darwin
  4155. */
  4156. bounce(type?: 'critical' | 'informational'): number;
  4157. /**
  4158. * Cancel the bounce of `id`.
  4159. *
  4160. * @platform darwin
  4161. */
  4162. cancelBounce(id: number): void;
  4163. /**
  4164. * Bounces the Downloads stack if the filePath is inside the Downloads folder.
  4165. *
  4166. * @platform darwin
  4167. */
  4168. downloadFinished(filePath: string): void;
  4169. /**
  4170. * The badge string of the dock.
  4171. *
  4172. * @platform darwin
  4173. */
  4174. getBadge(): string;
  4175. /**
  4176. * The application's [dock menu][dock-menu].
  4177. *
  4178. * @platform darwin
  4179. */
  4180. getMenu(): (Menu) | (null);
  4181. /**
  4182. * Hides the dock icon.
  4183. *
  4184. * @platform darwin
  4185. */
  4186. hide(): void;
  4187. /**
  4188. * Whether the dock icon is visible.
  4189. *
  4190. * @platform darwin
  4191. */
  4192. isVisible(): boolean;
  4193. /**
  4194. * Sets the string to be displayed in the dock’s badging area.
  4195. *
  4196. * @platform darwin
  4197. */
  4198. setBadge(text: string): void;
  4199. /**
  4200. * Sets the `image` associated with this dock icon.
  4201. *
  4202. * @platform darwin
  4203. */
  4204. setIcon(image: (NativeImage) | (string)): void;
  4205. /**
  4206. * Sets the application's [dock menu][dock-menu].
  4207. *
  4208. * @platform darwin
  4209. */
  4210. setMenu(menu: Menu): void;
  4211. /**
  4212. * Resolves when the dock icon is shown.
  4213. *
  4214. * @platform darwin
  4215. */
  4216. show(): Promise<void>;
  4217. }
  4218. class DownloadItem extends NodeEventEmitter {
  4219. // Docs: https://electronjs.org/docs/api/download-item
  4220. /**
  4221. * Emitted when the download is in a terminal state. This includes a completed
  4222. * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
  4223. * download that can't be resumed.
  4224. *
  4225. * The `state` can be one of following:
  4226. *
  4227. * * `completed` - The download completed successfully.
  4228. * * `cancelled` - The download has been cancelled.
  4229. * * `interrupted` - The download has interrupted and can not resume.
  4230. */
  4231. on(event: 'done', listener: (event: Event,
  4232. /**
  4233. * Can be `completed`, `cancelled` or `interrupted`.
  4234. */
  4235. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4236. once(event: 'done', listener: (event: Event,
  4237. /**
  4238. * Can be `completed`, `cancelled` or `interrupted`.
  4239. */
  4240. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4241. addListener(event: 'done', listener: (event: Event,
  4242. /**
  4243. * Can be `completed`, `cancelled` or `interrupted`.
  4244. */
  4245. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4246. removeListener(event: 'done', listener: (event: Event,
  4247. /**
  4248. * Can be `completed`, `cancelled` or `interrupted`.
  4249. */
  4250. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4251. /**
  4252. * Emitted when the download has been updated and is not done.
  4253. *
  4254. * The `state` can be one of following:
  4255. *
  4256. * * `progressing` - The download is in-progress.
  4257. * * `interrupted` - The download has interrupted and can be resumed.
  4258. */
  4259. on(event: 'updated', listener: (event: Event,
  4260. /**
  4261. * Can be `progressing` or `interrupted`.
  4262. */
  4263. state: ('progressing' | 'interrupted')) => void): this;
  4264. once(event: 'updated', listener: (event: Event,
  4265. /**
  4266. * Can be `progressing` or `interrupted`.
  4267. */
  4268. state: ('progressing' | 'interrupted')) => void): this;
  4269. addListener(event: 'updated', listener: (event: Event,
  4270. /**
  4271. * Can be `progressing` or `interrupted`.
  4272. */
  4273. state: ('progressing' | 'interrupted')) => void): this;
  4274. removeListener(event: 'updated', listener: (event: Event,
  4275. /**
  4276. * Can be `progressing` or `interrupted`.
  4277. */
  4278. state: ('progressing' | 'interrupted')) => void): this;
  4279. /**
  4280. * Cancels the download operation.
  4281. */
  4282. cancel(): void;
  4283. /**
  4284. * Whether the download can resume.
  4285. */
  4286. canResume(): boolean;
  4287. /**
  4288. * The Content-Disposition field from the response header.
  4289. */
  4290. getContentDisposition(): string;
  4291. /**
  4292. * ETag header value.
  4293. */
  4294. getETag(): string;
  4295. /**
  4296. * The file name of the download item.
  4297. *
  4298. * **Note:** The file name is not always the same as the actual one saved in local
  4299. * disk. If user changes the file name in a prompted download saving dialog, the
  4300. * actual name of saved file will be different.
  4301. */
  4302. getFilename(): string;
  4303. /**
  4304. * Last-Modified header value.
  4305. */
  4306. getLastModifiedTime(): string;
  4307. /**
  4308. * The files mime type.
  4309. */
  4310. getMimeType(): string;
  4311. /**
  4312. * The received bytes of the download item.
  4313. */
  4314. getReceivedBytes(): number;
  4315. /**
  4316. * Returns the object previously set by
  4317. * `downloadItem.setSaveDialogOptions(options)`.
  4318. */
  4319. getSaveDialogOptions(): SaveDialogOptions;
  4320. /**
  4321. * The save path of the download item. This will be either the path set via
  4322. * `downloadItem.setSavePath(path)` or the path selected from the shown save
  4323. * dialog.
  4324. */
  4325. getSavePath(): string;
  4326. /**
  4327. * Number of seconds since the UNIX epoch when the download was started.
  4328. */
  4329. getStartTime(): number;
  4330. /**
  4331. * The current state. Can be `progressing`, `completed`, `cancelled` or
  4332. * `interrupted`.
  4333. *
  4334. * **Note:** The following methods are useful specifically to resume a `cancelled`
  4335. * item when session is restarted.
  4336. */
  4337. getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
  4338. /**
  4339. * The total size in bytes of the download item.
  4340. *
  4341. If the size is unknown, it returns 0.
  4342. */
  4343. getTotalBytes(): number;
  4344. /**
  4345. * The origin URL where the item is downloaded from.
  4346. */
  4347. getURL(): string;
  4348. /**
  4349. * The complete URL chain of the item including any redirects.
  4350. */
  4351. getURLChain(): string[];
  4352. /**
  4353. * Whether the download has user gesture.
  4354. */
  4355. hasUserGesture(): boolean;
  4356. /**
  4357. * Whether the download is paused.
  4358. */
  4359. isPaused(): boolean;
  4360. /**
  4361. * Pauses the download.
  4362. */
  4363. pause(): void;
  4364. /**
  4365. * Resumes the download that has been paused.
  4366. *
  4367. * **Note:** To enable resumable downloads the server you are downloading from must
  4368. * support range requests and provide both `Last-Modified` and `ETag` header
  4369. * values. Otherwise `resume()` will dismiss previously received bytes and restart
  4370. * the download from the beginning.
  4371. */
  4372. resume(): void;
  4373. /**
  4374. * This API allows the user to set custom options for the save dialog that opens
  4375. * for the download item by default. The API is only available in session's
  4376. * `will-download` callback function.
  4377. */
  4378. setSaveDialogOptions(options: SaveDialogOptions): void;
  4379. /**
  4380. * The API is only available in session's `will-download` callback function. If
  4381. * `path` doesn't exist, Electron will try to make the directory recursively. If
  4382. * user doesn't set the save path via the API, Electron will use the original
  4383. * routine to determine the save path; this usually prompts a save dialog.
  4384. */
  4385. setSavePath(path: string): void;
  4386. savePath: string;
  4387. }
  4388. interface Event extends GlobalEvent {
  4389. // Docs: https://electronjs.org/docs/api/structures/event
  4390. preventDefault: (() => void);
  4391. }
  4392. interface Extension {
  4393. // Docs: https://electronjs.org/docs/api/structures/extension
  4394. id: string;
  4395. /**
  4396. * Copy of the extension's manifest data.
  4397. */
  4398. manifest: any;
  4399. name: string;
  4400. /**
  4401. * The extension's file path.
  4402. */
  4403. path: string;
  4404. /**
  4405. * The extension's `chrome-extension://` URL.
  4406. */
  4407. url: string;
  4408. version: string;
  4409. }
  4410. interface ExtensionInfo {
  4411. // Docs: https://electronjs.org/docs/api/structures/extension-info
  4412. name: string;
  4413. version: string;
  4414. }
  4415. interface FileFilter {
  4416. // Docs: https://electronjs.org/docs/api/structures/file-filter
  4417. extensions: string[];
  4418. name: string;
  4419. }
  4420. interface FilePathWithHeaders {
  4421. // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
  4422. /**
  4423. * Additional headers to be sent.
  4424. */
  4425. headers?: Record<string, string>;
  4426. /**
  4427. * The path to the file to send.
  4428. */
  4429. path: string;
  4430. }
  4431. interface GlobalShortcut {
  4432. // Docs: https://electronjs.org/docs/api/global-shortcut
  4433. /**
  4434. * Whether this application has registered `accelerator`.
  4435. *
  4436. * When the accelerator is already taken by other applications, this call will
  4437. * still return `false`. This behavior is intended by operating systems, since they
  4438. * don't want applications to fight for global shortcuts.
  4439. */
  4440. isRegistered(accelerator: Accelerator): boolean;
  4441. /**
  4442. * Whether or not the shortcut was registered successfully.
  4443. *
  4444. * Registers a global shortcut of `accelerator`. The `callback` is called when the
  4445. * registered shortcut is pressed by the user.
  4446. *
  4447. * When the accelerator is already taken by other applications, this call will
  4448. * silently fail. This behavior is intended by operating systems, since they don't
  4449. * want applications to fight for global shortcuts.
  4450. *
  4451. * The following accelerators will not be registered successfully on macOS 10.14
  4452. * Mojave unless the app has been authorized as a trusted accessibility client:
  4453. *
  4454. * * "Media Play/Pause"
  4455. * * "Media Next Track"
  4456. * "Media Previous Track"
  4457. * "Media Stop"
  4458. */
  4459. register(accelerator: Accelerator, callback: () => void): boolean;
  4460. /**
  4461. * Registers a global shortcut of all `accelerator` items in `accelerators`. The
  4462. * `callback` is called when any of the registered shortcuts are pressed by the
  4463. * user.
  4464. *
  4465. * When a given accelerator is already taken by other applications, this call will
  4466. * silently fail. This behavior is intended by operating systems, since they don't
  4467. * want applications to fight for global shortcuts.
  4468. *
  4469. * The following accelerators will not be registered successfully on macOS 10.14
  4470. * Mojave unless the app has been authorized as a trusted accessibility client:
  4471. *
  4472. * * "Media Play/Pause"
  4473. * * "Media Next Track"
  4474. * "Media Previous Track"
  4475. * "Media Stop"
  4476. */
  4477. registerAll(accelerators: string[], callback: () => void): void;
  4478. /**
  4479. * Unregisters the global shortcut of `accelerator`.
  4480. */
  4481. unregister(accelerator: Accelerator): void;
  4482. /**
  4483. * Unregisters all of the global shortcuts.
  4484. */
  4485. unregisterAll(): void;
  4486. }
  4487. interface GPUFeatureStatus {
  4488. // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
  4489. /**
  4490. * Canvas.
  4491. */
  4492. '2d_canvas': string;
  4493. /**
  4494. * Flash.
  4495. */
  4496. flash_3d: string;
  4497. /**
  4498. * Flash Stage3D.
  4499. */
  4500. flash_stage3d: string;
  4501. /**
  4502. * Flash Stage3D Baseline profile.
  4503. */
  4504. flash_stage3d_baseline: string;
  4505. /**
  4506. * Compositing.
  4507. */
  4508. gpu_compositing: string;
  4509. /**
  4510. * Multiple Raster Threads.
  4511. */
  4512. multiple_raster_threads: string;
  4513. /**
  4514. * Native GpuMemoryBuffers.
  4515. */
  4516. native_gpu_memory_buffers: string;
  4517. /**
  4518. * Rasterization.
  4519. */
  4520. rasterization: string;
  4521. /**
  4522. * Video Decode.
  4523. */
  4524. video_decode: string;
  4525. /**
  4526. * Video Encode.
  4527. */
  4528. video_encode: string;
  4529. /**
  4530. * VPx Video Decode.
  4531. */
  4532. vpx_decode: string;
  4533. /**
  4534. * WebGL.
  4535. */
  4536. webgl: string;
  4537. /**
  4538. * WebGL2.
  4539. */
  4540. webgl2: string;
  4541. }
  4542. interface InAppPurchase extends NodeJS.EventEmitter {
  4543. // Docs: https://electronjs.org/docs/api/in-app-purchase
  4544. on(event: 'transactions-updated', listener: Function): this;
  4545. once(event: 'transactions-updated', listener: Function): this;
  4546. addListener(event: 'transactions-updated', listener: Function): this;
  4547. removeListener(event: 'transactions-updated', listener: Function): this;
  4548. /**
  4549. * whether a user can make a payment.
  4550. */
  4551. canMakePayments(): boolean;
  4552. /**
  4553. * Completes all pending transactions.
  4554. */
  4555. finishAllTransactions(): void;
  4556. /**
  4557. * Completes the pending transactions corresponding to the date.
  4558. */
  4559. finishTransactionByDate(date: string): void;
  4560. /**
  4561. * Resolves with an array of `Product` objects.
  4562. *
  4563. Retrieves the product descriptions.
  4564. */
  4565. getProducts(productIDs: string[]): Promise<Electron.Product[]>;
  4566. /**
  4567. * the path to the receipt.
  4568. */
  4569. getReceiptURL(): string;
  4570. /**
  4571. * Returns `true` if the product is valid and added to the payment queue.
  4572. *
  4573. * You should listen for the `transactions-updated` event as soon as possible and
  4574. * certainly before you call `purchaseProduct`.
  4575. */
  4576. purchaseProduct(productID: string, quantity?: number): Promise<boolean>;
  4577. /**
  4578. * Restores finished transactions. This method can be called either to install
  4579. * purchases on additional devices, or to restore purchases for an application that
  4580. * the user deleted and reinstalled.
  4581. *
  4582. * The payment queue delivers a new transaction for each previously completed
  4583. * transaction that can be restored. Each transaction includes a copy of the
  4584. * original transaction.
  4585. */
  4586. restoreCompletedTransactions(): void;
  4587. }
  4588. class IncomingMessage extends NodeEventEmitter {
  4589. // Docs: https://electronjs.org/docs/api/incoming-message
  4590. /**
  4591. * Emitted when a request has been canceled during an ongoing HTTP transaction.
  4592. */
  4593. on(event: 'aborted', listener: Function): this;
  4594. once(event: 'aborted', listener: Function): this;
  4595. addListener(event: 'aborted', listener: Function): this;
  4596. removeListener(event: 'aborted', listener: Function): this;
  4597. /**
  4598. * The `data` event is the usual method of transferring response data into
  4599. * applicative code.
  4600. */
  4601. on(event: 'data', listener: (
  4602. /**
  4603. * A chunk of response body's data.
  4604. */
  4605. chunk: Buffer) => void): this;
  4606. once(event: 'data', listener: (
  4607. /**
  4608. * A chunk of response body's data.
  4609. */
  4610. chunk: Buffer) => void): this;
  4611. addListener(event: 'data', listener: (
  4612. /**
  4613. * A chunk of response body's data.
  4614. */
  4615. chunk: Buffer) => void): this;
  4616. removeListener(event: 'data', listener: (
  4617. /**
  4618. * A chunk of response body's data.
  4619. */
  4620. chunk: Buffer) => void): this;
  4621. /**
  4622. * Indicates that response body has ended. Must be placed before 'data' event.
  4623. */
  4624. on(event: 'end', listener: Function): this;
  4625. once(event: 'end', listener: Function): this;
  4626. addListener(event: 'end', listener: Function): this;
  4627. removeListener(event: 'end', listener: Function): this;
  4628. /**
  4629. * Returns:
  4630. *
  4631. * `error` Error - Typically holds an error string identifying failure root cause.
  4632. *
  4633. * Emitted when an error was encountered while streaming response data events. For
  4634. * instance, if the server closes the underlying while the response is still
  4635. * streaming, an `error` event will be emitted on the response object and a `close`
  4636. * event will subsequently follow on the request object.
  4637. */
  4638. on(event: 'error', listener: Function): this;
  4639. once(event: 'error', listener: Function): this;
  4640. addListener(event: 'error', listener: Function): this;
  4641. removeListener(event: 'error', listener: Function): this;
  4642. headers: Record<string, (string) | (string[])>;
  4643. httpVersion: string;
  4644. httpVersionMajor: number;
  4645. httpVersionMinor: number;
  4646. statusCode: number;
  4647. statusMessage: string;
  4648. }
  4649. interface InputEvent {
  4650. // Docs: https://electronjs.org/docs/api/structures/input-event
  4651. /**
  4652. * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
  4653. * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
  4654. * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
  4655. */
  4656. modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
  4657. }
  4658. interface IOCounters {
  4659. // Docs: https://electronjs.org/docs/api/structures/io-counters
  4660. /**
  4661. * Then number of I/O other operations.
  4662. */
  4663. otherOperationCount: number;
  4664. /**
  4665. * Then number of I/O other transfers.
  4666. */
  4667. otherTransferCount: number;
  4668. /**
  4669. * The number of I/O read operations.
  4670. */
  4671. readOperationCount: number;
  4672. /**
  4673. * The number of I/O read transfers.
  4674. */
  4675. readTransferCount: number;
  4676. /**
  4677. * The number of I/O write operations.
  4678. */
  4679. writeOperationCount: number;
  4680. /**
  4681. * The number of I/O write transfers.
  4682. */
  4683. writeTransferCount: number;
  4684. }
  4685. interface IpcMain extends NodeJS.EventEmitter {
  4686. // Docs: https://electronjs.org/docs/api/ipc-main
  4687. /**
  4688. * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
  4689. * renderer calls `ipcRenderer.invoke(channel, ...args)`.
  4690. *
  4691. * If `listener` returns a Promise, the eventual result of the promise will be
  4692. * returned as a reply to the remote caller. Otherwise, the return value of the
  4693. * listener will be used as the value of the reply.
  4694. *
  4695. * The `event` that is passed as the first argument to the handler is the same as
  4696. * that passed to a regular event listener. It includes information about which
  4697. * WebContents is the source of the invoke request.
  4698. *
  4699. * Errors thrown through `handle` in the main process are not transparent as they
  4700. * are serialized and only the `message` property from the original error is
  4701. * provided to the renderer process. Please refer to #24427 for details.
  4702. */
  4703. handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
  4704. /**
  4705. * Handles a single `invoke`able IPC message, then removes the listener. See
  4706. * `ipcMain.handle(channel, listener)`.
  4707. */
  4708. handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
  4709. /**
  4710. * Listens to `channel`, when a new message arrives `listener` would be called with
  4711. * `listener(event, args...)`.
  4712. */
  4713. on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  4714. /**
  4715. * Adds a one time `listener` function for the event. This `listener` is invoked
  4716. * only the next time a message is sent to `channel`, after which it is removed.
  4717. */
  4718. once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  4719. /**
  4720. * Removes listeners of the specified `channel`.
  4721. */
  4722. removeAllListeners(channel?: string): this;
  4723. /**
  4724. * Removes any handler for `channel`, if present.
  4725. */
  4726. removeHandler(channel: string): void;
  4727. /**
  4728. * Removes the specified `listener` from the listener array for the specified
  4729. * `channel`.
  4730. */
  4731. removeListener(channel: string, listener: (...args: any[]) => void): this;
  4732. }
  4733. interface IpcMainEvent extends Event {
  4734. // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
  4735. /**
  4736. * The ID of the renderer frame that sent this message
  4737. */
  4738. frameId: number;
  4739. /**
  4740. * A list of MessagePorts that were transferred with this message
  4741. */
  4742. ports: MessagePortMain[];
  4743. /**
  4744. * The internal ID of the renderer process that sent this message
  4745. */
  4746. processId: number;
  4747. /**
  4748. * A function that will send an IPC message to the renderer frame that sent the
  4749. * original message that you are currently handling. You should use this method to
  4750. * "reply" to the sent message in order to guarantee the reply will go to the
  4751. * correct process and frame.
  4752. */
  4753. reply: Function;
  4754. /**
  4755. * Set this to the value to be returned in a synchronous message
  4756. */
  4757. returnValue: any;
  4758. /**
  4759. * Returns the `webContents` that sent the message
  4760. */
  4761. sender: WebContents;
  4762. /**
  4763. * The frame that sent this message
  4764. *
  4765. */
  4766. readonly senderFrame: WebFrameMain;
  4767. }
  4768. interface IpcMainInvokeEvent extends Event {
  4769. // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
  4770. /**
  4771. * The ID of the renderer frame that sent this message
  4772. */
  4773. frameId: number;
  4774. /**
  4775. * The internal ID of the renderer process that sent this message
  4776. */
  4777. processId: number;
  4778. /**
  4779. * Returns the `webContents` that sent the message
  4780. */
  4781. sender: WebContents;
  4782. /**
  4783. * The frame that sent this message
  4784. *
  4785. */
  4786. readonly senderFrame: WebFrameMain;
  4787. }
  4788. interface IpcRenderer extends NodeJS.EventEmitter {
  4789. // Docs: https://electronjs.org/docs/api/ipc-renderer
  4790. /**
  4791. * Resolves with the response from the main process.
  4792. *
  4793. * Send a message to the main process via `channel` and expect a result
  4794. * asynchronously. Arguments will be serialized with the Structured Clone
  4795. * Algorithm, just like `window.postMessage`, so prototype chains will not be
  4796. * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
  4797. * an exception.
  4798. *
  4799. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  4800. * Electron objects will throw an exception.
  4801. *
  4802. * Since the main process does not have support for DOM objects such as
  4803. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  4804. * Electron's IPC to the main process, as the main process would have no way to
  4805. * decode them. Attempting to send such objects over IPC will result in an error.
  4806. *
  4807. * The main process should listen for `channel` with `ipcMain.handle()`.
  4808. *
  4809. * For example:
  4810. *
  4811. * If you need to transfer a `MessagePort` to the main process, use
  4812. * `ipcRenderer.postMessage`.
  4813. *
  4814. * If you do not need a response to the message, consider using `ipcRenderer.send`.
  4815. */
  4816. invoke(channel: string, ...args: any[]): Promise<any>;
  4817. /**
  4818. * Listens to `channel`, when a new message arrives `listener` would be called with
  4819. * `listener(event, args...)`.
  4820. */
  4821. on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  4822. /**
  4823. * Adds a one time `listener` function for the event. This `listener` is invoked
  4824. * only the next time a message is sent to `channel`, after which it is removed.
  4825. */
  4826. once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  4827. /**
  4828. * Send a message to the main process, optionally transferring ownership of zero or
  4829. * more `MessagePort` objects.
  4830. *
  4831. * The transferred `MessagePort` objects will be available in the main process as
  4832. * `MessagePortMain` objects by accessing the `ports` property of the emitted
  4833. * event.
  4834. *
  4835. * For example:
  4836. *
  4837. * For more information on using `MessagePort` and `MessageChannel`, see the MDN
  4838. * documentation.
  4839. */
  4840. postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
  4841. /**
  4842. * Removes all listeners, or those of the specified `channel`.
  4843. */
  4844. removeAllListeners(channel: string): this;
  4845. /**
  4846. * Removes the specified `listener` from the listener array for the specified
  4847. * `channel`.
  4848. */
  4849. removeListener(channel: string, listener: (...args: any[]) => void): this;
  4850. /**
  4851. * Send an asynchronous message to the main process via `channel`, along with
  4852. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  4853. * just like `window.postMessage`, so prototype chains will not be included.
  4854. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  4855. * exception.
  4856. *
  4857. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  4858. * Electron objects will throw an exception.
  4859. *
  4860. * Since the main process does not have support for DOM objects such as
  4861. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  4862. * Electron's IPC to the main process, as the main process would have no way to
  4863. * decode them. Attempting to send such objects over IPC will result in an error.
  4864. *
  4865. * The main process handles it by listening for `channel` with the `ipcMain`
  4866. * module.
  4867. *
  4868. * If you need to transfer a `MessagePort` to the main process, use
  4869. * `ipcRenderer.postMessage`.
  4870. *
  4871. * If you want to receive a single response from the main process, like the result
  4872. * of a method call, consider using `ipcRenderer.invoke`.
  4873. */
  4874. send(channel: string, ...args: any[]): void;
  4875. /**
  4876. * The value sent back by the `ipcMain` handler.
  4877. *
  4878. * Send a message to the main process via `channel` and expect a result
  4879. * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
  4880. * just like `window.postMessage`, so prototype chains will not be included.
  4881. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  4882. * exception.
  4883. *
  4884. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  4885. * Electron objects will throw an exception.
  4886. *
  4887. * Since the main process does not have support for DOM objects such as
  4888. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  4889. * Electron's IPC to the main process, as the main process would have no way to
  4890. * decode them. Attempting to send such objects over IPC will result in an error.
  4891. *
  4892. * The main process handles it by listening for `channel` with `ipcMain` module,
  4893. * and replies by setting `event.returnValue`.
  4894. *
  4895. * > :warning: **WARNING**: Sending a synchronous message will block the whole
  4896. * renderer process until the reply is received, so use this method only as a last
  4897. * resort. It's much better to use the asynchronous version, `invoke()`.
  4898. */
  4899. sendSync(channel: string, ...args: any[]): any;
  4900. /**
  4901. * Sends a message to a window with `webContentsId` via `channel`.
  4902. */
  4903. sendTo(webContentsId: number, channel: string, ...args: any[]): void;
  4904. /**
  4905. * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
  4906. * the host page instead of the main process.
  4907. */
  4908. sendToHost(channel: string, ...args: any[]): void;
  4909. }
  4910. interface IpcRendererEvent extends Event {
  4911. // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
  4912. /**
  4913. * A list of MessagePorts that were transferred with this message
  4914. */
  4915. ports: MessagePort[];
  4916. /**
  4917. * The `IpcRenderer` instance that emitted the event originally
  4918. */
  4919. sender: IpcRenderer;
  4920. /**
  4921. * The `webContents.id` that sent the message, you can call
  4922. * `event.sender.sendTo(event.senderId, ...)` to reply to the message, see
  4923. * ipcRenderer.sendTo for more information. This only applies to messages sent from
  4924. * a different renderer. Messages sent directly from the main process set
  4925. * `event.senderId` to `0`.
  4926. */
  4927. senderId: number;
  4928. }
  4929. interface JumpListCategory {
  4930. // Docs: https://electronjs.org/docs/api/structures/jump-list-category
  4931. /**
  4932. * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
  4933. * should be omitted.
  4934. */
  4935. items?: JumpListItem[];
  4936. /**
  4937. * Must be set if `type` is `custom`, otherwise it should be omitted.
  4938. */
  4939. name?: string;
  4940. /**
  4941. * One of the following:
  4942. */
  4943. type?: ('tasks' | 'frequent' | 'recent' | 'custom');
  4944. }
  4945. interface JumpListItem {
  4946. // Docs: https://electronjs.org/docs/api/structures/jump-list-item
  4947. /**
  4948. * The command line arguments when `program` is executed. Should only be set if
  4949. * `type` is `task`.
  4950. */
  4951. args?: string;
  4952. /**
  4953. * Description of the task (displayed in a tooltip). Should only be set if `type`
  4954. * is `task`. Maximum length 260 characters.
  4955. */
  4956. description?: string;
  4957. /**
  4958. * The index of the icon in the resource file. If a resource file contains multiple
  4959. * icons this value can be used to specify the zero-based index of the icon that
  4960. * should be displayed for this task. If a resource file contains only one icon,
  4961. * this property should be set to zero.
  4962. */
  4963. iconIndex?: number;
  4964. /**
  4965. * The absolute path to an icon to be displayed in a Jump List, which can be an
  4966. * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
  4967. * can usually specify `process.execPath` to show the program icon.
  4968. */
  4969. iconPath?: string;
  4970. /**
  4971. * Path of the file to open, should only be set if `type` is `file`.
  4972. */
  4973. path?: string;
  4974. /**
  4975. * Path of the program to execute, usually you should specify `process.execPath`
  4976. * which opens the current program. Should only be set if `type` is `task`.
  4977. */
  4978. program?: string;
  4979. /**
  4980. * The text to be displayed for the item in the Jump List. Should only be set if
  4981. * `type` is `task`.
  4982. */
  4983. title?: string;
  4984. /**
  4985. * One of the following:
  4986. */
  4987. type?: ('task' | 'separator' | 'file');
  4988. /**
  4989. * The working directory. Default is empty.
  4990. */
  4991. workingDirectory?: string;
  4992. }
  4993. interface KeyboardEvent {
  4994. // Docs: https://electronjs.org/docs/api/structures/keyboard-event
  4995. /**
  4996. * whether an Alt key was used in an accelerator to trigger the Event
  4997. */
  4998. altKey?: boolean;
  4999. /**
  5000. * whether the Control key was used in an accelerator to trigger the Event
  5001. */
  5002. ctrlKey?: boolean;
  5003. /**
  5004. * whether a meta key was used in an accelerator to trigger the Event
  5005. */
  5006. metaKey?: boolean;
  5007. /**
  5008. * whether a Shift key was used in an accelerator to trigger the Event
  5009. */
  5010. shiftKey?: boolean;
  5011. /**
  5012. * whether an accelerator was used to trigger the event as opposed to another user
  5013. * gesture like mouse click
  5014. */
  5015. triggeredByAccelerator?: boolean;
  5016. }
  5017. interface KeyboardInputEvent extends InputEvent {
  5018. // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
  5019. /**
  5020. * The character that will be sent as the keyboard event. Should only use the valid
  5021. * key codes in Accelerator.
  5022. */
  5023. keyCode: string;
  5024. /**
  5025. * The type of the event, can be `keyDown`, `keyUp` or `char`.
  5026. */
  5027. type: ('keyDown' | 'keyUp' | 'char');
  5028. }
  5029. interface MemoryInfo {
  5030. // Docs: https://electronjs.org/docs/api/structures/memory-info
  5031. /**
  5032. * The maximum amount of memory that has ever been pinned to actual physical RAM.
  5033. */
  5034. peakWorkingSetSize: number;
  5035. /**
  5036. * The amount of memory not shared by other processes, such as JS heap or HTML
  5037. * content.
  5038. *
  5039. * @platform win32
  5040. */
  5041. privateBytes?: number;
  5042. /**
  5043. * The amount of memory currently pinned to actual physical RAM.
  5044. */
  5045. workingSetSize: number;
  5046. }
  5047. interface MemoryUsageDetails {
  5048. // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
  5049. count: number;
  5050. liveSize: number;
  5051. size: number;
  5052. }
  5053. class Menu {
  5054. // Docs: https://electronjs.org/docs/api/menu
  5055. /**
  5056. * Emitted when a popup is closed either manually or with `menu.closePopup()`.
  5057. */
  5058. on(event: 'menu-will-close', listener: (event: Event) => void): this;
  5059. once(event: 'menu-will-close', listener: (event: Event) => void): this;
  5060. addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  5061. removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  5062. /**
  5063. * Emitted when `menu.popup()` is called.
  5064. */
  5065. on(event: 'menu-will-show', listener: (event: Event) => void): this;
  5066. once(event: 'menu-will-show', listener: (event: Event) => void): this;
  5067. addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  5068. removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  5069. /**
  5070. * Menu
  5071. */
  5072. constructor();
  5073. /**
  5074. * Generally, the `template` is an array of `options` for constructing a MenuItem.
  5075. * The usage can be referenced above.
  5076. *
  5077. * You can also attach other fields to the element of the `template` and they will
  5078. * become properties of the constructed menu items.
  5079. */
  5080. static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
  5081. /**
  5082. * The application menu, if set, or `null`, if not set.
  5083. *
  5084. * **Note:** The returned `Menu` instance doesn't support dynamic addition or
  5085. * removal of menu items. Instance properties can still be dynamically modified.
  5086. */
  5087. static getApplicationMenu(): (Menu) | (null);
  5088. /**
  5089. * Sends the `action` to the first responder of application. This is used for
  5090. * emulating default macOS menu behaviors. Usually you would use the `role`
  5091. * property of a `MenuItem`.
  5092. *
  5093. * See the macOS Cocoa Event Handling Guide for more information on macOS' native
  5094. * actions.
  5095. *
  5096. * @platform darwin
  5097. */
  5098. static sendActionToFirstResponder(action: string): void;
  5099. /**
  5100. * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
  5101. * will be set as each window's top menu.
  5102. *
  5103. * Also on Windows and Linux, you can use a `&` in the top-level item name to
  5104. * indicate which letter should get a generated accelerator. For example, using
  5105. * `&File` for the file menu would result in a generated `Alt-F` accelerator that
  5106. * opens the associated menu. The indicated character in the button label then gets
  5107. * an underline, and the `&` character is not displayed on the button label.
  5108. *
  5109. * In order to escape the `&` character in an item name, add a proceeding `&`. For
  5110. * example, `&&File` would result in `&File` displayed on the button label.
  5111. *
  5112. * Passing `null` will suppress the default menu. On Windows and Linux, this has
  5113. * the additional effect of removing the menu bar from the window.
  5114. *
  5115. * **Note:** The default menu will be created automatically if the app does not set
  5116. * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
  5117. * `Help`.
  5118. */
  5119. static setApplicationMenu(menu: (Menu) | (null)): void;
  5120. /**
  5121. * Appends the `menuItem` to the menu.
  5122. */
  5123. append(menuItem: MenuItem): void;
  5124. /**
  5125. * Closes the context menu in the `browserWindow`.
  5126. */
  5127. closePopup(browserWindow?: BrowserWindow): void;
  5128. /**
  5129. * the item with the specified `id`
  5130. */
  5131. getMenuItemById(id: string): (MenuItem) | (null);
  5132. /**
  5133. * Inserts the `menuItem` to the `pos` position of the menu.
  5134. */
  5135. insert(pos: number, menuItem: MenuItem): void;
  5136. /**
  5137. * Pops up this menu as a context menu in the `BrowserWindow`.
  5138. */
  5139. popup(options?: PopupOptions): void;
  5140. items: MenuItem[];
  5141. }
  5142. class MenuItem {
  5143. // Docs: https://electronjs.org/docs/api/menu-item
  5144. /**
  5145. * MenuItem
  5146. */
  5147. constructor(options: MenuItemConstructorOptions);
  5148. accelerator?: Accelerator;
  5149. checked: boolean;
  5150. click: Function;
  5151. commandId: number;
  5152. enabled: boolean;
  5153. icon?: (NativeImage) | (string);
  5154. id: string;
  5155. label: string;
  5156. menu: Menu;
  5157. registerAccelerator: boolean;
  5158. role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  5159. sharingItem: SharingItem;
  5160. sublabel: string;
  5161. submenu?: Menu;
  5162. toolTip: string;
  5163. type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  5164. visible: boolean;
  5165. }
  5166. class MessageChannelMain extends NodeEventEmitter {
  5167. // Docs: https://electronjs.org/docs/api/message-channel-main
  5168. port1: MessagePortMain;
  5169. port2: MessagePortMain;
  5170. }
  5171. class MessagePortMain extends NodeEventEmitter {
  5172. // Docs: https://electronjs.org/docs/api/message-port-main
  5173. /**
  5174. * Emitted when the remote end of a MessagePortMain object becomes disconnected.
  5175. */
  5176. on(event: 'close', listener: Function): this;
  5177. once(event: 'close', listener: Function): this;
  5178. addListener(event: 'close', listener: Function): this;
  5179. removeListener(event: 'close', listener: Function): this;
  5180. /**
  5181. * Emitted when a MessagePortMain object receives a message.
  5182. */
  5183. on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5184. once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5185. addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5186. removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5187. /**
  5188. * Disconnects the port, so it is no longer active.
  5189. */
  5190. close(): void;
  5191. /**
  5192. * Sends a message from the port, and optionally, transfers ownership of objects to
  5193. * other browsing contexts.
  5194. */
  5195. postMessage(message: any, transfer?: MessagePortMain[]): void;
  5196. /**
  5197. * Starts the sending of messages queued on the port. Messages will be queued until
  5198. * this method is called.
  5199. */
  5200. start(): void;
  5201. }
  5202. interface MimeTypedBuffer {
  5203. // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
  5204. /**
  5205. * Charset of the buffer.
  5206. */
  5207. charset?: string;
  5208. /**
  5209. * The actual Buffer content.
  5210. */
  5211. data: Buffer;
  5212. /**
  5213. * MIME type of the buffer.
  5214. */
  5215. mimeType?: string;
  5216. }
  5217. interface MouseInputEvent extends InputEvent {
  5218. // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
  5219. /**
  5220. * The button pressed, can be `left`, `middle`, `right`.
  5221. */
  5222. button?: ('left' | 'middle' | 'right');
  5223. clickCount?: number;
  5224. globalX?: number;
  5225. globalY?: number;
  5226. movementX?: number;
  5227. movementY?: number;
  5228. /**
  5229. * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
  5230. * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
  5231. */
  5232. type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
  5233. x: number;
  5234. y: number;
  5235. }
  5236. interface MouseWheelInputEvent extends MouseInputEvent {
  5237. // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
  5238. accelerationRatioX?: number;
  5239. accelerationRatioY?: number;
  5240. canScroll?: boolean;
  5241. deltaX?: number;
  5242. deltaY?: number;
  5243. hasPreciseScrollingDeltas?: boolean;
  5244. /**
  5245. * The type of the event, can be `mouseWheel`.
  5246. */
  5247. type: ('mouseWheel');
  5248. wheelTicksX?: number;
  5249. wheelTicksY?: number;
  5250. }
  5251. class NativeImage {
  5252. // Docs: https://electronjs.org/docs/api/native-image
  5253. /**
  5254. * Creates an empty `NativeImage` instance.
  5255. */
  5256. static createEmpty(): NativeImage;
  5257. /**
  5258. * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
  5259. * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
  5260. */
  5261. static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
  5262. /**
  5263. * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
  5264. * JPEG first.
  5265. */
  5266. static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
  5267. /**
  5268. * Creates a new `NativeImage` instance from `dataURL`.
  5269. */
  5270. static createFromDataURL(dataURL: string): NativeImage;
  5271. /**
  5272. * Creates a new `NativeImage` instance from the NSImage that maps to the given
  5273. * image name. See `System Icons` for a list of possible values.
  5274. *
  5275. * The `hslShift` is applied to the image with the following rules:
  5276. *
  5277. * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
  5278. * and 360 on the hue color wheel (red).
  5279. * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
  5280. * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
  5281. * saturate the image.
  5282. * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
  5283. * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
  5284. * leave unchanged. 1 = full lightness (make all pixels white).
  5285. *
  5286. * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
  5287. * 0]` will make the image completely black.
  5288. *
  5289. * In some cases, the `NSImageName` doesn't match its string representation; one
  5290. * example of this is `NSFolderImageName`, whose string representation would
  5291. * actually be `NSFolder`. Therefore, you'll need to determine the correct string
  5292. * representation for your image before passing it in. This can be done with the
  5293. * following:
  5294. *
  5295. * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
  5296. * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
  5297. *
  5298. where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
  5299. *
  5300. * @platform darwin
  5301. */
  5302. static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
  5303. /**
  5304. * Creates a new `NativeImage` instance from a file located at `path`. This method
  5305. * returns an empty image if the `path` does not exist, cannot be read, or is not a
  5306. * valid image.
  5307. */
  5308. static createFromPath(path: string): NativeImage;
  5309. /**
  5310. * fulfilled with the file's thumbnail preview image, which is a NativeImage.
  5311. *
  5312. * @platform darwin,win32
  5313. */
  5314. static createThumbnailFromPath(path: string, maxSize: Size): Promise<Electron.NativeImage>;
  5315. /**
  5316. * Add an image representation for a specific scale factor. This can be used to
  5317. * explicitly add different scale factor representations to an image. This can be
  5318. * called on empty images.
  5319. */
  5320. addRepresentation(options: AddRepresentationOptions): void;
  5321. /**
  5322. * The cropped image.
  5323. */
  5324. crop(rect: Rectangle): NativeImage;
  5325. /**
  5326. * The image's aspect ratio.
  5327. *
  5328. * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
  5329. * the image representation most closely matching the passed value.
  5330. */
  5331. getAspectRatio(scaleFactor?: number): number;
  5332. /**
  5333. * A Buffer that contains the image's raw bitmap pixel data.
  5334. *
  5335. * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
  5336. * not copy the bitmap data, so you have to use the returned Buffer immediately in
  5337. * current event loop tick; otherwise the data might be changed or destroyed.
  5338. */
  5339. getBitmap(options?: BitmapOptions): Buffer;
  5340. /**
  5341. * A Buffer that stores C pointer to underlying native handle of the image. On
  5342. * macOS, a pointer to `NSImage` instance would be returned.
  5343. *
  5344. * Notice that the returned pointer is a weak pointer to the underlying native
  5345. * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
  5346. * instance is kept around.
  5347. *
  5348. * @platform darwin
  5349. */
  5350. getNativeHandle(): Buffer;
  5351. /**
  5352. * An array of all scale factors corresponding to representations for a given
  5353. * nativeImage.
  5354. */
  5355. getScaleFactors(): number[];
  5356. /**
  5357. * If `scaleFactor` is passed, this will return the size corresponding to the image
  5358. * representation most closely matching the passed value.
  5359. */
  5360. getSize(scaleFactor?: number): Size;
  5361. /**
  5362. * Whether the image is empty.
  5363. */
  5364. isEmpty(): boolean;
  5365. /**
  5366. * Whether the image is a template image.
  5367. */
  5368. isTemplateImage(): boolean;
  5369. /**
  5370. * The resized image.
  5371. *
  5372. * If only the `height` or the `width` are specified then the current aspect ratio
  5373. * will be preserved in the resized image.
  5374. */
  5375. resize(options: ResizeOptions): NativeImage;
  5376. /**
  5377. * Marks the image as a template image.
  5378. */
  5379. setTemplateImage(option: boolean): void;
  5380. /**
  5381. * A Buffer that contains a copy of the image's raw bitmap pixel data.
  5382. */
  5383. toBitmap(options?: ToBitmapOptions): Buffer;
  5384. /**
  5385. * The data URL of the image.
  5386. */
  5387. toDataURL(options?: ToDataURLOptions): string;
  5388. /**
  5389. * A Buffer that contains the image's `JPEG` encoded data.
  5390. */
  5391. toJPEG(quality: number): Buffer;
  5392. /**
  5393. * A Buffer that contains the image's `PNG` encoded data.
  5394. */
  5395. toPNG(options?: ToPNGOptions): Buffer;
  5396. isMacTemplateImage: boolean;
  5397. }
  5398. interface NativeTheme extends NodeJS.EventEmitter {
  5399. // Docs: https://electronjs.org/docs/api/native-theme
  5400. /**
  5401. * Emitted when something in the underlying NativeTheme has changed. This normally
  5402. * means that either the value of `shouldUseDarkColors`,
  5403. * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
  5404. * will have to check them to determine which one has changed.
  5405. */
  5406. on(event: 'updated', listener: Function): this;
  5407. once(event: 'updated', listener: Function): this;
  5408. addListener(event: 'updated', listener: Function): this;
  5409. removeListener(event: 'updated', listener: Function): this;
  5410. /**
  5411. * A `Boolean` for if the OS / Chromium currently has a dark mode enabled or is
  5412. * being instructed to show a dark-style UI. If you want to modify this value you
  5413. * should use `themeSource` below.
  5414. *
  5415. */
  5416. readonly shouldUseDarkColors: boolean;
  5417. /**
  5418. * A `Boolean` for if the OS / Chromium currently has high-contrast mode enabled or
  5419. * is being instructed to show a high-contrast UI.
  5420. *
  5421. * @platform darwin,win32
  5422. */
  5423. readonly shouldUseHighContrastColors: boolean;
  5424. /**
  5425. * A `Boolean` for if the OS / Chromium currently has an inverted color scheme or
  5426. * is being instructed to use an inverted color scheme.
  5427. *
  5428. * @platform darwin,win32
  5429. */
  5430. readonly shouldUseInvertedColorScheme: boolean;
  5431. /**
  5432. * A `String` property that can be `system`, `light` or `dark`. It is used to
  5433. * override and supersede the value that Chromium has chosen to use internally.
  5434. *
  5435. * Setting this property to `system` will remove the override and everything will
  5436. * be reset to the OS default. By default `themeSource` is `system`.
  5437. *
  5438. * Settings this property to `dark` will have the following effects:
  5439. *
  5440. * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
  5441. * * Any UI Electron renders on Linux and Windows including context menus,
  5442. * devtools, etc. will use the dark UI.
  5443. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  5444. * the dark UI.
  5445. * * The `prefers-color-scheme` CSS query will match `dark` mode.
  5446. * * The `updated` event will be emitted
  5447. *
  5448. * Settings this property to `light` will have the following effects:
  5449. *
  5450. * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
  5451. * * Any UI Electron renders on Linux and Windows including context menus,
  5452. * devtools, etc. will use the light UI.
  5453. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  5454. * the light UI.
  5455. * * The `prefers-color-scheme` CSS query will match `light` mode.
  5456. * * The `updated` event will be emitted
  5457. *
  5458. * The usage of this property should align with a classic "dark mode" state machine
  5459. * in your application where the user has three options.
  5460. *
  5461. * * `Follow OS` --> `themeSource = 'system'`
  5462. * * `Dark Mode` --> `themeSource = 'dark'`
  5463. * * `Light Mode` --> `themeSource = 'light'`
  5464. *
  5465. * Your application should then always use `shouldUseDarkColors` to determine what
  5466. * CSS to apply.
  5467. */
  5468. themeSource: ('system' | 'light' | 'dark');
  5469. }
  5470. interface Net {
  5471. // Docs: https://electronjs.org/docs/api/net
  5472. /**
  5473. * Whether there is currently internet connection.
  5474. *
  5475. * A return value of `false` is a pretty strong indicator that the user won't be
  5476. * able to connect to remote sites. However, a return value of `true` is
  5477. * inconclusive; even if some link is up, it is uncertain whether a particular
  5478. * connection attempt to a particular remote site will be successful.
  5479. */
  5480. isOnline(): boolean;
  5481. /**
  5482. * Creates a `ClientRequest` instance using the provided `options` which are
  5483. * directly forwarded to the `ClientRequest` constructor. The `net.request` method
  5484. * would be used to issue both secure and insecure HTTP requests according to the
  5485. * specified protocol scheme in the `options` object.
  5486. */
  5487. request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
  5488. /**
  5489. * A `Boolean` property. Whether there is currently internet connection.
  5490. *
  5491. * A return value of `false` is a pretty strong indicator that the user won't be
  5492. * able to connect to remote sites. However, a return value of `true` is
  5493. * inconclusive; even if some link is up, it is uncertain whether a particular
  5494. * connection attempt to a particular remote site will be successful.
  5495. *
  5496. */
  5497. readonly online: boolean;
  5498. }
  5499. interface NetLog {
  5500. // Docs: https://electronjs.org/docs/api/net-log
  5501. /**
  5502. * resolves when the net log has begun recording.
  5503. *
  5504. Starts recording network events to `path`.
  5505. */
  5506. startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
  5507. /**
  5508. * resolves when the net log has been flushed to disk.
  5509. *
  5510. * Stops recording network events. If not called, net logging will automatically
  5511. * end when app quits.
  5512. */
  5513. stopLogging(): Promise<void>;
  5514. /**
  5515. * A `Boolean` property that indicates whether network logs are currently being
  5516. * recorded.
  5517. *
  5518. */
  5519. readonly currentlyLogging: boolean;
  5520. }
  5521. interface NewWindowWebContentsEvent extends Event {
  5522. // Docs: https://electronjs.org/docs/api/structures/new-window-web-contents-event
  5523. newGuest?: BrowserWindow;
  5524. }
  5525. class Notification extends NodeEventEmitter {
  5526. // Docs: https://electronjs.org/docs/api/notification
  5527. on(event: 'action', listener: (event: Event,
  5528. /**
  5529. * The index of the action that was activated.
  5530. */
  5531. index: number) => void): this;
  5532. once(event: 'action', listener: (event: Event,
  5533. /**
  5534. * The index of the action that was activated.
  5535. */
  5536. index: number) => void): this;
  5537. addListener(event: 'action', listener: (event: Event,
  5538. /**
  5539. * The index of the action that was activated.
  5540. */
  5541. index: number) => void): this;
  5542. removeListener(event: 'action', listener: (event: Event,
  5543. /**
  5544. * The index of the action that was activated.
  5545. */
  5546. index: number) => void): this;
  5547. /**
  5548. * Emitted when the notification is clicked by the user.
  5549. */
  5550. on(event: 'click', listener: (event: Event) => void): this;
  5551. once(event: 'click', listener: (event: Event) => void): this;
  5552. addListener(event: 'click', listener: (event: Event) => void): this;
  5553. removeListener(event: 'click', listener: (event: Event) => void): this;
  5554. /**
  5555. * Emitted when the notification is closed by manual intervention from the user.
  5556. *
  5557. * This event is not guaranteed to be emitted in all cases where the notification
  5558. * is closed.
  5559. */
  5560. on(event: 'close', listener: (event: Event) => void): this;
  5561. once(event: 'close', listener: (event: Event) => void): this;
  5562. addListener(event: 'close', listener: (event: Event) => void): this;
  5563. removeListener(event: 'close', listener: (event: Event) => void): this;
  5564. /**
  5565. * Emitted when an error is encountered while creating and showing the native
  5566. * notification.
  5567. *
  5568. * @platform win32
  5569. */
  5570. on(event: 'failed', listener: (event: Event,
  5571. /**
  5572. * The error encountered during execution of the `show()` method.
  5573. */
  5574. error: string) => void): this;
  5575. once(event: 'failed', listener: (event: Event,
  5576. /**
  5577. * The error encountered during execution of the `show()` method.
  5578. */
  5579. error: string) => void): this;
  5580. addListener(event: 'failed', listener: (event: Event,
  5581. /**
  5582. * The error encountered during execution of the `show()` method.
  5583. */
  5584. error: string) => void): this;
  5585. removeListener(event: 'failed', listener: (event: Event,
  5586. /**
  5587. * The error encountered during execution of the `show()` method.
  5588. */
  5589. error: string) => void): this;
  5590. /**
  5591. * Emitted when the user clicks the "Reply" button on a notification with
  5592. * `hasReply: true`.
  5593. *
  5594. * @platform darwin
  5595. */
  5596. on(event: 'reply', listener: (event: Event,
  5597. /**
  5598. * The string the user entered into the inline reply field.
  5599. */
  5600. reply: string) => void): this;
  5601. once(event: 'reply', listener: (event: Event,
  5602. /**
  5603. * The string the user entered into the inline reply field.
  5604. */
  5605. reply: string) => void): this;
  5606. addListener(event: 'reply', listener: (event: Event,
  5607. /**
  5608. * The string the user entered into the inline reply field.
  5609. */
  5610. reply: string) => void): this;
  5611. removeListener(event: 'reply', listener: (event: Event,
  5612. /**
  5613. * The string the user entered into the inline reply field.
  5614. */
  5615. reply: string) => void): this;
  5616. /**
  5617. * Emitted when the notification is shown to the user, note this could be fired
  5618. * multiple times as a notification can be shown multiple times through the
  5619. * `show()` method.
  5620. */
  5621. on(event: 'show', listener: (event: Event) => void): this;
  5622. once(event: 'show', listener: (event: Event) => void): this;
  5623. addListener(event: 'show', listener: (event: Event) => void): this;
  5624. removeListener(event: 'show', listener: (event: Event) => void): this;
  5625. /**
  5626. * Notification
  5627. */
  5628. constructor(options?: NotificationConstructorOptions);
  5629. /**
  5630. * Whether or not desktop notifications are supported on the current system
  5631. */
  5632. static isSupported(): boolean;
  5633. /**
  5634. * Dismisses the notification.
  5635. */
  5636. close(): void;
  5637. /**
  5638. * Immediately shows the notification to the user, please note this means unlike
  5639. * the HTML5 Notification implementation, instantiating a `new Notification` does
  5640. * not immediately show it to the user, you need to call this method before the OS
  5641. * will display it.
  5642. *
  5643. * If the notification has been shown before, this method will dismiss the
  5644. * previously shown notification and create a new one with identical properties.
  5645. */
  5646. show(): void;
  5647. actions: NotificationAction[];
  5648. body: string;
  5649. closeButtonText: string;
  5650. hasReply: boolean;
  5651. replyPlaceholder: string;
  5652. silent: boolean;
  5653. sound: string;
  5654. subtitle: string;
  5655. timeoutType: ('default' | 'never');
  5656. title: string;
  5657. toastXml: string;
  5658. urgency: ('normal' | 'critical' | 'low');
  5659. }
  5660. interface NotificationAction {
  5661. // Docs: https://electronjs.org/docs/api/structures/notification-action
  5662. /**
  5663. * The label for the given action.
  5664. */
  5665. text?: string;
  5666. /**
  5667. * The type of action, can be `button`.
  5668. */
  5669. type: ('button');
  5670. }
  5671. interface NotificationResponse {
  5672. // Docs: https://electronjs.org/docs/api/structures/notification-response
  5673. /**
  5674. * The identifier string of the action that the user selected.
  5675. */
  5676. actionIdentifier: string;
  5677. /**
  5678. * The delivery date of the notification.
  5679. */
  5680. date: number;
  5681. /**
  5682. * The unique identifier for this notification request.
  5683. */
  5684. identifier: string;
  5685. /**
  5686. * A dictionary of custom information associated with the notification.
  5687. */
  5688. userInfo: Record<string, any>;
  5689. /**
  5690. * The text entered or chosen by the user.
  5691. */
  5692. userText?: string;
  5693. }
  5694. interface OverlayOptions {
  5695. // Docs: https://electronjs.org/docs/api/structures/overlay-options
  5696. /**
  5697. * The CSS color of the Window Controls Overlay when enabled. Default is the system
  5698. * color.
  5699. *
  5700. * @platform win32
  5701. */
  5702. color?: string;
  5703. /**
  5704. * The CSS color of the symbols on the Window Controls Overlay when enabled.
  5705. * Default is the system color.
  5706. *
  5707. * @platform win32
  5708. */
  5709. symbolColor?: string;
  5710. }
  5711. interface Point {
  5712. // Docs: https://electronjs.org/docs/api/structures/point
  5713. x: number;
  5714. y: number;
  5715. }
  5716. interface PostBody {
  5717. // Docs: https://electronjs.org/docs/api/structures/post-body
  5718. /**
  5719. * The boundary used to separate multiple parts of the message. Only valid when
  5720. * `contentType` is `multipart/form-data`.
  5721. */
  5722. boundary?: string;
  5723. /**
  5724. * The `content-type` header used for the data. One of
  5725. * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
  5726. * `enctype` attribute of the submitted HTML form.
  5727. */
  5728. contentType: string;
  5729. /**
  5730. * The post data to be sent to the new window.
  5731. */
  5732. data: Array<(UploadRawData) | (UploadFile)>;
  5733. }
  5734. interface PowerMonitor extends NodeJS.EventEmitter {
  5735. // Docs: https://electronjs.org/docs/api/power-monitor
  5736. /**
  5737. * Emitted when the system is about to lock the screen.
  5738. *
  5739. * @platform darwin,win32
  5740. */
  5741. on(event: 'lock-screen', listener: Function): this;
  5742. once(event: 'lock-screen', listener: Function): this;
  5743. addListener(event: 'lock-screen', listener: Function): this;
  5744. removeListener(event: 'lock-screen', listener: Function): this;
  5745. /**
  5746. * Emitted when the system changes to AC power.
  5747. *
  5748. * @platform darwin,win32
  5749. */
  5750. on(event: 'on-ac', listener: Function): this;
  5751. once(event: 'on-ac', listener: Function): this;
  5752. addListener(event: 'on-ac', listener: Function): this;
  5753. removeListener(event: 'on-ac', listener: Function): this;
  5754. /**
  5755. * Emitted when system changes to battery power.
  5756. *
  5757. * @platform darwin
  5758. */
  5759. on(event: 'on-battery', listener: Function): this;
  5760. once(event: 'on-battery', listener: Function): this;
  5761. addListener(event: 'on-battery', listener: Function): this;
  5762. removeListener(event: 'on-battery', listener: Function): this;
  5763. /**
  5764. * Emitted when system is resuming.
  5765. *
  5766. * @platform darwin,win32
  5767. */
  5768. on(event: 'resume', listener: Function): this;
  5769. once(event: 'resume', listener: Function): this;
  5770. addListener(event: 'resume', listener: Function): this;
  5771. removeListener(event: 'resume', listener: Function): this;
  5772. /**
  5773. * Emitted when the system is about to reboot or shut down. If the event handler
  5774. * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
  5775. * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
  5776. * should exit as soon as possible by calling something like `app.quit()`.
  5777. *
  5778. * @platform linux,darwin
  5779. */
  5780. on(event: 'shutdown', listener: Function): this;
  5781. once(event: 'shutdown', listener: Function): this;
  5782. addListener(event: 'shutdown', listener: Function): this;
  5783. removeListener(event: 'shutdown', listener: Function): this;
  5784. /**
  5785. * Emitted when the system is suspending.
  5786. *
  5787. * @platform darwin,win32
  5788. */
  5789. on(event: 'suspend', listener: Function): this;
  5790. once(event: 'suspend', listener: Function): this;
  5791. addListener(event: 'suspend', listener: Function): this;
  5792. removeListener(event: 'suspend', listener: Function): this;
  5793. /**
  5794. * Emitted as soon as the systems screen is unlocked.
  5795. *
  5796. * @platform darwin,win32
  5797. */
  5798. on(event: 'unlock-screen', listener: Function): this;
  5799. once(event: 'unlock-screen', listener: Function): this;
  5800. addListener(event: 'unlock-screen', listener: Function): this;
  5801. removeListener(event: 'unlock-screen', listener: Function): this;
  5802. /**
  5803. * Emitted when a login session is activated. See documentation for more
  5804. * information.
  5805. *
  5806. * @platform darwin
  5807. */
  5808. on(event: 'user-did-become-active', listener: Function): this;
  5809. once(event: 'user-did-become-active', listener: Function): this;
  5810. addListener(event: 'user-did-become-active', listener: Function): this;
  5811. removeListener(event: 'user-did-become-active', listener: Function): this;
  5812. /**
  5813. * Emitted when a login session is deactivated. See documentation for more
  5814. * information.
  5815. *
  5816. * @platform darwin
  5817. */
  5818. on(event: 'user-did-resign-active', listener: Function): this;
  5819. once(event: 'user-did-resign-active', listener: Function): this;
  5820. addListener(event: 'user-did-resign-active', listener: Function): this;
  5821. removeListener(event: 'user-did-resign-active', listener: Function): this;
  5822. /**
  5823. * The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
  5824. *
  5825. * Calculate the system idle state. `idleThreshold` is the amount of time (in
  5826. * seconds) before considered idle. `locked` is available on supported systems
  5827. * only.
  5828. */
  5829. getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
  5830. /**
  5831. * Idle time in seconds
  5832. Calculate system idle time in seconds.
  5833. */
  5834. getSystemIdleTime(): number;
  5835. /**
  5836. * Whether the system is on battery power.
  5837. *
  5838. * To monitor for changes in this property, use the `on-battery` and `on-ac`
  5839. * events.
  5840. */
  5841. isOnBatteryPower(): boolean;
  5842. /**
  5843. * A `Boolean` property. True if the system is on battery power.
  5844. *
  5845. See `powerMonitor.isOnBatteryPower()`.
  5846. */
  5847. onBatteryPower: boolean;
  5848. }
  5849. interface PowerSaveBlocker {
  5850. // Docs: https://electronjs.org/docs/api/power-save-blocker
  5851. /**
  5852. * Whether the corresponding `powerSaveBlocker` has started.
  5853. */
  5854. isStarted(id: number): boolean;
  5855. /**
  5856. * The blocker ID that is assigned to this power blocker.
  5857. *
  5858. * Starts preventing the system from entering lower-power mode. Returns an integer
  5859. * identifying the power save blocker.
  5860. *
  5861. * **Note:** `prevent-display-sleep` has higher precedence over
  5862. * `prevent-app-suspension`. Only the highest precedence type takes effect. In
  5863. * other words, `prevent-display-sleep` always takes precedence over
  5864. * `prevent-app-suspension`.
  5865. *
  5866. * For example, an API calling A requests for `prevent-app-suspension`, and another
  5867. * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
  5868. * used until B stops its request. After that, `prevent-app-suspension` is used.
  5869. */
  5870. start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
  5871. /**
  5872. * Stops the specified power save blocker.
  5873. */
  5874. stop(id: number): void;
  5875. }
  5876. interface PrinterInfo {
  5877. // Docs: https://electronjs.org/docs/api/structures/printer-info
  5878. /**
  5879. * a longer description of the printer's type.
  5880. */
  5881. description: string;
  5882. /**
  5883. * the name of the printer as shown in Print Preview.
  5884. */
  5885. displayName: string;
  5886. /**
  5887. * whether or not a given printer is set as the default printer on the OS.
  5888. */
  5889. isDefault: boolean;
  5890. /**
  5891. * the name of the printer as understood by the OS.
  5892. */
  5893. name: string;
  5894. /**
  5895. * an object containing a variable number of platform-specific printer information.
  5896. */
  5897. options: Options;
  5898. /**
  5899. * the current status of the printer.
  5900. */
  5901. status: number;
  5902. }
  5903. interface ProcessMemoryInfo {
  5904. // Docs: https://electronjs.org/docs/api/structures/process-memory-info
  5905. /**
  5906. * The amount of memory not shared by other processes, such as JS heap or HTML
  5907. * content in Kilobytes.
  5908. */
  5909. private: number;
  5910. /**
  5911. * The amount of memory currently pinned to actual physical RAM in Kilobytes.
  5912. *
  5913. * @platform linux,win32
  5914. */
  5915. residentSet: number;
  5916. /**
  5917. * The amount of memory shared between processes, typically memory consumed by the
  5918. * Electron code itself in Kilobytes.
  5919. */
  5920. shared: number;
  5921. }
  5922. interface ProcessMetric {
  5923. // Docs: https://electronjs.org/docs/api/structures/process-metric
  5924. /**
  5925. * CPU usage of the process.
  5926. */
  5927. cpu: CPUUsage;
  5928. /**
  5929. * Creation time for this process. The time is represented as number of
  5930. * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
  5931. * is useful to use both the `pid` and the `creationTime` to uniquely identify a
  5932. * process.
  5933. */
  5934. creationTime: number;
  5935. /**
  5936. * One of the following values:
  5937. *
  5938. * @platform win32
  5939. */
  5940. integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
  5941. /**
  5942. * Memory information for the process.
  5943. */
  5944. memory: MemoryInfo;
  5945. /**
  5946. * The name of the process. Examples for utility: `Audio Service`, `Content
  5947. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  5948. */
  5949. name?: string;
  5950. /**
  5951. * Process id of the process.
  5952. */
  5953. pid: number;
  5954. /**
  5955. * Whether the process is sandboxed on OS level.
  5956. *
  5957. * @platform darwin,win32
  5958. */
  5959. sandboxed?: boolean;
  5960. /**
  5961. * The non-localized name of the process.
  5962. */
  5963. serviceName?: string;
  5964. /**
  5965. * Process type. One of the following values:
  5966. */
  5967. type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  5968. }
  5969. interface Product {
  5970. // Docs: https://electronjs.org/docs/api/structures/product
  5971. /**
  5972. * The total size of the content, in bytes.
  5973. */
  5974. contentLengths: number[];
  5975. /**
  5976. * A string that identifies the version of the content.
  5977. */
  5978. contentVersion: string;
  5979. /**
  5980. * 3 character code presenting a product's currency based on the ISO 4217 standard.
  5981. */
  5982. currencyCode: string;
  5983. /**
  5984. * The locale formatted price of the product.
  5985. */
  5986. formattedPrice: string;
  5987. /**
  5988. * A Boolean value that indicates whether the App Store has downloadable content
  5989. * for this product. `true` if at least one file has been associated with the
  5990. * product.
  5991. */
  5992. isDownloadable: boolean;
  5993. /**
  5994. * A description of the product.
  5995. */
  5996. localizedDescription: string;
  5997. /**
  5998. * The name of the product.
  5999. */
  6000. localizedTitle: string;
  6001. /**
  6002. * The cost of the product in the local currency.
  6003. */
  6004. price: number;
  6005. /**
  6006. * The string that identifies the product to the Apple App Store.
  6007. */
  6008. productIdentifier: string;
  6009. }
  6010. interface Protocol {
  6011. // Docs: https://electronjs.org/docs/api/protocol
  6012. /**
  6013. * Whether the protocol was successfully intercepted
  6014. *
  6015. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6016. * which sends a `Buffer` as a response.
  6017. */
  6018. interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  6019. /**
  6020. * Whether the protocol was successfully intercepted
  6021. *
  6022. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6023. * which sends a file as a response.
  6024. */
  6025. interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6026. /**
  6027. * Whether the protocol was successfully intercepted
  6028. *
  6029. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6030. * which sends a new HTTP request as a response.
  6031. */
  6032. interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  6033. /**
  6034. * Whether the protocol was successfully intercepted
  6035. *
  6036. * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
  6037. * protocol handler.
  6038. */
  6039. interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  6040. /**
  6041. * Whether the protocol was successfully intercepted
  6042. *
  6043. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6044. * which sends a `String` as a response.
  6045. */
  6046. interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6047. /**
  6048. * Whether `scheme` is already intercepted.
  6049. */
  6050. isProtocolIntercepted(scheme: string): boolean;
  6051. /**
  6052. * Whether `scheme` is already registered.
  6053. */
  6054. isProtocolRegistered(scheme: string): boolean;
  6055. /**
  6056. * Whether the protocol was successfully registered
  6057. *
  6058. * Registers a protocol of `scheme` that will send a `Buffer` as a response.
  6059. *
  6060. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6061. * should be called with either a `Buffer` object or an object that has the `data`
  6062. * property.
  6063. Example:
  6064. */
  6065. registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  6066. /**
  6067. * Whether the protocol was successfully registered
  6068. *
  6069. * Registers a protocol of `scheme` that will send a file as the response. The
  6070. * `handler` will be called with `request` and `callback` where `request` is an
  6071. * incoming request for the `scheme`.
  6072. *
  6073. * To handle the `request`, the `callback` should be called with either the file's
  6074. * path or an object that has a `path` property, e.g. `callback(filePath)` or
  6075. * `callback({ path: filePath })`. The `filePath` must be an absolute path.
  6076. *
  6077. * By default the `scheme` is treated like `http:`, which is parsed differently
  6078. * from protocols that follow the "generic URI syntax" like `file:`.
  6079. */
  6080. registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6081. /**
  6082. * Whether the protocol was successfully registered
  6083. *
  6084. * Registers a protocol of `scheme` that will send an HTTP request as a response.
  6085. *
  6086. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6087. * should be called with an object that has the `url` property.
  6088. */
  6089. registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  6090. /**
  6091. * **Note:** This method can only be used before the `ready` event of the `app`
  6092. * module gets emitted and can be called only once.
  6093. *
  6094. * Registers the `scheme` as standard, secure, bypasses content security policy for
  6095. * resources, allows registering ServiceWorker, supports fetch API, and streaming
  6096. * video/audio. Specify a privilege with the value of `true` to enable the
  6097. * capability.
  6098. *
  6099. * An example of registering a privileged scheme, that bypasses Content Security
  6100. * Policy:
  6101. *
  6102. * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
  6103. * `http` and `https` are standard schemes, while `file` is not.
  6104. *
  6105. * Registering a scheme as standard allows relative and absolute resources to be
  6106. * resolved correctly when served. Otherwise the scheme will behave like the `file`
  6107. * protocol, but without the ability to resolve relative URLs.
  6108. *
  6109. * For example when you load following page with custom protocol without
  6110. * registering it as standard scheme, the image will not be loaded because
  6111. * non-standard schemes can not recognize relative URLs:
  6112. *
  6113. * Registering a scheme as standard will allow access to files through the
  6114. * FileSystem API. Otherwise the renderer will throw a security error for the
  6115. * scheme.
  6116. *
  6117. * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
  6118. * cookies) are disabled for non standard schemes. So in general if you want to
  6119. * register a custom protocol to replace the `http` protocol, you have to register
  6120. * it as a standard scheme.
  6121. *
  6122. * Protocols that use streams (http and stream protocols) should set `stream:
  6123. * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
  6124. * their responses by default. The `stream` flag configures those elements to
  6125. * correctly expect streaming responses.
  6126. */
  6127. registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
  6128. /**
  6129. * Whether the protocol was successfully registered
  6130. *
  6131. * Registers a protocol of `scheme` that will send a stream as a response.
  6132. *
  6133. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6134. * should be called with either a `ReadableStream` object or an object that has the
  6135. * `data` property.
  6136. *
  6137. * Example:
  6138. *
  6139. * It is possible to pass any object that implements the readable stream API (emits
  6140. * `data`/`end`/`error` events). For example, here's how a file could be returned:
  6141. */
  6142. registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  6143. /**
  6144. * Whether the protocol was successfully registered
  6145. *
  6146. * Registers a protocol of `scheme` that will send a `String` as a response.
  6147. *
  6148. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6149. * should be called with either a `String` or an object that has the `data`
  6150. * property.
  6151. */
  6152. registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6153. /**
  6154. * Whether the protocol was successfully unintercepted
  6155. *
  6156. Remove the interceptor installed for `scheme` and restore its original handler.
  6157. */
  6158. uninterceptProtocol(scheme: string): boolean;
  6159. /**
  6160. * Whether the protocol was successfully unregistered
  6161. *
  6162. Unregisters the custom protocol of `scheme`.
  6163. */
  6164. unregisterProtocol(scheme: string): boolean;
  6165. }
  6166. interface ProtocolRequest {
  6167. // Docs: https://electronjs.org/docs/api/structures/protocol-request
  6168. headers: Record<string, string>;
  6169. method: string;
  6170. referrer: string;
  6171. uploadData?: UploadData[];
  6172. url: string;
  6173. }
  6174. interface ProtocolResponse {
  6175. // Docs: https://electronjs.org/docs/api/structures/protocol-response
  6176. /**
  6177. * The charset of response body, default is `"utf-8"`.
  6178. */
  6179. charset?: string;
  6180. /**
  6181. * The response body. When returning stream as response, this is a Node.js readable
  6182. * stream representing the response body. When returning `Buffer` as response, this
  6183. * is a `Buffer`. When returning `String` as response, this is a `String`. This is
  6184. * ignored for other types of responses.
  6185. */
  6186. data?: (Buffer) | (string) | (NodeJS.ReadableStream);
  6187. /**
  6188. * When assigned, the `request` will fail with the `error` number . For the
  6189. * available error numbers you can use, please see the net error list.
  6190. */
  6191. error?: number;
  6192. /**
  6193. * An object containing the response headers. The keys must be String, and values
  6194. * must be either String or Array of String.
  6195. */
  6196. headers?: Record<string, (string) | (string[])>;
  6197. /**
  6198. * The HTTP `method`. This is only used for file and URL responses.
  6199. */
  6200. method?: string;
  6201. /**
  6202. * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
  6203. * would implicitly set the `content-type` header in response, but if
  6204. * `content-type` is already set in `headers`, the `mimeType` would be ignored.
  6205. */
  6206. mimeType?: string;
  6207. /**
  6208. * Path to the file which would be sent as response body. This is only used for
  6209. * file responses.
  6210. */
  6211. path?: string;
  6212. /**
  6213. * The `referrer` URL. This is only used for file and URL responses.
  6214. */
  6215. referrer?: string;
  6216. /**
  6217. * The session used for requesting URL, by default the HTTP request will reuse the
  6218. * current session. Setting `session` to `null` would use a random independent
  6219. * session. This is only used for URL responses.
  6220. */
  6221. session?: Session;
  6222. /**
  6223. * The HTTP response code, default is 200.
  6224. */
  6225. statusCode?: number;
  6226. /**
  6227. * The data used as upload data. This is only used for URL responses when `method`
  6228. * is `"POST"`.
  6229. */
  6230. uploadData?: ProtocolResponseUploadData;
  6231. /**
  6232. * Download the `url` and pipe the result as response body. This is only used for
  6233. * URL responses.
  6234. */
  6235. url?: string;
  6236. }
  6237. interface ProtocolResponseUploadData {
  6238. // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
  6239. /**
  6240. * MIME type of the content.
  6241. */
  6242. contentType: string;
  6243. /**
  6244. * Content to be sent.
  6245. */
  6246. data: (string) | (Buffer);
  6247. }
  6248. interface Rectangle {
  6249. // Docs: https://electronjs.org/docs/api/structures/rectangle
  6250. /**
  6251. * The height of the rectangle (must be an integer).
  6252. */
  6253. height: number;
  6254. /**
  6255. * The width of the rectangle (must be an integer).
  6256. */
  6257. width: number;
  6258. /**
  6259. * The x coordinate of the origin of the rectangle (must be an integer).
  6260. */
  6261. x: number;
  6262. /**
  6263. * The y coordinate of the origin of the rectangle (must be an integer).
  6264. */
  6265. y: number;
  6266. }
  6267. interface Referrer {
  6268. // Docs: https://electronjs.org/docs/api/structures/referrer
  6269. /**
  6270. * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
  6271. * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
  6272. * See the Referrer-Policy spec for more details on the meaning of these values.
  6273. */
  6274. policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
  6275. /**
  6276. * HTTP Referrer URL.
  6277. */
  6278. url: string;
  6279. }
  6280. interface Remote extends RemoteMainInterface {
  6281. // Docs: https://electronjs.org/docs/api/remote
  6282. /**
  6283. * The web contents of this web page.
  6284. */
  6285. getCurrentWebContents(): WebContents;
  6286. /**
  6287. * The window to which this web page belongs.
  6288. *
  6289. * **Note:** Do not use `removeAllListeners` on `BrowserWindow`. Use of this can
  6290. * remove all `blur` listeners, disable click events on touch bar buttons, and
  6291. * other unintended consequences.
  6292. */
  6293. getCurrentWindow(): BrowserWindow;
  6294. /**
  6295. * The global variable of `name` (e.g. `global[name]`) in the main process.
  6296. */
  6297. getGlobal(name: string): any;
  6298. /**
  6299. * A `NodeJS.Process` object. The `process` object in the main process. This is
  6300. * the same as `remote.getGlobal('process')` but is cached.
  6301. *
  6302. */
  6303. readonly process: NodeJS.Process;
  6304. /**
  6305. * A `NodeJS.Require` function equivalent to `require(module)` in the main process.
  6306. * Modules specified by their relative path will resolve relative to the entrypoint
  6307. * of the main process.
  6308. e.g.
  6309. */
  6310. require: NodeJS.Require;
  6311. }
  6312. interface Screen extends NodeJS.EventEmitter {
  6313. // Docs: https://electronjs.org/docs/api/screen
  6314. /**
  6315. * Emitted when `newDisplay` has been added.
  6316. */
  6317. on(event: 'display-added', listener: (event: Event,
  6318. newDisplay: Display) => void): this;
  6319. once(event: 'display-added', listener: (event: Event,
  6320. newDisplay: Display) => void): this;
  6321. addListener(event: 'display-added', listener: (event: Event,
  6322. newDisplay: Display) => void): this;
  6323. removeListener(event: 'display-added', listener: (event: Event,
  6324. newDisplay: Display) => void): this;
  6325. /**
  6326. * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
  6327. * an array of strings that describe the changes. Possible changes are `bounds`,
  6328. * `workArea`, `scaleFactor` and `rotation`.
  6329. */
  6330. on(event: 'display-metrics-changed', listener: (event: Event,
  6331. display: Display,
  6332. changedMetrics: string[]) => void): this;
  6333. once(event: 'display-metrics-changed', listener: (event: Event,
  6334. display: Display,
  6335. changedMetrics: string[]) => void): this;
  6336. addListener(event: 'display-metrics-changed', listener: (event: Event,
  6337. display: Display,
  6338. changedMetrics: string[]) => void): this;
  6339. removeListener(event: 'display-metrics-changed', listener: (event: Event,
  6340. display: Display,
  6341. changedMetrics: string[]) => void): this;
  6342. /**
  6343. * Emitted when `oldDisplay` has been removed.
  6344. */
  6345. on(event: 'display-removed', listener: (event: Event,
  6346. oldDisplay: Display) => void): this;
  6347. once(event: 'display-removed', listener: (event: Event,
  6348. oldDisplay: Display) => void): this;
  6349. addListener(event: 'display-removed', listener: (event: Event,
  6350. oldDisplay: Display) => void): this;
  6351. removeListener(event: 'display-removed', listener: (event: Event,
  6352. oldDisplay: Display) => void): this;
  6353. /**
  6354. * Converts a screen DIP point to a screen physical point. The DPI scale is
  6355. * performed relative to the display containing the DIP point.
  6356. *
  6357. * @platform win32
  6358. */
  6359. dipToScreenPoint(point: Point): Point;
  6360. /**
  6361. * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
  6362. * relative to the display nearest to `window`. If `window` is null, scaling will
  6363. * be performed to the display nearest to `rect`.
  6364. *
  6365. * @platform win32
  6366. */
  6367. dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  6368. /**
  6369. * An array of displays that are currently available.
  6370. */
  6371. getAllDisplays(): Display[];
  6372. /**
  6373. * The current absolute position of the mouse pointer.
  6374. *
  6375. **Note:** The return value is a DIP point, not a screen physical point.
  6376. */
  6377. getCursorScreenPoint(): Point;
  6378. /**
  6379. * The display that most closely intersects the provided bounds.
  6380. */
  6381. getDisplayMatching(rect: Rectangle): Display;
  6382. /**
  6383. * The display nearest the specified point.
  6384. */
  6385. getDisplayNearestPoint(point: Point): Display;
  6386. /**
  6387. * The primary display.
  6388. */
  6389. getPrimaryDisplay(): Display;
  6390. /**
  6391. * Converts a screen physical point to a screen DIP point. The DPI scale is
  6392. * performed relative to the display containing the physical point.
  6393. *
  6394. * @platform win32
  6395. */
  6396. screenToDipPoint(point: Point): Point;
  6397. /**
  6398. * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
  6399. * relative to the display nearest to `window`. If `window` is null, scaling will
  6400. * be performed to the display nearest to `rect`.
  6401. *
  6402. * @platform win32
  6403. */
  6404. screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  6405. }
  6406. interface ScrubberItem {
  6407. // Docs: https://electronjs.org/docs/api/structures/scrubber-item
  6408. /**
  6409. * The image to appear in this item.
  6410. */
  6411. icon?: NativeImage;
  6412. /**
  6413. * The text to appear in this item.
  6414. */
  6415. label?: string;
  6416. }
  6417. interface SegmentedControlSegment {
  6418. // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
  6419. /**
  6420. * Whether this segment is selectable. Default: true.
  6421. */
  6422. enabled?: boolean;
  6423. /**
  6424. * The image to appear in this segment.
  6425. */
  6426. icon?: NativeImage;
  6427. /**
  6428. * The text to appear in this segment.
  6429. */
  6430. label?: string;
  6431. }
  6432. interface SerialPort {
  6433. // Docs: https://electronjs.org/docs/api/structures/serial-port
  6434. /**
  6435. * A stable identifier on Windows that can be used for device permissions.
  6436. */
  6437. deviceInstanceId?: string;
  6438. /**
  6439. * A string suitable for display to the user for describing this device.
  6440. */
  6441. displayName: string;
  6442. /**
  6443. * Unique identifier for the port.
  6444. */
  6445. portId: string;
  6446. /**
  6447. * Name of the port.
  6448. */
  6449. portName: string;
  6450. /**
  6451. * Optional USB product ID.
  6452. */
  6453. productId: string;
  6454. /**
  6455. * The USB device serial number.
  6456. */
  6457. serialNumber: string;
  6458. /**
  6459. * Represents a single serial port on macOS can be enumerated by multiple drivers.
  6460. */
  6461. usbDriverName?: string;
  6462. /**
  6463. * Optional USB vendor ID.
  6464. */
  6465. vendorId: string;
  6466. }
  6467. interface ServiceWorkerInfo {
  6468. // Docs: https://electronjs.org/docs/api/structures/service-worker-info
  6469. /**
  6470. * The virtual ID of the process that this service worker is running in. This is
  6471. * not an OS level PID. This aligns with the ID set used for
  6472. * `webContents.getProcessId()`.
  6473. */
  6474. renderProcessId: number;
  6475. /**
  6476. * The base URL that this service worker is active for.
  6477. */
  6478. scope: string;
  6479. /**
  6480. * The full URL to the script that this service worker runs
  6481. */
  6482. scriptUrl: string;
  6483. }
  6484. class ServiceWorkers extends NodeEventEmitter {
  6485. // Docs: https://electronjs.org/docs/api/service-workers
  6486. /**
  6487. * Emitted when a service worker logs something to the console.
  6488. */
  6489. on(event: 'console-message', listener: (event: Event,
  6490. /**
  6491. * Information about the console message
  6492. */
  6493. messageDetails: MessageDetails) => void): this;
  6494. once(event: 'console-message', listener: (event: Event,
  6495. /**
  6496. * Information about the console message
  6497. */
  6498. messageDetails: MessageDetails) => void): this;
  6499. addListener(event: 'console-message', listener: (event: Event,
  6500. /**
  6501. * Information about the console message
  6502. */
  6503. messageDetails: MessageDetails) => void): this;
  6504. removeListener(event: 'console-message', listener: (event: Event,
  6505. /**
  6506. * Information about the console message
  6507. */
  6508. messageDetails: MessageDetails) => void): this;
  6509. /**
  6510. * Emitted when a service worker has been registered. Can occur after a call to
  6511. * `navigator.serviceWorker.register('/sw.js')` successfully resolves or when a
  6512. * Chrome extension is loaded.
  6513. */
  6514. on(event: 'registration-completed', listener: (event: Event,
  6515. /**
  6516. * Information about the registered service worker
  6517. */
  6518. details: RegistrationCompletedDetails) => void): this;
  6519. once(event: 'registration-completed', listener: (event: Event,
  6520. /**
  6521. * Information about the registered service worker
  6522. */
  6523. details: RegistrationCompletedDetails) => void): this;
  6524. addListener(event: 'registration-completed', listener: (event: Event,
  6525. /**
  6526. * Information about the registered service worker
  6527. */
  6528. details: RegistrationCompletedDetails) => void): this;
  6529. removeListener(event: 'registration-completed', listener: (event: Event,
  6530. /**
  6531. * Information about the registered service worker
  6532. */
  6533. details: RegistrationCompletedDetails) => void): this;
  6534. /**
  6535. * A ServiceWorkerInfo object where the keys are the service worker version ID and
  6536. * the values are the information about that service worker.
  6537. */
  6538. getAllRunning(): Record<number, ServiceWorkerInfo>;
  6539. /**
  6540. * Information about this service worker
  6541. *
  6542. * If the service worker does not exist or is not running this method will throw an
  6543. * exception.
  6544. */
  6545. getFromVersionID(versionId: number): ServiceWorkerInfo;
  6546. }
  6547. class Session extends NodeEventEmitter {
  6548. // Docs: https://electronjs.org/docs/api/session
  6549. /**
  6550. * A session instance from `partition` string. When there is an existing `Session`
  6551. * with the same `partition`, it will be returned; otherwise a new `Session`
  6552. * instance will be created with `options`.
  6553. *
  6554. * If `partition` starts with `persist:`, the page will use a persistent session
  6555. * available to all pages in the app with the same `partition`. if there is no
  6556. * `persist:` prefix, the page will use an in-memory session. If the `partition` is
  6557. * empty then default session of the app will be returned.
  6558. *
  6559. * To create a `Session` with `options`, you have to ensure the `Session` with the
  6560. * `partition` has never been used before. There is no way to change the `options`
  6561. * of an existing `Session` object.
  6562. */
  6563. static fromPartition(partition: string, options?: FromPartitionOptions): Session;
  6564. /**
  6565. * A `Session` object, the default session object of the app.
  6566. */
  6567. static defaultSession: Session;
  6568. /**
  6569. * Emitted after an extension is loaded. This occurs whenever an extension is added
  6570. * to the "enabled" set of extensions. This includes:
  6571. *
  6572. * * Extensions being loaded from `Session.loadExtension`.
  6573. * * Extensions being reloaded:
  6574. * * from a crash.
  6575. * if the extension requested it (`chrome.runtime.reload()`).
  6576. */
  6577. on(event: 'extension-loaded', listener: (event: Event,
  6578. extension: Extension) => void): this;
  6579. once(event: 'extension-loaded', listener: (event: Event,
  6580. extension: Extension) => void): this;
  6581. addListener(event: 'extension-loaded', listener: (event: Event,
  6582. extension: Extension) => void): this;
  6583. removeListener(event: 'extension-loaded', listener: (event: Event,
  6584. extension: Extension) => void): this;
  6585. /**
  6586. * Emitted after an extension is loaded and all necessary browser state is
  6587. * initialized to support the start of the extension's background page.
  6588. */
  6589. on(event: 'extension-ready', listener: (event: Event,
  6590. extension: Extension) => void): this;
  6591. once(event: 'extension-ready', listener: (event: Event,
  6592. extension: Extension) => void): this;
  6593. addListener(event: 'extension-ready', listener: (event: Event,
  6594. extension: Extension) => void): this;
  6595. removeListener(event: 'extension-ready', listener: (event: Event,
  6596. extension: Extension) => void): this;
  6597. /**
  6598. * Emitted after an extension is unloaded. This occurs when
  6599. * `Session.removeExtension` is called.
  6600. */
  6601. on(event: 'extension-unloaded', listener: (event: Event,
  6602. extension: Extension) => void): this;
  6603. once(event: 'extension-unloaded', listener: (event: Event,
  6604. extension: Extension) => void): this;
  6605. addListener(event: 'extension-unloaded', listener: (event: Event,
  6606. extension: Extension) => void): this;
  6607. removeListener(event: 'extension-unloaded', listener: (event: Event,
  6608. extension: Extension) => void): this;
  6609. /**
  6610. * Emitted when a render process requests preconnection to a URL, generally due to
  6611. * a resource hint.
  6612. */
  6613. on(event: 'preconnect', listener: (event: Event,
  6614. /**
  6615. * The URL being requested for preconnection by the renderer.
  6616. */
  6617. preconnectUrl: string,
  6618. /**
  6619. * True if the renderer is requesting that the connection include credentials (see
  6620. * the spec for more details.)
  6621. */
  6622. allowCredentials: boolean) => void): this;
  6623. once(event: 'preconnect', listener: (event: Event,
  6624. /**
  6625. * The URL being requested for preconnection by the renderer.
  6626. */
  6627. preconnectUrl: string,
  6628. /**
  6629. * True if the renderer is requesting that the connection include credentials (see
  6630. * the spec for more details.)
  6631. */
  6632. allowCredentials: boolean) => void): this;
  6633. addListener(event: 'preconnect', listener: (event: Event,
  6634. /**
  6635. * The URL being requested for preconnection by the renderer.
  6636. */
  6637. preconnectUrl: string,
  6638. /**
  6639. * True if the renderer is requesting that the connection include credentials (see
  6640. * the spec for more details.)
  6641. */
  6642. allowCredentials: boolean) => void): this;
  6643. removeListener(event: 'preconnect', listener: (event: Event,
  6644. /**
  6645. * The URL being requested for preconnection by the renderer.
  6646. */
  6647. preconnectUrl: string,
  6648. /**
  6649. * True if the renderer is requesting that the connection include credentials (see
  6650. * the spec for more details.)
  6651. */
  6652. allowCredentials: boolean) => void): this;
  6653. /**
  6654. * Emitted when a serial port needs to be selected when a call to
  6655. * `navigator.serial.requestPort` is made. `callback` should be called with
  6656. * `portId` to be selected, passing an empty string to `callback` will cancel the
  6657. * request. Additionally, permissioning on `navigator.serial` can be managed by
  6658. * using ses.setPermissionCheckHandler(handler) with the `serial` permission.
  6659. *
  6660. * Because this is an experimental feature it is disabled by default. To enable
  6661. * this feature, you will need to use the `--enable-features=ElectronSerialChooser`
  6662. * command line switch. Additionally because this is an experimental Chromium
  6663. * feature you will need to set `enableBlinkFeatures: 'Serial'` on the
  6664. * `webPreferences` property when opening a BrowserWindow.
  6665. *
  6666. * @experimental
  6667. */
  6668. on(event: 'select-serial-port', listener: (event: Event,
  6669. portList: SerialPort[],
  6670. webContents: WebContents,
  6671. callback: (portId: string) => void) => void): this;
  6672. once(event: 'select-serial-port', listener: (event: Event,
  6673. portList: SerialPort[],
  6674. webContents: WebContents,
  6675. callback: (portId: string) => void) => void): this;
  6676. addListener(event: 'select-serial-port', listener: (event: Event,
  6677. portList: SerialPort[],
  6678. webContents: WebContents,
  6679. callback: (portId: string) => void) => void): this;
  6680. removeListener(event: 'select-serial-port', listener: (event: Event,
  6681. portList: SerialPort[],
  6682. webContents: WebContents,
  6683. callback: (portId: string) => void) => void): this;
  6684. /**
  6685. * Emitted after `navigator.serial.requestPort` has been called and
  6686. * `select-serial-port` has fired if a new serial port becomes available. For
  6687. * example, this event will fire when a new USB device is plugged in.
  6688. *
  6689. * @experimental
  6690. */
  6691. on(event: 'serial-port-added', listener: (event: Event,
  6692. port: SerialPort,
  6693. webContents: WebContents) => void): this;
  6694. once(event: 'serial-port-added', listener: (event: Event,
  6695. port: SerialPort,
  6696. webContents: WebContents) => void): this;
  6697. addListener(event: 'serial-port-added', listener: (event: Event,
  6698. port: SerialPort,
  6699. webContents: WebContents) => void): this;
  6700. removeListener(event: 'serial-port-added', listener: (event: Event,
  6701. port: SerialPort,
  6702. webContents: WebContents) => void): this;
  6703. /**
  6704. * Emitted after `navigator.serial.requestPort` has been called and
  6705. * `select-serial-port` has fired if a serial port has been removed. For example,
  6706. * this event will fire when a USB device is unplugged.
  6707. *
  6708. * @experimental
  6709. */
  6710. on(event: 'serial-port-removed', listener: (event: Event,
  6711. port: SerialPort,
  6712. webContents: WebContents) => void): this;
  6713. once(event: 'serial-port-removed', listener: (event: Event,
  6714. port: SerialPort,
  6715. webContents: WebContents) => void): this;
  6716. addListener(event: 'serial-port-removed', listener: (event: Event,
  6717. port: SerialPort,
  6718. webContents: WebContents) => void): this;
  6719. removeListener(event: 'serial-port-removed', listener: (event: Event,
  6720. port: SerialPort,
  6721. webContents: WebContents) => void): this;
  6722. /**
  6723. * Emitted when a hunspell dictionary file starts downloading
  6724. */
  6725. on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6726. /**
  6727. * The language code of the dictionary file
  6728. */
  6729. languageCode: string) => void): this;
  6730. once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6731. /**
  6732. * The language code of the dictionary file
  6733. */
  6734. languageCode: string) => void): this;
  6735. addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6736. /**
  6737. * The language code of the dictionary file
  6738. */
  6739. languageCode: string) => void): this;
  6740. removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6741. /**
  6742. * The language code of the dictionary file
  6743. */
  6744. languageCode: string) => void): this;
  6745. /**
  6746. * Emitted when a hunspell dictionary file download fails. For details on the
  6747. * failure you should collect a netlog and inspect the download request.
  6748. */
  6749. on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6750. /**
  6751. * The language code of the dictionary file
  6752. */
  6753. languageCode: string) => void): this;
  6754. once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6755. /**
  6756. * The language code of the dictionary file
  6757. */
  6758. languageCode: string) => void): this;
  6759. addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6760. /**
  6761. * The language code of the dictionary file
  6762. */
  6763. languageCode: string) => void): this;
  6764. removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6765. /**
  6766. * The language code of the dictionary file
  6767. */
  6768. languageCode: string) => void): this;
  6769. /**
  6770. * Emitted when a hunspell dictionary file has been successfully downloaded
  6771. */
  6772. on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6773. /**
  6774. * The language code of the dictionary file
  6775. */
  6776. languageCode: string) => void): this;
  6777. once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6778. /**
  6779. * The language code of the dictionary file
  6780. */
  6781. languageCode: string) => void): this;
  6782. addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6783. /**
  6784. * The language code of the dictionary file
  6785. */
  6786. languageCode: string) => void): this;
  6787. removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6788. /**
  6789. * The language code of the dictionary file
  6790. */
  6791. languageCode: string) => void): this;
  6792. /**
  6793. * Emitted when a hunspell dictionary file has been successfully initialized. This
  6794. * occurs after the file has been downloaded.
  6795. */
  6796. on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6797. /**
  6798. * The language code of the dictionary file
  6799. */
  6800. languageCode: string) => void): this;
  6801. once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6802. /**
  6803. * The language code of the dictionary file
  6804. */
  6805. languageCode: string) => void): this;
  6806. addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6807. /**
  6808. * The language code of the dictionary file
  6809. */
  6810. languageCode: string) => void): this;
  6811. removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6812. /**
  6813. * The language code of the dictionary file
  6814. */
  6815. languageCode: string) => void): this;
  6816. /**
  6817. * Emitted when Electron is about to download `item` in `webContents`.
  6818. *
  6819. * Calling `event.preventDefault()` will cancel the download and `item` will not be
  6820. * available from next tick of the process.
  6821. */
  6822. on(event: 'will-download', listener: (event: Event,
  6823. item: DownloadItem,
  6824. webContents: WebContents) => void): this;
  6825. once(event: 'will-download', listener: (event: Event,
  6826. item: DownloadItem,
  6827. webContents: WebContents) => void): this;
  6828. addListener(event: 'will-download', listener: (event: Event,
  6829. item: DownloadItem,
  6830. webContents: WebContents) => void): this;
  6831. removeListener(event: 'will-download', listener: (event: Event,
  6832. item: DownloadItem,
  6833. webContents: WebContents) => void): this;
  6834. /**
  6835. * Whether the word was successfully written to the custom dictionary. This API
  6836. * will not work on non-persistent (in-memory) sessions.
  6837. *
  6838. * **Note:** On macOS and Windows 10 this word will be written to the OS custom
  6839. * dictionary as well
  6840. */
  6841. addWordToSpellCheckerDictionary(word: string): boolean;
  6842. /**
  6843. * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
  6844. * authentication.
  6845. */
  6846. allowNTLMCredentialsForDomains(domains: string): void;
  6847. /**
  6848. * resolves when the session’s HTTP authentication cache has been cleared.
  6849. */
  6850. clearAuthCache(): Promise<void>;
  6851. /**
  6852. * resolves when the cache clear operation is complete.
  6853. *
  6854. Clears the session’s HTTP cache.
  6855. */
  6856. clearCache(): Promise<void>;
  6857. /**
  6858. * Resolves when the operation is complete.
  6859. Clears the host resolver cache.
  6860. */
  6861. clearHostResolverCache(): Promise<void>;
  6862. /**
  6863. * resolves when the storage data has been cleared.
  6864. */
  6865. clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
  6866. /**
  6867. * Resolves when all connections are closed.
  6868. *
  6869. **Note:** It will terminate / fail all requests currently in flight.
  6870. */
  6871. closeAllConnections(): Promise<void>;
  6872. /**
  6873. * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
  6874. * The API will generate a DownloadItem that can be accessed with the will-download
  6875. * event. The DownloadItem will not have any `WebContents` associated with it and
  6876. * the initial state will be `interrupted`. The download will start only when the
  6877. * `resume` API is called on the DownloadItem.
  6878. */
  6879. createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
  6880. /**
  6881. * Disables any network emulation already active for the `session`. Resets to the
  6882. * original network configuration.
  6883. */
  6884. disableNetworkEmulation(): void;
  6885. /**
  6886. * Initiates a download of the resource at `url`. The API will generate a
  6887. * DownloadItem that can be accessed with the will-download event.
  6888. *
  6889. * **Note:** This does not perform any security checks that relate to a page's
  6890. * origin, unlike `webContents.downloadURL`.
  6891. */
  6892. downloadURL(url: string): void;
  6893. /**
  6894. * Emulates network with the given configuration for the `session`.
  6895. */
  6896. enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
  6897. /**
  6898. * Writes any unwritten DOMStorage data to disk.
  6899. */
  6900. flushStorageData(): void;
  6901. /**
  6902. * Resolves when the all internal states of proxy service is reset and the latest
  6903. * proxy configuration is reapplied if it's already available. The pac script will
  6904. * be fetched from `pacScript` again if the proxy mode is `pac_script`.
  6905. */
  6906. forceReloadProxyConfig(): Promise<void>;
  6907. /**
  6908. * A list of all loaded extensions.
  6909. *
  6910. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6911. * is emitted.
  6912. */
  6913. getAllExtensions(): Extension[];
  6914. /**
  6915. * resolves with blob data.
  6916. */
  6917. getBlobData(identifier: string): Promise<Buffer>;
  6918. /**
  6919. * the session's current cache size, in bytes.
  6920. */
  6921. getCacheSize(): Promise<number>;
  6922. /**
  6923. * | `null` - The loaded extension with the given ID.
  6924. *
  6925. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6926. * is emitted.
  6927. */
  6928. getExtension(extensionId: string): Extension;
  6929. /**
  6930. * an array of paths to preload scripts that have been registered.
  6931. */
  6932. getPreloads(): string[];
  6933. /**
  6934. * An array of language codes the spellchecker is enabled for. If this list is
  6935. * empty the spellchecker will fallback to using `en-US`. By default on launch if
  6936. * this setting is an empty list Electron will try to populate this setting with
  6937. * the current OS locale. This setting is persisted across restarts.
  6938. *
  6939. * **Note:** On macOS the OS spellchecker is used and has its own list of
  6940. * languages. This API is a no-op on macOS.
  6941. */
  6942. getSpellCheckerLanguages(): string[];
  6943. /**
  6944. * A `String | null` indicating the absolute file system path where data for this
  6945. * session is persisted on disk. For in memory sessions this returns `null`.
  6946. */
  6947. getStoragePath(): void;
  6948. /**
  6949. * The user agent for this session.
  6950. */
  6951. getUserAgent(): string;
  6952. /**
  6953. * Whether or not this session is a persistent one. The default `webContents`
  6954. * session of a `BrowserWindow` is persistent. When creating a session from a
  6955. * partition, session prefixed with `persist:` will be persistent, while others
  6956. * will be temporary.
  6957. */
  6958. isPersistent(): boolean;
  6959. /**
  6960. * Whether the builtin spell checker is enabled.
  6961. */
  6962. isSpellCheckerEnabled(): boolean;
  6963. /**
  6964. * An array of all words in app's custom dictionary. Resolves when the full
  6965. * dictionary is loaded from disk.
  6966. */
  6967. listWordsInSpellCheckerDictionary(): Promise<string[]>;
  6968. /**
  6969. * resolves when the extension is loaded.
  6970. *
  6971. * This method will raise an exception if the extension could not be loaded. If
  6972. * there are warnings when installing the extension (e.g. if the extension requests
  6973. * an API that Electron does not support) then they will be logged to the console.
  6974. *
  6975. * Note that Electron does not support the full range of Chrome extensions APIs.
  6976. * See Supported Extensions APIs for more details on what is supported.
  6977. *
  6978. * Note that in previous versions of Electron, extensions that were loaded would be
  6979. * remembered for future runs of the application. This is no longer the case:
  6980. * `loadExtension` must be called on every boot of your app if you want the
  6981. * extension to be loaded.
  6982. *
  6983. * This API does not support loading packed (.crx) extensions.
  6984. *
  6985. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6986. * is emitted.
  6987. *
  6988. * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
  6989. * supported and will throw an error.
  6990. */
  6991. loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
  6992. /**
  6993. * Preconnects the given number of sockets to an origin.
  6994. */
  6995. preconnect(options: PreconnectOptions): void;
  6996. /**
  6997. * Unloads an extension.
  6998. *
  6999. * **Note:** This API cannot be called before the `ready` event of the `app` module
  7000. * is emitted.
  7001. */
  7002. removeExtension(extensionId: string): void;
  7003. /**
  7004. * Whether the word was successfully removed from the custom dictionary. This API
  7005. * will not work on non-persistent (in-memory) sessions.
  7006. *
  7007. * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
  7008. * dictionary as well
  7009. */
  7010. removeWordFromSpellCheckerDictionary(word: string): boolean;
  7011. /**
  7012. * Resolves with the proxy information for `url`.
  7013. */
  7014. resolveProxy(url: string): Promise<string>;
  7015. /**
  7016. * Sets the certificate verify proc for `session`, the `proc` will be called with
  7017. * `proc(request, callback)` whenever a server certificate verification is
  7018. * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
  7019. * rejects it.
  7020. *
  7021. * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
  7022. * verify proc.
  7023. *
  7024. > **NOTE:** The result of this procedure is cached by the network service.
  7025. */
  7026. setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
  7027. /**
  7028. * Sets download saving directory. By default, the download directory will be the
  7029. * `Downloads` under the respective app folder.
  7030. */
  7031. setDownloadPath(path: string): void;
  7032. /**
  7033. * Sets the handler which can be used to respond to permission checks for the
  7034. * `session`. Returning `true` will allow the permission and `false` will reject
  7035. * it. Please note that you must also implement `setPermissionRequestHandler` to
  7036. * get complete permission handling. Most web APIs do a permission check and then
  7037. * make a permission request if the check is denied. To clear the handler, call
  7038. * `setPermissionCheckHandler(null)`.
  7039. */
  7040. setPermissionCheckHandler(handler: ((webContents: (WebContents) | (null), permission: string, requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
  7041. /**
  7042. * Sets the handler which can be used to respond to permission requests for the
  7043. * `session`. Calling `callback(true)` will allow the permission and
  7044. * `callback(false)` will reject it. To clear the handler, call
  7045. * `setPermissionRequestHandler(null)`. Please note that you must also implement
  7046. * `setPermissionCheckHandler` to get complete permission handling. Most web APIs
  7047. * do a permission check and then make a permission request if the check is denied.
  7048. */
  7049. setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'media' | 'display-capture' | 'mediaKeySystem' | 'geolocation' | 'notifications' | 'midi' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal' | 'unknown', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
  7050. /**
  7051. * Adds scripts that will be executed on ALL web contents that are associated with
  7052. * this session just before normal `preload` scripts run.
  7053. */
  7054. setPreloads(preloads: string[]): void;
  7055. /**
  7056. * Resolves when the proxy setting process is complete.
  7057. *
  7058. * Sets the proxy settings.
  7059. *
  7060. * When `mode` is unspecified, `pacScript` and `proxyRules` are provided together,
  7061. * the `proxyRules` option is ignored and `pacScript` configuration is applied.
  7062. *
  7063. * You may need `ses.closeAllConnections` to close currently in flight connections
  7064. * to prevent pooled sockets using previous proxy from being reused by future
  7065. * requests.
  7066. *
  7067. * The `proxyRules` has to follow the rules below:
  7068. *
  7069. * For example:
  7070. *
  7071. * * `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
  7072. * HTTP proxy `foopy2:80` for `ftp://` URLs.
  7073. * * `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
  7074. * * `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
  7075. * over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
  7076. * * `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
  7077. * * `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
  7078. * over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
  7079. * * `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
  7080. * proxy if `foopy` is unavailable.
  7081. * * `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
  7082. * `socks4://foopy2` for all other URLs.
  7083. *
  7084. * The `proxyBypassRules` is a comma separated list of rules described below:
  7085. *
  7086. * * `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
  7087. *
  7088. * Match all hostnames that match the pattern HOSTNAME_PATTERN.
  7089. *
  7090. * Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
  7091. * "https://x.*.y.com:99"
  7092. * * `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
  7093. *
  7094. * Match a particular domain suffix.
  7095. *
  7096. * Examples: ".google.com", ".com", "http://.google.com"
  7097. * * `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
  7098. *
  7099. * Match URLs which are IP address literals.
  7100. *
  7101. * Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
  7102. * * `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
  7103. *
  7104. * Match any URL that is to an IP literal that falls between the given range. IP
  7105. * range is specified using CIDR notation.
  7106. *
  7107. * Examples: "192.168.1.1/16", "fefe:13::abc/33".
  7108. * * `<local>`
  7109. *
  7110. * Match local addresses. The meaning of `<local>` is whether the host matches one
  7111. * of: "127.0.0.1", "::1", "localhost".
  7112. */
  7113. setProxy(config: Config): Promise<void>;
  7114. /**
  7115. * By default Electron will download hunspell dictionaries from the Chromium CDN.
  7116. * If you want to override this behavior you can use this API to point the
  7117. * dictionary downloader at your own hosted version of the hunspell dictionaries.
  7118. * We publish a `hunspell_dictionaries.zip` file with each release which contains
  7119. * the files you need to host here, the file server must be **case insensitive**
  7120. * you must upload each file twice, once with the case it has in the ZIP file and
  7121. * once with the filename as all lower case.
  7122. *
  7123. * If the files present in `hunspell_dictionaries.zip` are available at
  7124. * `https://example.com/dictionaries/language-code.bdic` then you should call this
  7125. * api with
  7126. * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
  7127. * Please note the trailing slash. The URL to the dictionaries is formed as
  7128. * `${url}${filename}`.
  7129. *
  7130. * **Note:** On macOS the OS spellchecker is used and therefore we do not download
  7131. * any dictionary files. This API is a no-op on macOS.
  7132. */
  7133. setSpellCheckerDictionaryDownloadURL(url: string): void;
  7134. /**
  7135. * Sets whether to enable the builtin spell checker.
  7136. */
  7137. setSpellCheckerEnabled(enable: boolean): void;
  7138. /**
  7139. * The built in spellchecker does not automatically detect what language a user is
  7140. * typing in. In order for the spell checker to correctly check their words you
  7141. * must call this API with an array of language codes. You can get the list of
  7142. * supported language codes with the `ses.availableSpellCheckerLanguages` property.
  7143. *
  7144. * **Note:** On macOS the OS spellchecker is used and will detect your language
  7145. * automatically. This API is a no-op on macOS.
  7146. */
  7147. setSpellCheckerLanguages(languages: string[]): void;
  7148. /**
  7149. * Sets the SSL configuration for the session. All subsequent network requests will
  7150. * use the new configuration. Existing network connections (such as WebSocket
  7151. * connections) will not be terminated, but old sockets in the pool will not be
  7152. * reused for new connections.
  7153. */
  7154. setSSLConfig(config: SSLConfigConfig): void;
  7155. /**
  7156. * Overrides the `userAgent` and `acceptLanguages` for this session.
  7157. *
  7158. * The `acceptLanguages` must a comma separated ordered list of language codes, for
  7159. * example `"en-US,fr,de,ko,zh-CN,ja"`.
  7160. *
  7161. * This doesn't affect existing `WebContents`, and each `WebContents` can use
  7162. * `webContents.setUserAgent` to override the session-wide user agent.
  7163. */
  7164. setUserAgent(userAgent: string, acceptLanguages?: string): void;
  7165. readonly availableSpellCheckerLanguages: string[];
  7166. readonly cookies: Cookies;
  7167. readonly netLog: NetLog;
  7168. readonly protocol: Protocol;
  7169. readonly serviceWorkers: ServiceWorkers;
  7170. spellCheckerEnabled: boolean;
  7171. readonly storagePath: (string) | (null);
  7172. readonly webRequest: WebRequest;
  7173. }
  7174. interface SharedWorkerInfo {
  7175. // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
  7176. /**
  7177. * The unique id of the shared worker.
  7178. */
  7179. id: string;
  7180. /**
  7181. * The url of the shared worker.
  7182. */
  7183. url: string;
  7184. }
  7185. class ShareMenu extends NodeEventEmitter {
  7186. // Docs: https://electronjs.org/docs/api/share-menu
  7187. /**
  7188. * ShareMenu
  7189. */
  7190. constructor(sharingItem: SharingItem);
  7191. /**
  7192. * Closes the context menu in the `browserWindow`.
  7193. */
  7194. closePopup(browserWindow?: BrowserWindow): void;
  7195. /**
  7196. * Pops up this menu as a context menu in the `BrowserWindow`.
  7197. */
  7198. popup(options?: PopupOptions): void;
  7199. }
  7200. interface SharingItem {
  7201. // Docs: https://electronjs.org/docs/api/structures/sharing-item
  7202. /**
  7203. * An array of files to share.
  7204. */
  7205. filePaths?: string[];
  7206. /**
  7207. * An array of text to share.
  7208. */
  7209. texts?: string[];
  7210. /**
  7211. * An array of URLs to share.
  7212. */
  7213. urls?: string[];
  7214. }
  7215. interface Shell {
  7216. // Docs: https://electronjs.org/docs/api/shell
  7217. /**
  7218. * Play the beep sound.
  7219. */
  7220. beep(): void;
  7221. /**
  7222. * Open the given external protocol URL in the desktop's default manner. (For
  7223. * example, mailto: URLs in the user's default mail agent).
  7224. */
  7225. openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
  7226. /**
  7227. * Resolves with a string containing the error message corresponding to the failure
  7228. * if a failure occurred, otherwise "".
  7229. *
  7230. Open the given file in the desktop's default manner.
  7231. */
  7232. openPath(path: string): Promise<string>;
  7233. /**
  7234. * Resolves the shortcut link at `shortcutPath`.
  7235. *
  7236. An exception will be thrown when any error happens.
  7237. *
  7238. * @platform win32
  7239. */
  7240. readShortcutLink(shortcutPath: string): ShortcutDetails;
  7241. /**
  7242. * Show the given file in a file manager. If possible, select the file.
  7243. */
  7244. showItemInFolder(fullPath: string): void;
  7245. /**
  7246. * Resolves when the operation has been completed. Rejects if there was an error
  7247. * while deleting the requested item.
  7248. *
  7249. * This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin
  7250. * on Windows, and a desktop-environment-specific location on Linux).
  7251. */
  7252. trashItem(path: string): Promise<void>;
  7253. /**
  7254. * Whether the shortcut was created successfully.
  7255. *
  7256. Creates or updates a shortcut link at `shortcutPath`.
  7257. *
  7258. * @platform win32
  7259. */
  7260. writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
  7261. /**
  7262. * Whether the shortcut was created successfully.
  7263. *
  7264. Creates or updates a shortcut link at `shortcutPath`.
  7265. *
  7266. * @platform win32
  7267. */
  7268. writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
  7269. }
  7270. interface ShortcutDetails {
  7271. // Docs: https://electronjs.org/docs/api/structures/shortcut-details
  7272. /**
  7273. * The Application User Model ID. Default is empty.
  7274. */
  7275. appUserModelId?: string;
  7276. /**
  7277. * The arguments to be applied to `target` when launching from this shortcut.
  7278. * Default is empty.
  7279. */
  7280. args?: string;
  7281. /**
  7282. * The working directory. Default is empty.
  7283. */
  7284. cwd?: string;
  7285. /**
  7286. * The description of the shortcut. Default is empty.
  7287. */
  7288. description?: string;
  7289. /**
  7290. * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
  7291. * together. Default is empty, which uses the target's icon.
  7292. */
  7293. icon?: string;
  7294. /**
  7295. * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
  7296. */
  7297. iconIndex?: number;
  7298. /**
  7299. * The target to launch from this shortcut.
  7300. */
  7301. target: string;
  7302. /**
  7303. * The Application Toast Activator CLSID. Needed for participating in Action
  7304. * Center.
  7305. */
  7306. toastActivatorClsid?: string;
  7307. }
  7308. interface Size {
  7309. // Docs: https://electronjs.org/docs/api/structures/size
  7310. height: number;
  7311. width: number;
  7312. }
  7313. interface SystemPreferences extends NodeJS.EventEmitter {
  7314. // Docs: https://electronjs.org/docs/api/system-preferences
  7315. on(event: 'accent-color-changed', listener: (event: Event,
  7316. /**
  7317. * The new RGBA color the user assigned to be their system accent color.
  7318. */
  7319. newColor: string) => void): this;
  7320. once(event: 'accent-color-changed', listener: (event: Event,
  7321. /**
  7322. * The new RGBA color the user assigned to be their system accent color.
  7323. */
  7324. newColor: string) => void): this;
  7325. addListener(event: 'accent-color-changed', listener: (event: Event,
  7326. /**
  7327. * The new RGBA color the user assigned to be their system accent color.
  7328. */
  7329. newColor: string) => void): this;
  7330. removeListener(event: 'accent-color-changed', listener: (event: Event,
  7331. /**
  7332. * The new RGBA color the user assigned to be their system accent color.
  7333. */
  7334. newColor: string) => void): this;
  7335. on(event: 'color-changed', listener: (event: Event) => void): this;
  7336. once(event: 'color-changed', listener: (event: Event) => void): this;
  7337. addListener(event: 'color-changed', listener: (event: Event) => void): this;
  7338. removeListener(event: 'color-changed', listener: (event: Event) => void): this;
  7339. /**
  7340. * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
  7341. *
  7342. * @deprecated
  7343. * @platform win32
  7344. */
  7345. on(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7346. /**
  7347. * `true` if a high contrast theme is being used, `false` otherwise.
  7348. */
  7349. highContrastColorScheme: boolean) => void): this;
  7350. once(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7351. /**
  7352. * `true` if a high contrast theme is being used, `false` otherwise.
  7353. */
  7354. highContrastColorScheme: boolean) => void): this;
  7355. addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7356. /**
  7357. * `true` if a high contrast theme is being used, `false` otherwise.
  7358. */
  7359. highContrastColorScheme: boolean) => void): this;
  7360. removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7361. /**
  7362. * `true` if a high contrast theme is being used, `false` otherwise.
  7363. */
  7364. highContrastColorScheme: boolean) => void): this;
  7365. /**
  7366. * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
  7367. *
  7368. * @deprecated
  7369. * @platform win32
  7370. */
  7371. on(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7372. /**
  7373. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7374. * and dark backgrounds) is being used, `false` otherwise.
  7375. */
  7376. invertedColorScheme: boolean) => void): this;
  7377. once(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7378. /**
  7379. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7380. * and dark backgrounds) is being used, `false` otherwise.
  7381. */
  7382. invertedColorScheme: boolean) => void): this;
  7383. addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7384. /**
  7385. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7386. * and dark backgrounds) is being used, `false` otherwise.
  7387. */
  7388. invertedColorScheme: boolean) => void): this;
  7389. removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7390. /**
  7391. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7392. * and dark backgrounds) is being used, `false` otherwise.
  7393. */
  7394. invertedColorScheme: boolean) => void): this;
  7395. /**
  7396. * A promise that resolves with `true` if consent was granted and `false` if it was
  7397. * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
  7398. * access request was denied and later is changed through the System Preferences
  7399. * pane, a restart of the app will be required for the new permissions to take
  7400. * effect. If access has already been requested and denied, it _must_ be changed
  7401. * through the preference pane; an alert will not pop up and the promise will
  7402. * resolve with the existing access status.
  7403. *
  7404. * **Important:** In order to properly leverage this API, you must set the
  7405. * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
  7406. * app's `Info.plist` file. The values for these keys will be used to populate the
  7407. * permission dialogs so that the user will be properly informed as to the purpose
  7408. * of the permission request. See Electron Application Distribution for more
  7409. * information about how to set these in the context of Electron.
  7410. *
  7411. * This user consent was not required until macOS 10.14 Mojave, so this method will
  7412. * always return `true` if your system is running 10.13 High Sierra or lower.
  7413. *
  7414. * @platform darwin
  7415. */
  7416. askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
  7417. /**
  7418. * whether or not this device has the ability to use Touch ID.
  7419. *
  7420. * **NOTE:** This API will return `false` on macOS systems older than Sierra
  7421. * 10.12.2.
  7422. *
  7423. * @platform darwin
  7424. */
  7425. canPromptTouchID(): boolean;
  7426. /**
  7427. * The users current system wide accent color preference in RGBA hexadecimal form.
  7428. *
  7429. This API is only available on macOS 10.14 Mojave or newer.
  7430. *
  7431. * @platform win32,darwin
  7432. */
  7433. getAccentColor(): string;
  7434. /**
  7435. * * `shouldRenderRichAnimation` Boolean - Returns true if rich animations should
  7436. * be rendered. Looks at session type (e.g. remote desktop) and accessibility
  7437. * settings to give guidance for heavy animations.
  7438. * * `scrollAnimationsEnabledBySystem` Boolean - Determines on a per-platform basis
  7439. * whether scroll animations (e.g. produced by home/end key) should be enabled.
  7440. * * `prefersReducedMotion` Boolean - Determines whether the user desires reduced
  7441. * motion based on platform APIs.
  7442. *
  7443. Returns an object with system animation settings.
  7444. */
  7445. getAnimationSettings(): AnimationSettings;
  7446. /**
  7447. * | `null` - Can be `dark`, `light` or `unknown`.
  7448. *
  7449. * Gets the macOS appearance setting that you have declared you want for your
  7450. * application, maps to NSApplication.appearance. You can use the
  7451. * `setAppLevelAppearance` API to set this value.
  7452. *
  7453. * @deprecated
  7454. * @platform darwin
  7455. */
  7456. getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
  7457. /**
  7458. * The system color setting in RGB hexadecimal form (`#ABCDEF`). See the Windows
  7459. * docs and the macOS docs for more details.
  7460. *
  7461. * The following colors are only available on macOS 10.14: `find-highlight`,
  7462. * `selected-content-background`, `separator`,
  7463. * `unemphasized-selected-content-background`,
  7464. * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
  7465. *
  7466. * @platform win32,darwin
  7467. */
  7468. 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' | 'alternate-selected-control-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;
  7469. /**
  7470. * Can be `dark`, `light` or `unknown`.
  7471. *
  7472. * Gets the macOS appearance setting that is currently applied to your application,
  7473. * maps to NSApplication.effectiveAppearance
  7474. *
  7475. * @platform darwin
  7476. */
  7477. getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
  7478. /**
  7479. * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
  7480. *
  7481. * This user consent was not required on macOS 10.13 High Sierra or lower so this
  7482. * method will always return `granted`. macOS 10.14 Mojave or higher requires
  7483. * consent for `microphone` and `camera` access. macOS 10.15 Catalina or higher
  7484. * requires consent for `screen` access.
  7485. *
  7486. * Windows 10 has a global setting controlling `microphone` and `camera` access for
  7487. * all win32 applications. It will always return `granted` for `screen` and for all
  7488. * media types on older versions of Windows.
  7489. *
  7490. * @platform win32,darwin
  7491. */
  7492. getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
  7493. /**
  7494. * The standard system color formatted as `#RRGGBBAA`.
  7495. *
  7496. * Returns one of several standard system colors that automatically adapt to
  7497. * vibrancy and changes in accessibility settings like 'Increase contrast' and
  7498. * 'Reduce transparency'. See Apple Documentation for more details.
  7499. *
  7500. * @platform darwin
  7501. */
  7502. getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
  7503. /**
  7504. * The value of `key` in `NSUserDefaults`.
  7505. *
  7506. * Some popular `key` and `type`s are:
  7507. *
  7508. * * `AppleInterfaceStyle`: `string`
  7509. * * `AppleAquaColorVariant`: `integer`
  7510. * * `AppleHighlightColor`: `string`
  7511. * * `AppleShowScrollBars`: `string`
  7512. * * `NSNavRecentPlaces`: `array`
  7513. * * `NSPreferredWebServices`: `dictionary`
  7514. * * `NSUserDictionaryReplacementItems`: `array`
  7515. *
  7516. * @platform darwin
  7517. */
  7518. getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
  7519. /**
  7520. * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
  7521. *
  7522. * An example of using it to determine if you should create a transparent window or
  7523. * not (transparent windows won't work correctly when DWM composition is disabled):
  7524. *
  7525. * @platform win32
  7526. */
  7527. isAeroGlassEnabled(): boolean;
  7528. /**
  7529. * Whether the system is in Dark Mode.
  7530. *
  7531. **Deprecated:** Should use the new `nativeTheme.shouldUseDarkColors` API.
  7532. *
  7533. * @deprecated
  7534. * @platform darwin,win32
  7535. */
  7536. isDarkMode(): boolean;
  7537. /**
  7538. * `true` if a high contrast theme is active, `false` otherwise.
  7539. *
  7540. * **Deprecated:** Should use the new `nativeTheme.shouldUseHighContrastColors`
  7541. * API.
  7542. *
  7543. * @deprecated
  7544. * @platform darwin,win32
  7545. */
  7546. isHighContrastColorScheme(): boolean;
  7547. /**
  7548. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7549. * and dark backgrounds) is active, `false` otherwise.
  7550. *
  7551. * **Deprecated:** Should use the new `nativeTheme.shouldUseInvertedColorScheme`
  7552. * API.
  7553. *
  7554. * @deprecated
  7555. * @platform win32
  7556. */
  7557. isInvertedColorScheme(): boolean;
  7558. /**
  7559. * Whether the Swipe between pages setting is on.
  7560. *
  7561. * @platform darwin
  7562. */
  7563. isSwipeTrackingFromScrollEventsEnabled(): boolean;
  7564. /**
  7565. * `true` if the current process is a trusted accessibility client and `false` if
  7566. * it is not.
  7567. *
  7568. * @platform darwin
  7569. */
  7570. isTrustedAccessibilityClient(prompt: boolean): boolean;
  7571. /**
  7572. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7573. * contains the user information dictionary sent along with the notification.
  7574. *
  7575. * @platform darwin
  7576. */
  7577. postLocalNotification(event: string, userInfo: Record<string, any>): void;
  7578. /**
  7579. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7580. * contains the user information dictionary sent along with the notification.
  7581. *
  7582. * @platform darwin
  7583. */
  7584. postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
  7585. /**
  7586. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7587. * contains the user information dictionary sent along with the notification.
  7588. *
  7589. * @platform darwin
  7590. */
  7591. postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
  7592. /**
  7593. * resolves if the user has successfully authenticated with Touch ID.
  7594. *
  7595. * This API itself will not protect your user data; rather, it is a mechanism to
  7596. * allow you to do so. Native apps will need to set Access Control Constants like
  7597. * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
  7598. * auto-prompt for Touch ID biometric consent. This could be done with
  7599. * `node-keytar`, such that one would store an encryption key with `node-keytar`
  7600. * and only fetch it if `promptTouchID()` resolves.
  7601. *
  7602. * **NOTE:** This API will return a rejected Promise on macOS systems older than
  7603. * Sierra 10.12.2.
  7604. *
  7605. * @platform darwin
  7606. */
  7607. promptTouchID(reason: string): Promise<void>;
  7608. /**
  7609. * Add the specified defaults to your application's `NSUserDefaults`.
  7610. *
  7611. * @platform darwin
  7612. */
  7613. registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
  7614. /**
  7615. * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
  7616. * or global value of a `key` previously set with `setUserDefault`.
  7617. *
  7618. * @platform darwin
  7619. */
  7620. removeUserDefault(key: string): void;
  7621. /**
  7622. * Sets the appearance setting for your application, this should override the
  7623. * system default and override the value of `getEffectiveAppearance`.
  7624. *
  7625. * @deprecated
  7626. * @platform darwin
  7627. */
  7628. setAppLevelAppearance(appearance: (('dark' | 'light')) | (null)): void;
  7629. /**
  7630. * Set the value of `key` in `NSUserDefaults`.
  7631. *
  7632. * Note that `type` should match actual type of `value`. An exception is thrown if
  7633. * they don't.
  7634. *
  7635. Some popular `key` and `type`s are:
  7636. * `ApplePressAndHoldEnabled`: `boolean`
  7637. *
  7638. * @platform darwin
  7639. */
  7640. setUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary', value: string): void;
  7641. /**
  7642. * The ID of this subscription
  7643. *
  7644. * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
  7645. * defaults. This is necessary for events such as
  7646. * `NSUserDefaultsDidChangeNotification`.
  7647. *
  7648. * @platform darwin
  7649. */
  7650. subscribeLocalNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  7651. /**
  7652. * The ID of this subscription
  7653. *
  7654. * Subscribes to native notifications of macOS, `callback` will be called with
  7655. * `callback(event, userInfo)` when the corresponding `event` happens. The
  7656. * `userInfo` is an Object that contains the user information dictionary sent along
  7657. * with the notification. The `object` is the sender of the notification, and only
  7658. * supports `NSString` values for now.
  7659. *
  7660. * The `id` of the subscriber is returned, which can be used to unsubscribe the
  7661. * `event`.
  7662. *
  7663. * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
  7664. * values of `event` are:
  7665. *
  7666. * * `AppleInterfaceThemeChangedNotification`
  7667. * * `AppleAquaColorVariantChanged`
  7668. * * `AppleColorPreferencesChangedNotification`
  7669. * * `AppleShowScrollBarsSettingChanged`
  7670. *
  7671. * @platform darwin
  7672. */
  7673. subscribeNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  7674. /**
  7675. * The ID of this subscription
  7676. *
  7677. * Same as `subscribeNotification`, but uses
  7678. * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
  7679. * such as `NSWorkspaceDidActivateApplicationNotification`.
  7680. *
  7681. * @platform darwin
  7682. */
  7683. subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  7684. /**
  7685. * Same as `unsubscribeNotification`, but removes the subscriber from
  7686. * `NSNotificationCenter`.
  7687. *
  7688. * @platform darwin
  7689. */
  7690. unsubscribeLocalNotification(id: number): void;
  7691. /**
  7692. * Removes the subscriber with `id`.
  7693. *
  7694. * @platform darwin
  7695. */
  7696. unsubscribeNotification(id: number): void;
  7697. /**
  7698. * Same as `unsubscribeNotification`, but removes the subscriber from
  7699. * `NSWorkspace.sharedWorkspace.notificationCenter`.
  7700. *
  7701. * @platform darwin
  7702. */
  7703. unsubscribeWorkspaceNotification(id: number): void;
  7704. /**
  7705. * A `String` property that can be `dark`, `light` or `unknown`. It determines the
  7706. * macOS appearance setting for your application. This maps to values in:
  7707. * NSApplication.appearance. Setting this will override the system default as well
  7708. * as the value of `getEffectiveAppearance`.
  7709. *
  7710. * Possible values that can be set are `dark` and `light`, and possible return
  7711. * values are `dark`, `light`, and `unknown`.
  7712. *
  7713. This property is only available on macOS 10.14 Mojave or newer.
  7714. *
  7715. * @platform darwin
  7716. */
  7717. appLevelAppearance: ('dark' | 'light' | 'unknown');
  7718. /**
  7719. * A `String` property that can be `dark`, `light` or `unknown`.
  7720. *
  7721. * Returns the macOS appearance setting that is currently applied to your
  7722. * application, maps to NSApplication.effectiveAppearance
  7723. *
  7724. * @platform darwin
  7725. */
  7726. readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
  7727. }
  7728. interface Task {
  7729. // Docs: https://electronjs.org/docs/api/structures/task
  7730. /**
  7731. * The command line arguments when `program` is executed.
  7732. */
  7733. arguments: string;
  7734. /**
  7735. * Description of this task.
  7736. */
  7737. description: string;
  7738. /**
  7739. * The icon index in the icon file. If an icon file consists of two or more icons,
  7740. * set this value to identify the icon. If an icon file consists of one icon, this
  7741. * value is 0.
  7742. */
  7743. iconIndex: number;
  7744. /**
  7745. * The absolute path to an icon to be displayed in a JumpList, which can be an
  7746. * arbitrary resource file that contains an icon. You can usually specify
  7747. * `process.execPath` to show the icon of the program.
  7748. */
  7749. iconPath: string;
  7750. /**
  7751. * Path of the program to execute, usually you should specify `process.execPath`
  7752. * which opens the current program.
  7753. */
  7754. program: string;
  7755. /**
  7756. * The string to be displayed in a JumpList.
  7757. */
  7758. title: string;
  7759. /**
  7760. * The working directory. Default is empty.
  7761. */
  7762. workingDirectory?: string;
  7763. }
  7764. interface ThumbarButton {
  7765. // Docs: https://electronjs.org/docs/api/structures/thumbar-button
  7766. click: Function;
  7767. /**
  7768. * Control specific states and behaviors of the button. By default, it is
  7769. * `['enabled']`.
  7770. */
  7771. flags?: string[];
  7772. /**
  7773. * The icon showing in thumbnail toolbar.
  7774. */
  7775. icon: NativeImage;
  7776. /**
  7777. * The text of the button's tooltip.
  7778. */
  7779. tooltip?: string;
  7780. }
  7781. class TouchBar {
  7782. // Docs: https://electronjs.org/docs/api/touch-bar
  7783. /**
  7784. * TouchBar
  7785. */
  7786. constructor(options: TouchBarConstructorOptions);
  7787. escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
  7788. static TouchBarButton: typeof TouchBarButton;
  7789. static TouchBarColorPicker: typeof TouchBarColorPicker;
  7790. static TouchBarGroup: typeof TouchBarGroup;
  7791. static TouchBarLabel: typeof TouchBarLabel;
  7792. static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
  7793. static TouchBarPopover: typeof TouchBarPopover;
  7794. static TouchBarScrubber: typeof TouchBarScrubber;
  7795. static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
  7796. static TouchBarSlider: typeof TouchBarSlider;
  7797. static TouchBarSpacer: typeof TouchBarSpacer;
  7798. }
  7799. class TouchBarButton {
  7800. // Docs: https://electronjs.org/docs/api/touch-bar-button
  7801. /**
  7802. * TouchBarButton
  7803. */
  7804. constructor(options: TouchBarButtonConstructorOptions);
  7805. accessibilityLabel: string;
  7806. backgroundColor: string;
  7807. enabled: boolean;
  7808. icon: NativeImage;
  7809. iconPosition: ('left' | 'right' | 'overlay');
  7810. label: string;
  7811. }
  7812. class TouchBarColorPicker extends NodeEventEmitter {
  7813. // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
  7814. /**
  7815. * TouchBarColorPicker
  7816. */
  7817. constructor(options: TouchBarColorPickerConstructorOptions);
  7818. availableColors: string[];
  7819. selectedColor: string;
  7820. }
  7821. class TouchBarGroup extends NodeEventEmitter {
  7822. // Docs: https://electronjs.org/docs/api/touch-bar-group
  7823. /**
  7824. * TouchBarGroup
  7825. */
  7826. constructor(options: TouchBarGroupConstructorOptions);
  7827. }
  7828. class TouchBarLabel extends NodeEventEmitter {
  7829. // Docs: https://electronjs.org/docs/api/touch-bar-label
  7830. /**
  7831. * TouchBarLabel
  7832. */
  7833. constructor(options: TouchBarLabelConstructorOptions);
  7834. accessibilityLabel: string;
  7835. label: string;
  7836. textColor: string;
  7837. }
  7838. class TouchBarOtherItemsProxy extends NodeEventEmitter {
  7839. // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
  7840. /**
  7841. * TouchBarOtherItemsProxy
  7842. */
  7843. constructor();
  7844. }
  7845. class TouchBarPopover extends NodeEventEmitter {
  7846. // Docs: https://electronjs.org/docs/api/touch-bar-popover
  7847. /**
  7848. * TouchBarPopover
  7849. */
  7850. constructor(options: TouchBarPopoverConstructorOptions);
  7851. icon: NativeImage;
  7852. label: string;
  7853. }
  7854. class TouchBarScrubber extends NodeEventEmitter {
  7855. // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
  7856. /**
  7857. * TouchBarScrubber
  7858. */
  7859. constructor(options: TouchBarScrubberConstructorOptions);
  7860. continuous: boolean;
  7861. items: ScrubberItem[];
  7862. mode: ('fixed' | 'free');
  7863. overlayStyle: ('background' | 'outline' | 'none');
  7864. selectedStyle: ('background' | 'outline' | 'none');
  7865. showArrowButtons: boolean;
  7866. }
  7867. class TouchBarSegmentedControl extends NodeEventEmitter {
  7868. // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
  7869. /**
  7870. * TouchBarSegmentedControl
  7871. */
  7872. constructor(options: TouchBarSegmentedControlConstructorOptions);
  7873. mode: ('single' | 'multiple' | 'buttons');
  7874. segments: SegmentedControlSegment[];
  7875. segmentStyle: string;
  7876. selectedIndex: number;
  7877. }
  7878. class TouchBarSlider extends NodeEventEmitter {
  7879. // Docs: https://electronjs.org/docs/api/touch-bar-slider
  7880. /**
  7881. * TouchBarSlider
  7882. */
  7883. constructor(options: TouchBarSliderConstructorOptions);
  7884. label: string;
  7885. maxValue: number;
  7886. minValue: number;
  7887. value: number;
  7888. }
  7889. class TouchBarSpacer extends NodeEventEmitter {
  7890. // Docs: https://electronjs.org/docs/api/touch-bar-spacer
  7891. /**
  7892. * TouchBarSpacer
  7893. */
  7894. constructor(options: TouchBarSpacerConstructorOptions);
  7895. size: ('small' | 'large' | 'flexible');
  7896. }
  7897. interface TraceCategoriesAndOptions {
  7898. // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
  7899. /**
  7900. * A filter to control what category groups should be traced. A filter can have an
  7901. * optional '-' prefix to exclude category groups that contain a matching category.
  7902. * Having both included and excluded category patterns in the same list is not
  7903. * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
  7904. * `-excluded_category1,-excluded_category2`.
  7905. */
  7906. categoryFilter: string;
  7907. /**
  7908. * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
  7909. * the following strings: `record-until-full`, `record-continuously`,
  7910. * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
  7911. * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
  7912. * modes and hence mutually exclusive. If more than one trace recording modes
  7913. * appear in the `traceOptions` string, the last one takes precedence. If none of
  7914. * the trace recording modes are specified, recording mode is `record-until-full`.
  7915. * The trace option will first be reset to the default option (`record_mode` set to
  7916. * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
  7917. * before options parsed from `traceOptions` are applied on it.
  7918. */
  7919. traceOptions: string;
  7920. }
  7921. interface TraceConfig {
  7922. // Docs: https://electronjs.org/docs/api/structures/trace-config
  7923. /**
  7924. * if true, filter event data according to a specific list of events that have been
  7925. * manually vetted to not include any PII. See the implementation in Chromium for
  7926. * specifics.
  7927. */
  7928. enable_argument_filter?: boolean;
  7929. /**
  7930. * a list of tracing categories to exclude. Can include glob-like patterns using
  7931. * `*` at the end of the category name. See tracing categories for the list of
  7932. * categories.
  7933. */
  7934. excluded_categories?: string[];
  7935. /**
  7936. * a list of histogram names to report with the trace.
  7937. */
  7938. histogram_names?: string[];
  7939. /**
  7940. * a list of tracing categories to include. Can include glob-like patterns using
  7941. * `*` at the end of the category name. See tracing categories for the list of
  7942. * categories.
  7943. */
  7944. included_categories?: string[];
  7945. /**
  7946. * a list of process IDs to include in the trace. If not specified, trace all
  7947. * processes.
  7948. */
  7949. included_process_ids?: number[];
  7950. /**
  7951. * if the `disabled-by-default-memory-infra` category is enabled, this contains
  7952. * optional additional configuration for data collection. See the Chromium
  7953. * memory-infra docs for more information.
  7954. */
  7955. memory_dump_config?: Record<string, any>;
  7956. /**
  7957. * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
  7958. * or `trace-to-console`. Defaults to `record-until-full`.
  7959. */
  7960. recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
  7961. /**
  7962. * maximum size of the trace recording buffer in events.
  7963. */
  7964. trace_buffer_size_in_events?: number;
  7965. /**
  7966. * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
  7967. */
  7968. trace_buffer_size_in_kb?: number;
  7969. }
  7970. interface Transaction {
  7971. // Docs: https://electronjs.org/docs/api/structures/transaction
  7972. /**
  7973. * The error code if an error occurred while processing the transaction.
  7974. */
  7975. errorCode: number;
  7976. /**
  7977. * The error message if an error occurred while processing the transaction.
  7978. */
  7979. errorMessage: string;
  7980. /**
  7981. * The identifier of the restored transaction by the App Store.
  7982. */
  7983. originalTransactionIdentifier: string;
  7984. payment: Payment;
  7985. /**
  7986. * The date the transaction was added to the App Store’s payment queue.
  7987. */
  7988. transactionDate: string;
  7989. /**
  7990. * A string that uniquely identifies a successful payment transaction.
  7991. */
  7992. transactionIdentifier: string;
  7993. /**
  7994. * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
  7995. * `deferred`.
  7996. */
  7997. transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
  7998. }
  7999. class Tray extends NodeEventEmitter {
  8000. // Docs: https://electronjs.org/docs/api/tray
  8001. /**
  8002. * Emitted when the tray balloon is clicked.
  8003. *
  8004. * @platform win32
  8005. */
  8006. on(event: 'balloon-click', listener: Function): this;
  8007. once(event: 'balloon-click', listener: Function): this;
  8008. addListener(event: 'balloon-click', listener: Function): this;
  8009. removeListener(event: 'balloon-click', listener: Function): this;
  8010. /**
  8011. * Emitted when the tray balloon is closed because of timeout or user manually
  8012. * closes it.
  8013. *
  8014. * @platform win32
  8015. */
  8016. on(event: 'balloon-closed', listener: Function): this;
  8017. once(event: 'balloon-closed', listener: Function): this;
  8018. addListener(event: 'balloon-closed', listener: Function): this;
  8019. removeListener(event: 'balloon-closed', listener: Function): this;
  8020. /**
  8021. * Emitted when the tray balloon shows.
  8022. *
  8023. * @platform win32
  8024. */
  8025. on(event: 'balloon-show', listener: Function): this;
  8026. once(event: 'balloon-show', listener: Function): this;
  8027. addListener(event: 'balloon-show', listener: Function): this;
  8028. removeListener(event: 'balloon-show', listener: Function): this;
  8029. /**
  8030. * Emitted when the tray icon is clicked.
  8031. */
  8032. on(event: 'click', listener: (event: KeyboardEvent,
  8033. /**
  8034. * The bounds of tray icon.
  8035. */
  8036. bounds: Rectangle,
  8037. /**
  8038. * The position of the event.
  8039. */
  8040. position: Point) => void): this;
  8041. once(event: 'click', listener: (event: KeyboardEvent,
  8042. /**
  8043. * The bounds of tray icon.
  8044. */
  8045. bounds: Rectangle,
  8046. /**
  8047. * The position of the event.
  8048. */
  8049. position: Point) => void): this;
  8050. addListener(event: 'click', listener: (event: KeyboardEvent,
  8051. /**
  8052. * The bounds of tray icon.
  8053. */
  8054. bounds: Rectangle,
  8055. /**
  8056. * The position of the event.
  8057. */
  8058. position: Point) => void): this;
  8059. removeListener(event: 'click', listener: (event: KeyboardEvent,
  8060. /**
  8061. * The bounds of tray icon.
  8062. */
  8063. bounds: Rectangle,
  8064. /**
  8065. * The position of the event.
  8066. */
  8067. position: Point) => void): this;
  8068. /**
  8069. * Emitted when the tray icon is double clicked.
  8070. *
  8071. * @platform darwin,win32
  8072. */
  8073. on(event: 'double-click', listener: (event: KeyboardEvent,
  8074. /**
  8075. * The bounds of tray icon.
  8076. */
  8077. bounds: Rectangle) => void): this;
  8078. once(event: 'double-click', listener: (event: KeyboardEvent,
  8079. /**
  8080. * The bounds of tray icon.
  8081. */
  8082. bounds: Rectangle) => void): this;
  8083. addListener(event: 'double-click', listener: (event: KeyboardEvent,
  8084. /**
  8085. * The bounds of tray icon.
  8086. */
  8087. bounds: Rectangle) => void): this;
  8088. removeListener(event: 'double-click', listener: (event: KeyboardEvent,
  8089. /**
  8090. * The bounds of tray icon.
  8091. */
  8092. bounds: Rectangle) => void): this;
  8093. /**
  8094. * Emitted when a drag operation ends on the tray or ends at another location.
  8095. *
  8096. * @platform darwin
  8097. */
  8098. on(event: 'drag-end', listener: Function): this;
  8099. once(event: 'drag-end', listener: Function): this;
  8100. addListener(event: 'drag-end', listener: Function): this;
  8101. removeListener(event: 'drag-end', listener: Function): this;
  8102. /**
  8103. * Emitted when a drag operation enters the tray icon.
  8104. *
  8105. * @platform darwin
  8106. */
  8107. on(event: 'drag-enter', listener: Function): this;
  8108. once(event: 'drag-enter', listener: Function): this;
  8109. addListener(event: 'drag-enter', listener: Function): this;
  8110. removeListener(event: 'drag-enter', listener: Function): this;
  8111. /**
  8112. * Emitted when a drag operation exits the tray icon.
  8113. *
  8114. * @platform darwin
  8115. */
  8116. on(event: 'drag-leave', listener: Function): this;
  8117. once(event: 'drag-leave', listener: Function): this;
  8118. addListener(event: 'drag-leave', listener: Function): this;
  8119. removeListener(event: 'drag-leave', listener: Function): this;
  8120. /**
  8121. * Emitted when any dragged items are dropped on the tray icon.
  8122. *
  8123. * @platform darwin
  8124. */
  8125. on(event: 'drop', listener: Function): this;
  8126. once(event: 'drop', listener: Function): this;
  8127. addListener(event: 'drop', listener: Function): this;
  8128. removeListener(event: 'drop', listener: Function): this;
  8129. /**
  8130. * Emitted when dragged files are dropped in the tray icon.
  8131. *
  8132. * @platform darwin
  8133. */
  8134. on(event: 'drop-files', listener: (event: Event,
  8135. /**
  8136. * The paths of the dropped files.
  8137. */
  8138. files: string[]) => void): this;
  8139. once(event: 'drop-files', listener: (event: Event,
  8140. /**
  8141. * The paths of the dropped files.
  8142. */
  8143. files: string[]) => void): this;
  8144. addListener(event: 'drop-files', listener: (event: Event,
  8145. /**
  8146. * The paths of the dropped files.
  8147. */
  8148. files: string[]) => void): this;
  8149. removeListener(event: 'drop-files', listener: (event: Event,
  8150. /**
  8151. * The paths of the dropped files.
  8152. */
  8153. files: string[]) => void): this;
  8154. /**
  8155. * Emitted when dragged text is dropped in the tray icon.
  8156. *
  8157. * @platform darwin
  8158. */
  8159. on(event: 'drop-text', listener: (event: Event,
  8160. /**
  8161. * the dropped text string.
  8162. */
  8163. text: string) => void): this;
  8164. once(event: 'drop-text', listener: (event: Event,
  8165. /**
  8166. * the dropped text string.
  8167. */
  8168. text: string) => void): this;
  8169. addListener(event: 'drop-text', listener: (event: Event,
  8170. /**
  8171. * the dropped text string.
  8172. */
  8173. text: string) => void): this;
  8174. removeListener(event: 'drop-text', listener: (event: Event,
  8175. /**
  8176. * the dropped text string.
  8177. */
  8178. text: string) => void): this;
  8179. /**
  8180. * Emitted when the mouse clicks the tray icon.
  8181. *
  8182. * @platform darwin
  8183. */
  8184. on(event: 'mouse-down', listener: (event: KeyboardEvent,
  8185. /**
  8186. * The position of the event.
  8187. */
  8188. position: Point) => void): this;
  8189. once(event: 'mouse-down', listener: (event: KeyboardEvent,
  8190. /**
  8191. * The position of the event.
  8192. */
  8193. position: Point) => void): this;
  8194. addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  8195. /**
  8196. * The position of the event.
  8197. */
  8198. position: Point) => void): this;
  8199. removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  8200. /**
  8201. * The position of the event.
  8202. */
  8203. position: Point) => void): this;
  8204. /**
  8205. * Emitted when the mouse enters the tray icon.
  8206. *
  8207. * @platform darwin
  8208. */
  8209. on(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8210. /**
  8211. * The position of the event.
  8212. */
  8213. position: Point) => void): this;
  8214. once(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8215. /**
  8216. * The position of the event.
  8217. */
  8218. position: Point) => void): this;
  8219. addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8220. /**
  8221. * The position of the event.
  8222. */
  8223. position: Point) => void): this;
  8224. removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8225. /**
  8226. * The position of the event.
  8227. */
  8228. position: Point) => void): this;
  8229. /**
  8230. * Emitted when the mouse exits the tray icon.
  8231. *
  8232. * @platform darwin
  8233. */
  8234. on(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8235. /**
  8236. * The position of the event.
  8237. */
  8238. position: Point) => void): this;
  8239. once(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8240. /**
  8241. * The position of the event.
  8242. */
  8243. position: Point) => void): this;
  8244. addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8245. /**
  8246. * The position of the event.
  8247. */
  8248. position: Point) => void): this;
  8249. removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8250. /**
  8251. * The position of the event.
  8252. */
  8253. position: Point) => void): this;
  8254. /**
  8255. * Emitted when the mouse moves in the tray icon.
  8256. *
  8257. * @platform darwin,win32
  8258. */
  8259. on(event: 'mouse-move', listener: (event: KeyboardEvent,
  8260. /**
  8261. * The position of the event.
  8262. */
  8263. position: Point) => void): this;
  8264. once(event: 'mouse-move', listener: (event: KeyboardEvent,
  8265. /**
  8266. * The position of the event.
  8267. */
  8268. position: Point) => void): this;
  8269. addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  8270. /**
  8271. * The position of the event.
  8272. */
  8273. position: Point) => void): this;
  8274. removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  8275. /**
  8276. * The position of the event.
  8277. */
  8278. position: Point) => void): this;
  8279. /**
  8280. * Emitted when the mouse is released from clicking the tray icon.
  8281. *
  8282. * Note: This will not be emitted if you have set a context menu for your Tray
  8283. * using `tray.setContextMenu`, as a result of macOS-level constraints.
  8284. *
  8285. * @platform darwin
  8286. */
  8287. on(event: 'mouse-up', listener: (event: KeyboardEvent,
  8288. /**
  8289. * The position of the event.
  8290. */
  8291. position: Point) => void): this;
  8292. once(event: 'mouse-up', listener: (event: KeyboardEvent,
  8293. /**
  8294. * The position of the event.
  8295. */
  8296. position: Point) => void): this;
  8297. addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  8298. /**
  8299. * The position of the event.
  8300. */
  8301. position: Point) => void): this;
  8302. removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  8303. /**
  8304. * The position of the event.
  8305. */
  8306. position: Point) => void): this;
  8307. /**
  8308. * Emitted when the tray icon is right clicked.
  8309. *
  8310. * @platform darwin,win32
  8311. */
  8312. on(event: 'right-click', listener: (event: KeyboardEvent,
  8313. /**
  8314. * The bounds of tray icon.
  8315. */
  8316. bounds: Rectangle) => void): this;
  8317. once(event: 'right-click', listener: (event: KeyboardEvent,
  8318. /**
  8319. * The bounds of tray icon.
  8320. */
  8321. bounds: Rectangle) => void): this;
  8322. addListener(event: 'right-click', listener: (event: KeyboardEvent,
  8323. /**
  8324. * The bounds of tray icon.
  8325. */
  8326. bounds: Rectangle) => void): this;
  8327. removeListener(event: 'right-click', listener: (event: KeyboardEvent,
  8328. /**
  8329. * The bounds of tray icon.
  8330. */
  8331. bounds: Rectangle) => void): this;
  8332. /**
  8333. * Tray
  8334. */
  8335. constructor(image: (NativeImage) | (string), guid?: string);
  8336. /**
  8337. * Closes an open context menu, as set by `tray.setContextMenu()`.
  8338. *
  8339. * @platform darwin,win32
  8340. */
  8341. closeContextMenu(): void;
  8342. /**
  8343. * Destroys the tray icon immediately.
  8344. */
  8345. destroy(): void;
  8346. /**
  8347. * Displays a tray balloon.
  8348. *
  8349. * @platform win32
  8350. */
  8351. displayBalloon(options: DisplayBalloonOptions): void;
  8352. /**
  8353. * Returns focus to the taskbar notification area. Notification area icons should
  8354. * use this message when they have completed their UI operation. For example, if
  8355. * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
  8356. * `tray.focus()` to return focus to the notification area.
  8357. *
  8358. * @platform win32
  8359. */
  8360. focus(): void;
  8361. /**
  8362. * The `bounds` of this tray icon as `Object`.
  8363. *
  8364. * @platform darwin,win32
  8365. */
  8366. getBounds(): Rectangle;
  8367. /**
  8368. * Whether double click events will be ignored.
  8369. *
  8370. * @platform darwin
  8371. */
  8372. getIgnoreDoubleClickEvents(): boolean;
  8373. /**
  8374. * the title displayed next to the tray icon in the status bar
  8375. *
  8376. * @platform darwin
  8377. */
  8378. getTitle(): string;
  8379. /**
  8380. * Whether the tray icon is destroyed.
  8381. */
  8382. isDestroyed(): boolean;
  8383. /**
  8384. * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
  8385. * will be shown instead of the tray icon's context menu.
  8386. *
  8387. The `position` is only available on Windows, and it is (0, 0) by default.
  8388. *
  8389. * @platform darwin,win32
  8390. */
  8391. popUpContextMenu(menu?: Menu, position?: Point): void;
  8392. /**
  8393. * Removes a tray balloon.
  8394. *
  8395. * @platform win32
  8396. */
  8397. removeBalloon(): void;
  8398. /**
  8399. * Sets the context menu for this icon.
  8400. */
  8401. setContextMenu(menu: (Menu) | (null)): void;
  8402. /**
  8403. * Sets the option to ignore double click events. Ignoring these events allows you
  8404. * to detect every individual click of the tray icon.
  8405. *
  8406. This value is set to false by default.
  8407. *
  8408. * @platform darwin
  8409. */
  8410. setIgnoreDoubleClickEvents(ignore: boolean): void;
  8411. /**
  8412. * Sets the `image` associated with this tray icon.
  8413. */
  8414. setImage(image: (NativeImage) | (string)): void;
  8415. /**
  8416. * Sets the `image` associated with this tray icon when pressed on macOS.
  8417. *
  8418. * @platform darwin
  8419. */
  8420. setPressedImage(image: (NativeImage) | (string)): void;
  8421. /**
  8422. * Sets the title displayed next to the tray icon in the status bar (Support ANSI
  8423. * colors).
  8424. *
  8425. * @platform darwin
  8426. */
  8427. setTitle(title: string, options?: TitleOptions): void;
  8428. /**
  8429. * Sets the hover text for this tray icon.
  8430. */
  8431. setToolTip(toolTip: string): void;
  8432. }
  8433. interface UploadData {
  8434. // Docs: https://electronjs.org/docs/api/structures/upload-data
  8435. /**
  8436. * UUID of blob data. Use ses.getBlobData method to retrieve the data.
  8437. */
  8438. blobUUID?: string;
  8439. /**
  8440. * Content being sent.
  8441. */
  8442. bytes: Buffer;
  8443. /**
  8444. * Path of file being uploaded.
  8445. */
  8446. file?: string;
  8447. }
  8448. interface UploadFile {
  8449. // Docs: https://electronjs.org/docs/api/structures/upload-file
  8450. /**
  8451. * Path of file to be uploaded.
  8452. */
  8453. filePath: string;
  8454. /**
  8455. * Number of bytes to read from `offset`. Defaults to `0`.
  8456. */
  8457. length: number;
  8458. /**
  8459. * Last Modification time in number of seconds since the UNIX epoch.
  8460. */
  8461. modificationTime: number;
  8462. /**
  8463. * Defaults to `0`.
  8464. */
  8465. offset: number;
  8466. /**
  8467. * `file`.
  8468. */
  8469. type: 'file';
  8470. }
  8471. interface UploadRawData {
  8472. // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
  8473. /**
  8474. * Data to be uploaded.
  8475. */
  8476. bytes: Buffer;
  8477. /**
  8478. * `rawData`.
  8479. */
  8480. type: 'rawData';
  8481. }
  8482. class WebContents extends NodeEventEmitter {
  8483. // Docs: https://electronjs.org/docs/api/web-contents
  8484. /**
  8485. * | undefined - A WebContents instance with the given TargetID, or `undefined` if
  8486. * there is no WebContents associated with the given TargetID.
  8487. *
  8488. * When communicating with the Chrome DevTools Protocol, it can be useful to lookup
  8489. * a WebContents instance based on its assigned TargetID.
  8490. */
  8491. static fromDevToolsTargetId(targetId: string): WebContents;
  8492. /**
  8493. * | undefined - A WebContents instance with the given ID, or `undefined` if there
  8494. * is no WebContents associated with the given ID.
  8495. */
  8496. static fromId(id: number): WebContents;
  8497. /**
  8498. * An array of all `WebContents` instances. This will contain web contents for all
  8499. * windows, webviews, opened devtools, and devtools extension background pages.
  8500. */
  8501. static getAllWebContents(): WebContents[];
  8502. /**
  8503. * The web contents that is focused in this application, otherwise returns `null`.
  8504. */
  8505. static getFocusedWebContents(): WebContents;
  8506. /**
  8507. * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
  8508. * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
  8509. * menu shortcuts.
  8510. *
  8511. To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
  8512. */
  8513. on(event: 'before-input-event', listener: (event: Event,
  8514. /**
  8515. * Input properties.
  8516. */
  8517. input: Input) => void): this;
  8518. once(event: 'before-input-event', listener: (event: Event,
  8519. /**
  8520. * Input properties.
  8521. */
  8522. input: Input) => void): this;
  8523. addListener(event: 'before-input-event', listener: (event: Event,
  8524. /**
  8525. * Input properties.
  8526. */
  8527. input: Input) => void): this;
  8528. removeListener(event: 'before-input-event', listener: (event: Event,
  8529. /**
  8530. * Input properties.
  8531. */
  8532. input: Input) => void): this;
  8533. /**
  8534. * Emitted when failed to verify the `certificate` for `url`.
  8535. *
  8536. The usage is the same with the `certificate-error` event of `app`.
  8537. */
  8538. on(event: 'certificate-error', listener: (event: Event,
  8539. url: string,
  8540. /**
  8541. * The error code.
  8542. */
  8543. error: string,
  8544. certificate: Certificate,
  8545. callback: (isTrusted: boolean) => void) => void): this;
  8546. once(event: 'certificate-error', listener: (event: Event,
  8547. url: string,
  8548. /**
  8549. * The error code.
  8550. */
  8551. error: string,
  8552. certificate: Certificate,
  8553. callback: (isTrusted: boolean) => void) => void): this;
  8554. addListener(event: 'certificate-error', listener: (event: Event,
  8555. url: string,
  8556. /**
  8557. * The error code.
  8558. */
  8559. error: string,
  8560. certificate: Certificate,
  8561. callback: (isTrusted: boolean) => void) => void): this;
  8562. removeListener(event: 'certificate-error', listener: (event: Event,
  8563. url: string,
  8564. /**
  8565. * The error code.
  8566. */
  8567. error: string,
  8568. certificate: Certificate,
  8569. callback: (isTrusted: boolean) => void) => void): this;
  8570. /**
  8571. * Emitted when the associated window logs a console message.
  8572. */
  8573. on(event: 'console-message', listener: (event: Event,
  8574. /**
  8575. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8576. * `error`.
  8577. */
  8578. level: number,
  8579. /**
  8580. * The actual console message
  8581. */
  8582. message: string,
  8583. /**
  8584. * The line number of the source that triggered this console message
  8585. */
  8586. line: number,
  8587. sourceId: string) => void): this;
  8588. once(event: 'console-message', listener: (event: Event,
  8589. /**
  8590. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8591. * `error`.
  8592. */
  8593. level: number,
  8594. /**
  8595. * The actual console message
  8596. */
  8597. message: string,
  8598. /**
  8599. * The line number of the source that triggered this console message
  8600. */
  8601. line: number,
  8602. sourceId: string) => void): this;
  8603. addListener(event: 'console-message', listener: (event: Event,
  8604. /**
  8605. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8606. * `error`.
  8607. */
  8608. level: number,
  8609. /**
  8610. * The actual console message
  8611. */
  8612. message: string,
  8613. /**
  8614. * The line number of the source that triggered this console message
  8615. */
  8616. line: number,
  8617. sourceId: string) => void): this;
  8618. removeListener(event: 'console-message', listener: (event: Event,
  8619. /**
  8620. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8621. * `error`.
  8622. */
  8623. level: number,
  8624. /**
  8625. * The actual console message
  8626. */
  8627. message: string,
  8628. /**
  8629. * The line number of the source that triggered this console message
  8630. */
  8631. line: number,
  8632. sourceId: string) => void): this;
  8633. /**
  8634. * Emitted when there is a new context menu that needs to be handled.
  8635. */
  8636. on(event: 'context-menu', listener: (event: Event,
  8637. params: ContextMenuParams) => void): this;
  8638. once(event: 'context-menu', listener: (event: Event,
  8639. params: ContextMenuParams) => void): this;
  8640. addListener(event: 'context-menu', listener: (event: Event,
  8641. params: ContextMenuParams) => void): this;
  8642. removeListener(event: 'context-menu', listener: (event: Event,
  8643. params: ContextMenuParams) => void): this;
  8644. /**
  8645. * Emitted when the renderer process crashes or is killed.
  8646. *
  8647. * **Deprecated:** This event is superceded by the `render-process-gone` event
  8648. * which contains more information about why the render process disappeared. It
  8649. * isn't always because it crashed. The `killed` boolean can be replaced by
  8650. * checking `reason === 'killed'` when you switch to that event.
  8651. *
  8652. * @deprecated
  8653. */
  8654. on(event: 'crashed', listener: (event: Event,
  8655. killed: boolean) => void): this;
  8656. once(event: 'crashed', listener: (event: Event,
  8657. killed: boolean) => void): this;
  8658. addListener(event: 'crashed', listener: (event: Event,
  8659. killed: boolean) => void): this;
  8660. removeListener(event: 'crashed', listener: (event: Event,
  8661. killed: boolean) => void): this;
  8662. /**
  8663. * Emitted when the cursor's type changes. The `type` parameter can be `default`,
  8664. * `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
  8665. * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
  8666. * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
  8667. * `row-resize`, `m-panning`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`,
  8668. * `s-panning`, `se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`,
  8669. * `cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`, `none`,
  8670. * `not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing` or `custom`.
  8671. *
  8672. * If the `type` parameter is `custom`, the `image` parameter will hold the custom
  8673. * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
  8674. * additional information about the custom cursor.
  8675. */
  8676. on(event: 'cursor-changed', listener: (event: Event,
  8677. type: string,
  8678. image: NativeImage,
  8679. /**
  8680. * scaling factor for the custom cursor.
  8681. */
  8682. scale: number,
  8683. /**
  8684. * the size of the `image`.
  8685. */
  8686. size: Size,
  8687. /**
  8688. * coordinates of the custom cursor's hotspot.
  8689. */
  8690. hotspot: Point) => void): this;
  8691. once(event: 'cursor-changed', listener: (event: Event,
  8692. type: string,
  8693. image: NativeImage,
  8694. /**
  8695. * scaling factor for the custom cursor.
  8696. */
  8697. scale: number,
  8698. /**
  8699. * the size of the `image`.
  8700. */
  8701. size: Size,
  8702. /**
  8703. * coordinates of the custom cursor's hotspot.
  8704. */
  8705. hotspot: Point) => void): this;
  8706. addListener(event: 'cursor-changed', listener: (event: Event,
  8707. type: string,
  8708. image: NativeImage,
  8709. /**
  8710. * scaling factor for the custom cursor.
  8711. */
  8712. scale: number,
  8713. /**
  8714. * the size of the `image`.
  8715. */
  8716. size: Size,
  8717. /**
  8718. * coordinates of the custom cursor's hotspot.
  8719. */
  8720. hotspot: Point) => void): this;
  8721. removeListener(event: 'cursor-changed', listener: (event: Event,
  8722. type: string,
  8723. image: NativeImage,
  8724. /**
  8725. * scaling factor for the custom cursor.
  8726. */
  8727. scale: number,
  8728. /**
  8729. * the size of the `image`.
  8730. */
  8731. size: Size,
  8732. /**
  8733. * coordinates of the custom cursor's hotspot.
  8734. */
  8735. hotspot: Point) => void): this;
  8736. /**
  8737. * Emitted when `desktopCapturer.getSources()` is called in the renderer process.
  8738. * Calling `event.preventDefault()` will make it return empty sources.
  8739. */
  8740. on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8741. once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8742. addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8743. removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8744. /**
  8745. * Emitted when `webContents` is destroyed.
  8746. */
  8747. on(event: 'destroyed', listener: Function): this;
  8748. once(event: 'destroyed', listener: Function): this;
  8749. addListener(event: 'destroyed', listener: Function): this;
  8750. removeListener(event: 'destroyed', listener: Function): this;
  8751. /**
  8752. * Emitted when DevTools is closed.
  8753. */
  8754. on(event: 'devtools-closed', listener: Function): this;
  8755. once(event: 'devtools-closed', listener: Function): this;
  8756. addListener(event: 'devtools-closed', listener: Function): this;
  8757. removeListener(event: 'devtools-closed', listener: Function): this;
  8758. /**
  8759. * Emitted when DevTools is focused / opened.
  8760. */
  8761. on(event: 'devtools-focused', listener: Function): this;
  8762. once(event: 'devtools-focused', listener: Function): this;
  8763. addListener(event: 'devtools-focused', listener: Function): this;
  8764. removeListener(event: 'devtools-focused', listener: Function): this;
  8765. /**
  8766. * Emitted when DevTools is opened.
  8767. */
  8768. on(event: 'devtools-opened', listener: Function): this;
  8769. once(event: 'devtools-opened', listener: Function): this;
  8770. addListener(event: 'devtools-opened', listener: Function): this;
  8771. removeListener(event: 'devtools-opened', listener: Function): this;
  8772. /**
  8773. * Emitted when the devtools window instructs the webContents to reload
  8774. */
  8775. on(event: 'devtools-reload-page', listener: Function): this;
  8776. once(event: 'devtools-reload-page', listener: Function): this;
  8777. addListener(event: 'devtools-reload-page', listener: Function): this;
  8778. removeListener(event: 'devtools-reload-page', listener: Function): this;
  8779. /**
  8780. * Emitted when a `<webview>` has been attached to this web contents.
  8781. */
  8782. on(event: 'did-attach-webview', listener: (event: Event,
  8783. /**
  8784. * The guest web contents that is used by the `<webview>`.
  8785. */
  8786. webContents: WebContents) => void): this;
  8787. once(event: 'did-attach-webview', listener: (event: Event,
  8788. /**
  8789. * The guest web contents that is used by the `<webview>`.
  8790. */
  8791. webContents: WebContents) => void): this;
  8792. addListener(event: 'did-attach-webview', listener: (event: Event,
  8793. /**
  8794. * The guest web contents that is used by the `<webview>`.
  8795. */
  8796. webContents: WebContents) => void): this;
  8797. removeListener(event: 'did-attach-webview', listener: (event: Event,
  8798. /**
  8799. * The guest web contents that is used by the `<webview>`.
  8800. */
  8801. webContents: WebContents) => void): this;
  8802. /**
  8803. * Emitted when a page's theme color changes. This is usually due to encountering a
  8804. * meta tag:
  8805. */
  8806. on(event: 'did-change-theme-color', listener: (event: Event,
  8807. /**
  8808. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8809. */
  8810. color: (string) | (null)) => void): this;
  8811. once(event: 'did-change-theme-color', listener: (event: Event,
  8812. /**
  8813. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8814. */
  8815. color: (string) | (null)) => void): this;
  8816. addListener(event: 'did-change-theme-color', listener: (event: Event,
  8817. /**
  8818. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8819. */
  8820. color: (string) | (null)) => void): this;
  8821. removeListener(event: 'did-change-theme-color', listener: (event: Event,
  8822. /**
  8823. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8824. */
  8825. color: (string) | (null)) => void): this;
  8826. /**
  8827. * Emitted _after_ successful creation of a window via `window.open` in the
  8828. * renderer. Not emitted if the creation of the window is canceled from
  8829. * `webContents.setWindowOpenHandler`.
  8830. *
  8831. * See `window.open()` for more details and how to use this in conjunction with
  8832. * `webContents.setWindowOpenHandler`.
  8833. */
  8834. on(event: 'did-create-window', listener: (window: BrowserWindow,
  8835. details: DidCreateWindowDetails) => void): this;
  8836. once(event: 'did-create-window', listener: (window: BrowserWindow,
  8837. details: DidCreateWindowDetails) => void): this;
  8838. addListener(event: 'did-create-window', listener: (window: BrowserWindow,
  8839. details: DidCreateWindowDetails) => void): this;
  8840. removeListener(event: 'did-create-window', listener: (window: BrowserWindow,
  8841. details: DidCreateWindowDetails) => void): this;
  8842. /**
  8843. * This event is like `did-finish-load` but emitted when the load failed. The full
  8844. * list of error codes and their meaning is available here.
  8845. */
  8846. on(event: 'did-fail-load', listener: (event: Event,
  8847. errorCode: number,
  8848. errorDescription: string,
  8849. validatedURL: string,
  8850. isMainFrame: boolean,
  8851. frameProcessId: number,
  8852. frameRoutingId: number) => void): this;
  8853. once(event: 'did-fail-load', listener: (event: Event,
  8854. errorCode: number,
  8855. errorDescription: string,
  8856. validatedURL: string,
  8857. isMainFrame: boolean,
  8858. frameProcessId: number,
  8859. frameRoutingId: number) => void): this;
  8860. addListener(event: 'did-fail-load', listener: (event: Event,
  8861. errorCode: number,
  8862. errorDescription: string,
  8863. validatedURL: string,
  8864. isMainFrame: boolean,
  8865. frameProcessId: number,
  8866. frameRoutingId: number) => void): this;
  8867. removeListener(event: 'did-fail-load', listener: (event: Event,
  8868. errorCode: number,
  8869. errorDescription: string,
  8870. validatedURL: string,
  8871. isMainFrame: boolean,
  8872. frameProcessId: number,
  8873. frameRoutingId: number) => void): this;
  8874. /**
  8875. * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
  8876. * `window.stop()` was invoked).
  8877. */
  8878. on(event: 'did-fail-provisional-load', listener: (event: Event,
  8879. errorCode: number,
  8880. errorDescription: string,
  8881. validatedURL: string,
  8882. isMainFrame: boolean,
  8883. frameProcessId: number,
  8884. frameRoutingId: number) => void): this;
  8885. once(event: 'did-fail-provisional-load', listener: (event: Event,
  8886. errorCode: number,
  8887. errorDescription: string,
  8888. validatedURL: string,
  8889. isMainFrame: boolean,
  8890. frameProcessId: number,
  8891. frameRoutingId: number) => void): this;
  8892. addListener(event: 'did-fail-provisional-load', listener: (event: Event,
  8893. errorCode: number,
  8894. errorDescription: string,
  8895. validatedURL: string,
  8896. isMainFrame: boolean,
  8897. frameProcessId: number,
  8898. frameRoutingId: number) => void): this;
  8899. removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
  8900. errorCode: number,
  8901. errorDescription: string,
  8902. validatedURL: string,
  8903. isMainFrame: boolean,
  8904. frameProcessId: number,
  8905. frameRoutingId: number) => void): this;
  8906. /**
  8907. * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
  8908. * spinning, and the `onload` event was dispatched.
  8909. */
  8910. on(event: 'did-finish-load', listener: Function): this;
  8911. once(event: 'did-finish-load', listener: Function): this;
  8912. addListener(event: 'did-finish-load', listener: Function): this;
  8913. removeListener(event: 'did-finish-load', listener: Function): this;
  8914. /**
  8915. * Emitted when a frame has done navigation.
  8916. */
  8917. on(event: 'did-frame-finish-load', listener: (event: Event,
  8918. isMainFrame: boolean,
  8919. frameProcessId: number,
  8920. frameRoutingId: number) => void): this;
  8921. once(event: 'did-frame-finish-load', listener: (event: Event,
  8922. isMainFrame: boolean,
  8923. frameProcessId: number,
  8924. frameRoutingId: number) => void): this;
  8925. addListener(event: 'did-frame-finish-load', listener: (event: Event,
  8926. isMainFrame: boolean,
  8927. frameProcessId: number,
  8928. frameRoutingId: number) => void): this;
  8929. removeListener(event: 'did-frame-finish-load', listener: (event: Event,
  8930. isMainFrame: boolean,
  8931. frameProcessId: number,
  8932. frameRoutingId: number) => void): this;
  8933. /**
  8934. * Emitted when any frame navigation is done.
  8935. *
  8936. * This event is not emitted for in-page navigations, such as clicking anchor links
  8937. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  8938. * this purpose.
  8939. */
  8940. on(event: 'did-frame-navigate', listener: (event: Event,
  8941. url: string,
  8942. /**
  8943. * -1 for non HTTP navigations
  8944. */
  8945. httpResponseCode: number,
  8946. /**
  8947. * empty for non HTTP navigations,
  8948. */
  8949. httpStatusText: string,
  8950. isMainFrame: boolean,
  8951. frameProcessId: number,
  8952. frameRoutingId: number) => void): this;
  8953. once(event: 'did-frame-navigate', listener: (event: Event,
  8954. url: string,
  8955. /**
  8956. * -1 for non HTTP navigations
  8957. */
  8958. httpResponseCode: number,
  8959. /**
  8960. * empty for non HTTP navigations,
  8961. */
  8962. httpStatusText: string,
  8963. isMainFrame: boolean,
  8964. frameProcessId: number,
  8965. frameRoutingId: number) => void): this;
  8966. addListener(event: 'did-frame-navigate', listener: (event: Event,
  8967. url: string,
  8968. /**
  8969. * -1 for non HTTP navigations
  8970. */
  8971. httpResponseCode: number,
  8972. /**
  8973. * empty for non HTTP navigations,
  8974. */
  8975. httpStatusText: string,
  8976. isMainFrame: boolean,
  8977. frameProcessId: number,
  8978. frameRoutingId: number) => void): this;
  8979. removeListener(event: 'did-frame-navigate', listener: (event: Event,
  8980. url: string,
  8981. /**
  8982. * -1 for non HTTP navigations
  8983. */
  8984. httpResponseCode: number,
  8985. /**
  8986. * empty for non HTTP navigations,
  8987. */
  8988. httpStatusText: string,
  8989. isMainFrame: boolean,
  8990. frameProcessId: number,
  8991. frameRoutingId: number) => void): this;
  8992. /**
  8993. * Emitted when a main frame navigation is done.
  8994. *
  8995. * This event is not emitted for in-page navigations, such as clicking anchor links
  8996. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  8997. * this purpose.
  8998. */
  8999. on(event: 'did-navigate', listener: (event: Event,
  9000. url: string,
  9001. /**
  9002. * -1 for non HTTP navigations
  9003. */
  9004. httpResponseCode: number,
  9005. /**
  9006. * empty for non HTTP navigations
  9007. */
  9008. httpStatusText: string) => void): this;
  9009. once(event: 'did-navigate', listener: (event: Event,
  9010. url: string,
  9011. /**
  9012. * -1 for non HTTP navigations
  9013. */
  9014. httpResponseCode: number,
  9015. /**
  9016. * empty for non HTTP navigations
  9017. */
  9018. httpStatusText: string) => void): this;
  9019. addListener(event: 'did-navigate', listener: (event: Event,
  9020. url: string,
  9021. /**
  9022. * -1 for non HTTP navigations
  9023. */
  9024. httpResponseCode: number,
  9025. /**
  9026. * empty for non HTTP navigations
  9027. */
  9028. httpStatusText: string) => void): this;
  9029. removeListener(event: 'did-navigate', listener: (event: Event,
  9030. url: string,
  9031. /**
  9032. * -1 for non HTTP navigations
  9033. */
  9034. httpResponseCode: number,
  9035. /**
  9036. * empty for non HTTP navigations
  9037. */
  9038. httpStatusText: string) => void): this;
  9039. /**
  9040. * Emitted when an in-page navigation happened in any frame.
  9041. *
  9042. * When in-page navigation happens, the page URL changes but does not cause
  9043. * navigation outside of the page. Examples of this occurring are when anchor links
  9044. * are clicked or when the DOM `hashchange` event is triggered.
  9045. */
  9046. on(event: 'did-navigate-in-page', listener: (event: Event,
  9047. url: string,
  9048. isMainFrame: boolean,
  9049. frameProcessId: number,
  9050. frameRoutingId: number) => void): this;
  9051. once(event: 'did-navigate-in-page', listener: (event: Event,
  9052. url: string,
  9053. isMainFrame: boolean,
  9054. frameProcessId: number,
  9055. frameRoutingId: number) => void): this;
  9056. addListener(event: 'did-navigate-in-page', listener: (event: Event,
  9057. url: string,
  9058. isMainFrame: boolean,
  9059. frameProcessId: number,
  9060. frameRoutingId: number) => void): this;
  9061. removeListener(event: 'did-navigate-in-page', listener: (event: Event,
  9062. url: string,
  9063. isMainFrame: boolean,
  9064. frameProcessId: number,
  9065. frameRoutingId: number) => void): this;
  9066. /**
  9067. * Emitted after a server side redirect occurs during navigation. For example a
  9068. * 302 redirect.
  9069. *
  9070. * This event cannot be prevented, if you want to prevent redirects you should
  9071. * checkout out the `will-redirect` event above.
  9072. */
  9073. on(event: 'did-redirect-navigation', listener: (event: Event,
  9074. url: string,
  9075. isInPlace: boolean,
  9076. isMainFrame: boolean,
  9077. frameProcessId: number,
  9078. frameRoutingId: number) => void): this;
  9079. once(event: 'did-redirect-navigation', listener: (event: Event,
  9080. url: string,
  9081. isInPlace: boolean,
  9082. isMainFrame: boolean,
  9083. frameProcessId: number,
  9084. frameRoutingId: number) => void): this;
  9085. addListener(event: 'did-redirect-navigation', listener: (event: Event,
  9086. url: string,
  9087. isInPlace: boolean,
  9088. isMainFrame: boolean,
  9089. frameProcessId: number,
  9090. frameRoutingId: number) => void): this;
  9091. removeListener(event: 'did-redirect-navigation', listener: (event: Event,
  9092. url: string,
  9093. isInPlace: boolean,
  9094. isMainFrame: boolean,
  9095. frameProcessId: number,
  9096. frameRoutingId: number) => void): this;
  9097. /**
  9098. * Corresponds to the points in time when the spinner of the tab started spinning.
  9099. */
  9100. on(event: 'did-start-loading', listener: Function): this;
  9101. once(event: 'did-start-loading', listener: Function): this;
  9102. addListener(event: 'did-start-loading', listener: Function): this;
  9103. removeListener(event: 'did-start-loading', listener: Function): this;
  9104. /**
  9105. * Emitted when any frame (including main) starts navigating. `isInPlace` will be
  9106. * `true` for in-page navigations.
  9107. */
  9108. on(event: 'did-start-navigation', listener: (event: Event,
  9109. url: string,
  9110. isInPlace: boolean,
  9111. isMainFrame: boolean,
  9112. frameProcessId: number,
  9113. frameRoutingId: number) => void): this;
  9114. once(event: 'did-start-navigation', listener: (event: Event,
  9115. url: string,
  9116. isInPlace: boolean,
  9117. isMainFrame: boolean,
  9118. frameProcessId: number,
  9119. frameRoutingId: number) => void): this;
  9120. addListener(event: 'did-start-navigation', listener: (event: Event,
  9121. url: string,
  9122. isInPlace: boolean,
  9123. isMainFrame: boolean,
  9124. frameProcessId: number,
  9125. frameRoutingId: number) => void): this;
  9126. removeListener(event: 'did-start-navigation', listener: (event: Event,
  9127. url: string,
  9128. isInPlace: boolean,
  9129. isMainFrame: boolean,
  9130. frameProcessId: number,
  9131. frameRoutingId: number) => void): this;
  9132. /**
  9133. * Corresponds to the points in time when the spinner of the tab stopped spinning.
  9134. */
  9135. on(event: 'did-stop-loading', listener: Function): this;
  9136. once(event: 'did-stop-loading', listener: Function): this;
  9137. addListener(event: 'did-stop-loading', listener: Function): this;
  9138. removeListener(event: 'did-stop-loading', listener: Function): this;
  9139. /**
  9140. * Emitted when the document in the given frame is loaded.
  9141. */
  9142. on(event: 'dom-ready', listener: (event: Event) => void): this;
  9143. once(event: 'dom-ready', listener: (event: Event) => void): this;
  9144. addListener(event: 'dom-ready', listener: (event: Event) => void): this;
  9145. removeListener(event: 'dom-ready', listener: (event: Event) => void): this;
  9146. /**
  9147. * Emitted when the window enters a full-screen state triggered by HTML API.
  9148. */
  9149. on(event: 'enter-html-full-screen', listener: Function): this;
  9150. once(event: 'enter-html-full-screen', listener: Function): this;
  9151. addListener(event: 'enter-html-full-screen', listener: Function): this;
  9152. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  9153. /**
  9154. * Emitted when a result is available for [`webContents.findInPage`] request.
  9155. */
  9156. on(event: 'found-in-page', listener: (event: Event,
  9157. result: Result) => void): this;
  9158. once(event: 'found-in-page', listener: (event: Event,
  9159. result: Result) => void): this;
  9160. addListener(event: 'found-in-page', listener: (event: Event,
  9161. result: Result) => void): this;
  9162. removeListener(event: 'found-in-page', listener: (event: Event,
  9163. result: Result) => void): this;
  9164. /**
  9165. * Emitted when the renderer process sends an asynchronous message via
  9166. * `ipcRenderer.send()`.
  9167. */
  9168. on(event: 'ipc-message', listener: (event: Event,
  9169. channel: string,
  9170. ...args: any[]) => void): this;
  9171. once(event: 'ipc-message', listener: (event: Event,
  9172. channel: string,
  9173. ...args: any[]) => void): this;
  9174. addListener(event: 'ipc-message', listener: (event: Event,
  9175. channel: string,
  9176. ...args: any[]) => void): this;
  9177. removeListener(event: 'ipc-message', listener: (event: Event,
  9178. channel: string,
  9179. ...args: any[]) => void): this;
  9180. /**
  9181. * Emitted when the renderer process sends a synchronous message via
  9182. * `ipcRenderer.sendSync()`.
  9183. */
  9184. on(event: 'ipc-message-sync', listener: (event: Event,
  9185. channel: string,
  9186. ...args: any[]) => void): this;
  9187. once(event: 'ipc-message-sync', listener: (event: Event,
  9188. channel: string,
  9189. ...args: any[]) => void): this;
  9190. addListener(event: 'ipc-message-sync', listener: (event: Event,
  9191. channel: string,
  9192. ...args: any[]) => void): this;
  9193. removeListener(event: 'ipc-message-sync', listener: (event: Event,
  9194. channel: string,
  9195. ...args: any[]) => void): this;
  9196. /**
  9197. * Emitted when the window leaves a full-screen state triggered by HTML API.
  9198. */
  9199. on(event: 'leave-html-full-screen', listener: Function): this;
  9200. once(event: 'leave-html-full-screen', listener: Function): this;
  9201. addListener(event: 'leave-html-full-screen', listener: Function): this;
  9202. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  9203. /**
  9204. * Emitted when `webContents` wants to do basic auth.
  9205. *
  9206. The usage is the same with the `login` event of `app`.
  9207. */
  9208. on(event: 'login', listener: (event: Event,
  9209. authenticationResponseDetails: AuthenticationResponseDetails,
  9210. authInfo: AuthInfo,
  9211. callback: (username?: string, password?: string) => void) => void): this;
  9212. once(event: 'login', listener: (event: Event,
  9213. authenticationResponseDetails: AuthenticationResponseDetails,
  9214. authInfo: AuthInfo,
  9215. callback: (username?: string, password?: string) => void) => void): this;
  9216. addListener(event: 'login', listener: (event: Event,
  9217. authenticationResponseDetails: AuthenticationResponseDetails,
  9218. authInfo: AuthInfo,
  9219. callback: (username?: string, password?: string) => void) => void): this;
  9220. removeListener(event: 'login', listener: (event: Event,
  9221. authenticationResponseDetails: AuthenticationResponseDetails,
  9222. authInfo: AuthInfo,
  9223. callback: (username?: string, password?: string) => void) => void): this;
  9224. /**
  9225. * Emitted when media is paused or done playing.
  9226. */
  9227. on(event: 'media-paused', listener: Function): this;
  9228. once(event: 'media-paused', listener: Function): this;
  9229. addListener(event: 'media-paused', listener: Function): this;
  9230. removeListener(event: 'media-paused', listener: Function): this;
  9231. /**
  9232. * Emitted when media starts playing.
  9233. */
  9234. on(event: 'media-started-playing', listener: Function): this;
  9235. once(event: 'media-started-playing', listener: Function): this;
  9236. addListener(event: 'media-started-playing', listener: Function): this;
  9237. removeListener(event: 'media-started-playing', listener: Function): this;
  9238. /**
  9239. * Deprecated in favor of `webContents.setWindowOpenHandler`.
  9240. *
  9241. * Emitted when the page requests to open a new window for a `url`. It could be
  9242. * requested by `window.open` or an external link like `<a target='_blank'>`.
  9243. *
  9244. * By default a new `BrowserWindow` will be created for the `url`.
  9245. *
  9246. * Calling `event.preventDefault()` will prevent Electron from automatically
  9247. * creating a new `BrowserWindow`. If you call `event.preventDefault()` and
  9248. * manually create a new `BrowserWindow` then you must set `event.newGuest` to
  9249. * reference the new `BrowserWindow` instance, failing to do so may result in
  9250. * unexpected behavior. For example:
  9251. *
  9252. * @deprecated
  9253. */
  9254. on(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9255. url: string,
  9256. frameName: string,
  9257. /**
  9258. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9259. * `save-to-disk` and `other`.
  9260. */
  9261. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9262. /**
  9263. * The options which will be used for creating the new `BrowserWindow`.
  9264. */
  9265. options: BrowserWindowConstructorOptions,
  9266. /**
  9267. * The non-standard features (features not handled by Chromium or Electron) given
  9268. * to `window.open()`.
  9269. */
  9270. additionalFeatures: string[],
  9271. /**
  9272. * The referrer that will be passed to the new window. May or may not result in the
  9273. * `Referer` header being sent, depending on the referrer policy.
  9274. */
  9275. referrer: Referrer,
  9276. /**
  9277. * The post data that will be sent to the new window, along with the appropriate
  9278. * headers that will be set. If no post data is to be sent, the value will be
  9279. * `null`. Only defined when the window is being created by a form that set
  9280. * `target=_blank`.
  9281. */
  9282. postBody: PostBody) => void): this;
  9283. once(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9284. url: string,
  9285. frameName: string,
  9286. /**
  9287. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9288. * `save-to-disk` and `other`.
  9289. */
  9290. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9291. /**
  9292. * The options which will be used for creating the new `BrowserWindow`.
  9293. */
  9294. options: BrowserWindowConstructorOptions,
  9295. /**
  9296. * The non-standard features (features not handled by Chromium or Electron) given
  9297. * to `window.open()`.
  9298. */
  9299. additionalFeatures: string[],
  9300. /**
  9301. * The referrer that will be passed to the new window. May or may not result in the
  9302. * `Referer` header being sent, depending on the referrer policy.
  9303. */
  9304. referrer: Referrer,
  9305. /**
  9306. * The post data that will be sent to the new window, along with the appropriate
  9307. * headers that will be set. If no post data is to be sent, the value will be
  9308. * `null`. Only defined when the window is being created by a form that set
  9309. * `target=_blank`.
  9310. */
  9311. postBody: PostBody) => void): this;
  9312. addListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9313. url: string,
  9314. frameName: string,
  9315. /**
  9316. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9317. * `save-to-disk` and `other`.
  9318. */
  9319. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9320. /**
  9321. * The options which will be used for creating the new `BrowserWindow`.
  9322. */
  9323. options: BrowserWindowConstructorOptions,
  9324. /**
  9325. * The non-standard features (features not handled by Chromium or Electron) given
  9326. * to `window.open()`.
  9327. */
  9328. additionalFeatures: string[],
  9329. /**
  9330. * The referrer that will be passed to the new window. May or may not result in the
  9331. * `Referer` header being sent, depending on the referrer policy.
  9332. */
  9333. referrer: Referrer,
  9334. /**
  9335. * The post data that will be sent to the new window, along with the appropriate
  9336. * headers that will be set. If no post data is to be sent, the value will be
  9337. * `null`. Only defined when the window is being created by a form that set
  9338. * `target=_blank`.
  9339. */
  9340. postBody: PostBody) => void): this;
  9341. removeListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9342. url: string,
  9343. frameName: string,
  9344. /**
  9345. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9346. * `save-to-disk` and `other`.
  9347. */
  9348. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9349. /**
  9350. * The options which will be used for creating the new `BrowserWindow`.
  9351. */
  9352. options: BrowserWindowConstructorOptions,
  9353. /**
  9354. * The non-standard features (features not handled by Chromium or Electron) given
  9355. * to `window.open()`.
  9356. */
  9357. additionalFeatures: string[],
  9358. /**
  9359. * The referrer that will be passed to the new window. May or may not result in the
  9360. * `Referer` header being sent, depending on the referrer policy.
  9361. */
  9362. referrer: Referrer,
  9363. /**
  9364. * The post data that will be sent to the new window, along with the appropriate
  9365. * headers that will be set. If no post data is to be sent, the value will be
  9366. * `null`. Only defined when the window is being created by a form that set
  9367. * `target=_blank`.
  9368. */
  9369. postBody: PostBody) => void): this;
  9370. /**
  9371. * Emitted when page receives favicon urls.
  9372. */
  9373. on(event: 'page-favicon-updated', listener: (event: Event,
  9374. /**
  9375. * Array of URLs.
  9376. */
  9377. favicons: string[]) => void): this;
  9378. once(event: 'page-favicon-updated', listener: (event: Event,
  9379. /**
  9380. * Array of URLs.
  9381. */
  9382. favicons: string[]) => void): this;
  9383. addListener(event: 'page-favicon-updated', listener: (event: Event,
  9384. /**
  9385. * Array of URLs.
  9386. */
  9387. favicons: string[]) => void): this;
  9388. removeListener(event: 'page-favicon-updated', listener: (event: Event,
  9389. /**
  9390. * Array of URLs.
  9391. */
  9392. favicons: string[]) => void): this;
  9393. /**
  9394. * Fired when page title is set during navigation. `explicitSet` is false when
  9395. * title is synthesized from file url.
  9396. */
  9397. on(event: 'page-title-updated', listener: (event: Event,
  9398. title: string,
  9399. explicitSet: boolean) => void): this;
  9400. once(event: 'page-title-updated', listener: (event: Event,
  9401. title: string,
  9402. explicitSet: boolean) => void): this;
  9403. addListener(event: 'page-title-updated', listener: (event: Event,
  9404. title: string,
  9405. explicitSet: boolean) => void): this;
  9406. removeListener(event: 'page-title-updated', listener: (event: Event,
  9407. title: string,
  9408. explicitSet: boolean) => void): this;
  9409. /**
  9410. * Emitted when a new frame is generated. Only the dirty area is passed in the
  9411. * buffer.
  9412. */
  9413. on(event: 'paint', listener: (event: Event,
  9414. dirtyRect: Rectangle,
  9415. /**
  9416. * The image data of the whole frame.
  9417. */
  9418. image: NativeImage) => void): this;
  9419. once(event: 'paint', listener: (event: Event,
  9420. dirtyRect: Rectangle,
  9421. /**
  9422. * The image data of the whole frame.
  9423. */
  9424. image: NativeImage) => void): this;
  9425. addListener(event: 'paint', listener: (event: Event,
  9426. dirtyRect: Rectangle,
  9427. /**
  9428. * The image data of the whole frame.
  9429. */
  9430. image: NativeImage) => void): this;
  9431. removeListener(event: 'paint', listener: (event: Event,
  9432. dirtyRect: Rectangle,
  9433. /**
  9434. * The image data of the whole frame.
  9435. */
  9436. image: NativeImage) => void): this;
  9437. /**
  9438. * Emitted when a plugin process has crashed.
  9439. */
  9440. on(event: 'plugin-crashed', listener: (event: Event,
  9441. name: string,
  9442. version: string) => void): this;
  9443. once(event: 'plugin-crashed', listener: (event: Event,
  9444. name: string,
  9445. version: string) => void): this;
  9446. addListener(event: 'plugin-crashed', listener: (event: Event,
  9447. name: string,
  9448. version: string) => void): this;
  9449. removeListener(event: 'plugin-crashed', listener: (event: Event,
  9450. name: string,
  9451. version: string) => void): this;
  9452. /**
  9453. * Emitted when the `WebContents` preferred size has changed.
  9454. *
  9455. * This event will only be emitted when `enablePreferredSizeMode` is set to `true`
  9456. * in `webPreferences`.
  9457. */
  9458. on(event: 'preferred-size-changed', listener: (event: Event,
  9459. /**
  9460. * The minimum size needed to contain the layout of the document—without requiring
  9461. * scrolling.
  9462. */
  9463. preferredSize: Size) => void): this;
  9464. once(event: 'preferred-size-changed', listener: (event: Event,
  9465. /**
  9466. * The minimum size needed to contain the layout of the document—without requiring
  9467. * scrolling.
  9468. */
  9469. preferredSize: Size) => void): this;
  9470. addListener(event: 'preferred-size-changed', listener: (event: Event,
  9471. /**
  9472. * The minimum size needed to contain the layout of the document—without requiring
  9473. * scrolling.
  9474. */
  9475. preferredSize: Size) => void): this;
  9476. removeListener(event: 'preferred-size-changed', listener: (event: Event,
  9477. /**
  9478. * The minimum size needed to contain the layout of the document—without requiring
  9479. * scrolling.
  9480. */
  9481. preferredSize: Size) => void): this;
  9482. /**
  9483. * Emitted when the preload script `preloadPath` throws an unhandled exception
  9484. * `error`.
  9485. */
  9486. on(event: 'preload-error', listener: (event: Event,
  9487. preloadPath: string,
  9488. error: Error) => void): this;
  9489. once(event: 'preload-error', listener: (event: Event,
  9490. preloadPath: string,
  9491. error: Error) => void): this;
  9492. addListener(event: 'preload-error', listener: (event: Event,
  9493. preloadPath: string,
  9494. error: Error) => void): this;
  9495. removeListener(event: 'preload-error', listener: (event: Event,
  9496. preloadPath: string,
  9497. error: Error) => void): this;
  9498. /**
  9499. * Emitted when `remote.getBuiltin()` is called in the renderer process. Calling
  9500. * `event.preventDefault()` will prevent the module from being returned. Custom
  9501. * value can be returned by setting `event.returnValue`.
  9502. *
  9503. * @deprecated
  9504. */
  9505. on(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9506. moduleName: string) => void): this;
  9507. once(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9508. moduleName: string) => void): this;
  9509. addListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9510. moduleName: string) => void): this;
  9511. removeListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9512. moduleName: string) => void): this;
  9513. /**
  9514. * Emitted when `remote.getCurrentWebContents()` is called in the renderer process.
  9515. * Calling `event.preventDefault()` will prevent the object from being returned.
  9516. * Custom value can be returned by setting `event.returnValue`.
  9517. *
  9518. * @deprecated
  9519. */
  9520. on(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9521. once(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9522. addListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9523. removeListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9524. /**
  9525. * Emitted when `remote.getCurrentWindow()` is called in the renderer process.
  9526. * Calling `event.preventDefault()` will prevent the object from being returned.
  9527. * Custom value can be returned by setting `event.returnValue`.
  9528. *
  9529. * @deprecated
  9530. */
  9531. on(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9532. once(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9533. addListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9534. removeListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9535. /**
  9536. * Emitted when `remote.getGlobal()` is called in the renderer process. Calling
  9537. * `event.preventDefault()` will prevent the global from being returned. Custom
  9538. * value can be returned by setting `event.returnValue`.
  9539. *
  9540. * @deprecated
  9541. */
  9542. on(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9543. globalName: string) => void): this;
  9544. once(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9545. globalName: string) => void): this;
  9546. addListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9547. globalName: string) => void): this;
  9548. removeListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9549. globalName: string) => void): this;
  9550. /**
  9551. * Emitted when `remote.require()` is called in the renderer process. Calling
  9552. * `event.preventDefault()` will prevent the module from being returned. Custom
  9553. * value can be returned by setting `event.returnValue`.
  9554. *
  9555. * @deprecated
  9556. */
  9557. on(event: 'remote-require', listener: (event: IpcMainEvent,
  9558. moduleName: string) => void): this;
  9559. once(event: 'remote-require', listener: (event: IpcMainEvent,
  9560. moduleName: string) => void): this;
  9561. addListener(event: 'remote-require', listener: (event: IpcMainEvent,
  9562. moduleName: string) => void): this;
  9563. removeListener(event: 'remote-require', listener: (event: IpcMainEvent,
  9564. moduleName: string) => void): this;
  9565. /**
  9566. * Emitted when the renderer process unexpectedly disappears. This is normally
  9567. * because it was crashed or killed.
  9568. */
  9569. on(event: 'render-process-gone', listener: (event: Event,
  9570. details: RenderProcessGoneDetails) => void): this;
  9571. once(event: 'render-process-gone', listener: (event: Event,
  9572. details: RenderProcessGoneDetails) => void): this;
  9573. addListener(event: 'render-process-gone', listener: (event: Event,
  9574. details: RenderProcessGoneDetails) => void): this;
  9575. removeListener(event: 'render-process-gone', listener: (event: Event,
  9576. details: RenderProcessGoneDetails) => void): this;
  9577. /**
  9578. * Emitted when the unresponsive web page becomes responsive again.
  9579. */
  9580. on(event: 'responsive', listener: Function): this;
  9581. once(event: 'responsive', listener: Function): this;
  9582. addListener(event: 'responsive', listener: Function): this;
  9583. removeListener(event: 'responsive', listener: Function): this;
  9584. /**
  9585. * Emitted when bluetooth device needs to be selected on call to
  9586. * `navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
  9587. * `webBluetooth` should be enabled. If `event.preventDefault` is not called, first
  9588. * available device will be selected. `callback` should be called with `deviceId`
  9589. * to be selected, passing empty string to `callback` will cancel the request.
  9590. */
  9591. on(event: 'select-bluetooth-device', listener: (event: Event,
  9592. devices: BluetoothDevice[],
  9593. callback: (deviceId: string) => void) => void): this;
  9594. once(event: 'select-bluetooth-device', listener: (event: Event,
  9595. devices: BluetoothDevice[],
  9596. callback: (deviceId: string) => void) => void): this;
  9597. addListener(event: 'select-bluetooth-device', listener: (event: Event,
  9598. devices: BluetoothDevice[],
  9599. callback: (deviceId: string) => void) => void): this;
  9600. removeListener(event: 'select-bluetooth-device', listener: (event: Event,
  9601. devices: BluetoothDevice[],
  9602. callback: (deviceId: string) => void) => void): this;
  9603. /**
  9604. * Emitted when a client certificate is requested.
  9605. *
  9606. The usage is the same with the `select-client-certificate` event of `app`.
  9607. */
  9608. on(event: 'select-client-certificate', listener: (event: Event,
  9609. url: string,
  9610. certificateList: Certificate[],
  9611. callback: (certificate: Certificate) => void) => void): this;
  9612. once(event: 'select-client-certificate', listener: (event: Event,
  9613. url: string,
  9614. certificateList: Certificate[],
  9615. callback: (certificate: Certificate) => void) => void): this;
  9616. addListener(event: 'select-client-certificate', listener: (event: Event,
  9617. url: string,
  9618. certificateList: Certificate[],
  9619. callback: (certificate: Certificate) => void) => void): this;
  9620. removeListener(event: 'select-client-certificate', listener: (event: Event,
  9621. url: string,
  9622. certificateList: Certificate[],
  9623. callback: (certificate: Certificate) => void) => void): this;
  9624. /**
  9625. * Emitted when the web page becomes unresponsive.
  9626. */
  9627. on(event: 'unresponsive', listener: Function): this;
  9628. once(event: 'unresponsive', listener: Function): this;
  9629. addListener(event: 'unresponsive', listener: Function): this;
  9630. removeListener(event: 'unresponsive', listener: Function): this;
  9631. /**
  9632. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  9633. */
  9634. on(event: 'update-target-url', listener: (event: Event,
  9635. url: string) => void): this;
  9636. once(event: 'update-target-url', listener: (event: Event,
  9637. url: string) => void): this;
  9638. addListener(event: 'update-target-url', listener: (event: Event,
  9639. url: string) => void): this;
  9640. removeListener(event: 'update-target-url', listener: (event: Event,
  9641. url: string) => void): this;
  9642. /**
  9643. * Emitted when a `<webview>`'s web contents is being attached to this web
  9644. * contents. Calling `event.preventDefault()` will destroy the guest page.
  9645. *
  9646. * This event can be used to configure `webPreferences` for the `webContents` of a
  9647. * `<webview>` before it's loaded, and provides the ability to set settings that
  9648. * can't be set via `<webview>` attributes.
  9649. *
  9650. * **Note:** The specified `preload` script option will appear as `preloadURL` (not
  9651. * `preload`) in the `webPreferences` object emitted with this event.
  9652. */
  9653. on(event: 'will-attach-webview', listener: (event: Event,
  9654. /**
  9655. * The web preferences that will be used by the guest page. This object can be
  9656. * modified to adjust the preferences for the guest page.
  9657. */
  9658. webPreferences: WebPreferences,
  9659. /**
  9660. * The other `<webview>` parameters such as the `src` URL. This object can be
  9661. * modified to adjust the parameters of the guest page.
  9662. */
  9663. params: Record<string, string>) => void): this;
  9664. once(event: 'will-attach-webview', listener: (event: Event,
  9665. /**
  9666. * The web preferences that will be used by the guest page. This object can be
  9667. * modified to adjust the preferences for the guest page.
  9668. */
  9669. webPreferences: WebPreferences,
  9670. /**
  9671. * The other `<webview>` parameters such as the `src` URL. This object can be
  9672. * modified to adjust the parameters of the guest page.
  9673. */
  9674. params: Record<string, string>) => void): this;
  9675. addListener(event: 'will-attach-webview', listener: (event: Event,
  9676. /**
  9677. * The web preferences that will be used by the guest page. This object can be
  9678. * modified to adjust the preferences for the guest page.
  9679. */
  9680. webPreferences: WebPreferences,
  9681. /**
  9682. * The other `<webview>` parameters such as the `src` URL. This object can be
  9683. * modified to adjust the parameters of the guest page.
  9684. */
  9685. params: Record<string, string>) => void): this;
  9686. removeListener(event: 'will-attach-webview', listener: (event: Event,
  9687. /**
  9688. * The web preferences that will be used by the guest page. This object can be
  9689. * modified to adjust the preferences for the guest page.
  9690. */
  9691. webPreferences: WebPreferences,
  9692. /**
  9693. * The other `<webview>` parameters such as the `src` URL. This object can be
  9694. * modified to adjust the parameters of the guest page.
  9695. */
  9696. params: Record<string, string>) => void): this;
  9697. /**
  9698. * Emitted when a user or the page wants to start navigation. It can happen when
  9699. * the `window.location` object is changed or a user clicks a link in the page.
  9700. *
  9701. * This event will not emit when the navigation is started programmatically with
  9702. * APIs like `webContents.loadURL` and `webContents.back`.
  9703. *
  9704. * It is also not emitted for in-page navigations, such as clicking anchor links or
  9705. * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
  9706. * purpose.
  9707. Calling `event.preventDefault()` will prevent the navigation.
  9708. */
  9709. on(event: 'will-navigate', listener: (event: Event,
  9710. url: string) => void): this;
  9711. once(event: 'will-navigate', listener: (event: Event,
  9712. url: string) => void): this;
  9713. addListener(event: 'will-navigate', listener: (event: Event,
  9714. url: string) => void): this;
  9715. removeListener(event: 'will-navigate', listener: (event: Event,
  9716. url: string) => void): this;
  9717. /**
  9718. * Emitted when a `beforeunload` event handler is attempting to cancel a page
  9719. * unload.
  9720. *
  9721. * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
  9722. * and allow the page to be unloaded.
  9723. */
  9724. on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9725. once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9726. addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9727. removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9728. /**
  9729. * Emitted as a server side redirect occurs during navigation. For example a 302
  9730. * redirect.
  9731. *
  9732. * This event will be emitted after `did-start-navigation` and always before the
  9733. * `did-redirect-navigation` event for the same navigation.
  9734. *
  9735. * Calling `event.preventDefault()` will prevent the navigation (not just the
  9736. * redirect).
  9737. */
  9738. on(event: 'will-redirect', listener: (event: Event,
  9739. url: string,
  9740. isInPlace: boolean,
  9741. isMainFrame: boolean,
  9742. frameProcessId: number,
  9743. frameRoutingId: number) => void): this;
  9744. once(event: 'will-redirect', listener: (event: Event,
  9745. url: string,
  9746. isInPlace: boolean,
  9747. isMainFrame: boolean,
  9748. frameProcessId: number,
  9749. frameRoutingId: number) => void): this;
  9750. addListener(event: 'will-redirect', listener: (event: Event,
  9751. url: string,
  9752. isInPlace: boolean,
  9753. isMainFrame: boolean,
  9754. frameProcessId: number,
  9755. frameRoutingId: number) => void): this;
  9756. removeListener(event: 'will-redirect', listener: (event: Event,
  9757. url: string,
  9758. isInPlace: boolean,
  9759. isMainFrame: boolean,
  9760. frameProcessId: number,
  9761. frameRoutingId: number) => void): this;
  9762. /**
  9763. * Emitted when the user is requesting to change the zoom level using the mouse
  9764. * wheel.
  9765. */
  9766. on(event: 'zoom-changed', listener: (event: Event,
  9767. /**
  9768. * Can be `in` or `out`.
  9769. */
  9770. zoomDirection: ('in' | 'out')) => void): this;
  9771. once(event: 'zoom-changed', listener: (event: Event,
  9772. /**
  9773. * Can be `in` or `out`.
  9774. */
  9775. zoomDirection: ('in' | 'out')) => void): this;
  9776. addListener(event: 'zoom-changed', listener: (event: Event,
  9777. /**
  9778. * Can be `in` or `out`.
  9779. */
  9780. zoomDirection: ('in' | 'out')) => void): this;
  9781. removeListener(event: 'zoom-changed', listener: (event: Event,
  9782. /**
  9783. * Can be `in` or `out`.
  9784. */
  9785. zoomDirection: ('in' | 'out')) => void): this;
  9786. /**
  9787. * Adds the specified path to DevTools workspace. Must be used after DevTools
  9788. * creation:
  9789. */
  9790. addWorkSpace(path: string): void;
  9791. /**
  9792. * Begin subscribing for presentation events and captured frames, the `callback`
  9793. * will be called with `callback(image, dirtyRect)` when there is a presentation
  9794. * event.
  9795. *
  9796. * The `image` is an instance of NativeImage that stores the captured frame.
  9797. *
  9798. * The `dirtyRect` is an object with `x, y, width, height` properties that
  9799. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  9800. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  9801. */
  9802. beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  9803. /**
  9804. * Begin subscribing for presentation events and captured frames, the `callback`
  9805. * will be called with `callback(image, dirtyRect)` when there is a presentation
  9806. * event.
  9807. *
  9808. * The `image` is an instance of NativeImage that stores the captured frame.
  9809. *
  9810. * The `dirtyRect` is an object with `x, y, width, height` properties that
  9811. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  9812. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  9813. */
  9814. beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  9815. /**
  9816. * Whether the browser can go back to previous web page.
  9817. */
  9818. canGoBack(): boolean;
  9819. /**
  9820. * Whether the browser can go forward to next web page.
  9821. */
  9822. canGoForward(): boolean;
  9823. /**
  9824. * Whether the web page can go to `offset`.
  9825. */
  9826. canGoToOffset(offset: number): boolean;
  9827. /**
  9828. * Resolves with a NativeImage
  9829. *
  9830. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  9831. * whole visible page.
  9832. */
  9833. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  9834. /**
  9835. * Clears the navigation history.
  9836. */
  9837. clearHistory(): void;
  9838. /**
  9839. * Closes the devtools.
  9840. */
  9841. closeDevTools(): void;
  9842. /**
  9843. * Executes the editing command `copy` in web page.
  9844. */
  9845. copy(): void;
  9846. /**
  9847. * Copy the image at the given position to the clipboard.
  9848. */
  9849. copyImageAt(x: number, y: number): void;
  9850. /**
  9851. * Executes the editing command `cut` in web page.
  9852. */
  9853. cut(): void;
  9854. /**
  9855. * Decrease the capturer count by one. The page will be set to hidden or occluded
  9856. * state when its browser window is hidden or occluded and the capturer count
  9857. * reaches zero. If you want to decrease the hidden capturer count instead you
  9858. * should set `stayHidden` to true.
  9859. */
  9860. decrementCapturerCount(stayHidden?: boolean, stayAwake?: boolean): void;
  9861. /**
  9862. * Executes the editing command `delete` in web page.
  9863. */
  9864. delete(): void;
  9865. /**
  9866. * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
  9867. */
  9868. disableDeviceEmulation(): void;
  9869. /**
  9870. * Initiates a download of the resource at `url` without navigating. The
  9871. * `will-download` event of `session` will be triggered.
  9872. */
  9873. downloadURL(url: string): void;
  9874. /**
  9875. * Enable device emulation with the given parameters.
  9876. */
  9877. enableDeviceEmulation(parameters: Parameters): void;
  9878. /**
  9879. * End subscribing for frame presentation events.
  9880. */
  9881. endFrameSubscription(): void;
  9882. /**
  9883. * A promise that resolves with the result of the executed code or is rejected if
  9884. * the result of the code is a rejected promise.
  9885. *
  9886. * Evaluates `code` in page.
  9887. *
  9888. * In the browser window some HTML APIs like `requestFullScreen` can only be
  9889. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  9890. * this limitation.
  9891. Code execution will be suspended until web page stop loading.
  9892. */
  9893. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  9894. /**
  9895. * A promise that resolves with the result of the executed code or is rejected if
  9896. * the result of the code is a rejected promise.
  9897. *
  9898. Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  9899. */
  9900. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
  9901. /**
  9902. * The request id used for the request.
  9903. *
  9904. * Starts a request to find all matches for the `text` in the web page. The result
  9905. * of the request can be obtained by subscribing to `found-in-page` event.
  9906. */
  9907. findInPage(text: string, options?: FindInPageOptions): number;
  9908. /**
  9909. * Focuses the web page.
  9910. */
  9911. focus(): void;
  9912. /**
  9913. * Forcefully terminates the renderer process that is currently hosting this
  9914. * `webContents`. This will cause the `render-process-gone` event to be emitted
  9915. * with the `reason=killed || reason=crashed`. Please note that some webContents
  9916. * share renderer processes and therefore calling this method may also crash the
  9917. * host process for other webContents as well.
  9918. *
  9919. * Calling `reload()` immediately after calling this method will force the reload
  9920. * to occur in a new process. This should be used when this process is unstable or
  9921. * unusable, for instance in order to recover from the `unresponsive` event.
  9922. */
  9923. forcefullyCrashRenderer(): void;
  9924. /**
  9925. * Information about all Shared Workers.
  9926. */
  9927. getAllSharedWorkers(): SharedWorkerInfo[];
  9928. /**
  9929. * whether or not this WebContents will throttle animations and timers when the
  9930. * page becomes backgrounded. This also affects the Page Visibility API.
  9931. */
  9932. getBackgroundThrottling(): boolean;
  9933. /**
  9934. * If *offscreen rendering* is enabled returns the current frame rate.
  9935. */
  9936. getFrameRate(): number;
  9937. /**
  9938. * The operating system `pid` of the associated renderer process.
  9939. */
  9940. getOSProcessId(): number;
  9941. /**
  9942. * Get the system printer list.
  9943. */
  9944. getPrinters(): PrinterInfo[];
  9945. /**
  9946. * The Chromium internal `pid` of the associated renderer. Can be compared to the
  9947. * `frameProcessId` passed by frame specific navigation events (e.g.
  9948. * `did-frame-navigate`)
  9949. */
  9950. getProcessId(): number;
  9951. /**
  9952. * The title of the current web page.
  9953. */
  9954. getTitle(): string;
  9955. /**
  9956. * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
  9957. * `remote`, `webview` or `offscreen`.
  9958. */
  9959. getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
  9960. /**
  9961. * The URL of the current web page.
  9962. */
  9963. getURL(): string;
  9964. /**
  9965. * The user agent for this web page.
  9966. */
  9967. getUserAgent(): string;
  9968. /**
  9969. * Returns the WebRTC IP Handling Policy.
  9970. */
  9971. getWebRTCIPHandlingPolicy(): string;
  9972. /**
  9973. * the current zoom factor.
  9974. */
  9975. getZoomFactor(): number;
  9976. /**
  9977. * the current zoom level.
  9978. */
  9979. getZoomLevel(): number;
  9980. /**
  9981. * Makes the browser go back a web page.
  9982. */
  9983. goBack(): void;
  9984. /**
  9985. * Makes the browser go forward a web page.
  9986. */
  9987. goForward(): void;
  9988. /**
  9989. * Navigates browser to the specified absolute web page index.
  9990. */
  9991. goToIndex(index: number): void;
  9992. /**
  9993. * Navigates to the specified offset from the "current entry".
  9994. */
  9995. goToOffset(offset: number): void;
  9996. /**
  9997. * Increase the capturer count by one. The page is considered visible when its
  9998. * browser window is hidden and the capturer count is non-zero. If you would like
  9999. * the page to stay hidden, you should ensure that `stayHidden` is set to true.
  10000. *
  10001. This also affects the Page Visibility API.
  10002. */
  10003. incrementCapturerCount(size?: Size, stayHidden?: boolean, stayAwake?: boolean): void;
  10004. /**
  10005. * A promise that resolves with a key for the inserted CSS that can later be used
  10006. * to remove the CSS via `contents.removeInsertedCSS(key)`.
  10007. *
  10008. * Injects CSS into the current web page and returns a unique key for the inserted
  10009. * stylesheet.
  10010. */
  10011. insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
  10012. /**
  10013. * Inserts `text` to the focused element.
  10014. */
  10015. insertText(text: string): Promise<void>;
  10016. /**
  10017. * Starts inspecting element at position (`x`, `y`).
  10018. */
  10019. inspectElement(x: number, y: number): void;
  10020. /**
  10021. * Opens the developer tools for the service worker context.
  10022. */
  10023. inspectServiceWorker(): void;
  10024. /**
  10025. * Opens the developer tools for the shared worker context.
  10026. */
  10027. inspectSharedWorker(): void;
  10028. /**
  10029. * Inspects the shared worker based on its ID.
  10030. */
  10031. inspectSharedWorkerById(workerId: string): void;
  10032. /**
  10033. * Schedules a full repaint of the window this web contents is in.
  10034. *
  10035. * If *offscreen rendering* is enabled invalidates the frame and generates a new
  10036. * one through the `'paint'` event.
  10037. */
  10038. invalidate(): void;
  10039. /**
  10040. * Whether this page has been muted.
  10041. */
  10042. isAudioMuted(): boolean;
  10043. /**
  10044. * Whether this page is being captured. It returns true when the capturer count is
  10045. * large then 0.
  10046. */
  10047. isBeingCaptured(): boolean;
  10048. /**
  10049. * Whether the renderer process has crashed.
  10050. */
  10051. isCrashed(): boolean;
  10052. /**
  10053. * Whether audio is currently playing.
  10054. */
  10055. isCurrentlyAudible(): boolean;
  10056. /**
  10057. * Whether the web page is destroyed.
  10058. */
  10059. isDestroyed(): boolean;
  10060. /**
  10061. * Whether the devtools view is focused .
  10062. */
  10063. isDevToolsFocused(): boolean;
  10064. /**
  10065. * Whether the devtools is opened.
  10066. */
  10067. isDevToolsOpened(): boolean;
  10068. /**
  10069. * Whether the web page is focused.
  10070. */
  10071. isFocused(): boolean;
  10072. /**
  10073. * Whether web page is still loading resources.
  10074. */
  10075. isLoading(): boolean;
  10076. /**
  10077. * Whether the main frame (and not just iframes or frames within it) is still
  10078. * loading.
  10079. */
  10080. isLoadingMainFrame(): boolean;
  10081. /**
  10082. * Indicates whether *offscreen rendering* is enabled.
  10083. */
  10084. isOffscreen(): boolean;
  10085. /**
  10086. * If *offscreen rendering* is enabled returns whether it is currently painting.
  10087. */
  10088. isPainting(): boolean;
  10089. /**
  10090. * Whether the web page is waiting for a first-response from the main resource of
  10091. * the page.
  10092. */
  10093. isWaitingForResponse(): boolean;
  10094. /**
  10095. * the promise will resolve when the page has finished loading (see
  10096. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  10097. *
  10098. * Loads the given file in the window, `filePath` should be a path to an HTML file
  10099. * relative to the root of your application. For instance an app structure like
  10100. * this:
  10101. Would require code like this
  10102. */
  10103. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  10104. /**
  10105. * the promise will resolve when the page has finished loading (see
  10106. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  10107. * A noop rejection handler is already attached, which avoids unhandled rejection
  10108. * errors.
  10109. *
  10110. * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
  10111. * the `http://` or `file://`. If the load should bypass http cache then use the
  10112. * `pragma` header to achieve it.
  10113. */
  10114. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  10115. /**
  10116. * Opens the devtools.
  10117. *
  10118. * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
  10119. * explicitly passing an empty `mode` can force using last used dock state.
  10120. */
  10121. openDevTools(options?: OpenDevToolsOptions): void;
  10122. /**
  10123. * Executes the editing command `paste` in web page.
  10124. */
  10125. paste(): void;
  10126. /**
  10127. * Executes the editing command `pasteAndMatchStyle` in web page.
  10128. */
  10129. pasteAndMatchStyle(): void;
  10130. /**
  10131. * Send a message to the renderer process, optionally transferring ownership of
  10132. * zero or more [`MessagePortMain`][] objects.
  10133. *
  10134. * The transferred `MessagePortMain` objects will be available in the renderer
  10135. * process by accessing the `ports` property of the emitted event. When they arrive
  10136. * in the renderer, they will be native DOM `MessagePort` objects.
  10137. For example:
  10138. */
  10139. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  10140. /**
  10141. * When a custom `pageSize` is passed, Chromium attempts to validate platform
  10142. * specific minimum values for `width_microns` and `height_microns`. Width and
  10143. * height must both be minimum 353 microns but may be higher on some operating
  10144. * systems.
  10145. *
  10146. * Prints window's web page. When `silent` is set to `true`, Electron will pick the
  10147. * system's default printer if `deviceName` is empty and the default settings for
  10148. * printing.
  10149. *
  10150. * Use `page-break-before: always;` CSS style to force to print to a new page.
  10151. *
  10152. Example usage:
  10153. */
  10154. print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
  10155. /**
  10156. * Resolves with the generated PDF data.
  10157. *
  10158. * Prints window's web page as PDF with Chromium's preview printing custom
  10159. * settings.
  10160. *
  10161. * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
  10162. *
  10163. * By default, an empty `options` will be regarded as:
  10164. *
  10165. * Use `page-break-before: always;` CSS style to force to print to a new page.
  10166. *
  10167. An example of `webContents.printToPDF`:
  10168. */
  10169. printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
  10170. /**
  10171. * Executes the editing command `redo` in web page.
  10172. */
  10173. redo(): void;
  10174. /**
  10175. * Reloads the current web page.
  10176. */
  10177. reload(): void;
  10178. /**
  10179. * Reloads current page and ignores cache.
  10180. */
  10181. reloadIgnoringCache(): void;
  10182. /**
  10183. * Resolves if the removal was successful.
  10184. *
  10185. * Removes the inserted CSS from the current web page. The stylesheet is identified
  10186. * by its key, which is returned from `contents.insertCSS(css)`.
  10187. */
  10188. removeInsertedCSS(key: string): Promise<void>;
  10189. /**
  10190. * Removes the specified path from DevTools workspace.
  10191. */
  10192. removeWorkSpace(path: string): void;
  10193. /**
  10194. * Executes the editing command `replace` in web page.
  10195. */
  10196. replace(text: string): void;
  10197. /**
  10198. * Executes the editing command `replaceMisspelling` in web page.
  10199. */
  10200. replaceMisspelling(text: string): void;
  10201. /**
  10202. * resolves if the page is saved.
  10203. */
  10204. savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
  10205. /**
  10206. * Executes the editing command `selectAll` in web page.
  10207. */
  10208. selectAll(): void;
  10209. /**
  10210. * Send an asynchronous message to the renderer process via `channel`, along with
  10211. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  10212. * just like `postMessage`, so prototype chains will not be included. Sending
  10213. * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
  10214. *
  10215. * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
  10216. * Electron objects will throw an exception.
  10217. *
  10218. * The renderer process can handle the message by listening to `channel` with the
  10219. * `ipcRenderer` module.
  10220. *
  10221. An example of sending messages from the main process to the renderer process:
  10222. */
  10223. send(channel: string, ...args: any[]): void;
  10224. /**
  10225. * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
  10226. * contents needs to be focused for `sendInputEvent()` to work.
  10227. */
  10228. sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
  10229. /**
  10230. * Send an asynchronous message to a specific frame in a renderer process via
  10231. * `channel`, along with arguments. Arguments will be serialized with the
  10232. * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
  10233. * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
  10234. * will throw an exception.
  10235. *
  10236. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  10237. * Electron objects will throw an exception.
  10238. *
  10239. * The renderer process can handle the message by listening to `channel` with the
  10240. * `ipcRenderer` module.
  10241. *
  10242. * If you want to get the `frameId` of a given renderer context you should use the
  10243. * `webFrame.routingId` value. E.g.
  10244. *
  10245. You can also read `frameId` from all incoming IPC messages in the main process.
  10246. */
  10247. sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
  10248. /**
  10249. * Mute the audio on the current web page.
  10250. */
  10251. setAudioMuted(muted: boolean): void;
  10252. /**
  10253. * Controls whether or not this WebContents will throttle animations and timers
  10254. * when the page becomes backgrounded. This also affects the Page Visibility API.
  10255. */
  10256. setBackgroundThrottling(allowed: boolean): void;
  10257. /**
  10258. * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
  10259. *
  10260. * The `devToolsWebContents` must not have done any navigation, and it should not
  10261. * be used for other purposes after the call.
  10262. *
  10263. * By default Electron manages the devtools by creating an internal `WebContents`
  10264. * with native view, which developers have very limited control of. With the
  10265. * `setDevToolsWebContents` method, developers can use any `WebContents` to show
  10266. * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
  10267. * tag.
  10268. *
  10269. * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
  10270. * caller's responsibility to destroy `devToolsWebContents`.
  10271. *
  10272. * An example of showing devtools in a `<webview>` tag:
  10273. *
  10274. An example of showing devtools in a `BrowserWindow`:
  10275. */
  10276. setDevToolsWebContents(devToolsWebContents: WebContents): void;
  10277. /**
  10278. * If *offscreen rendering* is enabled sets the frame rate to the specified number.
  10279. * Only values between 1 and 240 are accepted.
  10280. */
  10281. setFrameRate(fps: number): void;
  10282. /**
  10283. * Ignore application menu shortcuts while this web contents is focused.
  10284. */
  10285. setIgnoreMenuShortcuts(ignore: boolean): void;
  10286. /**
  10287. * Overrides the user agent for this web page.
  10288. */
  10289. setUserAgent(userAgent: string): void;
  10290. /**
  10291. * Sets the maximum and minimum pinch-to-zoom level.
  10292. *
  10293. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  10294. * call:
  10295. */
  10296. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  10297. /**
  10298. * Setting the WebRTC IP handling policy allows you to control which IPs are
  10299. * exposed via WebRTC. See BrowserLeaks for more details.
  10300. */
  10301. setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
  10302. /**
  10303. * Called before creating a window when `window.open()` is called from the
  10304. * renderer. See `window.open()` for more details and how to use this in
  10305. * conjunction with `did-create-window`.
  10306. */
  10307. setWindowOpenHandler(handler: (details: HandlerDetails) => ({action: 'deny'}) | ({action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions})): void;
  10308. /**
  10309. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  10310. * divided by 100, so 300% = 3.0.
  10311. The factor must be greater than 0.0.
  10312. */
  10313. setZoomFactor(factor: number): void;
  10314. /**
  10315. * Changes the zoom level to the specified level. The original size is 0 and each
  10316. * increment above or below represents zooming 20% larger or smaller to default
  10317. * limits of 300% and 50% of original size, respectively. The formula for this is
  10318. * `scale := 1.2 ^ level`.
  10319. *
  10320. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  10321. * the zoom level for a specific domain propagates across all instances of windows
  10322. * with the same domain. Differentiating the window URLs will make zoom work
  10323. * per-window.
  10324. */
  10325. setZoomLevel(level: number): void;
  10326. /**
  10327. * Shows pop-up dictionary that searches the selected word on the page.
  10328. *
  10329. * @platform darwin
  10330. */
  10331. showDefinitionForSelection(): void;
  10332. /**
  10333. * Sets the `item` as dragging item for current drag-drop operation, `file` is the
  10334. * absolute path of the file to be dragged, and `icon` is the image showing under
  10335. * the cursor when dragging.
  10336. */
  10337. startDrag(item: Item): void;
  10338. /**
  10339. * If *offscreen rendering* is enabled and not painting, start painting.
  10340. */
  10341. startPainting(): void;
  10342. /**
  10343. * Stops any pending navigation.
  10344. */
  10345. stop(): void;
  10346. /**
  10347. * Stops any `findInPage` request for the `webContents` with the provided `action`.
  10348. */
  10349. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  10350. /**
  10351. * If *offscreen rendering* is enabled and painting, stop painting.
  10352. */
  10353. stopPainting(): void;
  10354. /**
  10355. * Indicates whether the snapshot has been created successfully.
  10356. *
  10357. Takes a V8 heap snapshot and saves it to `filePath`.
  10358. */
  10359. takeHeapSnapshot(filePath: string): Promise<void>;
  10360. /**
  10361. * Toggles the developer tools.
  10362. */
  10363. toggleDevTools(): void;
  10364. /**
  10365. * Executes the editing command `undo` in web page.
  10366. */
  10367. undo(): void;
  10368. /**
  10369. * Executes the editing command `unselect` in web page.
  10370. */
  10371. unselect(): void;
  10372. audioMuted: boolean;
  10373. backgroundThrottling: boolean;
  10374. readonly debugger: Debugger;
  10375. readonly devToolsWebContents: (WebContents) | (null);
  10376. frameRate: number;
  10377. readonly hostWebContents: WebContents;
  10378. readonly id: number;
  10379. readonly mainFrame: WebFrameMain;
  10380. readonly session: Session;
  10381. userAgent: string;
  10382. zoomFactor: number;
  10383. zoomLevel: number;
  10384. }
  10385. interface WebFrame extends NodeJS.EventEmitter {
  10386. // Docs: https://electronjs.org/docs/api/web-frame
  10387. /**
  10388. * Attempts to free memory that is no longer being used (like images from a
  10389. * previous navigation).
  10390. *
  10391. * Note that blindly calling this method probably makes Electron slower since it
  10392. * will have to refill these emptied caches, you should only call it if an event in
  10393. * your app has occurred that makes you think your page is actually using less
  10394. * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
  10395. * and intend to stay there).
  10396. */
  10397. clearCache(): void;
  10398. /**
  10399. * A promise that resolves with the result of the executed code or is rejected if
  10400. * execution throws or results in a rejected promise.
  10401. *
  10402. * Evaluates `code` in page.
  10403. *
  10404. * In the browser window some HTML APIs like `requestFullScreen` can only be
  10405. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  10406. * this limitation.
  10407. */
  10408. executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  10409. /**
  10410. * A promise that resolves with the result of the executed code or is rejected if
  10411. * execution could not start.
  10412. *
  10413. * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  10414. *
  10415. * Note that when the execution of script fails, the returned promise will not
  10416. * reject and the `result` would be `undefined`. This is because Chromium does not
  10417. * dispatch errors of isolated worlds to foreign worlds.
  10418. */
  10419. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  10420. /**
  10421. * A child of `webFrame` with the supplied `name`, `null` would be returned if
  10422. * there's no such frame or if the frame is not in the current renderer process.
  10423. */
  10424. findFrameByName(name: string): WebFrame;
  10425. /**
  10426. * that has the supplied `routingId`, `null` if not found.
  10427. */
  10428. findFrameByRoutingId(routingId: number): WebFrame;
  10429. /**
  10430. * The frame element in `webFrame's` document selected by `selector`, `null` would
  10431. * be returned if `selector` does not select a frame or if the frame is not in the
  10432. * current renderer process.
  10433. */
  10434. getFrameForSelector(selector: string): WebFrame;
  10435. /**
  10436. * * `images` MemoryUsageDetails
  10437. * * `scripts` MemoryUsageDetails
  10438. * * `cssStyleSheets` MemoryUsageDetails
  10439. * * `xslStyleSheets` MemoryUsageDetails
  10440. * * `fonts` MemoryUsageDetails
  10441. * * `other` MemoryUsageDetails
  10442. *
  10443. * Returns an object describing usage information of Blink's internal memory
  10444. * caches.
  10445. This will generate:
  10446. */
  10447. getResourceUsage(): ResourceUsage;
  10448. /**
  10449. * A list of suggested words for a given word. If the word is spelled correctly,
  10450. * the result will be empty.
  10451. */
  10452. getWordSuggestions(word: string): string[];
  10453. /**
  10454. * The current zoom factor.
  10455. */
  10456. getZoomFactor(): number;
  10457. /**
  10458. * The current zoom level.
  10459. */
  10460. getZoomLevel(): number;
  10461. /**
  10462. * A key for the inserted CSS that can later be used to remove the CSS via
  10463. * `webFrame.removeInsertedCSS(key)`.
  10464. *
  10465. * Injects CSS into the current web page and returns a unique key for the inserted
  10466. * stylesheet.
  10467. */
  10468. insertCSS(css: string): string;
  10469. /**
  10470. * Inserts `text` to the focused element.
  10471. */
  10472. insertText(text: string): void;
  10473. /**
  10474. * True if the word is misspelled according to the built in spellchecker, false
  10475. * otherwise. If no dictionary is loaded, always return false.
  10476. */
  10477. isWordMisspelled(word: string): boolean;
  10478. /**
  10479. * Removes the inserted CSS from the current web page. The stylesheet is identified
  10480. * by its key, which is returned from `webFrame.insertCSS(css)`.
  10481. */
  10482. removeInsertedCSS(key: string): void;
  10483. /**
  10484. * Set the security origin, content security policy and name of the isolated world.
  10485. * Note: If the `csp` is specified, then the `securityOrigin` also has to be
  10486. * specified.
  10487. */
  10488. setIsolatedWorldInfo(worldId: number, info: Info): void;
  10489. /**
  10490. * Sets a provider for spell checking in input fields and text areas.
  10491. *
  10492. * If you want to use this method you must disable the builtin spellchecker when
  10493. * you construct the window.
  10494. *
  10495. * The `provider` must be an object that has a `spellCheck` method that accepts an
  10496. * array of individual words for spellchecking. The `spellCheck` function runs
  10497. * asynchronously and calls the `callback` function with an array of misspelt words
  10498. * when complete.
  10499. An example of using node-spellchecker as provider:
  10500. */
  10501. setSpellCheckProvider(language: string, provider: Provider): void;
  10502. /**
  10503. * Sets the maximum and minimum pinch-to-zoom level.
  10504. *
  10505. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  10506. * call:
  10507. *
  10508. * > **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom
  10509. * shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem
  10510. * roles in the application Menu. To disable shortcuts, manually define the Menu
  10511. * and omit zoom roles from the definition.
  10512. */
  10513. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
  10514. /**
  10515. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  10516. * divided by 100, so 300% = 3.0.
  10517. The factor must be greater than 0.0.
  10518. */
  10519. setZoomFactor(factor: number): void;
  10520. /**
  10521. * Changes the zoom level to the specified level. The original size is 0 and each
  10522. * increment above or below represents zooming 20% larger or smaller to default
  10523. * limits of 300% and 50% of original size, respectively.
  10524. *
  10525. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  10526. * the zoom level for a specific domain propagates across all instances of windows
  10527. * with the same domain. Differentiating the window URLs will make zoom work
  10528. * per-window.
  10529. */
  10530. setZoomLevel(level: number): void;
  10531. /**
  10532. * A `WebFrame | null` representing the first child frame of `webFrame`, the
  10533. * property would be `null` if `webFrame` has no children or if first child is not
  10534. * in the current renderer process.
  10535. *
  10536. */
  10537. readonly firstChild: (WebFrame) | (null);
  10538. /**
  10539. * A `WebFrame | null` representing next sibling frame, the property would be
  10540. * `null` if `webFrame` is the last frame in its parent or if the next sibling is
  10541. * not in the current renderer process.
  10542. *
  10543. */
  10544. readonly nextSibling: (WebFrame) | (null);
  10545. /**
  10546. * A `WebFrame | null` representing the frame which opened `webFrame`, the property
  10547. * would be `null` if there's no opener or opener is not in the current renderer
  10548. * process.
  10549. *
  10550. */
  10551. readonly opener: (WebFrame) | (null);
  10552. /**
  10553. * A `WebFrame | null` representing parent frame of `webFrame`, the property would
  10554. * be `null` if `webFrame` is top or parent is not in the current renderer process.
  10555. *
  10556. */
  10557. readonly parent: (WebFrame) | (null);
  10558. /**
  10559. * An `Integer` representing the unique frame id in the current renderer process.
  10560. * Distinct WebFrame instances that refer to the same underlying frame will have
  10561. * the same `routingId`.
  10562. *
  10563. */
  10564. readonly routingId: number;
  10565. /**
  10566. * A `WebFrame | null` representing top frame in frame hierarchy to which
  10567. * `webFrame` belongs, the property would be `null` if top frame is not in the
  10568. * current renderer process.
  10569. *
  10570. */
  10571. readonly top: (WebFrame) | (null);
  10572. }
  10573. class WebFrameMain extends NodeEventEmitter {
  10574. // Docs: https://electronjs.org/docs/api/web-frame-main
  10575. /**
  10576. * A frame with the given process and routing IDs, or `undefined` if there is no
  10577. * WebFrameMain associated with the given IDs.
  10578. */
  10579. static fromId(processId: number, routingId: number): (WebFrameMain) | (undefined);
  10580. /**
  10581. * A promise that resolves with the result of the executed code or is rejected if
  10582. * execution throws or results in a rejected promise.
  10583. *
  10584. * Evaluates `code` in page.
  10585. *
  10586. * In the browser window some HTML APIs like `requestFullScreen` can only be
  10587. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  10588. * this limitation.
  10589. */
  10590. executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>;
  10591. /**
  10592. * Send a message to the renderer process, optionally transferring ownership of
  10593. * zero or more [`MessagePortMain`][] objects.
  10594. *
  10595. * The transferred `MessagePortMain` objects will be available in the renderer
  10596. * process by accessing the `ports` property of the emitted event. When they arrive
  10597. * in the renderer, they will be native DOM `MessagePort` objects.
  10598. For example:
  10599. */
  10600. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  10601. /**
  10602. * Whether the reload was initiated successfully. Only results in `false` when the
  10603. * frame has no history.
  10604. */
  10605. reload(): boolean;
  10606. /**
  10607. * Send an asynchronous message to the renderer process via `channel`, along with
  10608. * arguments. Arguments will be serialized with the [Structured Clone
  10609. * Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
  10610. * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
  10611. * an exception.
  10612. *
  10613. * The renderer process can handle the message by listening to `channel` with the
  10614. * `ipcRenderer` module.
  10615. */
  10616. send(channel: string, ...args: any[]): void;
  10617. readonly frames: WebFrameMain[];
  10618. readonly framesInSubtree: WebFrameMain[];
  10619. readonly frameTreeNodeId: number;
  10620. readonly name: string;
  10621. readonly osProcessId: number;
  10622. readonly parent: (WebFrameMain) | (null);
  10623. readonly processId: number;
  10624. readonly routingId: number;
  10625. readonly top: (WebFrameMain) | (null);
  10626. readonly url: string;
  10627. }
  10628. class WebRequest {
  10629. // Docs: https://electronjs.org/docs/api/web-request
  10630. /**
  10631. * The `listener` will be called with `listener(details)` when a server initiated
  10632. * redirect is about to occur.
  10633. */
  10634. onBeforeRedirect(filter: Filter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  10635. /**
  10636. * The `listener` will be called with `listener(details)` when a server initiated
  10637. * redirect is about to occur.
  10638. */
  10639. onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  10640. /**
  10641. * The `listener` will be called with `listener(details, callback)` when a request
  10642. * is about to occur.
  10643. *
  10644. * The `uploadData` is an array of `UploadData` objects.
  10645. *
  10646. * The `callback` has to be called with an `response` object.
  10647. *
  10648. Some examples of valid `urls`:
  10649. */
  10650. onBeforeRequest(filter: Filter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
  10651. /**
  10652. * The `listener` will be called with `listener(details, callback)` when a request
  10653. * is about to occur.
  10654. *
  10655. * The `uploadData` is an array of `UploadData` objects.
  10656. *
  10657. * The `callback` has to be called with an `response` object.
  10658. *
  10659. Some examples of valid `urls`:
  10660. */
  10661. onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
  10662. /**
  10663. * The `listener` will be called with `listener(details, callback)` before sending
  10664. * an HTTP request, once the request headers are available. This may occur after a
  10665. * TCP connection is made to the server, but before any http data is sent.
  10666. *
  10667. The `callback` has to be called with a `response` object.
  10668. */
  10669. onBeforeSendHeaders(filter: Filter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  10670. /**
  10671. * The `listener` will be called with `listener(details, callback)` before sending
  10672. * an HTTP request, once the request headers are available. This may occur after a
  10673. * TCP connection is made to the server, but before any http data is sent.
  10674. *
  10675. The `callback` has to be called with a `response` object.
  10676. */
  10677. onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  10678. /**
  10679. * The `listener` will be called with `listener(details)` when a request is
  10680. * completed.
  10681. */
  10682. onCompleted(filter: Filter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  10683. /**
  10684. * The `listener` will be called with `listener(details)` when a request is
  10685. * completed.
  10686. */
  10687. onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  10688. /**
  10689. * The `listener` will be called with `listener(details)` when an error occurs.
  10690. */
  10691. onErrorOccurred(filter: Filter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  10692. /**
  10693. * The `listener` will be called with `listener(details)` when an error occurs.
  10694. */
  10695. onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  10696. /**
  10697. * The `listener` will be called with `listener(details, callback)` when HTTP
  10698. * response headers of a request have been received.
  10699. *
  10700. The `callback` has to be called with a `response` object.
  10701. */
  10702. onHeadersReceived(filter: Filter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  10703. /**
  10704. * The `listener` will be called with `listener(details, callback)` when HTTP
  10705. * response headers of a request have been received.
  10706. *
  10707. The `callback` has to be called with a `response` object.
  10708. */
  10709. onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  10710. /**
  10711. * The `listener` will be called with `listener(details)` when first byte of the
  10712. * response body is received. For HTTP requests, this means that the status line
  10713. * and response headers are available.
  10714. */
  10715. onResponseStarted(filter: Filter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  10716. /**
  10717. * The `listener` will be called with `listener(details)` when first byte of the
  10718. * response body is received. For HTTP requests, this means that the status line
  10719. * and response headers are available.
  10720. */
  10721. onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  10722. /**
  10723. * The `listener` will be called with `listener(details)` just before a request is
  10724. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  10725. * response are visible by the time this listener is fired.
  10726. */
  10727. onSendHeaders(filter: Filter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  10728. /**
  10729. * The `listener` will be called with `listener(details)` just before a request is
  10730. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  10731. * response are visible by the time this listener is fired.
  10732. */
  10733. onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  10734. }
  10735. interface WebSource {
  10736. // Docs: https://electronjs.org/docs/api/structures/web-source
  10737. code: string;
  10738. /**
  10739. * Default is 1.
  10740. */
  10741. startLine?: number;
  10742. url?: string;
  10743. }
  10744. interface WebviewTag extends HTMLElement {
  10745. // Docs: https://electronjs.org/docs/api/webview-tag
  10746. /**
  10747. * Fired when a load has committed. This includes navigation within the current
  10748. * document as well as subframe document-level loads, but does not include
  10749. * asynchronous resource loads.
  10750. */
  10751. addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
  10752. removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
  10753. /**
  10754. * Fired when the navigation is done, i.e. the spinner of the tab will stop
  10755. * spinning, and the `onload` event is dispatched.
  10756. */
  10757. addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this;
  10758. removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this;
  10759. /**
  10760. * This event is like `did-finish-load`, but fired when the load failed or was
  10761. * cancelled, e.g. `window.stop()` is invoked.
  10762. */
  10763. addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
  10764. removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
  10765. /**
  10766. * Fired when a frame has done navigation.
  10767. */
  10768. addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
  10769. removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
  10770. /**
  10771. * Corresponds to the points in time when the spinner of the tab starts spinning.
  10772. */
  10773. addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this;
  10774. removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this;
  10775. /**
  10776. * Corresponds to the points in time when the spinner of the tab stops spinning.
  10777. */
  10778. addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this;
  10779. removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this;
  10780. /**
  10781. * Fired when attached to the embedder web contents.
  10782. */
  10783. addEventListener(event: 'did-attach', listener: (event: Event) => void, useCapture?: boolean): this;
  10784. removeEventListener(event: 'did-attach', listener: (event: Event) => void): this;
  10785. /**
  10786. * Fired when document in the given frame is loaded.
  10787. */
  10788. addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this;
  10789. removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this;
  10790. /**
  10791. * Fired when page title is set during navigation. `explicitSet` is false when
  10792. * title is synthesized from file url.
  10793. */
  10794. addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
  10795. removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
  10796. /**
  10797. * Fired when page receives favicon urls.
  10798. */
  10799. addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
  10800. removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
  10801. /**
  10802. * Fired when page enters fullscreen triggered by HTML API.
  10803. */
  10804. addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
  10805. removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this;
  10806. /**
  10807. * Fired when page leaves fullscreen triggered by HTML API.
  10808. */
  10809. addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
  10810. removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this;
  10811. /**
  10812. * Fired when the guest window logs a console message.
  10813. *
  10814. * The following example code forwards all log messages to the embedder's console
  10815. * without regard for log level or other properties.
  10816. */
  10817. addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
  10818. removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
  10819. /**
  10820. * Fired when a result is available for `webview.findInPage` request.
  10821. */
  10822. addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
  10823. removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
  10824. /**
  10825. * Fired when the guest page attempts to open a new browser window.
  10826. *
  10827. The following example code opens the new url in system's default browser.
  10828. */
  10829. addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this;
  10830. removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this;
  10831. /**
  10832. * Emitted when a user or the page wants to start navigation. It can happen when
  10833. * the `window.location` object is changed or a user clicks a link in the page.
  10834. *
  10835. * This event will not emit when the navigation is started programmatically with
  10836. * APIs like `<webview>.loadURL` and `<webview>.back`.
  10837. *
  10838. * It is also not emitted during in-page navigation, such as clicking anchor links
  10839. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  10840. * this purpose.
  10841. Calling `event.preventDefault()` does __NOT__ have any effect.
  10842. */
  10843. addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
  10844. removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
  10845. /**
  10846. * Emitted when any frame (including main) starts navigating. `isInPlace` will be
  10847. * `true` for in-page navigations.
  10848. */
  10849. addEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void, useCapture?: boolean): this;
  10850. removeEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void): this;
  10851. /**
  10852. * Emitted when a navigation is done.
  10853. *
  10854. * This event is not emitted for in-page navigations, such as clicking anchor links
  10855. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  10856. * this purpose.
  10857. */
  10858. addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
  10859. removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
  10860. /**
  10861. * Emitted when any frame navigation is done.
  10862. *
  10863. * This event is not emitted for in-page navigations, such as clicking anchor links
  10864. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  10865. * this purpose.
  10866. */
  10867. addEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void, useCapture?: boolean): this;
  10868. removeEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void): this;
  10869. /**
  10870. * Emitted when an in-page navigation happened.
  10871. *
  10872. * When in-page navigation happens, the page URL changes but does not cause
  10873. * navigation outside of the page. Examples of this occurring are when anchor links
  10874. * are clicked or when the DOM `hashchange` event is triggered.
  10875. */
  10876. addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
  10877. removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
  10878. /**
  10879. * Fired when the guest page attempts to close itself.
  10880. *
  10881. * The following example code navigates the `webview` to `about:blank` when the
  10882. * guest attempts to close itself.
  10883. */
  10884. addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this;
  10885. removeEventListener(event: 'close', listener: (event: Event) => void): this;
  10886. /**
  10887. * Fired when the guest page has sent an asynchronous message to embedder page.
  10888. *
  10889. * With `sendToHost` method and `ipc-message` event you can communicate between
  10890. * guest page and embedder page:
  10891. */
  10892. addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
  10893. removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
  10894. /**
  10895. * Fired when the renderer process is crashed.
  10896. */
  10897. addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this;
  10898. removeEventListener(event: 'crashed', listener: (event: Event) => void): this;
  10899. /**
  10900. * Fired when a plugin process is crashed.
  10901. */
  10902. addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
  10903. removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
  10904. /**
  10905. * Fired when the WebContents is destroyed.
  10906. */
  10907. addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this;
  10908. removeEventListener(event: 'destroyed', listener: (event: Event) => void): this;
  10909. /**
  10910. * Emitted when media starts playing.
  10911. */
  10912. addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this;
  10913. removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this;
  10914. /**
  10915. * Emitted when media is paused or done playing.
  10916. */
  10917. addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this;
  10918. removeEventListener(event: 'media-paused', listener: (event: Event) => void): this;
  10919. /**
  10920. * Emitted when a page's theme color changes. This is usually due to encountering a
  10921. * meta tag:
  10922. */
  10923. addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
  10924. removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
  10925. /**
  10926. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  10927. */
  10928. addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
  10929. removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
  10930. /**
  10931. * Emitted when DevTools is opened.
  10932. */
  10933. addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this;
  10934. removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this;
  10935. /**
  10936. * Emitted when DevTools is closed.
  10937. */
  10938. addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this;
  10939. removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this;
  10940. /**
  10941. * Emitted when DevTools is focused / opened.
  10942. */
  10943. addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this;
  10944. removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this;
  10945. addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  10946. addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  10947. removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  10948. removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  10949. /**
  10950. * Whether the guest page can go back.
  10951. */
  10952. canGoBack(): boolean;
  10953. /**
  10954. * Whether the guest page can go forward.
  10955. */
  10956. canGoForward(): boolean;
  10957. /**
  10958. * Whether the guest page can go to `offset`.
  10959. */
  10960. canGoToOffset(offset: number): boolean;
  10961. /**
  10962. * Resolves with a NativeImage
  10963. *
  10964. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  10965. * whole visible page.
  10966. */
  10967. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  10968. /**
  10969. * Clears the navigation history.
  10970. */
  10971. clearHistory(): void;
  10972. /**
  10973. * Closes the DevTools window of guest page.
  10974. */
  10975. closeDevTools(): void;
  10976. /**
  10977. * Executes editing command `copy` in page.
  10978. */
  10979. copy(): void;
  10980. /**
  10981. * Executes editing command `cut` in page.
  10982. */
  10983. cut(): void;
  10984. /**
  10985. * Executes editing command `delete` in page.
  10986. */
  10987. delete(): void;
  10988. /**
  10989. * Initiates a download of the resource at `url` without navigating.
  10990. */
  10991. downloadURL(url: string): void;
  10992. /**
  10993. * A promise that resolves with the result of the executed code or is rejected if
  10994. * the result of the code is a rejected promise.
  10995. *
  10996. * Evaluates `code` in page. If `userGesture` is set, it will create the user
  10997. * gesture context in the page. HTML APIs like `requestFullScreen`, which require
  10998. * user action, can take advantage of this option for automation.
  10999. */
  11000. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  11001. /**
  11002. * The request id used for the request.
  11003. *
  11004. * Starts a request to find all matches for the `text` in the web page. The result
  11005. * of the request can be obtained by subscribing to `found-in-page` event.
  11006. */
  11007. findInPage(text: string, options?: FindInPageOptions): number;
  11008. /**
  11009. * The title of guest page.
  11010. */
  11011. getTitle(): string;
  11012. /**
  11013. * The URL of guest page.
  11014. */
  11015. getURL(): string;
  11016. /**
  11017. * The user agent for guest page.
  11018. */
  11019. getUserAgent(): string;
  11020. /**
  11021. * The WebContents ID of this `webview`.
  11022. */
  11023. getWebContentsId(): number;
  11024. /**
  11025. * the current zoom factor.
  11026. */
  11027. getZoomFactor(): number;
  11028. /**
  11029. * the current zoom level.
  11030. */
  11031. getZoomLevel(): number;
  11032. /**
  11033. * Makes the guest page go back.
  11034. */
  11035. goBack(): void;
  11036. /**
  11037. * Makes the guest page go forward.
  11038. */
  11039. goForward(): void;
  11040. /**
  11041. * Navigates to the specified absolute index.
  11042. */
  11043. goToIndex(index: number): void;
  11044. /**
  11045. * Navigates to the specified offset from the "current entry".
  11046. */
  11047. goToOffset(offset: number): void;
  11048. /**
  11049. * A promise that resolves with a key for the inserted CSS that can later be used
  11050. * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
  11051. *
  11052. * Injects CSS into the current web page and returns a unique key for the inserted
  11053. * stylesheet.
  11054. */
  11055. insertCSS(css: string): Promise<string>;
  11056. /**
  11057. * Inserts `text` to the focused element.
  11058. */
  11059. insertText(text: string): Promise<void>;
  11060. /**
  11061. * Starts inspecting element at position (`x`, `y`) of guest page.
  11062. */
  11063. inspectElement(x: number, y: number): void;
  11064. /**
  11065. * Opens the DevTools for the service worker context present in the guest page.
  11066. */
  11067. inspectServiceWorker(): void;
  11068. /**
  11069. * Opens the DevTools for the shared worker context present in the guest page.
  11070. */
  11071. inspectSharedWorker(): void;
  11072. /**
  11073. * Whether guest page has been muted.
  11074. */
  11075. isAudioMuted(): boolean;
  11076. /**
  11077. * Whether the renderer process has crashed.
  11078. */
  11079. isCrashed(): boolean;
  11080. /**
  11081. * Whether audio is currently playing.
  11082. */
  11083. isCurrentlyAudible(): boolean;
  11084. /**
  11085. * Whether DevTools window of guest page is focused.
  11086. */
  11087. isDevToolsFocused(): boolean;
  11088. /**
  11089. * Whether guest page has a DevTools window attached.
  11090. */
  11091. isDevToolsOpened(): boolean;
  11092. /**
  11093. * Whether guest page is still loading resources.
  11094. */
  11095. isLoading(): boolean;
  11096. /**
  11097. * Whether the main frame (and not just iframes or frames within it) is still
  11098. * loading.
  11099. */
  11100. isLoadingMainFrame(): boolean;
  11101. /**
  11102. * Whether the guest page is waiting for a first-response for the main resource of
  11103. * the page.
  11104. */
  11105. isWaitingForResponse(): boolean;
  11106. /**
  11107. * The promise will resolve when the page has finished loading (see
  11108. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  11109. *
  11110. * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
  11111. * the `http://` or `file://`.
  11112. */
  11113. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  11114. /**
  11115. * Opens a DevTools window for guest page.
  11116. */
  11117. openDevTools(): void;
  11118. /**
  11119. * Executes editing command `paste` in page.
  11120. */
  11121. paste(): void;
  11122. /**
  11123. * Executes editing command `pasteAndMatchStyle` in page.
  11124. */
  11125. pasteAndMatchStyle(): void;
  11126. /**
  11127. * Prints `webview`'s web page. Same as `webContents.print([options])`.
  11128. */
  11129. print(options?: WebviewTagPrintOptions): Promise<void>;
  11130. /**
  11131. * Resolves with the generated PDF data.
  11132. *
  11133. Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
  11134. */
  11135. printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
  11136. /**
  11137. * Executes editing command `redo` in page.
  11138. */
  11139. redo(): void;
  11140. /**
  11141. * Reloads the guest page.
  11142. */
  11143. reload(): void;
  11144. /**
  11145. * Reloads the guest page and ignores cache.
  11146. */
  11147. reloadIgnoringCache(): void;
  11148. /**
  11149. * Resolves if the removal was successful.
  11150. *
  11151. * Removes the inserted CSS from the current web page. The stylesheet is identified
  11152. * by its key, which is returned from `<webview>.insertCSS(css)`.
  11153. */
  11154. removeInsertedCSS(key: string): Promise<void>;
  11155. /**
  11156. * Executes editing command `replace` in page.
  11157. */
  11158. replace(text: string): void;
  11159. /**
  11160. * Executes editing command `replaceMisspelling` in page.
  11161. */
  11162. replaceMisspelling(text: string): void;
  11163. /**
  11164. * Executes editing command `selectAll` in page.
  11165. */
  11166. selectAll(): void;
  11167. /**
  11168. * Send an asynchronous message to renderer process via `channel`, you can also
  11169. * send arbitrary arguments. The renderer process can handle the message by
  11170. * listening to the `channel` event with the `ipcRenderer` module.
  11171. *
  11172. See webContents.send for examples.
  11173. */
  11174. send(channel: string, ...args: any[]): Promise<void>;
  11175. /**
  11176. * Sends an input `event` to the page.
  11177. *
  11178. See webContents.sendInputEvent for detailed description of `event` object.
  11179. */
  11180. sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
  11181. /**
  11182. * Set guest page muted.
  11183. */
  11184. setAudioMuted(muted: boolean): void;
  11185. /**
  11186. * Overrides the user agent for the guest page.
  11187. */
  11188. setUserAgent(userAgent: string): void;
  11189. /**
  11190. * Sets the maximum and minimum pinch-to-zoom level.
  11191. */
  11192. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  11193. /**
  11194. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  11195. * divided by 100, so 300% = 3.0.
  11196. */
  11197. setZoomFactor(factor: number): void;
  11198. /**
  11199. * Changes the zoom level to the specified level. The original size is 0 and each
  11200. * increment above or below represents zooming 20% larger or smaller to default
  11201. * limits of 300% and 50% of original size, respectively. The formula for this is
  11202. * `scale := 1.2 ^ level`.
  11203. *
  11204. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  11205. * the zoom level for a specific domain propagates across all instances of windows
  11206. * with the same domain. Differentiating the window URLs will make zoom work
  11207. * per-window.
  11208. */
  11209. setZoomLevel(level: number): void;
  11210. /**
  11211. * Shows pop-up dictionary that searches the selected word on the page.
  11212. *
  11213. * @platform darwin
  11214. */
  11215. showDefinitionForSelection(): void;
  11216. /**
  11217. * Stops any pending navigation.
  11218. */
  11219. stop(): void;
  11220. /**
  11221. * Stops any `findInPage` request for the `webview` with the provided `action`.
  11222. */
  11223. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  11224. /**
  11225. * Executes editing command `undo` in page.
  11226. */
  11227. undo(): void;
  11228. /**
  11229. * Executes editing command `unselect` in page.
  11230. */
  11231. unselect(): void;
  11232. /**
  11233. * A `Boolean`. When this attribute is present the guest page will be allowed to
  11234. * open new windows. Popups are disabled by default.
  11235. */
  11236. allowpopups: boolean;
  11237. /**
  11238. * A `String` which is a list of strings which specifies the blink features to be
  11239. * disabled separated by `,`. The full list of supported feature strings can be
  11240. * found in the RuntimeEnabledFeatures.json5 file.
  11241. */
  11242. disableblinkfeatures: string;
  11243. /**
  11244. * A `Boolean`. When this attribute is present the guest page will have web
  11245. * security disabled. Web security is enabled by default.
  11246. */
  11247. disablewebsecurity: boolean;
  11248. /**
  11249. * A `String` which is a list of strings which specifies the blink features to be
  11250. * enabled separated by `,`. The full list of supported feature strings can be
  11251. * found in the RuntimeEnabledFeatures.json5 file.
  11252. */
  11253. enableblinkfeatures: string;
  11254. /**
  11255. * A `Boolean`. When this attribute is `false` the guest page in `webview` will not
  11256. * have access to the `remote` module. The remote module is unavailable by default.
  11257. */
  11258. enableremotemodule: boolean;
  11259. /**
  11260. * A `String` that sets the referrer URL for the guest page.
  11261. */
  11262. httpreferrer: string;
  11263. /**
  11264. * A `Boolean`. When this attribute is present the guest page in `webview` will
  11265. * have node integration and can use node APIs like `require` and `process` to
  11266. * access low level system resources. Node integration is disabled by default in
  11267. * the guest page.
  11268. */
  11269. nodeintegration: boolean;
  11270. /**
  11271. * A `Boolean` for the experimental option for enabling NodeJS support in
  11272. * sub-frames such as iframes inside the `webview`. All your preloads will load for
  11273. * every iframe, you can use `process.isMainFrame` to determine if you are in the
  11274. * main frame or not. This option is disabled by default in the guest page.
  11275. */
  11276. nodeintegrationinsubframes: boolean;
  11277. /**
  11278. * A `String` that sets the session used by the page. If `partition` starts with
  11279. * `persist:`, the page will use a persistent session available to all pages in the
  11280. * app with the same `partition`. if there is no `persist:` prefix, the page will
  11281. * use an in-memory session. By assigning the same `partition`, multiple pages can
  11282. * share the same session. If the `partition` is unset then default session of the
  11283. * app will be used.
  11284. *
  11285. * This value can only be modified before the first navigation, since the session
  11286. * of an active renderer process cannot change. Subsequent attempts to modify the
  11287. * value will fail with a DOM exception.
  11288. */
  11289. partition: string;
  11290. /**
  11291. * A `Boolean`. When this attribute is present the guest page in `webview` will be
  11292. * able to use browser plugins. Plugins are disabled by default.
  11293. */
  11294. plugins: boolean;
  11295. /**
  11296. * A `String` that specifies a script that will be loaded before other scripts run
  11297. * in the guest page. The protocol of script's URL must be `file:` (even when using
  11298. * `asar:` archives) because it will be loaded by Node's `require` under the hood,
  11299. * which treats `asar:` archives as virtual directories.
  11300. *
  11301. * When the guest page doesn't have node integration this script will still have
  11302. * access to all Node APIs, but global objects injected by Node will be deleted
  11303. * after this script has finished executing.
  11304. *
  11305. * **Note:** This option will appear as `preloadURL` (not `preload`) in the
  11306. * `webPreferences` specified to the `will-attach-webview` event.
  11307. */
  11308. preload: string;
  11309. /**
  11310. * A `String` representing the visible URL. Writing to this attribute initiates
  11311. * top-level navigation.
  11312. *
  11313. * Assigning `src` its own value will reload the current page.
  11314. *
  11315. * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
  11316. * world!`.
  11317. */
  11318. src: string;
  11319. /**
  11320. * A `String` that sets the user agent for the guest page before the page is
  11321. * navigated to. Once the page is loaded, use the `setUserAgent` method to change
  11322. * the user agent.
  11323. */
  11324. useragent: string;
  11325. /**
  11326. * A `String` which is a comma separated list of strings which specifies the web
  11327. * preferences to be set on the webview. The full list of supported preference
  11328. * strings can be found in BrowserWindow.
  11329. *
  11330. * The string follows the same format as the features string in `window.open`. A
  11331. * name by itself is given a `true` boolean value. A preference can be set to
  11332. * another value by including an `=`, followed by the value. Special values `yes`
  11333. * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
  11334. * `false`.
  11335. */
  11336. webpreferences: string;
  11337. }
  11338. interface AboutPanelOptionsOptions {
  11339. /**
  11340. * The app's name.
  11341. */
  11342. applicationName?: string;
  11343. /**
  11344. * The app's version.
  11345. */
  11346. applicationVersion?: string;
  11347. /**
  11348. * Copyright information.
  11349. */
  11350. copyright?: string;
  11351. /**
  11352. * The app's build version number.
  11353. *
  11354. * @platform darwin
  11355. */
  11356. version?: string;
  11357. /**
  11358. * Credit information.
  11359. *
  11360. * @platform darwin,win32
  11361. */
  11362. credits?: string;
  11363. /**
  11364. * List of app authors.
  11365. *
  11366. * @platform linux
  11367. */
  11368. authors?: string[];
  11369. /**
  11370. * The app's website.
  11371. *
  11372. * @platform linux
  11373. */
  11374. website?: string;
  11375. /**
  11376. * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
  11377. * 64x64 pixels while retaining aspect ratio.
  11378. *
  11379. * @platform linux,win32
  11380. */
  11381. iconPath?: string;
  11382. }
  11383. interface AddRepresentationOptions {
  11384. /**
  11385. * The scale factor to add the image representation for.
  11386. */
  11387. scaleFactor: number;
  11388. /**
  11389. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  11390. */
  11391. width?: number;
  11392. /**
  11393. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  11394. */
  11395. height?: number;
  11396. /**
  11397. * The buffer containing the raw image data.
  11398. */
  11399. buffer?: Buffer;
  11400. /**
  11401. * The data URL containing either a base 64 encoded PNG or JPEG image.
  11402. */
  11403. dataURL?: string;
  11404. }
  11405. interface AnimationSettings {
  11406. /**
  11407. * Returns true if rich animations should be rendered. Looks at session type (e.g.
  11408. * remote desktop) and accessibility settings to give guidance for heavy
  11409. * animations.
  11410. */
  11411. shouldRenderRichAnimation: boolean;
  11412. /**
  11413. * Determines on a per-platform basis whether scroll animations (e.g. produced by
  11414. * home/end key) should be enabled.
  11415. */
  11416. scrollAnimationsEnabledBySystem: boolean;
  11417. /**
  11418. * Determines whether the user desires reduced motion based on platform APIs.
  11419. */
  11420. prefersReducedMotion: boolean;
  11421. }
  11422. interface AppDetailsOptions {
  11423. /**
  11424. * Window's App User Model ID. It has to be set, otherwise the other options will
  11425. * have no effect.
  11426. */
  11427. appId?: string;
  11428. /**
  11429. * Window's Relaunch Icon.
  11430. */
  11431. appIconPath?: string;
  11432. /**
  11433. * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
  11434. * Default is `0`.
  11435. */
  11436. appIconIndex?: number;
  11437. /**
  11438. * Window's Relaunch Command.
  11439. */
  11440. relaunchCommand?: string;
  11441. /**
  11442. * Window's Relaunch Display Name.
  11443. */
  11444. relaunchDisplayName?: string;
  11445. }
  11446. interface ApplicationInfoForProtocolReturnValue {
  11447. /**
  11448. * the display icon of the app handling the protocol.
  11449. */
  11450. icon: NativeImage;
  11451. /**
  11452. * installation path of the app handling the protocol.
  11453. */
  11454. path: string;
  11455. /**
  11456. * display name of the app handling the protocol.
  11457. */
  11458. name: string;
  11459. }
  11460. interface AuthenticationResponseDetails {
  11461. url: string;
  11462. }
  11463. interface AuthInfo {
  11464. isProxy: boolean;
  11465. scheme: string;
  11466. host: string;
  11467. port: number;
  11468. realm: string;
  11469. }
  11470. interface AutoResizeOptions {
  11471. /**
  11472. * If `true`, the view's width will grow and shrink together with the window.
  11473. * `false` by default.
  11474. */
  11475. width?: boolean;
  11476. /**
  11477. * If `true`, the view's height will grow and shrink together with the window.
  11478. * `false` by default.
  11479. */
  11480. height?: boolean;
  11481. /**
  11482. * If `true`, the view's x position and width will grow and shrink proportionally
  11483. * with the window. `false` by default.
  11484. */
  11485. horizontal?: boolean;
  11486. /**
  11487. * If `true`, the view's y position and height will grow and shrink proportionally
  11488. * with the window. `false` by default.
  11489. */
  11490. vertical?: boolean;
  11491. }
  11492. interface BeforeSendResponse {
  11493. cancel?: boolean;
  11494. /**
  11495. * When provided, request will be made with these headers.
  11496. */
  11497. requestHeaders?: Record<string, (string) | (string[])>;
  11498. }
  11499. interface BitmapOptions {
  11500. /**
  11501. * Defaults to 1.0.
  11502. */
  11503. scaleFactor?: number;
  11504. }
  11505. interface BlinkMemoryInfo {
  11506. /**
  11507. * Size of all allocated objects in Kilobytes.
  11508. */
  11509. allocated: number;
  11510. /**
  11511. * Size of all marked objects in Kilobytes.
  11512. */
  11513. marked: number;
  11514. /**
  11515. * Total allocated space in Kilobytes.
  11516. */
  11517. total: number;
  11518. }
  11519. interface BrowserViewConstructorOptions {
  11520. /**
  11521. * See BrowserWindow.
  11522. */
  11523. webPreferences?: WebPreferences;
  11524. }
  11525. interface BrowserWindowConstructorOptions {
  11526. /**
  11527. * Window's width in pixels. Default is `800`.
  11528. */
  11529. width?: number;
  11530. /**
  11531. * Window's height in pixels. Default is `600`.
  11532. */
  11533. height?: number;
  11534. /**
  11535. * (**required** if y is used) Window's left offset from screen. Default is to
  11536. * center the window.
  11537. */
  11538. x?: number;
  11539. /**
  11540. * (**required** if x is used) Window's top offset from screen. Default is to
  11541. * center the window.
  11542. */
  11543. y?: number;
  11544. /**
  11545. * The `width` and `height` would be used as web page's size, which means the
  11546. * actual window's size will include window frame's size and be slightly larger.
  11547. * Default is `false`.
  11548. */
  11549. useContentSize?: boolean;
  11550. /**
  11551. * Show window in the center of the screen.
  11552. */
  11553. center?: boolean;
  11554. /**
  11555. * Window's minimum width. Default is `0`.
  11556. */
  11557. minWidth?: number;
  11558. /**
  11559. * Window's minimum height. Default is `0`.
  11560. */
  11561. minHeight?: number;
  11562. /**
  11563. * Window's maximum width. Default is no limit.
  11564. */
  11565. maxWidth?: number;
  11566. /**
  11567. * Window's maximum height. Default is no limit.
  11568. */
  11569. maxHeight?: number;
  11570. /**
  11571. * Whether window is resizable. Default is `true`.
  11572. */
  11573. resizable?: boolean;
  11574. /**
  11575. * Whether window is movable. This is not implemented on Linux. Default is `true`.
  11576. */
  11577. movable?: boolean;
  11578. /**
  11579. * Whether window is minimizable. This is not implemented on Linux. Default is
  11580. * `true`.
  11581. */
  11582. minimizable?: boolean;
  11583. /**
  11584. * Whether window is maximizable. This is not implemented on Linux. Default is
  11585. * `true`.
  11586. */
  11587. maximizable?: boolean;
  11588. /**
  11589. * Whether window is closable. This is not implemented on Linux. Default is `true`.
  11590. */
  11591. closable?: boolean;
  11592. /**
  11593. * Whether the window can be focused. Default is `true`. On Windows setting
  11594. * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
  11595. * `focusable: false` makes the window stop interacting with wm, so the window will
  11596. * always stay on top in all workspaces.
  11597. */
  11598. focusable?: boolean;
  11599. /**
  11600. * Whether the window should always stay on top of other windows. Default is
  11601. * `false`.
  11602. */
  11603. alwaysOnTop?: boolean;
  11604. /**
  11605. * Whether the window should show in fullscreen. When explicitly set to `false` the
  11606. * fullscreen button will be hidden or disabled on macOS. Default is `false`.
  11607. */
  11608. fullscreen?: boolean;
  11609. /**
  11610. * Whether the window can be put into fullscreen mode. On macOS, also whether the
  11611. * maximize/zoom button should toggle full screen mode or maximize window. Default
  11612. * is `true`.
  11613. */
  11614. fullscreenable?: boolean;
  11615. /**
  11616. * Use pre-Lion fullscreen on macOS. Default is `false`.
  11617. */
  11618. simpleFullscreen?: boolean;
  11619. /**
  11620. * Whether to show the window in taskbar. Default is `false`.
  11621. */
  11622. skipTaskbar?: boolean;
  11623. /**
  11624. * Whether the window is in kiosk mode. Default is `false`.
  11625. */
  11626. kiosk?: boolean;
  11627. /**
  11628. * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
  11629. * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
  11630. */
  11631. title?: string;
  11632. /**
  11633. * The window icon. On Windows it is recommended to use `ICO` icons to get best
  11634. * visual effects, you can also leave it undefined so the executable's icon will be
  11635. * used.
  11636. */
  11637. icon?: (NativeImage) | (string);
  11638. /**
  11639. * Whether window should be shown when created. Default is `true`.
  11640. */
  11641. show?: boolean;
  11642. /**
  11643. * Whether the renderer should be active when `show` is `false` and it has just
  11644. * been created. In order for `document.visibilityState` to work correctly on
  11645. * first load with `show: false` you should set this to `false`. Setting this to
  11646. * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
  11647. */
  11648. paintWhenInitiallyHidden?: boolean;
  11649. /**
  11650. * Specify `false` to create a Frameless Window. Default is `true`.
  11651. */
  11652. frame?: boolean;
  11653. /**
  11654. * Specify parent window. Default is `null`.
  11655. */
  11656. parent?: BrowserWindow;
  11657. /**
  11658. * Whether this is a modal window. This only works when the window is a child
  11659. * window. Default is `false`.
  11660. */
  11661. modal?: boolean;
  11662. /**
  11663. * Whether clicking an inactive window will also click through to the web contents.
  11664. * Default is `false` on macOS. This option is not configurable on other platforms.
  11665. */
  11666. acceptFirstMouse?: boolean;
  11667. /**
  11668. * Whether to hide cursor when typing. Default is `false`.
  11669. */
  11670. disableAutoHideCursor?: boolean;
  11671. /**
  11672. * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
  11673. */
  11674. autoHideMenuBar?: boolean;
  11675. /**
  11676. * Enable the window to be resized larger than screen. Only relevant for macOS, as
  11677. * other OSes allow larger-than-screen windows by default. Default is `false`.
  11678. */
  11679. enableLargerThanScreen?: boolean;
  11680. /**
  11681. * Window's background color as a hexadecimal value, like `#66CD00` or `#FFF` or
  11682. * `#80FFFFFF` (alpha in #AARRGGBB format is supported if `transparent` is set to
  11683. * `true`). Default is `#FFF` (white).
  11684. */
  11685. backgroundColor?: string;
  11686. /**
  11687. * Whether window should have a shadow. Default is `true`.
  11688. */
  11689. hasShadow?: boolean;
  11690. /**
  11691. * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
  11692. * (fully opaque). This is only implemented on Windows and macOS.
  11693. */
  11694. opacity?: number;
  11695. /**
  11696. * Forces using dark theme for the window, only works on some GTK+3 desktop
  11697. * environments. Default is `false`.
  11698. */
  11699. darkTheme?: boolean;
  11700. /**
  11701. * Makes the window transparent. Default is `false`. On Windows, does not work
  11702. * unless the window is frameless.
  11703. */
  11704. transparent?: boolean;
  11705. /**
  11706. * The type of window, default is normal window. See more about this below.
  11707. */
  11708. type?: string;
  11709. /**
  11710. * Specify how the material appearance should reflect window activity state on
  11711. * macOS. Must be used with the `vibrancy` property. Possible values are:
  11712. */
  11713. visualEffectState?: ('followWindow' | 'active' | 'inactive');
  11714. /**
  11715. * The style of window title bar. Default is `default`. Possible values are:
  11716. *
  11717. * @platform darwin,win32
  11718. */
  11719. titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
  11720. /**
  11721. * Set a custom position for the traffic light buttons in frameless windows.
  11722. */
  11723. trafficLightPosition?: Point;
  11724. /**
  11725. * Whether frameless window should have rounded corners on macOS. Default is
  11726. * `true`.
  11727. */
  11728. roundedCorners?: boolean;
  11729. /**
  11730. * Shows the title in the title bar in full screen mode on macOS for `hiddenInset`
  11731. * titleBarStyle. Default is `false`.
  11732. *
  11733. * @deprecated
  11734. */
  11735. fullscreenWindowTitle?: boolean;
  11736. /**
  11737. * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
  11738. * window frame. Setting it to `false` will remove window shadow and window
  11739. * animations. Default is `true`.
  11740. */
  11741. thickFrame?: boolean;
  11742. /**
  11743. * Add a type of vibrancy effect to the window, only on macOS. Can be
  11744. * `appearance-based`, `light`, `dark`, `titlebar`, `selection`, `menu`, `popover`,
  11745. * `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`,
  11746. * `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please
  11747. * note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
  11748. * are deprecated and have been removed in macOS Catalina (10.15).
  11749. */
  11750. vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page');
  11751. /**
  11752. * Controls the behavior on macOS when option-clicking the green stoplight button
  11753. * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
  11754. * will grow to the preferred width of the web page when zoomed, `false` will cause
  11755. * it to zoom to the width of the screen. This will also affect the behavior when
  11756. * calling `maximize()` directly. Default is `false`.
  11757. */
  11758. zoomToPageWidth?: boolean;
  11759. /**
  11760. * Tab group name, allows opening the window as a native tab on macOS 10.12+.
  11761. * Windows with the same tabbing identifier will be grouped together. This also
  11762. * adds a native new tab button to your window's tab bar and allows your `app` and
  11763. * window to receive the `new-window-for-tab` event.
  11764. */
  11765. tabbingIdentifier?: string;
  11766. /**
  11767. * Settings of web page's features.
  11768. */
  11769. webPreferences?: WebPreferences;
  11770. /**
  11771. * When using a frameless window in conjuction with
  11772. * `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so
  11773. * that the standard window controls ("traffic lights" on macOS) are visible, this
  11774. * property enables the Window Controls Overlay JavaScript APIs and CSS Environment
  11775. * Variables. Specifying `true` will result in an overlay with default system
  11776. * colors. Default is `false`. On Windows, the OverlayOptions can be used instead
  11777. * of a boolean to specify colors for the overlay.
  11778. */
  11779. titleBarOverlay?: (OverlayOptions) | (boolean);
  11780. }
  11781. interface CertificateTrustDialogOptions {
  11782. /**
  11783. * The certificate to trust/import.
  11784. */
  11785. certificate: Certificate;
  11786. /**
  11787. * The message to display to the user.
  11788. */
  11789. message: string;
  11790. }
  11791. interface ClearStorageDataOptions {
  11792. /**
  11793. * Should follow `window.location.origin`’s representation `scheme://host:port`.
  11794. */
  11795. origin?: string;
  11796. /**
  11797. * The types of storages to clear, can contain: `appcache`, `cookies`,
  11798. * `filesystem`, `indexdb`, `localstorage`, `shadercache`, `websql`,
  11799. * `serviceworkers`, `cachestorage`. If not specified, clear all storage types.
  11800. */
  11801. storages?: string[];
  11802. /**
  11803. * The types of quotas to clear, can contain: `temporary`, `persistent`,
  11804. * `syncable`. If not specified, clear all quotas.
  11805. */
  11806. quotas?: string[];
  11807. }
  11808. interface ClientRequestConstructorOptions {
  11809. /**
  11810. * The HTTP request method. Defaults to the GET method.
  11811. */
  11812. method?: string;
  11813. /**
  11814. * The request URL. Must be provided in the absolute form with the protocol scheme
  11815. * specified as http or https.
  11816. */
  11817. url?: string;
  11818. /**
  11819. * The `Session` instance with which the request is associated.
  11820. */
  11821. session?: Session;
  11822. /**
  11823. * The name of the `partition` with which the request is associated. Defaults to
  11824. * the empty string. The `session` option supersedes `partition`. Thus if a
  11825. * `session` is explicitly specified, `partition` is ignored.
  11826. */
  11827. partition?: string;
  11828. /**
  11829. * Can be `include` or `omit`. Whether to send credentials with this request. If
  11830. * set to `include`, credentials from the session associated with the request will
  11831. * be used. If set to `omit`, credentials will not be sent with the request (and
  11832. * the `'login'` event will not be triggered in the event of a 401). This matches
  11833. * the behavior of the fetch option of the same name. If this option is not
  11834. * specified, authentication data from the session will be sent, and cookies will
  11835. * not be sent (unless `useSessionCookies` is set).
  11836. */
  11837. credentials?: ('include' | 'omit');
  11838. /**
  11839. * Whether to send cookies with this request from the provided session. If
  11840. * `credentials` is specified, this option has no effect. Default is `false`.
  11841. */
  11842. useSessionCookies?: boolean;
  11843. /**
  11844. * Can be `http:` or `https:`. The protocol scheme in the form 'scheme:'. Defaults
  11845. * to 'http:'.
  11846. */
  11847. protocol?: string;
  11848. /**
  11849. * The server host provided as a concatenation of the hostname and the port number
  11850. * 'hostname:port'.
  11851. */
  11852. host?: string;
  11853. /**
  11854. * The server host name.
  11855. */
  11856. hostname?: string;
  11857. /**
  11858. * The server's listening port number.
  11859. */
  11860. port?: number;
  11861. /**
  11862. * The path part of the request URL.
  11863. */
  11864. path?: string;
  11865. /**
  11866. * Can be `follow`, `error` or `manual`. The redirect mode for this request. When
  11867. * mode is `error`, any redirection will be aborted. When mode is `manual` the
  11868. * redirection will be cancelled unless `request.followRedirect` is invoked
  11869. * synchronously during the `redirect` event. Defaults to `follow`.
  11870. */
  11871. redirect?: ('follow' | 'error' | 'manual');
  11872. /**
  11873. * The origin URL of the request.
  11874. */
  11875. origin?: string;
  11876. }
  11877. interface Config {
  11878. /**
  11879. * The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`,
  11880. * `fixed_servers` or `system`. If it's unspecified, it will be automatically
  11881. * determined based on other specified options.
  11882. */
  11883. mode?: ('direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system');
  11884. /**
  11885. * The URL associated with the PAC file.
  11886. */
  11887. pacScript?: string;
  11888. /**
  11889. * Rules indicating which proxies to use.
  11890. */
  11891. proxyRules?: string;
  11892. /**
  11893. * Rules indicating which URLs should bypass the proxy settings.
  11894. */
  11895. proxyBypassRules?: string;
  11896. }
  11897. interface ConsoleMessageEvent extends Event {
  11898. /**
  11899. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  11900. * `error`.
  11901. */
  11902. level: number;
  11903. /**
  11904. * The actual console message
  11905. */
  11906. message: string;
  11907. /**
  11908. * The line number of the source that triggered this console message
  11909. */
  11910. line: number;
  11911. sourceId: string;
  11912. }
  11913. interface ContextMenuParams {
  11914. /**
  11915. * x coordinate.
  11916. */
  11917. x: number;
  11918. /**
  11919. * y coordinate.
  11920. */
  11921. y: number;
  11922. /**
  11923. * URL of the link that encloses the node the context menu was invoked on.
  11924. */
  11925. linkURL: string;
  11926. /**
  11927. * Text associated with the link. May be an empty string if the contents of the
  11928. * link are an image.
  11929. */
  11930. linkText: string;
  11931. /**
  11932. * URL of the top level page that the context menu was invoked on.
  11933. */
  11934. pageURL: string;
  11935. /**
  11936. * URL of the subframe that the context menu was invoked on.
  11937. */
  11938. frameURL: string;
  11939. /**
  11940. * Source URL for the element that the context menu was invoked on. Elements with
  11941. * source URLs are images, audio and video.
  11942. */
  11943. srcURL: string;
  11944. /**
  11945. * Type of the node the context menu was invoked on. Can be `none`, `image`,
  11946. * `audio`, `video`, `canvas`, `file` or `plugin`.
  11947. */
  11948. mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
  11949. /**
  11950. * Whether the context menu was invoked on an image which has non-empty contents.
  11951. */
  11952. hasImageContents: boolean;
  11953. /**
  11954. * Whether the context is editable.
  11955. */
  11956. isEditable: boolean;
  11957. /**
  11958. * Text of the selection that the context menu was invoked on.
  11959. */
  11960. selectionText: string;
  11961. /**
  11962. * Title text of the selection that the context menu was invoked on.
  11963. */
  11964. titleText: string;
  11965. /**
  11966. * Alt text of the selection that the context menu was invoked on.
  11967. */
  11968. altText: string;
  11969. /**
  11970. * Suggested filename to be used when saving file through 'Save Link As' option of
  11971. * context menu.
  11972. */
  11973. suggestedFilename: string;
  11974. /**
  11975. * Rect representing the coordinates in the document space of the selection.
  11976. */
  11977. selectionRect: Rectangle;
  11978. /**
  11979. * Start position of the selection text.
  11980. */
  11981. selectionStartOffset: number;
  11982. /**
  11983. * The referrer policy of the frame on which the menu is invoked.
  11984. */
  11985. referrerPolicy: Referrer;
  11986. /**
  11987. * The misspelled word under the cursor, if any.
  11988. */
  11989. misspelledWord: string;
  11990. /**
  11991. * An array of suggested words to show the user to replace the `misspelledWord`.
  11992. * Only available if there is a misspelled word and spellchecker is enabled.
  11993. */
  11994. dictionarySuggestions: string[];
  11995. /**
  11996. * The character encoding of the frame on which the menu was invoked.
  11997. */
  11998. frameCharset: string;
  11999. /**
  12000. * If the context menu was invoked on an input field, the type of that field.
  12001. * Possible values are `none`, `plainText`, `password`, `other`.
  12002. */
  12003. inputFieldType: string;
  12004. /**
  12005. * If the context is editable, whether or not spellchecking is enabled.
  12006. */
  12007. spellcheckEnabled: boolean;
  12008. /**
  12009. * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
  12010. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  12011. * `adjustSelection`, or `adjustSelectionReset`.
  12012. */
  12013. menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  12014. /**
  12015. * The flags for the media element the context menu was invoked on.
  12016. */
  12017. mediaFlags: MediaFlags;
  12018. /**
  12019. * These flags indicate whether the renderer believes it is able to perform the
  12020. * corresponding action.
  12021. */
  12022. editFlags: EditFlags;
  12023. }
  12024. interface CookiesGetFilter {
  12025. /**
  12026. * Retrieves cookies which are associated with `url`. Empty implies retrieving
  12027. * cookies of all URLs.
  12028. */
  12029. url?: string;
  12030. /**
  12031. * Filters cookies by name.
  12032. */
  12033. name?: string;
  12034. /**
  12035. * Retrieves cookies whose domains match or are subdomains of `domains`.
  12036. */
  12037. domain?: string;
  12038. /**
  12039. * Retrieves cookies whose path matches `path`.
  12040. */
  12041. path?: string;
  12042. /**
  12043. * Filters cookies by their Secure property.
  12044. */
  12045. secure?: boolean;
  12046. /**
  12047. * Filters out session or persistent cookies.
  12048. */
  12049. session?: boolean;
  12050. }
  12051. interface CookiesSetDetails {
  12052. /**
  12053. * The URL to associate the cookie with. The promise will be rejected if the URL is
  12054. * invalid.
  12055. */
  12056. url: string;
  12057. /**
  12058. * The name of the cookie. Empty by default if omitted.
  12059. */
  12060. name?: string;
  12061. /**
  12062. * The value of the cookie. Empty by default if omitted.
  12063. */
  12064. value?: string;
  12065. /**
  12066. * The domain of the cookie; this will be normalized with a preceding dot so that
  12067. * it's also valid for subdomains. Empty by default if omitted.
  12068. */
  12069. domain?: string;
  12070. /**
  12071. * The path of the cookie. Empty by default if omitted.
  12072. */
  12073. path?: string;
  12074. /**
  12075. * Whether the cookie should be marked as Secure. Defaults to false.
  12076. */
  12077. secure?: boolean;
  12078. /**
  12079. * Whether the cookie should be marked as HTTP only. Defaults to false.
  12080. */
  12081. httpOnly?: boolean;
  12082. /**
  12083. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  12084. * If omitted then the cookie becomes a session cookie and will not be retained
  12085. * between sessions.
  12086. */
  12087. expirationDate?: number;
  12088. /**
  12089. * The Same Site policy to apply to this cookie. Can be `unspecified`,
  12090. * `no_restriction`, `lax` or `strict`. Default is `no_restriction`.
  12091. */
  12092. sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  12093. }
  12094. interface CrashReporterStartOptions {
  12095. /**
  12096. * URL that crash reports will be sent to as POST. Required unless `uploadToServer`
  12097. * is `false`.
  12098. */
  12099. submitURL?: string;
  12100. /**
  12101. * Defaults to `app.name`.
  12102. */
  12103. productName?: string;
  12104. /**
  12105. * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
  12106. *
  12107. * @deprecated
  12108. */
  12109. companyName?: string;
  12110. /**
  12111. * Whether crash reports should be sent to the server. If false, crash reports will
  12112. * be collected and stored in the crashes directory, but not uploaded. Default is
  12113. * `true`.
  12114. */
  12115. uploadToServer?: boolean;
  12116. /**
  12117. * If true, crashes generated in the main process will not be forwarded to the
  12118. * system crash handler. Default is `false`.
  12119. */
  12120. ignoreSystemCrashHandler?: boolean;
  12121. /**
  12122. * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
  12123. *
  12124. * @platform darwin,win32
  12125. */
  12126. rateLimit?: boolean;
  12127. /**
  12128. * If true, crash reports will be compressed and uploaded with `Content-Encoding:
  12129. * gzip`. Default is `true`.
  12130. */
  12131. compress?: boolean;
  12132. /**
  12133. * Extra string key/value annotations that will be sent along with crash reports
  12134. * that are generated in the main process. Only string values are supported.
  12135. * Crashes generated in child processes will not contain these extra parameters to
  12136. * crash reports generated from child processes, call `addExtraParameter` from the
  12137. * child process.
  12138. */
  12139. extra?: Record<string, string>;
  12140. /**
  12141. * Extra string key/value annotations that will be sent along with any crash
  12142. * reports generated in any process. These annotations cannot be changed once the
  12143. * crash reporter has been started. If a key is present in both the global extra
  12144. * parameters and the process-specific extra parameters, then the global one will
  12145. * take precedence. By default, `productName` and the app version are included, as
  12146. * well as the Electron version.
  12147. */
  12148. globalExtra?: Record<string, string>;
  12149. }
  12150. interface CreateFromBitmapOptions {
  12151. width: number;
  12152. height: number;
  12153. /**
  12154. * Defaults to 1.0.
  12155. */
  12156. scaleFactor?: number;
  12157. }
  12158. interface CreateFromBufferOptions {
  12159. /**
  12160. * Required for bitmap buffers.
  12161. */
  12162. width?: number;
  12163. /**
  12164. * Required for bitmap buffers.
  12165. */
  12166. height?: number;
  12167. /**
  12168. * Defaults to 1.0.
  12169. */
  12170. scaleFactor?: number;
  12171. }
  12172. interface CreateInterruptedDownloadOptions {
  12173. /**
  12174. * Absolute path of the download.
  12175. */
  12176. path: string;
  12177. /**
  12178. * Complete URL chain for the download.
  12179. */
  12180. urlChain: string[];
  12181. mimeType?: string;
  12182. /**
  12183. * Start range for the download.
  12184. */
  12185. offset: number;
  12186. /**
  12187. * Total length of the download.
  12188. */
  12189. length: number;
  12190. /**
  12191. * Last-Modified header value.
  12192. */
  12193. lastModified?: string;
  12194. /**
  12195. * ETag header value.
  12196. */
  12197. eTag?: string;
  12198. /**
  12199. * Time when download was started in number of seconds since UNIX epoch.
  12200. */
  12201. startTime?: number;
  12202. }
  12203. interface Data {
  12204. text?: string;
  12205. html?: string;
  12206. image?: NativeImage;
  12207. rtf?: string;
  12208. /**
  12209. * The title of the URL at `text`.
  12210. */
  12211. bookmark?: string;
  12212. }
  12213. interface Details {
  12214. /**
  12215. * Process type. One of the following values:
  12216. */
  12217. type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  12218. /**
  12219. * The reason the child process is gone. Possible values:
  12220. */
  12221. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  12222. /**
  12223. * The exit code for the process (e.g. status from waitpid if on posix, from
  12224. * GetExitCodeProcess on Windows).
  12225. */
  12226. exitCode: number;
  12227. /**
  12228. * The non-localized name of the process.
  12229. */
  12230. serviceName?: string;
  12231. /**
  12232. * The name of the process. Examples for utility: `Audio Service`, `Content
  12233. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  12234. */
  12235. name?: string;
  12236. }
  12237. interface DidChangeThemeColorEvent extends Event {
  12238. themeColor: string;
  12239. }
  12240. interface DidCreateWindowDetails {
  12241. /**
  12242. * URL for the created window.
  12243. */
  12244. url: string;
  12245. /**
  12246. * Name given to the created window in the `window.open()` call.
  12247. */
  12248. frameName: string;
  12249. /**
  12250. * The options used to create the BrowserWindow. They are merged in increasing
  12251. * precedence: options inherited from the parent, parsed options from the
  12252. * `features` string from `window.open()`, and options given by
  12253. * `webContents.setWindowOpenHandler`. Unrecognized options are not filtered out.
  12254. */
  12255. options: BrowserWindowConstructorOptions;
  12256. /**
  12257. * The non-standard features (features not handled Chromium or Electron)
  12258. * _Deprecated_
  12259. */
  12260. additionalFeatures: string[];
  12261. /**
  12262. * The referrer that will be passed to the new window. May or may not result in the
  12263. * `Referer` header being sent, depending on the referrer policy.
  12264. */
  12265. referrer: Referrer;
  12266. /**
  12267. * The post data that will be sent to the new window, along with the appropriate
  12268. * headers that will be set. If no post data is to be sent, the value will be
  12269. * `null`. Only defined when the window is being created by a form that set
  12270. * `target=_blank`.
  12271. */
  12272. postBody?: PostBody;
  12273. /**
  12274. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  12275. * `save-to-disk` and `other`.
  12276. */
  12277. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  12278. }
  12279. interface DidFailLoadEvent extends Event {
  12280. errorCode: number;
  12281. errorDescription: string;
  12282. validatedURL: string;
  12283. isMainFrame: boolean;
  12284. }
  12285. interface DidFrameFinishLoadEvent extends Event {
  12286. isMainFrame: boolean;
  12287. }
  12288. interface DidFrameNavigateEvent extends Event {
  12289. url: string;
  12290. /**
  12291. * -1 for non HTTP navigations
  12292. */
  12293. httpResponseCode: number;
  12294. /**
  12295. * empty for non HTTP navigations,
  12296. */
  12297. httpStatusText: string;
  12298. isMainFrame: boolean;
  12299. frameProcessId: number;
  12300. frameRoutingId: number;
  12301. }
  12302. interface DidNavigateEvent extends Event {
  12303. url: string;
  12304. }
  12305. interface DidNavigateInPageEvent extends Event {
  12306. isMainFrame: boolean;
  12307. url: string;
  12308. }
  12309. interface DidStartNavigationEvent extends Event {
  12310. url: string;
  12311. isInPlace: boolean;
  12312. isMainFrame: boolean;
  12313. frameProcessId: number;
  12314. frameRoutingId: number;
  12315. }
  12316. interface DisplayBalloonOptions {
  12317. /**
  12318. * Icon to use when `iconType` is `custom`.
  12319. */
  12320. icon?: (NativeImage) | (string);
  12321. /**
  12322. * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
  12323. */
  12324. iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
  12325. title: string;
  12326. content: string;
  12327. /**
  12328. * The large version of the icon should be used. Default is `true`. Maps to
  12329. * `NIIF_LARGE_ICON`.
  12330. */
  12331. largeIcon?: boolean;
  12332. /**
  12333. * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
  12334. */
  12335. noSound?: boolean;
  12336. /**
  12337. * Do not display the balloon notification if the current user is in "quiet time".
  12338. * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
  12339. */
  12340. respectQuietTime?: boolean;
  12341. }
  12342. interface EnableNetworkEmulationOptions {
  12343. /**
  12344. * Whether to emulate network outage. Defaults to false.
  12345. */
  12346. offline?: boolean;
  12347. /**
  12348. * RTT in ms. Defaults to 0 which will disable latency throttling.
  12349. */
  12350. latency?: number;
  12351. /**
  12352. * Download rate in Bps. Defaults to 0 which will disable download throttling.
  12353. */
  12354. downloadThroughput?: number;
  12355. /**
  12356. * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
  12357. */
  12358. uploadThroughput?: number;
  12359. }
  12360. interface FeedURLOptions {
  12361. url: string;
  12362. /**
  12363. * HTTP request headers.
  12364. *
  12365. * @platform darwin
  12366. */
  12367. headers?: Record<string, string>;
  12368. /**
  12369. * Can be `json` or `default`, see the Squirrel.Mac README for more information.
  12370. *
  12371. * @platform darwin
  12372. */
  12373. serverType?: ('json' | 'default');
  12374. }
  12375. interface FileIconOptions {
  12376. size: ('small' | 'normal' | 'large');
  12377. }
  12378. interface Filter {
  12379. /**
  12380. * Array of URL patterns that will be used to filter out the requests that do not
  12381. * match the URL patterns.
  12382. */
  12383. urls: string[];
  12384. }
  12385. interface FindInPageOptions {
  12386. /**
  12387. * Whether to search forward or backward, defaults to `true`.
  12388. */
  12389. forward?: boolean;
  12390. /**
  12391. * Whether to begin a new text finding session with this request. Should be `true`
  12392. * for initial requests, and `false` for follow-up requests. Defaults to `false`.
  12393. */
  12394. findNext?: boolean;
  12395. /**
  12396. * Whether search should be case-sensitive, defaults to `false`.
  12397. */
  12398. matchCase?: boolean;
  12399. }
  12400. interface FocusOptions {
  12401. /**
  12402. * Make the receiver the active app even if another app is currently active.
  12403. *
  12404. * @platform darwin
  12405. */
  12406. steal: boolean;
  12407. }
  12408. interface FoundInPageEvent extends Event {
  12409. result: FoundInPageResult;
  12410. }
  12411. interface FromPartitionOptions {
  12412. /**
  12413. * Whether to enable cache.
  12414. */
  12415. cache: boolean;
  12416. }
  12417. interface HandlerDetails {
  12418. /**
  12419. * The _resolved_ version of the URL passed to `window.open()`. e.g. opening a
  12420. * window with `window.open('foo')` will yield something like
  12421. * `https://the-origin/the/current/path/foo`.
  12422. */
  12423. url: string;
  12424. /**
  12425. * Name of the window provided in `window.open()`
  12426. */
  12427. frameName: string;
  12428. /**
  12429. * Comma separated list of window features provided to `window.open()`.
  12430. */
  12431. features: string;
  12432. /**
  12433. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  12434. * `save-to-disk` or `other`.
  12435. */
  12436. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  12437. /**
  12438. * The referrer that will be passed to the new window. May or may not result in the
  12439. * `Referer` header being sent, depending on the referrer policy.
  12440. */
  12441. referrer: Referrer;
  12442. /**
  12443. * The post data that will be sent to the new window, along with the appropriate
  12444. * headers that will be set. If no post data is to be sent, the value will be
  12445. * `null`. Only defined when the window is being created by a form that set
  12446. * `target=_blank`.
  12447. */
  12448. postBody?: PostBody;
  12449. }
  12450. interface HeadersReceivedResponse {
  12451. cancel?: boolean;
  12452. /**
  12453. * When provided, the server is assumed to have responded with these headers.
  12454. */
  12455. responseHeaders?: Record<string, (string) | (string[])>;
  12456. /**
  12457. * Should be provided when overriding `responseHeaders` to change header status
  12458. * otherwise original response header's status will be used.
  12459. */
  12460. statusLine?: string;
  12461. }
  12462. interface HeapStatistics {
  12463. totalHeapSize: number;
  12464. totalHeapSizeExecutable: number;
  12465. totalPhysicalSize: number;
  12466. totalAvailableSize: number;
  12467. usedHeapSize: number;
  12468. heapSizeLimit: number;
  12469. mallocedMemory: number;
  12470. peakMallocedMemory: number;
  12471. doesZapGarbage: boolean;
  12472. }
  12473. interface IgnoreMouseEventsOptions {
  12474. /**
  12475. * If true, forwards mouse move messages to Chromium, enabling mouse related events
  12476. * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
  12477. * forwarding is always disabled regardless of this value.
  12478. *
  12479. * @platform darwin,win32
  12480. */
  12481. forward?: boolean;
  12482. }
  12483. interface ImportCertificateOptions {
  12484. /**
  12485. * Path for the pkcs12 file.
  12486. */
  12487. certificate: string;
  12488. /**
  12489. * Passphrase for the certificate.
  12490. */
  12491. password: string;
  12492. }
  12493. interface Info {
  12494. /**
  12495. * Security origin for the isolated world.
  12496. */
  12497. securityOrigin?: string;
  12498. /**
  12499. * Content Security Policy for the isolated world.
  12500. */
  12501. csp?: string;
  12502. /**
  12503. * Name for isolated world. Useful in devtools.
  12504. */
  12505. name?: string;
  12506. }
  12507. interface Input {
  12508. /**
  12509. * Either `keyUp` or `keyDown`.
  12510. */
  12511. type: string;
  12512. /**
  12513. * Equivalent to KeyboardEvent.key.
  12514. */
  12515. key: string;
  12516. /**
  12517. * Equivalent to KeyboardEvent.code.
  12518. */
  12519. code: string;
  12520. /**
  12521. * Equivalent to KeyboardEvent.repeat.
  12522. */
  12523. isAutoRepeat: boolean;
  12524. /**
  12525. * Equivalent to KeyboardEvent.isComposing.
  12526. */
  12527. isComposing: boolean;
  12528. /**
  12529. * Equivalent to KeyboardEvent.shiftKey.
  12530. */
  12531. shift: boolean;
  12532. /**
  12533. * Equivalent to KeyboardEvent.controlKey.
  12534. */
  12535. control: boolean;
  12536. /**
  12537. * Equivalent to KeyboardEvent.altKey.
  12538. */
  12539. alt: boolean;
  12540. /**
  12541. * Equivalent to KeyboardEvent.metaKey.
  12542. */
  12543. meta: boolean;
  12544. }
  12545. interface InsertCSSOptions {
  12546. /**
  12547. * Can be either 'user' or 'author'; Specifying 'user' enables you to prevent
  12548. * websites from overriding the CSS you insert. Default is 'author'.
  12549. */
  12550. cssOrigin?: string;
  12551. }
  12552. interface IpcMessageEvent extends Event {
  12553. channel: string;
  12554. args: any[];
  12555. }
  12556. interface Item {
  12557. /**
  12558. * The path(s) to the file(s) being dragged.
  12559. */
  12560. file: (string[]) | (string);
  12561. /**
  12562. * The image must be non-empty on macOS.
  12563. */
  12564. icon: (NativeImage) | (string);
  12565. }
  12566. interface JumpListSettings {
  12567. /**
  12568. * The minimum number of items that will be shown in the Jump List (for a more
  12569. * detailed description of this value see the MSDN docs).
  12570. */
  12571. minItems: number;
  12572. /**
  12573. * Array of `JumpListItem` objects that correspond to items that the user has
  12574. * explicitly removed from custom categories in the Jump List. These items must not
  12575. * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
  12576. * Windows will not display any custom category that contains any of the removed
  12577. * items.
  12578. */
  12579. removedItems: JumpListItem[];
  12580. }
  12581. interface LoadCommitEvent extends Event {
  12582. url: string;
  12583. isMainFrame: boolean;
  12584. }
  12585. interface LoadExtensionOptions {
  12586. /**
  12587. * Whether to allow the extension to read local files over `file://` protocol and
  12588. * inject content scripts into `file://` pages. This is required e.g. for loading
  12589. * devtools extensions on `file://` URLs. Defaults to false.
  12590. */
  12591. allowFileAccess: boolean;
  12592. }
  12593. interface LoadFileOptions {
  12594. /**
  12595. * Passed to `url.format()`.
  12596. */
  12597. query?: Record<string, string>;
  12598. /**
  12599. * Passed to `url.format()`.
  12600. */
  12601. search?: string;
  12602. /**
  12603. * Passed to `url.format()`.
  12604. */
  12605. hash?: string;
  12606. }
  12607. interface LoadURLOptions {
  12608. /**
  12609. * An HTTP Referrer url.
  12610. */
  12611. httpReferrer?: (string) | (Referrer);
  12612. /**
  12613. * A user agent originating the request.
  12614. */
  12615. userAgent?: string;
  12616. /**
  12617. * Extra headers separated by "\n"
  12618. */
  12619. extraHeaders?: string;
  12620. postData?: Array<(UploadRawData) | (UploadFile)>;
  12621. /**
  12622. * Base url (with trailing path separator) for files to be loaded by the data url.
  12623. * This is needed only if the specified `url` is a data url and needs to load other
  12624. * files.
  12625. */
  12626. baseURLForDataURL?: string;
  12627. }
  12628. interface LoginItemSettings {
  12629. /**
  12630. * `true` if the app is set to open at login.
  12631. */
  12632. openAtLogin: boolean;
  12633. /**
  12634. * `true` if the app is set to open as hidden at login. This setting is not
  12635. * available on MAS builds.
  12636. *
  12637. * @platform darwin
  12638. */
  12639. openAsHidden: boolean;
  12640. /**
  12641. * `true` if the app was opened at login automatically. This setting is not
  12642. * available on MAS builds.
  12643. *
  12644. * @platform darwin
  12645. */
  12646. wasOpenedAtLogin: boolean;
  12647. /**
  12648. * `true` if the app was opened as a hidden login item. This indicates that the app
  12649. * should not open any windows at startup. This setting is not available on MAS
  12650. * builds.
  12651. *
  12652. * @platform darwin
  12653. */
  12654. wasOpenedAsHidden: boolean;
  12655. /**
  12656. * `true` if the app was opened as a login item that should restore the state from
  12657. * the previous session. This indicates that the app should restore the windows
  12658. * that were open the last time the app was closed. This setting is not available
  12659. * on MAS builds.
  12660. *
  12661. * @platform darwin
  12662. */
  12663. restoreState: boolean;
  12664. /**
  12665. * `true` if app is set to open at login and its run key is not deactivated. This
  12666. * differs from `openAtLogin` as it ignores the `args` option, this property will
  12667. * be true if the given executable would be launched at login with **any**
  12668. * arguments.
  12669. *
  12670. * @platform win32
  12671. */
  12672. executableWillLaunchAtLogin: boolean;
  12673. launchItems: LaunchItems[];
  12674. }
  12675. interface LoginItemSettingsOptions {
  12676. /**
  12677. * The executable path to compare against. Defaults to `process.execPath`.
  12678. *
  12679. * @platform win32
  12680. */
  12681. path?: string;
  12682. /**
  12683. * The command-line arguments to compare against. Defaults to an empty array.
  12684. *
  12685. * @platform win32
  12686. */
  12687. args?: string[];
  12688. }
  12689. interface MenuItemConstructorOptions {
  12690. /**
  12691. * Will be called with `click(menuItem, browserWindow, event)` when the menu item
  12692. * is clicked.
  12693. */
  12694. click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
  12695. /**
  12696. * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
  12697. * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
  12698. * `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`,
  12699. * `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
  12700. * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
  12701. * `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`,
  12702. * `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`,
  12703. * `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when
  12704. * specified the `click` property will be ignored. See roles.
  12705. */
  12706. role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'shareMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  12707. /**
  12708. * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
  12709. */
  12710. type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  12711. label?: string;
  12712. sublabel?: string;
  12713. /**
  12714. * Hover text for this menu item.
  12715. *
  12716. * @platform darwin
  12717. */
  12718. toolTip?: string;
  12719. accelerator?: Accelerator;
  12720. icon?: (NativeImage) | (string);
  12721. /**
  12722. * If false, the menu item will be greyed out and unclickable.
  12723. */
  12724. enabled?: boolean;
  12725. /**
  12726. * default is `true`, and when `false` will prevent the accelerator from triggering
  12727. * the item if the item is not visible`.
  12728. *
  12729. * @platform darwin
  12730. */
  12731. acceleratorWorksWhenHidden?: boolean;
  12732. /**
  12733. * If false, the menu item will be entirely hidden.
  12734. */
  12735. visible?: boolean;
  12736. /**
  12737. * Should only be specified for `checkbox` or `radio` type menu items.
  12738. */
  12739. checked?: boolean;
  12740. /**
  12741. * If false, the accelerator won't be registered with the system, but it will still
  12742. * be displayed. Defaults to true.
  12743. *
  12744. * @platform linux,win32
  12745. */
  12746. registerAccelerator?: boolean;
  12747. /**
  12748. * The item to share when the `role` is `shareMenu`.
  12749. *
  12750. * @platform darwin
  12751. */
  12752. sharingItem?: SharingItem;
  12753. /**
  12754. * Should be specified for `submenu` type menu items. If `submenu` is specified,
  12755. * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
  12756. * be automatically converted to one using `Menu.buildFromTemplate`.
  12757. */
  12758. submenu?: (MenuItemConstructorOptions[]) | (Menu);
  12759. /**
  12760. * Unique within a single menu. If defined then it can be used as a reference to
  12761. * this item by the position attribute.
  12762. */
  12763. id?: string;
  12764. /**
  12765. * Inserts this item before the item with the specified label. If the referenced
  12766. * item doesn't exist the item will be inserted at the end of the menu. Also
  12767. * implies that the menu item in question should be placed in the same “group” as
  12768. * the item.
  12769. */
  12770. before?: string[];
  12771. /**
  12772. * Inserts this item after the item with the specified label. If the referenced
  12773. * item doesn't exist the item will be inserted at the end of the menu.
  12774. */
  12775. after?: string[];
  12776. /**
  12777. * Provides a means for a single context menu to declare the placement of their
  12778. * containing group before the containing group of the item with the specified
  12779. * label.
  12780. */
  12781. beforeGroupContaining?: string[];
  12782. /**
  12783. * Provides a means for a single context menu to declare the placement of their
  12784. * containing group after the containing group of the item with the specified
  12785. * label.
  12786. */
  12787. afterGroupContaining?: string[];
  12788. }
  12789. interface MessageBoxOptions {
  12790. /**
  12791. * Content of the message box.
  12792. */
  12793. message: string;
  12794. /**
  12795. * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
  12796. * `"question"` displays the same icon as `"info"`, unless you set an icon using
  12797. * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
  12798. * warning icon.
  12799. */
  12800. type?: string;
  12801. /**
  12802. * Array of texts for buttons. On Windows, an empty array will result in one button
  12803. * labeled "OK".
  12804. */
  12805. buttons?: string[];
  12806. /**
  12807. * Index of the button in the buttons array which will be selected by default when
  12808. * the message box opens.
  12809. */
  12810. defaultId?: number;
  12811. /**
  12812. * Title of the message box, some platforms will not show it.
  12813. */
  12814. title?: string;
  12815. /**
  12816. * Extra information of the message.
  12817. */
  12818. detail?: string;
  12819. /**
  12820. * If provided, the message box will include a checkbox with the given label.
  12821. */
  12822. checkboxLabel?: string;
  12823. /**
  12824. * Initial checked state of the checkbox. `false` by default.
  12825. */
  12826. checkboxChecked?: boolean;
  12827. icon?: NativeImage;
  12828. /**
  12829. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  12830. * default this is assigned to the first button with "cancel" or "no" as the label.
  12831. * If no such labeled buttons exist and this option is not set, `0` will be used as
  12832. * the return value.
  12833. */
  12834. cancelId?: number;
  12835. /**
  12836. * On Windows Electron will try to figure out which one of the `buttons` are common
  12837. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  12838. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  12839. * you don't like this behavior, you can set `noLink` to `true`.
  12840. */
  12841. noLink?: boolean;
  12842. /**
  12843. * Normalize the keyboard access keys across platforms. Default is `false`.
  12844. * Enabling this assumes `&` is used in the button labels for the placement of the
  12845. * keyboard shortcut access key and labels will be converted so they work correctly
  12846. * on each platform, `&` characters are removed on macOS, converted to `_` on
  12847. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  12848. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  12849. * via `Alt-W` on Windows and Linux.
  12850. */
  12851. normalizeAccessKeys?: boolean;
  12852. }
  12853. interface MessageBoxReturnValue {
  12854. /**
  12855. * The index of the clicked button.
  12856. */
  12857. response: number;
  12858. /**
  12859. * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
  12860. */
  12861. checkboxChecked: boolean;
  12862. }
  12863. interface MessageBoxSyncOptions {
  12864. /**
  12865. * Content of the message box.
  12866. */
  12867. message: string;
  12868. /**
  12869. * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
  12870. * `"question"` displays the same icon as `"info"`, unless you set an icon using
  12871. * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
  12872. * warning icon.
  12873. */
  12874. type?: string;
  12875. /**
  12876. * Array of texts for buttons. On Windows, an empty array will result in one button
  12877. * labeled "OK".
  12878. */
  12879. buttons?: string[];
  12880. /**
  12881. * Index of the button in the buttons array which will be selected by default when
  12882. * the message box opens.
  12883. */
  12884. defaultId?: number;
  12885. /**
  12886. * Title of the message box, some platforms will not show it.
  12887. */
  12888. title?: string;
  12889. /**
  12890. * Extra information of the message.
  12891. */
  12892. detail?: string;
  12893. /**
  12894. * If provided, the message box will include a checkbox with the given label.
  12895. */
  12896. checkboxLabel?: string;
  12897. /**
  12898. * Initial checked state of the checkbox. `false` by default.
  12899. */
  12900. checkboxChecked?: boolean;
  12901. icon?: (NativeImage) | (string);
  12902. /**
  12903. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  12904. * default this is assigned to the first button with "cancel" or "no" as the label.
  12905. * If no such labeled buttons exist and this option is not set, `0` will be used as
  12906. * the return value.
  12907. */
  12908. cancelId?: number;
  12909. /**
  12910. * On Windows Electron will try to figure out which one of the `buttons` are common
  12911. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  12912. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  12913. * you don't like this behavior, you can set `noLink` to `true`.
  12914. */
  12915. noLink?: boolean;
  12916. /**
  12917. * Normalize the keyboard access keys across platforms. Default is `false`.
  12918. * Enabling this assumes `&` is used in the button labels for the placement of the
  12919. * keyboard shortcut access key and labels will be converted so they work correctly
  12920. * on each platform, `&` characters are removed on macOS, converted to `_` on
  12921. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  12922. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  12923. * via `Alt-W` on Windows and Linux.
  12924. */
  12925. normalizeAccessKeys?: boolean;
  12926. }
  12927. interface MessageDetails {
  12928. /**
  12929. * The actual console message
  12930. */
  12931. message: string;
  12932. /**
  12933. * The version ID of the service worker that sent the log message
  12934. */
  12935. versionId: number;
  12936. /**
  12937. * The type of source for this message. Can be `javascript`, `xml`, `network`,
  12938. * `console-api`, `storage`, `app-cache`, `rendering`, `security`, `deprecation`,
  12939. * `worker`, `violation`, `intervention`, `recommendation` or `other`.
  12940. */
  12941. source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'app-cache' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
  12942. /**
  12943. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  12944. * `error`.
  12945. */
  12946. level: number;
  12947. /**
  12948. * The URL the message came from
  12949. */
  12950. sourceUrl: string;
  12951. /**
  12952. * The line number of the source that triggered this console message
  12953. */
  12954. lineNumber: number;
  12955. }
  12956. interface MessageEvent {
  12957. data: any;
  12958. ports: MessagePortMain[];
  12959. }
  12960. interface MoveToApplicationsFolderOptions {
  12961. /**
  12962. * A handler for potential conflict in move failure.
  12963. */
  12964. conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
  12965. }
  12966. interface NewWindowEvent extends Event {
  12967. url: string;
  12968. frameName: string;
  12969. /**
  12970. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  12971. * `save-to-disk` and `other`.
  12972. */
  12973. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  12974. /**
  12975. * The options which should be used for creating the new `BrowserWindow`.
  12976. */
  12977. options: BrowserWindowConstructorOptions;
  12978. }
  12979. interface NotificationConstructorOptions {
  12980. /**
  12981. * A title for the notification, which will be shown at the top of the notification
  12982. * window when it is shown.
  12983. */
  12984. title?: string;
  12985. /**
  12986. * A subtitle for the notification, which will be displayed below the title.
  12987. *
  12988. * @platform darwin
  12989. */
  12990. subtitle?: string;
  12991. /**
  12992. * The body text of the notification, which will be displayed below the title or
  12993. * subtitle.
  12994. */
  12995. body?: string;
  12996. /**
  12997. * Whether or not to emit an OS notification noise when showing the notification.
  12998. */
  12999. silent?: boolean;
  13000. /**
  13001. * An icon to use in the notification.
  13002. */
  13003. icon?: (string) | (NativeImage);
  13004. /**
  13005. * Whether or not to add an inline reply option to the notification.
  13006. *
  13007. * @platform darwin
  13008. */
  13009. hasReply?: boolean;
  13010. /**
  13011. * The timeout duration of the notification. Can be 'default' or 'never'.
  13012. *
  13013. * @platform linux,win32
  13014. */
  13015. timeoutType?: ('default' | 'never');
  13016. /**
  13017. * The placeholder to write in the inline reply input field.
  13018. *
  13019. * @platform darwin
  13020. */
  13021. replyPlaceholder?: string;
  13022. /**
  13023. * The name of the sound file to play when the notification is shown.
  13024. *
  13025. * @platform darwin
  13026. */
  13027. sound?: string;
  13028. /**
  13029. * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
  13030. *
  13031. * @platform linux
  13032. */
  13033. urgency?: ('normal' | 'critical' | 'low');
  13034. /**
  13035. * Actions to add to the notification. Please read the available actions and
  13036. * limitations in the `NotificationAction` documentation.
  13037. *
  13038. * @platform darwin
  13039. */
  13040. actions?: NotificationAction[];
  13041. /**
  13042. * A custom title for the close button of an alert. An empty string will cause the
  13043. * default localized text to be used.
  13044. *
  13045. * @platform darwin
  13046. */
  13047. closeButtonText?: string;
  13048. /**
  13049. * A custom description of the Notification on Windows superseding all properties
  13050. * above. Provides full customization of design and behavior of the notification.
  13051. *
  13052. * @platform win32
  13053. */
  13054. toastXml?: string;
  13055. }
  13056. interface OnBeforeRedirectListenerDetails {
  13057. id: number;
  13058. url: string;
  13059. method: string;
  13060. webContentsId?: number;
  13061. webContents?: WebContents;
  13062. frame?: WebFrameMain;
  13063. resourceType: string;
  13064. referrer: string;
  13065. timestamp: number;
  13066. redirectURL: string;
  13067. statusCode: number;
  13068. statusLine: string;
  13069. /**
  13070. * The server IP address that the request was actually sent to.
  13071. */
  13072. ip?: string;
  13073. fromCache: boolean;
  13074. responseHeaders?: Record<string, string[]>;
  13075. }
  13076. interface OnBeforeRequestListenerDetails {
  13077. id: number;
  13078. url: string;
  13079. method: string;
  13080. webContentsId?: number;
  13081. webContents?: WebContents;
  13082. frame?: WebFrameMain;
  13083. resourceType: string;
  13084. referrer: string;
  13085. timestamp: number;
  13086. uploadData: UploadData[];
  13087. }
  13088. interface OnBeforeSendHeadersListenerDetails {
  13089. id: number;
  13090. url: string;
  13091. method: string;
  13092. webContentsId?: number;
  13093. webContents?: WebContents;
  13094. frame?: WebFrameMain;
  13095. resourceType: string;
  13096. referrer: string;
  13097. timestamp: number;
  13098. requestHeaders: Record<string, string>;
  13099. }
  13100. interface OnCompletedListenerDetails {
  13101. id: number;
  13102. url: string;
  13103. method: string;
  13104. webContentsId?: number;
  13105. webContents?: WebContents;
  13106. frame?: WebFrameMain;
  13107. resourceType: string;
  13108. referrer: string;
  13109. timestamp: number;
  13110. responseHeaders?: Record<string, string[]>;
  13111. fromCache: boolean;
  13112. statusCode: number;
  13113. statusLine: string;
  13114. error: string;
  13115. }
  13116. interface OnErrorOccurredListenerDetails {
  13117. id: number;
  13118. url: string;
  13119. method: string;
  13120. webContentsId?: number;
  13121. webContents?: WebContents;
  13122. frame?: WebFrameMain;
  13123. resourceType: string;
  13124. referrer: string;
  13125. timestamp: number;
  13126. fromCache: boolean;
  13127. /**
  13128. * The error description.
  13129. */
  13130. error: string;
  13131. }
  13132. interface OnHeadersReceivedListenerDetails {
  13133. id: number;
  13134. url: string;
  13135. method: string;
  13136. webContentsId?: number;
  13137. webContents?: WebContents;
  13138. frame?: WebFrameMain;
  13139. resourceType: string;
  13140. referrer: string;
  13141. timestamp: number;
  13142. statusLine: string;
  13143. statusCode: number;
  13144. responseHeaders?: Record<string, string[]>;
  13145. }
  13146. interface OnResponseStartedListenerDetails {
  13147. id: number;
  13148. url: string;
  13149. method: string;
  13150. webContentsId?: number;
  13151. webContents?: WebContents;
  13152. frame?: WebFrameMain;
  13153. resourceType: string;
  13154. referrer: string;
  13155. timestamp: number;
  13156. responseHeaders?: Record<string, string[]>;
  13157. /**
  13158. * Indicates whether the response was fetched from disk cache.
  13159. */
  13160. fromCache: boolean;
  13161. statusCode: number;
  13162. statusLine: string;
  13163. }
  13164. interface OnSendHeadersListenerDetails {
  13165. id: number;
  13166. url: string;
  13167. method: string;
  13168. webContentsId?: number;
  13169. webContents?: WebContents;
  13170. frame?: WebFrameMain;
  13171. resourceType: string;
  13172. referrer: string;
  13173. timestamp: number;
  13174. requestHeaders: Record<string, string>;
  13175. }
  13176. interface OpenDevToolsOptions {
  13177. /**
  13178. * Opens the devtools with specified dock state, can be `right`, `bottom`,
  13179. * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
  13180. * possible to dock back. In `detach` mode it's not.
  13181. */
  13182. mode: ('right' | 'bottom' | 'undocked' | 'detach');
  13183. /**
  13184. * Whether to bring the opened devtools window to the foreground. The default is
  13185. * `true`.
  13186. */
  13187. activate?: boolean;
  13188. }
  13189. interface OpenDialogOptions {
  13190. title?: string;
  13191. defaultPath?: string;
  13192. /**
  13193. * Custom label for the confirmation button, when left empty the default label will
  13194. * be used.
  13195. */
  13196. buttonLabel?: string;
  13197. filters?: FileFilter[];
  13198. /**
  13199. * Contains which features the dialog should use. The following values are
  13200. * supported:
  13201. */
  13202. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  13203. /**
  13204. * Message to display above input boxes.
  13205. *
  13206. * @platform darwin
  13207. */
  13208. message?: string;
  13209. /**
  13210. * Create security scoped bookmarks when packaged for the Mac App Store.
  13211. *
  13212. * @platform darwin,mas
  13213. */
  13214. securityScopedBookmarks?: boolean;
  13215. }
  13216. interface OpenDialogReturnValue {
  13217. /**
  13218. * whether or not the dialog was canceled.
  13219. */
  13220. canceled: boolean;
  13221. /**
  13222. * An array of file paths chosen by the user. If the dialog is cancelled this will
  13223. * be an empty array.
  13224. */
  13225. filePaths: string[];
  13226. /**
  13227. * An array matching the `filePaths` array of base64 encoded strings which contains
  13228. * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
  13229. * this to be populated. (For return values, see table here.)
  13230. *
  13231. * @platform darwin,mas
  13232. */
  13233. bookmarks?: string[];
  13234. }
  13235. interface OpenDialogSyncOptions {
  13236. title?: string;
  13237. defaultPath?: string;
  13238. /**
  13239. * Custom label for the confirmation button, when left empty the default label will
  13240. * be used.
  13241. */
  13242. buttonLabel?: string;
  13243. filters?: FileFilter[];
  13244. /**
  13245. * Contains which features the dialog should use. The following values are
  13246. * supported:
  13247. */
  13248. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  13249. /**
  13250. * Message to display above input boxes.
  13251. *
  13252. * @platform darwin
  13253. */
  13254. message?: string;
  13255. /**
  13256. * Create security scoped bookmarks when packaged for the Mac App Store.
  13257. *
  13258. * @platform darwin,mas
  13259. */
  13260. securityScopedBookmarks?: boolean;
  13261. }
  13262. interface OpenExternalOptions {
  13263. /**
  13264. * `true` to bring the opened application to the foreground. The default is `true`.
  13265. *
  13266. * @platform darwin
  13267. */
  13268. activate?: boolean;
  13269. /**
  13270. * The working directory.
  13271. *
  13272. * @platform win32
  13273. */
  13274. workingDirectory?: string;
  13275. }
  13276. interface Options {
  13277. }
  13278. interface PageFaviconUpdatedEvent extends Event {
  13279. /**
  13280. * Array of URLs.
  13281. */
  13282. favicons: string[];
  13283. }
  13284. interface PageTitleUpdatedEvent extends Event {
  13285. title: string;
  13286. explicitSet: boolean;
  13287. }
  13288. interface Parameters {
  13289. /**
  13290. * Specify the screen type to emulate (default: `desktop`):
  13291. */
  13292. screenPosition: ('desktop' | 'mobile');
  13293. /**
  13294. * Set the emulated screen size (screenPosition == mobile).
  13295. */
  13296. screenSize: Size;
  13297. /**
  13298. * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
  13299. * 0 }`).
  13300. */
  13301. viewPosition: Point;
  13302. /**
  13303. * Set the device scale factor (if zero defaults to original device scale factor)
  13304. * (default: `0`).
  13305. */
  13306. deviceScaleFactor: number;
  13307. /**
  13308. * Set the emulated view size (empty means no override)
  13309. */
  13310. viewSize: Size;
  13311. /**
  13312. * Scale of emulated view inside available space (not in fit to view mode)
  13313. * (default: `1`).
  13314. */
  13315. scale: number;
  13316. }
  13317. interface Payment {
  13318. /**
  13319. * The identifier of the purchased product.
  13320. */
  13321. productIdentifier: string;
  13322. /**
  13323. * The quantity purchased.
  13324. */
  13325. quantity: number;
  13326. }
  13327. interface PermissionCheckHandlerHandlerDetails {
  13328. /**
  13329. * The origin of the frame embedding the frame that made the permission check.
  13330. * Only set for cross-origin sub frames making permission checks.
  13331. */
  13332. embeddingOrigin?: string;
  13333. /**
  13334. * The security origin of the `media` check.
  13335. */
  13336. securityOrigin?: string;
  13337. /**
  13338. * The type of media access being requested, can be `video`, `audio` or `unknown`
  13339. */
  13340. mediaType?: ('video' | 'audio' | 'unknown');
  13341. /**
  13342. * The last URL the requesting frame loaded. This is not provided for cross-origin
  13343. * sub frames making permission checks.
  13344. */
  13345. requestingUrl?: string;
  13346. /**
  13347. * Whether the frame making the request is the main frame
  13348. */
  13349. isMainFrame: boolean;
  13350. }
  13351. interface PermissionRequestHandlerHandlerDetails {
  13352. /**
  13353. * The url of the `openExternal` request.
  13354. */
  13355. externalURL?: string;
  13356. /**
  13357. * The types of media access being requested, elements can be `video` or `audio`
  13358. */
  13359. mediaTypes?: Array<'video' | 'audio'>;
  13360. /**
  13361. * The last URL the requesting frame loaded
  13362. */
  13363. requestingUrl: string;
  13364. /**
  13365. * Whether the frame making the request is the main frame
  13366. */
  13367. isMainFrame: boolean;
  13368. }
  13369. interface PluginCrashedEvent extends Event {
  13370. name: string;
  13371. version: string;
  13372. }
  13373. interface PopupOptions {
  13374. /**
  13375. * Default is the focused window.
  13376. */
  13377. window?: BrowserWindow;
  13378. /**
  13379. * Default is the current mouse cursor position. Must be declared if `y` is
  13380. * declared.
  13381. */
  13382. x?: number;
  13383. /**
  13384. * Default is the current mouse cursor position. Must be declared if `x` is
  13385. * declared.
  13386. */
  13387. y?: number;
  13388. /**
  13389. * The index of the menu item to be positioned under the mouse cursor at the
  13390. * specified coordinates. Default is -1.
  13391. *
  13392. * @platform darwin
  13393. */
  13394. positioningItem?: number;
  13395. /**
  13396. * Called when menu is closed.
  13397. */
  13398. callback?: () => void;
  13399. }
  13400. interface PreconnectOptions {
  13401. /**
  13402. * URL for preconnect. Only the origin is relevant for opening the socket.
  13403. */
  13404. url: string;
  13405. /**
  13406. * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
  13407. */
  13408. numSockets?: number;
  13409. }
  13410. interface PrintToPDFOptions {
  13411. /**
  13412. * the header and footer for the PDF.
  13413. */
  13414. headerFooter?: Record<string, string>;
  13415. /**
  13416. * `true` for landscape, `false` for portrait.
  13417. */
  13418. landscape?: boolean;
  13419. /**
  13420. * Specifies the type of margins to use. Uses 0 for default margin, 1 for no
  13421. * margin, and 2 for minimum margin. and `width` in microns.
  13422. */
  13423. marginsType?: number;
  13424. /**
  13425. * The scale factor of the web page. Can range from 0 to 100.
  13426. */
  13427. scaleFactor?: number;
  13428. /**
  13429. * The page range to print. On macOS, only the first range is honored.
  13430. */
  13431. pageRanges?: Record<string, number>;
  13432. /**
  13433. * Specify page size of the generated PDF. Can be `A3`, `A4`, `A5`, `Legal`,
  13434. * `Letter`, `Tabloid` or an Object containing `height`
  13435. */
  13436. pageSize?: (string) | (Size);
  13437. /**
  13438. * Whether to print CSS backgrounds.
  13439. */
  13440. printBackground?: boolean;
  13441. /**
  13442. * Whether to print selection only.
  13443. */
  13444. printSelectionOnly?: boolean;
  13445. }
  13446. interface Privileges {
  13447. /**
  13448. * Default false.
  13449. */
  13450. standard?: boolean;
  13451. /**
  13452. * Default false.
  13453. */
  13454. secure?: boolean;
  13455. /**
  13456. * Default false.
  13457. */
  13458. bypassCSP?: boolean;
  13459. /**
  13460. * Default false.
  13461. */
  13462. allowServiceWorkers?: boolean;
  13463. /**
  13464. * Default false.
  13465. */
  13466. supportFetchAPI?: boolean;
  13467. /**
  13468. * Default false.
  13469. */
  13470. corsEnabled?: boolean;
  13471. /**
  13472. * Default false.
  13473. */
  13474. stream?: boolean;
  13475. }
  13476. interface ProgressBarOptions {
  13477. /**
  13478. * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
  13479. * `paused`.
  13480. *
  13481. * @platform win32
  13482. */
  13483. mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
  13484. }
  13485. interface Provider {
  13486. spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
  13487. }
  13488. interface ReadBookmark {
  13489. title: string;
  13490. url: string;
  13491. }
  13492. interface RegistrationCompletedDetails {
  13493. /**
  13494. * The base URL that a service worker is registered for
  13495. */
  13496. scope: string;
  13497. }
  13498. interface RelaunchOptions {
  13499. args?: string[];
  13500. execPath?: string;
  13501. }
  13502. interface RenderProcessGoneDetails {
  13503. /**
  13504. * The reason the render process is gone. Possible values:
  13505. */
  13506. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  13507. /**
  13508. * The exit code of the process, unless `reason` is `launch-failed`, in which case
  13509. * `exitCode` will be a platform-specific launch failure error code.
  13510. */
  13511. exitCode: number;
  13512. }
  13513. interface Request {
  13514. hostname: string;
  13515. certificate: Certificate;
  13516. validatedCertificate: Certificate;
  13517. /**
  13518. * Verification result from chromium.
  13519. */
  13520. verificationResult: string;
  13521. /**
  13522. * Error code.
  13523. */
  13524. errorCode: number;
  13525. }
  13526. interface ResizeOptions {
  13527. /**
  13528. * Defaults to the image's width.
  13529. */
  13530. width?: number;
  13531. /**
  13532. * Defaults to the image's height.
  13533. */
  13534. height?: number;
  13535. /**
  13536. * The desired quality of the resize image. Possible values are `good`, `better`,
  13537. * or `best`. The default is `best`. These values express a desired quality/speed
  13538. * tradeoff. They are translated into an algorithm-specific method that depends on
  13539. * the capabilities (CPU, GPU) of the underlying platform. It is possible for all
  13540. * three methods to be mapped to the same algorithm on a given platform.
  13541. */
  13542. quality?: string;
  13543. }
  13544. interface ResourceUsage {
  13545. images: MemoryUsageDetails;
  13546. scripts: MemoryUsageDetails;
  13547. cssStyleSheets: MemoryUsageDetails;
  13548. xslStyleSheets: MemoryUsageDetails;
  13549. fonts: MemoryUsageDetails;
  13550. other: MemoryUsageDetails;
  13551. }
  13552. interface Response {
  13553. cancel?: boolean;
  13554. /**
  13555. * The original request is prevented from being sent or completed and is instead
  13556. * redirected to the given URL.
  13557. */
  13558. redirectURL?: string;
  13559. }
  13560. interface Result {
  13561. requestId: number;
  13562. /**
  13563. * Position of the active match.
  13564. */
  13565. activeMatchOrdinal: number;
  13566. /**
  13567. * Number of Matches.
  13568. */
  13569. matches: number;
  13570. /**
  13571. * Coordinates of first match region.
  13572. */
  13573. selectionArea: Rectangle;
  13574. finalUpdate: boolean;
  13575. }
  13576. interface SaveDialogOptions {
  13577. /**
  13578. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  13579. */
  13580. title?: string;
  13581. /**
  13582. * Absolute directory path, absolute file path, or file name to use by default.
  13583. */
  13584. defaultPath?: string;
  13585. /**
  13586. * Custom label for the confirmation button, when left empty the default label will
  13587. * be used.
  13588. */
  13589. buttonLabel?: string;
  13590. filters?: FileFilter[];
  13591. /**
  13592. * Message to display above text fields.
  13593. *
  13594. * @platform darwin
  13595. */
  13596. message?: string;
  13597. /**
  13598. * Custom label for the text displayed in front of the filename text field.
  13599. *
  13600. * @platform darwin
  13601. */
  13602. nameFieldLabel?: string;
  13603. /**
  13604. * Show the tags input box, defaults to `true`.
  13605. *
  13606. * @platform darwin
  13607. */
  13608. showsTagField?: boolean;
  13609. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  13610. /**
  13611. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  13612. * option is enabled and the file doesn't already exist a blank file will be
  13613. * created at the chosen path.
  13614. *
  13615. * @platform darwin,mas
  13616. */
  13617. securityScopedBookmarks?: boolean;
  13618. }
  13619. interface SaveDialogReturnValue {
  13620. /**
  13621. * whether or not the dialog was canceled.
  13622. */
  13623. canceled: boolean;
  13624. /**
  13625. * If the dialog is canceled, this will be `undefined`.
  13626. */
  13627. filePath?: string;
  13628. /**
  13629. * Base64 encoded string which contains the security scoped bookmark data for the
  13630. * saved file. `securityScopedBookmarks` must be enabled for this to be present.
  13631. * (For return values, see table here.)
  13632. *
  13633. * @platform darwin,mas
  13634. */
  13635. bookmark?: string;
  13636. }
  13637. interface SaveDialogSyncOptions {
  13638. /**
  13639. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  13640. */
  13641. title?: string;
  13642. /**
  13643. * Absolute directory path, absolute file path, or file name to use by default.
  13644. */
  13645. defaultPath?: string;
  13646. /**
  13647. * Custom label for the confirmation button, when left empty the default label will
  13648. * be used.
  13649. */
  13650. buttonLabel?: string;
  13651. filters?: FileFilter[];
  13652. /**
  13653. * Message to display above text fields.
  13654. *
  13655. * @platform darwin
  13656. */
  13657. message?: string;
  13658. /**
  13659. * Custom label for the text displayed in front of the filename text field.
  13660. *
  13661. * @platform darwin
  13662. */
  13663. nameFieldLabel?: string;
  13664. /**
  13665. * Show the tags input box, defaults to `true`.
  13666. *
  13667. * @platform darwin
  13668. */
  13669. showsTagField?: boolean;
  13670. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  13671. /**
  13672. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  13673. * option is enabled and the file doesn't already exist a blank file will be
  13674. * created at the chosen path.
  13675. *
  13676. * @platform darwin,mas
  13677. */
  13678. securityScopedBookmarks?: boolean;
  13679. }
  13680. interface Settings {
  13681. /**
  13682. * `true` to open the app at login, `false` to remove the app as a login item.
  13683. * Defaults to `false`.
  13684. */
  13685. openAtLogin?: boolean;
  13686. /**
  13687. * `true` to open the app as hidden. Defaults to `false`. The user can edit this
  13688. * setting from the System Preferences so
  13689. * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
  13690. * opened to know the current value. This setting is not available on MAS builds.
  13691. *
  13692. * @platform darwin
  13693. */
  13694. openAsHidden?: boolean;
  13695. /**
  13696. * The executable to launch at login. Defaults to `process.execPath`.
  13697. *
  13698. * @platform win32
  13699. */
  13700. path?: string;
  13701. /**
  13702. * The command-line arguments to pass to the executable. Defaults to an empty
  13703. * array. Take care to wrap paths in quotes.
  13704. *
  13705. * @platform win32
  13706. */
  13707. args?: string[];
  13708. /**
  13709. * `true` will change the startup approved registry key and `enable / disable` the
  13710. * App in Task Manager and Windows Settings. Defaults to `true`.
  13711. *
  13712. * @platform win32
  13713. */
  13714. enabled?: boolean;
  13715. /**
  13716. * value name to write into registry. Defaults to the app's AppUserModelId(). Set
  13717. * the app's login item settings.
  13718. *
  13719. * @platform win32
  13720. */
  13721. name?: string;
  13722. }
  13723. interface SourcesOptions {
  13724. /**
  13725. * An array of Strings that lists the types of desktop sources to be captured,
  13726. * available types are `screen` and `window`.
  13727. */
  13728. types: string[];
  13729. /**
  13730. * The size that the media source thumbnail should be scaled to. Default is `150` x
  13731. * `150`. Set width or height to 0 when you do not need the thumbnails. This will
  13732. * save the processing time required for capturing the content of each window and
  13733. * screen.
  13734. */
  13735. thumbnailSize?: Size;
  13736. /**
  13737. * Set to true to enable fetching window icons. The default value is false. When
  13738. * false the appIcon property of the sources return null. Same if a source has the
  13739. * type screen.
  13740. */
  13741. fetchWindowIcons?: boolean;
  13742. }
  13743. interface SSLConfigConfig {
  13744. /**
  13745. * Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. The minimum SSL version to allow
  13746. * when connecting to remote servers. Defaults to `tls1`.
  13747. */
  13748. minVersion?: string;
  13749. /**
  13750. * Can be `tls1.2` or `tls1.3`. The maximum SSL version to allow when connecting to
  13751. * remote servers. Defaults to `tls1.3`.
  13752. */
  13753. maxVersion?: string;
  13754. /**
  13755. * List of cipher suites which should be explicitly prevented from being used in
  13756. * addition to those disabled by the net built-in policy. Supported literal forms:
  13757. * 0xAABB, where AA is `cipher_suite[0]` and BB is `cipher_suite[1]`, as defined in
  13758. * RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form
  13759. * will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify
  13760. * 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note
  13761. * that TLSv1.3 ciphers cannot be disabled using this mechanism.
  13762. */
  13763. disabledCipherSuites?: number[];
  13764. }
  13765. interface StartLoggingOptions {
  13766. /**
  13767. * What kinds of data should be captured. By default, only metadata about requests
  13768. * will be captured. Setting this to `includeSensitive` will include cookies and
  13769. * authentication data. Setting it to `everything` will include all bytes
  13770. * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
  13771. */
  13772. captureMode?: ('default' | 'includeSensitive' | 'everything');
  13773. /**
  13774. * When the log grows beyond this size, logging will automatically stop. Defaults
  13775. * to unlimited.
  13776. */
  13777. maxFileSize?: number;
  13778. }
  13779. interface SystemMemoryInfo {
  13780. /**
  13781. * The total amount of physical memory in Kilobytes available to the system.
  13782. */
  13783. total: number;
  13784. /**
  13785. * The total amount of memory not being used by applications or disk cache.
  13786. */
  13787. free: number;
  13788. /**
  13789. * The total amount of swap memory in Kilobytes available to the system.
  13790. *
  13791. * @platform win32,linux
  13792. */
  13793. swapTotal: number;
  13794. /**
  13795. * The free amount of swap memory in Kilobytes available to the system.
  13796. *
  13797. * @platform win32,linux
  13798. */
  13799. swapFree: number;
  13800. }
  13801. interface TitleOptions {
  13802. /**
  13803. * The font family variant to display, can be `monospaced` or `monospacedDigit`.
  13804. * `monospaced` is available in macOS 10.15+ and `monospacedDigit` is available in
  13805. * macOS 10.11+. When left blank, the title uses the default system font.
  13806. */
  13807. fontType?: ('monospaced' | 'monospacedDigit');
  13808. }
  13809. interface ToBitmapOptions {
  13810. /**
  13811. * Defaults to 1.0.
  13812. */
  13813. scaleFactor?: number;
  13814. }
  13815. interface ToDataURLOptions {
  13816. /**
  13817. * Defaults to 1.0.
  13818. */
  13819. scaleFactor?: number;
  13820. }
  13821. interface ToPNGOptions {
  13822. /**
  13823. * Defaults to 1.0.
  13824. */
  13825. scaleFactor?: number;
  13826. }
  13827. interface TouchBarButtonConstructorOptions {
  13828. /**
  13829. * Button text.
  13830. */
  13831. label?: string;
  13832. /**
  13833. * A short description of the button for use by screenreaders like VoiceOver.
  13834. */
  13835. accessibilityLabel?: string;
  13836. /**
  13837. * Button background color in hex format, i.e `#ABCDEF`.
  13838. */
  13839. backgroundColor?: string;
  13840. /**
  13841. * Button icon.
  13842. */
  13843. icon?: (NativeImage) | (string);
  13844. /**
  13845. * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
  13846. */
  13847. iconPosition?: ('left' | 'right' | 'overlay');
  13848. /**
  13849. * Function to call when the button is clicked.
  13850. */
  13851. click?: () => void;
  13852. /**
  13853. * Whether the button is in an enabled state. Default is `true`.
  13854. */
  13855. enabled?: boolean;
  13856. }
  13857. interface TouchBarColorPickerConstructorOptions {
  13858. /**
  13859. * Array of hex color strings to appear as possible colors to select.
  13860. */
  13861. availableColors?: string[];
  13862. /**
  13863. * The selected hex color in the picker, i.e `#ABCDEF`.
  13864. */
  13865. selectedColor?: string;
  13866. /**
  13867. * Function to call when a color is selected.
  13868. */
  13869. change?: (color: string) => void;
  13870. }
  13871. interface TouchBarConstructorOptions {
  13872. items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
  13873. escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
  13874. }
  13875. interface TouchBarGroupConstructorOptions {
  13876. /**
  13877. * Items to display as a group.
  13878. */
  13879. items: TouchBar;
  13880. }
  13881. interface TouchBarLabelConstructorOptions {
  13882. /**
  13883. * Text to display.
  13884. */
  13885. label?: string;
  13886. /**
  13887. * A short description of the button for use by screenreaders like VoiceOver.
  13888. */
  13889. accessibilityLabel?: string;
  13890. /**
  13891. * Hex color of text, i.e `#ABCDEF`.
  13892. */
  13893. textColor?: string;
  13894. }
  13895. interface TouchBarPopoverConstructorOptions {
  13896. /**
  13897. * Popover button text.
  13898. */
  13899. label?: string;
  13900. /**
  13901. * Popover button icon.
  13902. */
  13903. icon?: NativeImage;
  13904. /**
  13905. * Items to display in the popover.
  13906. */
  13907. items: TouchBar;
  13908. /**
  13909. * `true` to display a close button on the left of the popover, `false` to not show
  13910. * it. Default is `true`.
  13911. */
  13912. showCloseButton?: boolean;
  13913. }
  13914. interface TouchBarScrubberConstructorOptions {
  13915. /**
  13916. * An array of items to place in this scrubber.
  13917. */
  13918. items: ScrubberItem[];
  13919. /**
  13920. * Called when the user taps an item that was not the last tapped item.
  13921. */
  13922. select?: (selectedIndex: number) => void;
  13923. /**
  13924. * Called when the user taps any item.
  13925. */
  13926. highlight?: (highlightedIndex: number) => void;
  13927. /**
  13928. * Selected item style. Can be `background`, `outline` or `none`. Defaults to
  13929. * `none`.
  13930. */
  13931. selectedStyle?: ('background' | 'outline' | 'none');
  13932. /**
  13933. * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
  13934. * to `none`.
  13935. */
  13936. overlayStyle?: ('background' | 'outline' | 'none');
  13937. /**
  13938. * Whether to show arrow buttons. Defaults to `false` and is only shown if `items`
  13939. * is non-empty.
  13940. */
  13941. showArrowButtons?: boolean;
  13942. /**
  13943. * Can be `fixed` or `free`. The default is `free`.
  13944. */
  13945. mode?: ('fixed' | 'free');
  13946. /**
  13947. * Defaults to `true`.
  13948. */
  13949. continuous?: boolean;
  13950. }
  13951. interface TouchBarSegmentedControlConstructorOptions {
  13952. /**
  13953. * Style of the segments:
  13954. */
  13955. segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
  13956. /**
  13957. * The selection mode of the control:
  13958. */
  13959. mode?: ('single' | 'multiple' | 'buttons');
  13960. /**
  13961. * An array of segments to place in this control.
  13962. */
  13963. segments: SegmentedControlSegment[];
  13964. /**
  13965. * The index of the currently selected segment, will update automatically with user
  13966. * interaction. When the mode is `multiple` it will be the last selected item.
  13967. */
  13968. selectedIndex?: number;
  13969. /**
  13970. * Called when the user selects a new segment.
  13971. */
  13972. change?: (selectedIndex: number, isSelected: boolean) => void;
  13973. }
  13974. interface TouchBarSliderConstructorOptions {
  13975. /**
  13976. * Label text.
  13977. */
  13978. label?: string;
  13979. /**
  13980. * Selected value.
  13981. */
  13982. value?: number;
  13983. /**
  13984. * Minimum value.
  13985. */
  13986. minValue?: number;
  13987. /**
  13988. * Maximum value.
  13989. */
  13990. maxValue?: number;
  13991. /**
  13992. * Function to call when the slider is changed.
  13993. */
  13994. change?: (newValue: number) => void;
  13995. }
  13996. interface TouchBarSpacerConstructorOptions {
  13997. /**
  13998. * Size of spacer, possible values are:
  13999. */
  14000. size?: ('small' | 'large' | 'flexible');
  14001. }
  14002. interface TraceBufferUsageReturnValue {
  14003. value: number;
  14004. percentage: number;
  14005. }
  14006. interface UpdateTargetUrlEvent extends Event {
  14007. url: string;
  14008. }
  14009. interface UploadProgress {
  14010. /**
  14011. * Whether the request is currently active. If this is false no other properties
  14012. * will be set
  14013. */
  14014. active: boolean;
  14015. /**
  14016. * Whether the upload has started. If this is false both `current` and `total` will
  14017. * be set to 0.
  14018. */
  14019. started: boolean;
  14020. /**
  14021. * The number of bytes that have been uploaded so far
  14022. */
  14023. current: number;
  14024. /**
  14025. * The number of bytes that will be uploaded this request
  14026. */
  14027. total: number;
  14028. }
  14029. interface VisibleOnAllWorkspacesOptions {
  14030. /**
  14031. * Sets whether the window should be visible above fullscreen windows.
  14032. *
  14033. * @platform darwin
  14034. */
  14035. visibleOnFullScreen?: boolean;
  14036. /**
  14037. * Calling setVisibleOnAllWorkspaces will by default transform the process type
  14038. * between UIElementApplication and ForegroundApplication to ensure the correct
  14039. * behavior. However, this will hide the window and dock for a short time every
  14040. * time it is called. If your window is already of type UIElementApplication, you
  14041. * can bypass this transformation by passing true to skipTransformProcessType.
  14042. *
  14043. * @platform darwin
  14044. */
  14045. skipTransformProcessType?: boolean;
  14046. }
  14047. interface WebContentsPrintOptions {
  14048. /**
  14049. * Don't ask user for print settings. Default is `false`.
  14050. */
  14051. silent?: boolean;
  14052. /**
  14053. * Prints the background color and image of the web page. Default is `false`.
  14054. */
  14055. printBackground?: boolean;
  14056. /**
  14057. * Set the printer device name to use. Must be the system-defined name and not the
  14058. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  14059. */
  14060. deviceName?: string;
  14061. /**
  14062. * Set whether the printed web page will be in color or grayscale. Default is
  14063. * `true`.
  14064. */
  14065. color?: boolean;
  14066. margins?: Margins;
  14067. /**
  14068. * Whether the web page should be printed in landscape mode. Default is `false`.
  14069. */
  14070. landscape?: boolean;
  14071. /**
  14072. * The scale factor of the web page.
  14073. */
  14074. scaleFactor?: number;
  14075. /**
  14076. * The number of pages to print per page sheet.
  14077. */
  14078. pagesPerSheet?: number;
  14079. /**
  14080. * Whether the web page should be collated.
  14081. */
  14082. collate?: boolean;
  14083. /**
  14084. * The number of copies of the web page to print.
  14085. */
  14086. copies?: number;
  14087. /**
  14088. * The page range to print. On macOS, only one range is honored.
  14089. */
  14090. pageRanges?: PageRanges[];
  14091. /**
  14092. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  14093. * `longEdge`.
  14094. */
  14095. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  14096. dpi?: Record<string, number>;
  14097. /**
  14098. * String to be printed as page header.
  14099. */
  14100. header?: string;
  14101. /**
  14102. * String to be printed as page footer.
  14103. */
  14104. footer?: string;
  14105. /**
  14106. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  14107. * `Letter`, `Tabloid` or an Object containing `height`.
  14108. */
  14109. pageSize?: (string) | (Size);
  14110. }
  14111. interface WebviewTagPrintOptions {
  14112. /**
  14113. * Don't ask user for print settings. Default is `false`.
  14114. */
  14115. silent?: boolean;
  14116. /**
  14117. * Prints the background color and image of the web page. Default is `false`.
  14118. */
  14119. printBackground?: boolean;
  14120. /**
  14121. * Set the printer device name to use. Must be the system-defined name and not the
  14122. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  14123. */
  14124. deviceName?: string;
  14125. /**
  14126. * Set whether the printed web page will be in color or grayscale. Default is
  14127. * `true`.
  14128. */
  14129. color?: boolean;
  14130. margins?: Margins;
  14131. /**
  14132. * Whether the web page should be printed in landscape mode. Default is `false`.
  14133. */
  14134. landscape?: boolean;
  14135. /**
  14136. * The scale factor of the web page.
  14137. */
  14138. scaleFactor?: number;
  14139. /**
  14140. * The number of pages to print per page sheet.
  14141. */
  14142. pagesPerSheet?: number;
  14143. /**
  14144. * Whether the web page should be collated.
  14145. */
  14146. collate?: boolean;
  14147. /**
  14148. * The number of copies of the web page to print.
  14149. */
  14150. copies?: number;
  14151. /**
  14152. * The page range to print.
  14153. */
  14154. pageRanges?: PageRanges[];
  14155. /**
  14156. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  14157. * `longEdge`.
  14158. */
  14159. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  14160. dpi?: Record<string, number>;
  14161. /**
  14162. * String to be printed as page header.
  14163. */
  14164. header?: string;
  14165. /**
  14166. * String to be printed as page footer.
  14167. */
  14168. footer?: string;
  14169. /**
  14170. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  14171. * `Letter`, `Tabloid` or an Object containing `height`.
  14172. */
  14173. pageSize?: (string) | (Size);
  14174. }
  14175. interface WillNavigateEvent extends Event {
  14176. url: string;
  14177. }
  14178. interface EditFlags {
  14179. /**
  14180. * Whether the renderer believes it can undo.
  14181. */
  14182. canUndo: boolean;
  14183. /**
  14184. * Whether the renderer believes it can redo.
  14185. */
  14186. canRedo: boolean;
  14187. /**
  14188. * Whether the renderer believes it can cut.
  14189. */
  14190. canCut: boolean;
  14191. /**
  14192. * Whether the renderer believes it can copy.
  14193. */
  14194. canCopy: boolean;
  14195. /**
  14196. * Whether the renderer believes it can paste.
  14197. */
  14198. canPaste: boolean;
  14199. /**
  14200. * Whether the renderer believes it can delete.
  14201. */
  14202. canDelete: boolean;
  14203. /**
  14204. * Whether the renderer believes it can select all.
  14205. */
  14206. canSelectAll: boolean;
  14207. /**
  14208. * Whether the renderer believes it can edit text richly.
  14209. */
  14210. canEditRichly: boolean;
  14211. }
  14212. interface FoundInPageResult {
  14213. requestId: number;
  14214. /**
  14215. * Position of the active match.
  14216. */
  14217. activeMatchOrdinal: number;
  14218. /**
  14219. * Number of Matches.
  14220. */
  14221. matches: number;
  14222. /**
  14223. * Coordinates of first match region.
  14224. */
  14225. selectionArea: Rectangle;
  14226. finalUpdate: boolean;
  14227. }
  14228. interface LaunchItems {
  14229. /**
  14230. * name value of a registry entry.
  14231. *
  14232. * @platform win32
  14233. */
  14234. name: string;
  14235. /**
  14236. * The executable to an app that corresponds to a registry entry.
  14237. *
  14238. * @platform win32
  14239. */
  14240. path: string;
  14241. /**
  14242. * the command-line arguments to pass to the executable.
  14243. *
  14244. * @platform win32
  14245. */
  14246. args: string[];
  14247. /**
  14248. * one of `user` or `machine`. Indicates whether the registry entry is under
  14249. * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  14250. *
  14251. * @platform win32
  14252. */
  14253. scope: string;
  14254. /**
  14255. * `true` if the app registry key is startup approved and therefore shows as
  14256. * `enabled` in Task Manager and Windows settings.
  14257. *
  14258. * @platform win32
  14259. */
  14260. enabled: boolean;
  14261. }
  14262. interface Margins {
  14263. /**
  14264. * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
  14265. * you will also need to specify `top`, `bottom`, `left`, and `right`.
  14266. */
  14267. marginType?: ('default' | 'none' | 'printableArea' | 'custom');
  14268. /**
  14269. * The top margin of the printed web page, in pixels.
  14270. */
  14271. top?: number;
  14272. /**
  14273. * The bottom margin of the printed web page, in pixels.
  14274. */
  14275. bottom?: number;
  14276. /**
  14277. * The left margin of the printed web page, in pixels.
  14278. */
  14279. left?: number;
  14280. /**
  14281. * The right margin of the printed web page, in pixels.
  14282. */
  14283. right?: number;
  14284. }
  14285. interface MediaFlags {
  14286. /**
  14287. * Whether the media element has crashed.
  14288. */
  14289. inError: boolean;
  14290. /**
  14291. * Whether the media element is paused.
  14292. */
  14293. isPaused: boolean;
  14294. /**
  14295. * Whether the media element is muted.
  14296. */
  14297. isMuted: boolean;
  14298. /**
  14299. * Whether the media element has audio.
  14300. */
  14301. hasAudio: boolean;
  14302. /**
  14303. * Whether the media element is looping.
  14304. */
  14305. isLooping: boolean;
  14306. /**
  14307. * Whether the media element's controls are visible.
  14308. */
  14309. isControlsVisible: boolean;
  14310. /**
  14311. * Whether the media element's controls are toggleable.
  14312. */
  14313. canToggleControls: boolean;
  14314. /**
  14315. * Whether the media element can be printed.
  14316. */
  14317. canPrint: boolean;
  14318. /**
  14319. * Whether or not the media element can be downloaded.
  14320. */
  14321. canSave: boolean;
  14322. /**
  14323. * Whether the media element can show picture-in-picture.
  14324. */
  14325. canShowPictureInPicture: boolean;
  14326. /**
  14327. * Whether the media element is currently showing picture-in-picture.
  14328. */
  14329. isShowingPictureInPicture: boolean;
  14330. /**
  14331. * Whether the media element can be rotated.
  14332. */
  14333. canRotate: boolean;
  14334. /**
  14335. * Whether the media element can be looped.
  14336. */
  14337. canLoop: boolean;
  14338. }
  14339. interface PageRanges {
  14340. /**
  14341. * Index of the first page to print (0-based).
  14342. */
  14343. from: number;
  14344. /**
  14345. * Index of the last page to print (inclusive) (0-based).
  14346. */
  14347. to: number;
  14348. }
  14349. interface WebPreferences {
  14350. /**
  14351. * Whether to enable DevTools. If it is set to `false`, can not use
  14352. * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
  14353. */
  14354. devTools?: boolean;
  14355. /**
  14356. * Whether node integration is enabled. Default is `false`.
  14357. */
  14358. nodeIntegration?: boolean;
  14359. /**
  14360. * Whether node integration is enabled in web workers. Default is `false`. More
  14361. * about this can be found in Multithreading.
  14362. */
  14363. nodeIntegrationInWorker?: boolean;
  14364. /**
  14365. * Experimental option for enabling Node.js support in sub-frames such as iframes
  14366. * and child windows. All your preloads will load for every iframe, you can use
  14367. * `process.isMainFrame` to determine if you are in the main frame or not.
  14368. */
  14369. nodeIntegrationInSubFrames?: boolean;
  14370. /**
  14371. * Specifies a script that will be loaded before other scripts run in the page.
  14372. * This script will always have access to node APIs no matter whether node
  14373. * integration is turned on or off. The value should be the absolute file path to
  14374. * the script. When node integration is turned off, the preload script can
  14375. * reintroduce Node global symbols back to the global scope. See example here.
  14376. */
  14377. preload?: string;
  14378. /**
  14379. * If set, this will sandbox the renderer associated with the window, making it
  14380. * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
  14381. * This is not the same as the `nodeIntegration` option and the APIs available to
  14382. * the preload script are more limited. Read more about the option here.
  14383. */
  14384. sandbox?: boolean;
  14385. /**
  14386. * Whether to enable the `remote` module. Default is `false`.
  14387. */
  14388. enableRemoteModule?: boolean;
  14389. /**
  14390. * Sets the session used by the page. Instead of passing the Session object
  14391. * directly, you can also choose to use the `partition` option instead, which
  14392. * accepts a partition string. When both `session` and `partition` are provided,
  14393. * `session` will be preferred. Default is the default session.
  14394. */
  14395. session?: Session;
  14396. /**
  14397. * Sets the session used by the page according to the session's partition string.
  14398. * If `partition` starts with `persist:`, the page will use a persistent session
  14399. * available to all pages in the app with the same `partition`. If there is no
  14400. * `persist:` prefix, the page will use an in-memory session. By assigning the same
  14401. * `partition`, multiple pages can share the same session. Default is the default
  14402. * session.
  14403. */
  14404. partition?: string;
  14405. /**
  14406. * When specified, web pages with the same `affinity` will run in the same renderer
  14407. * process. Note that due to reusing the renderer process, certain `webPreferences`
  14408. * options will also be shared between the web pages even when you specified
  14409. * different values for them, including but not limited to `preload`, `sandbox` and
  14410. * `nodeIntegration`. So it is suggested to use exact same `webPreferences` for web
  14411. * pages with the same `affinity`. _Deprecated_
  14412. */
  14413. affinity?: string;
  14414. /**
  14415. * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
  14416. */
  14417. zoomFactor?: number;
  14418. /**
  14419. * Enables JavaScript support. Default is `true`.
  14420. */
  14421. javascript?: boolean;
  14422. /**
  14423. * When `false`, it will disable the same-origin policy (usually using testing
  14424. * websites by people), and set `allowRunningInsecureContent` to `true` if this
  14425. * options has not been set by user. Default is `true`.
  14426. */
  14427. webSecurity?: boolean;
  14428. /**
  14429. * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
  14430. * `false`.
  14431. */
  14432. allowRunningInsecureContent?: boolean;
  14433. /**
  14434. * Enables image support. Default is `true`.
  14435. */
  14436. images?: boolean;
  14437. /**
  14438. * Make TextArea elements resizable. Default is `true`.
  14439. */
  14440. textAreasAreResizable?: boolean;
  14441. /**
  14442. * Enables WebGL support. Default is `true`.
  14443. */
  14444. webgl?: boolean;
  14445. /**
  14446. * Whether plugins should be enabled. Default is `false`.
  14447. */
  14448. plugins?: boolean;
  14449. /**
  14450. * Enables Chromium's experimental features. Default is `false`.
  14451. */
  14452. experimentalFeatures?: boolean;
  14453. /**
  14454. * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
  14455. */
  14456. scrollBounce?: boolean;
  14457. /**
  14458. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  14459. * to enable. The full list of supported feature strings can be found in the
  14460. * RuntimeEnabledFeatures.json5 file.
  14461. */
  14462. enableBlinkFeatures?: string;
  14463. /**
  14464. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  14465. * to disable. The full list of supported feature strings can be found in the
  14466. * RuntimeEnabledFeatures.json5 file.
  14467. */
  14468. disableBlinkFeatures?: string;
  14469. /**
  14470. * Sets the default font for the font-family.
  14471. */
  14472. defaultFontFamily?: DefaultFontFamily;
  14473. /**
  14474. * Defaults to `16`.
  14475. */
  14476. defaultFontSize?: number;
  14477. /**
  14478. * Defaults to `13`.
  14479. */
  14480. defaultMonospaceFontSize?: number;
  14481. /**
  14482. * Defaults to `0`.
  14483. */
  14484. minimumFontSize?: number;
  14485. /**
  14486. * Defaults to `ISO-8859-1`.
  14487. */
  14488. defaultEncoding?: string;
  14489. /**
  14490. * Whether to throttle animations and timers when the page becomes background. This
  14491. * also affects the Page Visibility API. Defaults to `true`.
  14492. */
  14493. backgroundThrottling?: boolean;
  14494. /**
  14495. * Whether to enable offscreen rendering for the browser window. Defaults to
  14496. * `false`. See the offscreen rendering tutorial for more details.
  14497. */
  14498. offscreen?: boolean;
  14499. /**
  14500. * Whether to run Electron APIs and the specified `preload` script in a separate
  14501. * JavaScript context. Defaults to `true`. The context that the `preload` script
  14502. * runs in will only have access to its own dedicated `document` and `window`
  14503. * globals, as well as its own set of JavaScript builtins (`Array`, `Object`,
  14504. * `JSON`, etc.), which are all invisible to the loaded content. The Electron API
  14505. * will only be available in the `preload` script and not the loaded page. This
  14506. * option should be used when loading potentially untrusted remote content to
  14507. * ensure the loaded content cannot tamper with the `preload` script and any
  14508. * Electron APIs being used. This option uses the same technique used by Chrome
  14509. * Content Scripts. You can access this context in the dev tools by selecting the
  14510. * 'Electron Isolated Context' entry in the combo box at the top of the Console
  14511. * tab.
  14512. */
  14513. contextIsolation?: boolean;
  14514. /**
  14515. * If true, values returned from `webFrame.executeJavaScript` will be sanitized to
  14516. * ensure JS values can't unsafely cross between worlds when using
  14517. * `contextIsolation`. Defaults to `true`. _Deprecated_
  14518. */
  14519. worldSafeExecuteJavaScript?: boolean;
  14520. /**
  14521. * Whether to use native `window.open()`. Defaults to `false`. Child windows will
  14522. * always have node integration disabled unless `nodeIntegrationInSubFrames` is
  14523. * true. **Note:** This option is currently experimental.
  14524. */
  14525. nativeWindowOpen?: boolean;
  14526. /**
  14527. * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
  14528. * `preload` script configured for the `<webview>` will have node integration
  14529. * enabled when it is executed so you should ensure remote/untrusted content is not
  14530. * able to create a `<webview>` tag with a possibly malicious `preload` script. You
  14531. * can use the `will-attach-webview` event on webContents to strip away the
  14532. * `preload` script and to validate or alter the `<webview>`'s initial settings.
  14533. */
  14534. webviewTag?: boolean;
  14535. /**
  14536. * A list of strings that will be appended to `process.argv` in the renderer
  14537. * process of this app. Useful for passing small bits of data down to renderer
  14538. * process preload scripts.
  14539. */
  14540. additionalArguments?: string[];
  14541. /**
  14542. * Whether to enable browser style consecutive dialog protection. Default is
  14543. * `false`.
  14544. */
  14545. safeDialogs?: boolean;
  14546. /**
  14547. * The message to display when consecutive dialog protection is triggered. If not
  14548. * defined the default message would be used, note that currently the default
  14549. * message is in English and not localized.
  14550. */
  14551. safeDialogsMessage?: string;
  14552. /**
  14553. * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
  14554. * `false`.
  14555. */
  14556. disableDialogs?: boolean;
  14557. /**
  14558. * Whether dragging and dropping a file or link onto the page causes a navigation.
  14559. * Default is `false`.
  14560. */
  14561. navigateOnDragDrop?: boolean;
  14562. /**
  14563. * Autoplay policy to apply to content in the window, can be
  14564. * `no-user-gesture-required`, `user-gesture-required`,
  14565. * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
  14566. */
  14567. autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
  14568. /**
  14569. * Whether to prevent the window from resizing when entering HTML Fullscreen.
  14570. * Default is `false`.
  14571. */
  14572. disableHtmlFullscreenWindowResize?: boolean;
  14573. /**
  14574. * An alternative title string provided only to accessibility tools such as screen
  14575. * readers. This string is not directly visible to users.
  14576. */
  14577. accessibleTitle?: string;
  14578. /**
  14579. * Whether to enable the builtin spellchecker. Default is `true`.
  14580. */
  14581. spellcheck?: boolean;
  14582. /**
  14583. * Whether to enable the WebSQL api. Default is `true`.
  14584. */
  14585. enableWebSQL?: boolean;
  14586. /**
  14587. * Enforces the v8 code caching policy used by blink. Accepted values are
  14588. */
  14589. v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
  14590. /**
  14591. * Whether to enable preferred size mode. The preferred size is the minimum size
  14592. * needed to contain the layout of the document—without requiring scrolling.
  14593. * Enabling this will cause the `preferred-size-changed` event to be emitted on the
  14594. * `WebContents` when the preferred size changes. Default is `false`.
  14595. */
  14596. enablePreferredSizeMode?: boolean;
  14597. }
  14598. interface DefaultFontFamily {
  14599. /**
  14600. * Defaults to `Times New Roman`.
  14601. */
  14602. standard?: string;
  14603. /**
  14604. * Defaults to `Times New Roman`.
  14605. */
  14606. serif?: string;
  14607. /**
  14608. * Defaults to `Arial`.
  14609. */
  14610. sansSerif?: string;
  14611. /**
  14612. * Defaults to `Courier New`.
  14613. */
  14614. monospace?: string;
  14615. /**
  14616. * Defaults to `Script`.
  14617. */
  14618. cursive?: string;
  14619. /**
  14620. * Defaults to `Impact`.
  14621. */
  14622. fantasy?: string;
  14623. }
  14624. interface RemoteMainInterface {
  14625. app: App;
  14626. autoUpdater: AutoUpdater;
  14627. BrowserView: typeof BrowserView;
  14628. BrowserWindow: typeof BrowserWindow;
  14629. ClientRequest: typeof ClientRequest;
  14630. clipboard: Clipboard;
  14631. CommandLine: typeof CommandLine;
  14632. contentTracing: ContentTracing;
  14633. Cookies: typeof Cookies;
  14634. crashReporter: CrashReporter;
  14635. Debugger: typeof Debugger;
  14636. desktopCapturer: DesktopCapturer;
  14637. dialog: Dialog;
  14638. Dock: typeof Dock;
  14639. DownloadItem: typeof DownloadItem;
  14640. globalShortcut: GlobalShortcut;
  14641. inAppPurchase: InAppPurchase;
  14642. IncomingMessage: typeof IncomingMessage;
  14643. ipcMain: IpcMain;
  14644. Menu: typeof Menu;
  14645. MenuItem: typeof MenuItem;
  14646. MessageChannelMain: typeof MessageChannelMain;
  14647. MessagePortMain: typeof MessagePortMain;
  14648. nativeImage: typeof NativeImage;
  14649. nativeTheme: NativeTheme;
  14650. net: Net;
  14651. netLog: NetLog;
  14652. Notification: typeof Notification;
  14653. powerMonitor: PowerMonitor;
  14654. powerSaveBlocker: PowerSaveBlocker;
  14655. protocol: Protocol;
  14656. screen: Screen;
  14657. ServiceWorkers: typeof ServiceWorkers;
  14658. session: typeof Session;
  14659. ShareMenu: typeof ShareMenu;
  14660. shell: Shell;
  14661. systemPreferences: SystemPreferences;
  14662. TouchBar: typeof TouchBar;
  14663. TouchBarButton: typeof TouchBarButton;
  14664. TouchBarColorPicker: typeof TouchBarColorPicker;
  14665. TouchBarGroup: typeof TouchBarGroup;
  14666. TouchBarLabel: typeof TouchBarLabel;
  14667. TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
  14668. TouchBarPopover: typeof TouchBarPopover;
  14669. TouchBarScrubber: typeof TouchBarScrubber;
  14670. TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
  14671. TouchBarSlider: typeof TouchBarSlider;
  14672. TouchBarSpacer: typeof TouchBarSpacer;
  14673. Tray: typeof Tray;
  14674. webContents: typeof WebContents;
  14675. webFrameMain: typeof WebFrameMain;
  14676. WebRequest: typeof WebRequest;
  14677. }
  14678. namespace Common {
  14679. const clipboard: Clipboard;
  14680. const crashReporter: CrashReporter;
  14681. const desktopCapturer: DesktopCapturer;
  14682. class NativeImage extends Electron.NativeImage {}
  14683. type nativeImage = NativeImage;
  14684. const nativeImage: typeof NativeImage;
  14685. const shell: Shell;
  14686. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  14687. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  14688. type AnimationSettings = Electron.AnimationSettings;
  14689. type AppDetailsOptions = Electron.AppDetailsOptions;
  14690. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  14691. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  14692. type AuthInfo = Electron.AuthInfo;
  14693. type AutoResizeOptions = Electron.AutoResizeOptions;
  14694. type BeforeSendResponse = Electron.BeforeSendResponse;
  14695. type BitmapOptions = Electron.BitmapOptions;
  14696. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  14697. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  14698. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  14699. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  14700. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  14701. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  14702. type Config = Electron.Config;
  14703. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  14704. type ContextMenuParams = Electron.ContextMenuParams;
  14705. type CookiesGetFilter = Electron.CookiesGetFilter;
  14706. type CookiesSetDetails = Electron.CookiesSetDetails;
  14707. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  14708. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  14709. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  14710. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  14711. type Data = Electron.Data;
  14712. type Details = Electron.Details;
  14713. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  14714. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  14715. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  14716. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  14717. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  14718. type DidNavigateEvent = Electron.DidNavigateEvent;
  14719. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  14720. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  14721. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  14722. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  14723. type FeedURLOptions = Electron.FeedURLOptions;
  14724. type FileIconOptions = Electron.FileIconOptions;
  14725. type Filter = Electron.Filter;
  14726. type FindInPageOptions = Electron.FindInPageOptions;
  14727. type FocusOptions = Electron.FocusOptions;
  14728. type FoundInPageEvent = Electron.FoundInPageEvent;
  14729. type FromPartitionOptions = Electron.FromPartitionOptions;
  14730. type HandlerDetails = Electron.HandlerDetails;
  14731. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  14732. type HeapStatistics = Electron.HeapStatistics;
  14733. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  14734. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  14735. type Info = Electron.Info;
  14736. type Input = Electron.Input;
  14737. type InsertCSSOptions = Electron.InsertCSSOptions;
  14738. type IpcMessageEvent = Electron.IpcMessageEvent;
  14739. type Item = Electron.Item;
  14740. type JumpListSettings = Electron.JumpListSettings;
  14741. type LoadCommitEvent = Electron.LoadCommitEvent;
  14742. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  14743. type LoadFileOptions = Electron.LoadFileOptions;
  14744. type LoadURLOptions = Electron.LoadURLOptions;
  14745. type LoginItemSettings = Electron.LoginItemSettings;
  14746. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  14747. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  14748. type MessageBoxOptions = Electron.MessageBoxOptions;
  14749. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  14750. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  14751. type MessageDetails = Electron.MessageDetails;
  14752. type MessageEvent = Electron.MessageEvent;
  14753. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  14754. type NewWindowEvent = Electron.NewWindowEvent;
  14755. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  14756. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  14757. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  14758. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  14759. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  14760. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  14761. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  14762. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  14763. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  14764. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  14765. type OpenDialogOptions = Electron.OpenDialogOptions;
  14766. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  14767. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  14768. type OpenExternalOptions = Electron.OpenExternalOptions;
  14769. type Options = Electron.Options;
  14770. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  14771. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  14772. type Parameters = Electron.Parameters;
  14773. type Payment = Electron.Payment;
  14774. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  14775. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  14776. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  14777. type PopupOptions = Electron.PopupOptions;
  14778. type PreconnectOptions = Electron.PreconnectOptions;
  14779. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  14780. type Privileges = Electron.Privileges;
  14781. type ProgressBarOptions = Electron.ProgressBarOptions;
  14782. type Provider = Electron.Provider;
  14783. type ReadBookmark = Electron.ReadBookmark;
  14784. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  14785. type RelaunchOptions = Electron.RelaunchOptions;
  14786. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  14787. type Request = Electron.Request;
  14788. type ResizeOptions = Electron.ResizeOptions;
  14789. type ResourceUsage = Electron.ResourceUsage;
  14790. type Response = Electron.Response;
  14791. type Result = Electron.Result;
  14792. type SaveDialogOptions = Electron.SaveDialogOptions;
  14793. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  14794. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  14795. type Settings = Electron.Settings;
  14796. type SourcesOptions = Electron.SourcesOptions;
  14797. type SSLConfigConfig = Electron.SSLConfigConfig;
  14798. type StartLoggingOptions = Electron.StartLoggingOptions;
  14799. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  14800. type TitleOptions = Electron.TitleOptions;
  14801. type ToBitmapOptions = Electron.ToBitmapOptions;
  14802. type ToDataURLOptions = Electron.ToDataURLOptions;
  14803. type ToPNGOptions = Electron.ToPNGOptions;
  14804. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  14805. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  14806. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  14807. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  14808. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  14809. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  14810. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  14811. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  14812. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  14813. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  14814. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  14815. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  14816. type UploadProgress = Electron.UploadProgress;
  14817. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  14818. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  14819. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  14820. type WillNavigateEvent = Electron.WillNavigateEvent;
  14821. type EditFlags = Electron.EditFlags;
  14822. type FoundInPageResult = Electron.FoundInPageResult;
  14823. type LaunchItems = Electron.LaunchItems;
  14824. type Margins = Electron.Margins;
  14825. type MediaFlags = Electron.MediaFlags;
  14826. type PageRanges = Electron.PageRanges;
  14827. type WebPreferences = Electron.WebPreferences;
  14828. type DefaultFontFamily = Electron.DefaultFontFamily;
  14829. type BluetoothDevice = Electron.BluetoothDevice;
  14830. type Certificate = Electron.Certificate;
  14831. type CertificatePrincipal = Electron.CertificatePrincipal;
  14832. type Cookie = Electron.Cookie;
  14833. type CPUUsage = Electron.CPUUsage;
  14834. type CrashReport = Electron.CrashReport;
  14835. type CustomScheme = Electron.CustomScheme;
  14836. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  14837. type Display = Electron.Display;
  14838. type Event = Electron.Event;
  14839. type Extension = Electron.Extension;
  14840. type ExtensionInfo = Electron.ExtensionInfo;
  14841. type FileFilter = Electron.FileFilter;
  14842. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  14843. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  14844. type InputEvent = Electron.InputEvent;
  14845. type IOCounters = Electron.IOCounters;
  14846. type IpcMainEvent = Electron.IpcMainEvent;
  14847. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  14848. type IpcRendererEvent = Electron.IpcRendererEvent;
  14849. type JumpListCategory = Electron.JumpListCategory;
  14850. type JumpListItem = Electron.JumpListItem;
  14851. type KeyboardEvent = Electron.KeyboardEvent;
  14852. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  14853. type MemoryInfo = Electron.MemoryInfo;
  14854. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  14855. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  14856. type MouseInputEvent = Electron.MouseInputEvent;
  14857. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  14858. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  14859. type NotificationAction = Electron.NotificationAction;
  14860. type NotificationResponse = Electron.NotificationResponse;
  14861. type OverlayOptions = Electron.OverlayOptions;
  14862. type Point = Electron.Point;
  14863. type PostBody = Electron.PostBody;
  14864. type PrinterInfo = Electron.PrinterInfo;
  14865. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  14866. type ProcessMetric = Electron.ProcessMetric;
  14867. type Product = Electron.Product;
  14868. type ProtocolRequest = Electron.ProtocolRequest;
  14869. type ProtocolResponse = Electron.ProtocolResponse;
  14870. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  14871. type Rectangle = Electron.Rectangle;
  14872. type Referrer = Electron.Referrer;
  14873. type ScrubberItem = Electron.ScrubberItem;
  14874. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  14875. type SerialPort = Electron.SerialPort;
  14876. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  14877. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  14878. type SharingItem = Electron.SharingItem;
  14879. type ShortcutDetails = Electron.ShortcutDetails;
  14880. type Size = Electron.Size;
  14881. type Task = Electron.Task;
  14882. type ThumbarButton = Electron.ThumbarButton;
  14883. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  14884. type TraceConfig = Electron.TraceConfig;
  14885. type Transaction = Electron.Transaction;
  14886. type UploadData = Electron.UploadData;
  14887. type UploadFile = Electron.UploadFile;
  14888. type UploadRawData = Electron.UploadRawData;
  14889. type WebSource = Electron.WebSource;
  14890. }
  14891. namespace Main {
  14892. const app: App;
  14893. const autoUpdater: AutoUpdater;
  14894. class BrowserView extends Electron.BrowserView {}
  14895. class BrowserWindow extends Electron.BrowserWindow {}
  14896. class ClientRequest extends Electron.ClientRequest {}
  14897. class CommandLine extends Electron.CommandLine {}
  14898. const contentTracing: ContentTracing;
  14899. class Cookies extends Electron.Cookies {}
  14900. class Debugger extends Electron.Debugger {}
  14901. const dialog: Dialog;
  14902. class Dock extends Electron.Dock {}
  14903. class DownloadItem extends Electron.DownloadItem {}
  14904. const globalShortcut: GlobalShortcut;
  14905. const inAppPurchase: InAppPurchase;
  14906. class IncomingMessage extends Electron.IncomingMessage {}
  14907. const ipcMain: IpcMain;
  14908. class Menu extends Electron.Menu {}
  14909. class MenuItem extends Electron.MenuItem {}
  14910. class MessageChannelMain extends Electron.MessageChannelMain {}
  14911. class MessagePortMain extends Electron.MessagePortMain {}
  14912. const nativeTheme: NativeTheme;
  14913. const net: Net;
  14914. const netLog: NetLog;
  14915. class Notification extends Electron.Notification {}
  14916. const powerMonitor: PowerMonitor;
  14917. const powerSaveBlocker: PowerSaveBlocker;
  14918. const protocol: Protocol;
  14919. const screen: Screen;
  14920. class ServiceWorkers extends Electron.ServiceWorkers {}
  14921. class Session extends Electron.Session {}
  14922. type session = Session;
  14923. const session: typeof Session;
  14924. class ShareMenu extends Electron.ShareMenu {}
  14925. const systemPreferences: SystemPreferences;
  14926. class TouchBar extends Electron.TouchBar {}
  14927. class TouchBarButton extends Electron.TouchBarButton {}
  14928. class TouchBarColorPicker extends Electron.TouchBarColorPicker {}
  14929. class TouchBarGroup extends Electron.TouchBarGroup {}
  14930. class TouchBarLabel extends Electron.TouchBarLabel {}
  14931. class TouchBarOtherItemsProxy extends Electron.TouchBarOtherItemsProxy {}
  14932. class TouchBarPopover extends Electron.TouchBarPopover {}
  14933. class TouchBarScrubber extends Electron.TouchBarScrubber {}
  14934. class TouchBarSegmentedControl extends Electron.TouchBarSegmentedControl {}
  14935. class TouchBarSlider extends Electron.TouchBarSlider {}
  14936. class TouchBarSpacer extends Electron.TouchBarSpacer {}
  14937. class Tray extends Electron.Tray {}
  14938. class WebContents extends Electron.WebContents {}
  14939. type webContents = WebContents;
  14940. const webContents: typeof WebContents;
  14941. class WebFrameMain extends Electron.WebFrameMain {}
  14942. type webFrameMain = WebFrameMain;
  14943. const webFrameMain: typeof WebFrameMain;
  14944. class WebRequest extends Electron.WebRequest {}
  14945. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  14946. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  14947. type AnimationSettings = Electron.AnimationSettings;
  14948. type AppDetailsOptions = Electron.AppDetailsOptions;
  14949. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  14950. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  14951. type AuthInfo = Electron.AuthInfo;
  14952. type AutoResizeOptions = Electron.AutoResizeOptions;
  14953. type BeforeSendResponse = Electron.BeforeSendResponse;
  14954. type BitmapOptions = Electron.BitmapOptions;
  14955. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  14956. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  14957. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  14958. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  14959. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  14960. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  14961. type Config = Electron.Config;
  14962. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  14963. type ContextMenuParams = Electron.ContextMenuParams;
  14964. type CookiesGetFilter = Electron.CookiesGetFilter;
  14965. type CookiesSetDetails = Electron.CookiesSetDetails;
  14966. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  14967. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  14968. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  14969. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  14970. type Data = Electron.Data;
  14971. type Details = Electron.Details;
  14972. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  14973. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  14974. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  14975. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  14976. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  14977. type DidNavigateEvent = Electron.DidNavigateEvent;
  14978. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  14979. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  14980. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  14981. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  14982. type FeedURLOptions = Electron.FeedURLOptions;
  14983. type FileIconOptions = Electron.FileIconOptions;
  14984. type Filter = Electron.Filter;
  14985. type FindInPageOptions = Electron.FindInPageOptions;
  14986. type FocusOptions = Electron.FocusOptions;
  14987. type FoundInPageEvent = Electron.FoundInPageEvent;
  14988. type FromPartitionOptions = Electron.FromPartitionOptions;
  14989. type HandlerDetails = Electron.HandlerDetails;
  14990. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  14991. type HeapStatistics = Electron.HeapStatistics;
  14992. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  14993. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  14994. type Info = Electron.Info;
  14995. type Input = Electron.Input;
  14996. type InsertCSSOptions = Electron.InsertCSSOptions;
  14997. type IpcMessageEvent = Electron.IpcMessageEvent;
  14998. type Item = Electron.Item;
  14999. type JumpListSettings = Electron.JumpListSettings;
  15000. type LoadCommitEvent = Electron.LoadCommitEvent;
  15001. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  15002. type LoadFileOptions = Electron.LoadFileOptions;
  15003. type LoadURLOptions = Electron.LoadURLOptions;
  15004. type LoginItemSettings = Electron.LoginItemSettings;
  15005. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  15006. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  15007. type MessageBoxOptions = Electron.MessageBoxOptions;
  15008. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  15009. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  15010. type MessageDetails = Electron.MessageDetails;
  15011. type MessageEvent = Electron.MessageEvent;
  15012. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  15013. type NewWindowEvent = Electron.NewWindowEvent;
  15014. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  15015. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  15016. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  15017. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  15018. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  15019. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  15020. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  15021. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  15022. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  15023. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  15024. type OpenDialogOptions = Electron.OpenDialogOptions;
  15025. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  15026. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  15027. type OpenExternalOptions = Electron.OpenExternalOptions;
  15028. type Options = Electron.Options;
  15029. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  15030. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  15031. type Parameters = Electron.Parameters;
  15032. type Payment = Electron.Payment;
  15033. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  15034. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  15035. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  15036. type PopupOptions = Electron.PopupOptions;
  15037. type PreconnectOptions = Electron.PreconnectOptions;
  15038. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  15039. type Privileges = Electron.Privileges;
  15040. type ProgressBarOptions = Electron.ProgressBarOptions;
  15041. type Provider = Electron.Provider;
  15042. type ReadBookmark = Electron.ReadBookmark;
  15043. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  15044. type RelaunchOptions = Electron.RelaunchOptions;
  15045. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  15046. type Request = Electron.Request;
  15047. type ResizeOptions = Electron.ResizeOptions;
  15048. type ResourceUsage = Electron.ResourceUsage;
  15049. type Response = Electron.Response;
  15050. type Result = Electron.Result;
  15051. type SaveDialogOptions = Electron.SaveDialogOptions;
  15052. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  15053. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  15054. type Settings = Electron.Settings;
  15055. type SourcesOptions = Electron.SourcesOptions;
  15056. type SSLConfigConfig = Electron.SSLConfigConfig;
  15057. type StartLoggingOptions = Electron.StartLoggingOptions;
  15058. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  15059. type TitleOptions = Electron.TitleOptions;
  15060. type ToBitmapOptions = Electron.ToBitmapOptions;
  15061. type ToDataURLOptions = Electron.ToDataURLOptions;
  15062. type ToPNGOptions = Electron.ToPNGOptions;
  15063. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  15064. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  15065. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  15066. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  15067. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  15068. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  15069. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  15070. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  15071. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  15072. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  15073. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  15074. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  15075. type UploadProgress = Electron.UploadProgress;
  15076. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  15077. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  15078. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  15079. type WillNavigateEvent = Electron.WillNavigateEvent;
  15080. type EditFlags = Electron.EditFlags;
  15081. type FoundInPageResult = Electron.FoundInPageResult;
  15082. type LaunchItems = Electron.LaunchItems;
  15083. type Margins = Electron.Margins;
  15084. type MediaFlags = Electron.MediaFlags;
  15085. type PageRanges = Electron.PageRanges;
  15086. type WebPreferences = Electron.WebPreferences;
  15087. type DefaultFontFamily = Electron.DefaultFontFamily;
  15088. type BluetoothDevice = Electron.BluetoothDevice;
  15089. type Certificate = Electron.Certificate;
  15090. type CertificatePrincipal = Electron.CertificatePrincipal;
  15091. type Cookie = Electron.Cookie;
  15092. type CPUUsage = Electron.CPUUsage;
  15093. type CrashReport = Electron.CrashReport;
  15094. type CustomScheme = Electron.CustomScheme;
  15095. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  15096. type Display = Electron.Display;
  15097. type Event = Electron.Event;
  15098. type Extension = Electron.Extension;
  15099. type ExtensionInfo = Electron.ExtensionInfo;
  15100. type FileFilter = Electron.FileFilter;
  15101. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  15102. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  15103. type InputEvent = Electron.InputEvent;
  15104. type IOCounters = Electron.IOCounters;
  15105. type IpcMainEvent = Electron.IpcMainEvent;
  15106. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  15107. type IpcRendererEvent = Electron.IpcRendererEvent;
  15108. type JumpListCategory = Electron.JumpListCategory;
  15109. type JumpListItem = Electron.JumpListItem;
  15110. type KeyboardEvent = Electron.KeyboardEvent;
  15111. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  15112. type MemoryInfo = Electron.MemoryInfo;
  15113. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  15114. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  15115. type MouseInputEvent = Electron.MouseInputEvent;
  15116. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  15117. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  15118. type NotificationAction = Electron.NotificationAction;
  15119. type NotificationResponse = Electron.NotificationResponse;
  15120. type OverlayOptions = Electron.OverlayOptions;
  15121. type Point = Electron.Point;
  15122. type PostBody = Electron.PostBody;
  15123. type PrinterInfo = Electron.PrinterInfo;
  15124. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  15125. type ProcessMetric = Electron.ProcessMetric;
  15126. type Product = Electron.Product;
  15127. type ProtocolRequest = Electron.ProtocolRequest;
  15128. type ProtocolResponse = Electron.ProtocolResponse;
  15129. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  15130. type Rectangle = Electron.Rectangle;
  15131. type Referrer = Electron.Referrer;
  15132. type ScrubberItem = Electron.ScrubberItem;
  15133. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  15134. type SerialPort = Electron.SerialPort;
  15135. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  15136. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  15137. type SharingItem = Electron.SharingItem;
  15138. type ShortcutDetails = Electron.ShortcutDetails;
  15139. type Size = Electron.Size;
  15140. type Task = Electron.Task;
  15141. type ThumbarButton = Electron.ThumbarButton;
  15142. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  15143. type TraceConfig = Electron.TraceConfig;
  15144. type Transaction = Electron.Transaction;
  15145. type UploadData = Electron.UploadData;
  15146. type UploadFile = Electron.UploadFile;
  15147. type UploadRawData = Electron.UploadRawData;
  15148. type WebSource = Electron.WebSource;
  15149. }
  15150. namespace Renderer {
  15151. class BrowserWindowProxy extends Electron.BrowserWindowProxy {}
  15152. const contextBridge: ContextBridge;
  15153. const ipcRenderer: IpcRenderer;
  15154. const remote: Remote;
  15155. const webFrame: WebFrame;
  15156. const webviewTag: WebviewTag;
  15157. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  15158. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  15159. type AnimationSettings = Electron.AnimationSettings;
  15160. type AppDetailsOptions = Electron.AppDetailsOptions;
  15161. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  15162. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  15163. type AuthInfo = Electron.AuthInfo;
  15164. type AutoResizeOptions = Electron.AutoResizeOptions;
  15165. type BeforeSendResponse = Electron.BeforeSendResponse;
  15166. type BitmapOptions = Electron.BitmapOptions;
  15167. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  15168. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  15169. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  15170. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  15171. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  15172. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  15173. type Config = Electron.Config;
  15174. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  15175. type ContextMenuParams = Electron.ContextMenuParams;
  15176. type CookiesGetFilter = Electron.CookiesGetFilter;
  15177. type CookiesSetDetails = Electron.CookiesSetDetails;
  15178. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  15179. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  15180. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  15181. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  15182. type Data = Electron.Data;
  15183. type Details = Electron.Details;
  15184. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  15185. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  15186. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  15187. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  15188. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  15189. type DidNavigateEvent = Electron.DidNavigateEvent;
  15190. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  15191. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  15192. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  15193. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  15194. type FeedURLOptions = Electron.FeedURLOptions;
  15195. type FileIconOptions = Electron.FileIconOptions;
  15196. type Filter = Electron.Filter;
  15197. type FindInPageOptions = Electron.FindInPageOptions;
  15198. type FocusOptions = Electron.FocusOptions;
  15199. type FoundInPageEvent = Electron.FoundInPageEvent;
  15200. type FromPartitionOptions = Electron.FromPartitionOptions;
  15201. type HandlerDetails = Electron.HandlerDetails;
  15202. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  15203. type HeapStatistics = Electron.HeapStatistics;
  15204. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  15205. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  15206. type Info = Electron.Info;
  15207. type Input = Electron.Input;
  15208. type InsertCSSOptions = Electron.InsertCSSOptions;
  15209. type IpcMessageEvent = Electron.IpcMessageEvent;
  15210. type Item = Electron.Item;
  15211. type JumpListSettings = Electron.JumpListSettings;
  15212. type LoadCommitEvent = Electron.LoadCommitEvent;
  15213. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  15214. type LoadFileOptions = Electron.LoadFileOptions;
  15215. type LoadURLOptions = Electron.LoadURLOptions;
  15216. type LoginItemSettings = Electron.LoginItemSettings;
  15217. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  15218. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  15219. type MessageBoxOptions = Electron.MessageBoxOptions;
  15220. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  15221. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  15222. type MessageDetails = Electron.MessageDetails;
  15223. type MessageEvent = Electron.MessageEvent;
  15224. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  15225. type NewWindowEvent = Electron.NewWindowEvent;
  15226. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  15227. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  15228. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  15229. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  15230. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  15231. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  15232. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  15233. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  15234. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  15235. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  15236. type OpenDialogOptions = Electron.OpenDialogOptions;
  15237. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  15238. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  15239. type OpenExternalOptions = Electron.OpenExternalOptions;
  15240. type Options = Electron.Options;
  15241. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  15242. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  15243. type Parameters = Electron.Parameters;
  15244. type Payment = Electron.Payment;
  15245. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  15246. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  15247. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  15248. type PopupOptions = Electron.PopupOptions;
  15249. type PreconnectOptions = Electron.PreconnectOptions;
  15250. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  15251. type Privileges = Electron.Privileges;
  15252. type ProgressBarOptions = Electron.ProgressBarOptions;
  15253. type Provider = Electron.Provider;
  15254. type ReadBookmark = Electron.ReadBookmark;
  15255. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  15256. type RelaunchOptions = Electron.RelaunchOptions;
  15257. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  15258. type Request = Electron.Request;
  15259. type ResizeOptions = Electron.ResizeOptions;
  15260. type ResourceUsage = Electron.ResourceUsage;
  15261. type Response = Electron.Response;
  15262. type Result = Electron.Result;
  15263. type SaveDialogOptions = Electron.SaveDialogOptions;
  15264. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  15265. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  15266. type Settings = Electron.Settings;
  15267. type SourcesOptions = Electron.SourcesOptions;
  15268. type SSLConfigConfig = Electron.SSLConfigConfig;
  15269. type StartLoggingOptions = Electron.StartLoggingOptions;
  15270. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  15271. type TitleOptions = Electron.TitleOptions;
  15272. type ToBitmapOptions = Electron.ToBitmapOptions;
  15273. type ToDataURLOptions = Electron.ToDataURLOptions;
  15274. type ToPNGOptions = Electron.ToPNGOptions;
  15275. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  15276. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  15277. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  15278. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  15279. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  15280. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  15281. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  15282. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  15283. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  15284. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  15285. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  15286. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  15287. type UploadProgress = Electron.UploadProgress;
  15288. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  15289. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  15290. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  15291. type WillNavigateEvent = Electron.WillNavigateEvent;
  15292. type EditFlags = Electron.EditFlags;
  15293. type FoundInPageResult = Electron.FoundInPageResult;
  15294. type LaunchItems = Electron.LaunchItems;
  15295. type Margins = Electron.Margins;
  15296. type MediaFlags = Electron.MediaFlags;
  15297. type PageRanges = Electron.PageRanges;
  15298. type WebPreferences = Electron.WebPreferences;
  15299. type DefaultFontFamily = Electron.DefaultFontFamily;
  15300. type BluetoothDevice = Electron.BluetoothDevice;
  15301. type Certificate = Electron.Certificate;
  15302. type CertificatePrincipal = Electron.CertificatePrincipal;
  15303. type Cookie = Electron.Cookie;
  15304. type CPUUsage = Electron.CPUUsage;
  15305. type CrashReport = Electron.CrashReport;
  15306. type CustomScheme = Electron.CustomScheme;
  15307. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  15308. type Display = Electron.Display;
  15309. type Event = Electron.Event;
  15310. type Extension = Electron.Extension;
  15311. type ExtensionInfo = Electron.ExtensionInfo;
  15312. type FileFilter = Electron.FileFilter;
  15313. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  15314. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  15315. type InputEvent = Electron.InputEvent;
  15316. type IOCounters = Electron.IOCounters;
  15317. type IpcMainEvent = Electron.IpcMainEvent;
  15318. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  15319. type IpcRendererEvent = Electron.IpcRendererEvent;
  15320. type JumpListCategory = Electron.JumpListCategory;
  15321. type JumpListItem = Electron.JumpListItem;
  15322. type KeyboardEvent = Electron.KeyboardEvent;
  15323. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  15324. type MemoryInfo = Electron.MemoryInfo;
  15325. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  15326. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  15327. type MouseInputEvent = Electron.MouseInputEvent;
  15328. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  15329. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  15330. type NotificationAction = Electron.NotificationAction;
  15331. type NotificationResponse = Electron.NotificationResponse;
  15332. type OverlayOptions = Electron.OverlayOptions;
  15333. type Point = Electron.Point;
  15334. type PostBody = Electron.PostBody;
  15335. type PrinterInfo = Electron.PrinterInfo;
  15336. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  15337. type ProcessMetric = Electron.ProcessMetric;
  15338. type Product = Electron.Product;
  15339. type ProtocolRequest = Electron.ProtocolRequest;
  15340. type ProtocolResponse = Electron.ProtocolResponse;
  15341. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  15342. type Rectangle = Electron.Rectangle;
  15343. type Referrer = Electron.Referrer;
  15344. type ScrubberItem = Electron.ScrubberItem;
  15345. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  15346. type SerialPort = Electron.SerialPort;
  15347. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  15348. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  15349. type SharingItem = Electron.SharingItem;
  15350. type ShortcutDetails = Electron.ShortcutDetails;
  15351. type Size = Electron.Size;
  15352. type Task = Electron.Task;
  15353. type ThumbarButton = Electron.ThumbarButton;
  15354. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  15355. type TraceConfig = Electron.TraceConfig;
  15356. type Transaction = Electron.Transaction;
  15357. type UploadData = Electron.UploadData;
  15358. type UploadFile = Electron.UploadFile;
  15359. type UploadRawData = Electron.UploadRawData;
  15360. type WebSource = Electron.WebSource;
  15361. }
  15362. const app: App;
  15363. const autoUpdater: AutoUpdater;
  15364. const clipboard: Clipboard;
  15365. const contentTracing: ContentTracing;
  15366. const contextBridge: ContextBridge;
  15367. const crashReporter: CrashReporter;
  15368. const desktopCapturer: DesktopCapturer;
  15369. const dialog: Dialog;
  15370. const globalShortcut: GlobalShortcut;
  15371. const inAppPurchase: InAppPurchase;
  15372. const ipcMain: IpcMain;
  15373. const ipcRenderer: IpcRenderer;
  15374. type nativeImage = NativeImage;
  15375. const nativeImage: typeof NativeImage;
  15376. const nativeTheme: NativeTheme;
  15377. const net: Net;
  15378. const netLog: NetLog;
  15379. const powerMonitor: PowerMonitor;
  15380. const powerSaveBlocker: PowerSaveBlocker;
  15381. const protocol: Protocol;
  15382. const remote: Remote;
  15383. const screen: Screen;
  15384. type session = Session;
  15385. const session: typeof Session;
  15386. const shell: Shell;
  15387. const systemPreferences: SystemPreferences;
  15388. type webContents = WebContents;
  15389. const webContents: typeof WebContents;
  15390. const webFrame: WebFrame;
  15391. type webFrameMain = WebFrameMain;
  15392. const webFrameMain: typeof WebFrameMain;
  15393. const webviewTag: WebviewTag;
  15394. }
  15395. declare module 'electron' {
  15396. export = Electron;
  15397. }
  15398. declare module 'electron/main' {
  15399. export = Electron.Main
  15400. }
  15401. declare module 'electron/common' {
  15402. export = Electron.Common
  15403. }
  15404. declare module 'electron/renderer' {
  15405. export = Electron.Renderer
  15406. }
  15407. interface NodeRequireFunction {
  15408. (moduleName: 'electron'): typeof Electron;
  15409. (moduleName: 'electron/main'): typeof Electron.Main;
  15410. (moduleName: 'electron/common'): typeof Electron.Common;
  15411. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  15412. }
  15413. interface NodeRequire {
  15414. (moduleName: 'electron'): typeof Electron;
  15415. (moduleName: 'electron/main'): typeof Electron.Main;
  15416. (moduleName: 'electron/common'): typeof Electron.Common;
  15417. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  15418. }
  15419. interface File {
  15420. /**
  15421. * The real path to the file on the users filesystem
  15422. */
  15423. path: string;
  15424. }
  15425. declare module 'original-fs' {
  15426. import * as fs from 'fs';
  15427. export = fs;
  15428. }
  15429. interface Document {
  15430. createElement(tagName: 'webview'): Electron.WebviewTag;
  15431. }
  15432. declare namespace NodeJS {
  15433. interface Process extends NodeJS.EventEmitter {
  15434. // Docs: https://electronjs.org/docs/api/process
  15435. /**
  15436. * Emitted when Electron has loaded its internal initialization script and is
  15437. * beginning to load the web page or the main script.
  15438. */
  15439. on(event: 'loaded', listener: Function): this;
  15440. once(event: 'loaded', listener: Function): this;
  15441. addListener(event: 'loaded', listener: Function): this;
  15442. removeListener(event: 'loaded', listener: Function): this;
  15443. /**
  15444. * Causes the main thread of the current process crash.
  15445. */
  15446. crash(): void;
  15447. /**
  15448. * * `allocated` Integer - Size of all allocated objects in Kilobytes.
  15449. * * `marked` Integer - Size of all marked objects in Kilobytes.
  15450. * * `total` Integer - Total allocated space in Kilobytes.
  15451. *
  15452. * Returns an object with Blink memory information. It can be useful for debugging
  15453. * rendering / DOM related memory issues. Note that all values are reported in
  15454. * Kilobytes.
  15455. */
  15456. getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
  15457. getCPUUsage(): Electron.CPUUsage;
  15458. /**
  15459. * The number of milliseconds since epoch, or `null` if the information is
  15460. * unavailable
  15461. *
  15462. * Indicates the creation time of the application. The time is represented as
  15463. * number of milliseconds since epoch. It returns null if it is unable to get the
  15464. * process creation time.
  15465. */
  15466. getCreationTime(): (number) | (null);
  15467. /**
  15468. * * `totalHeapSize` Integer
  15469. * * `totalHeapSizeExecutable` Integer
  15470. * * `totalPhysicalSize` Integer
  15471. * * `totalAvailableSize` Integer
  15472. * * `usedHeapSize` Integer
  15473. * * `heapSizeLimit` Integer
  15474. * * `mallocedMemory` Integer
  15475. * * `peakMallocedMemory` Integer
  15476. * * `doesZapGarbage` Boolean
  15477. *
  15478. * Returns an object with V8 heap statistics. Note that all statistics are reported
  15479. * in Kilobytes.
  15480. */
  15481. getHeapStatistics(): Electron.HeapStatistics;
  15482. getIOCounters(): Electron.IOCounters;
  15483. /**
  15484. * Resolves with a ProcessMemoryInfo
  15485. *
  15486. * Returns an object giving memory usage statistics about the current process. Note
  15487. * that all statistics are reported in Kilobytes. This api should be called after
  15488. * app ready.
  15489. *
  15490. * Chromium does not provide `residentSet` value for macOS. This is because macOS
  15491. * performs in-memory compression of pages that haven't been recently used. As a
  15492. * result the resident set size value is not what one would expect. `private`
  15493. * memory is more representative of the actual pre-compression memory usage of the
  15494. * process on macOS.
  15495. */
  15496. getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
  15497. /**
  15498. * * `total` Integer - The total amount of physical memory in Kilobytes available
  15499. * to the system.
  15500. * * `free` Integer - The total amount of memory not being used by applications or
  15501. * disk cache.
  15502. * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
  15503. * Kilobytes available to the system.
  15504. * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
  15505. * Kilobytes available to the system.
  15506. *
  15507. * Returns an object giving memory usage statistics about the entire system. Note
  15508. * that all statistics are reported in Kilobytes.
  15509. */
  15510. getSystemMemoryInfo(): Electron.SystemMemoryInfo;
  15511. /**
  15512. * The version of the host operating system.
  15513. *
  15514. * Example:
  15515. *
  15516. * **Note:** It returns the actual operating system version instead of kernel
  15517. * version on macOS unlike `os.release()`.
  15518. */
  15519. getSystemVersion(): string;
  15520. /**
  15521. * Causes the main thread of the current process hang.
  15522. */
  15523. hang(): void;
  15524. /**
  15525. * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
  15526. * whichever is lower for the current process.
  15527. *
  15528. * @platform darwin,linux
  15529. */
  15530. setFdLimit(maxDescriptors: number): void;
  15531. /**
  15532. * Indicates whether the snapshot has been created successfully.
  15533. *
  15534. Takes a V8 heap snapshot and saves it to `filePath`.
  15535. */
  15536. takeHeapSnapshot(filePath: string): boolean;
  15537. /**
  15538. * A `String` representing Chrome's version string.
  15539. *
  15540. */
  15541. readonly chrome: string;
  15542. /**
  15543. * A `String` (optional) representing a globally unique ID of the current
  15544. * JavaScript context. Each frame has its own JavaScript context. When
  15545. * contextIsolation is enabled, the isolated world also has a separate JavaScript
  15546. * context. This property is only available in the renderer process.
  15547. *
  15548. */
  15549. readonly contextId?: string;
  15550. /**
  15551. * A `Boolean` that indicates whether the current renderer context has
  15552. * `contextIsolation` enabled. It is `undefined` in the main process.
  15553. *
  15554. */
  15555. readonly contextIsolated: boolean;
  15556. /**
  15557. * A `Boolean`. When app is started by being passed as parameter to the default
  15558. * app, this property is `true` in the main process, otherwise it is `undefined`.
  15559. *
  15560. */
  15561. readonly defaultApp: boolean;
  15562. /**
  15563. * A `String` representing Electron's version string.
  15564. *
  15565. */
  15566. readonly electron: string;
  15567. /**
  15568. * A `Boolean`, `true` when the current renderer context is the "main" renderer
  15569. * frame. If you want the ID of the current frame you should use
  15570. * `webFrame.routingId`.
  15571. *
  15572. */
  15573. readonly isMainFrame: boolean;
  15574. /**
  15575. * A `Boolean`. For Mac App Store build, this property is `true`, for other builds
  15576. * it is `undefined`.
  15577. *
  15578. */
  15579. readonly mas: boolean;
  15580. /**
  15581. * A `Boolean` that controls ASAR support inside your application. Setting this to
  15582. * `true` will disable the support for `asar` archives in Node's built-in modules.
  15583. */
  15584. noAsar: boolean;
  15585. /**
  15586. * A `Boolean` that controls whether or not deprecation warnings are printed to
  15587. * `stderr`. Setting this to `true` will silence deprecation warnings. This
  15588. * property is used instead of the `--no-deprecation` command line flag.
  15589. */
  15590. noDeprecation: boolean;
  15591. /**
  15592. * A `String` representing the path to the resources directory.
  15593. *
  15594. */
  15595. readonly resourcesPath: string;
  15596. /**
  15597. * A `Boolean`. When the renderer process is sandboxed, this property is `true`,
  15598. * otherwise it is `undefined`.
  15599. *
  15600. */
  15601. readonly sandboxed: boolean;
  15602. /**
  15603. * A `Boolean` that controls whether or not deprecation warnings will be thrown as
  15604. * exceptions. Setting this to `true` will throw errors for deprecations. This
  15605. * property is used instead of the `--throw-deprecation` command line flag.
  15606. */
  15607. throwDeprecation: boolean;
  15608. /**
  15609. * A `Boolean` that controls whether or not deprecations printed to `stderr`
  15610. * include their stack trace. Setting this to `true` will print stack traces for
  15611. * deprecations. This property is instead of the `--trace-deprecation` command line
  15612. * flag.
  15613. */
  15614. traceDeprecation: boolean;
  15615. /**
  15616. * A `Boolean` that controls whether or not process warnings printed to `stderr`
  15617. * include their stack trace. Setting this to `true` will print stack traces for
  15618. * process warnings (including deprecations). This property is instead of the
  15619. * `--trace-warnings` command line flag.
  15620. */
  15621. traceProcessWarnings: boolean;
  15622. /**
  15623. * A `String` representing the current process's type, can be:
  15624. *
  15625. * * `browser` - The main process
  15626. * * `renderer` - A renderer process
  15627. * `worker` - In a web worker
  15628. *
  15629. */
  15630. readonly type: ('browser' | 'renderer' | 'worker');
  15631. /**
  15632. * A `Boolean`. If the app is running as a Windows Store app (appx), this property
  15633. * is `true`, for otherwise it is `undefined`.
  15634. *
  15635. */
  15636. readonly windowsStore: boolean;
  15637. }
  15638. interface ProcessVersions {
  15639. readonly electron: string;
  15640. readonly chrome: string;
  15641. }
  15642. }