electron.d.ts 862 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178
  1. // Type definitions for Electron 28.3.3
  2. // Project: http://electronjs.org/
  3. // Definitions by: The Electron Team <https://github.com/electron/electron>
  4. // Definitions: https://github.com/electron/typescript-definitions
  5. /// <reference types="node" />
  6. type DOMEvent = Event;
  7. type GlobalResponse = Response;
  8. type GlobalRequest = Request;
  9. declare namespace Electron {
  10. const NodeEventEmitter: typeof import('events').EventEmitter;
  11. type Accelerator = string;
  12. type Event<Params extends object = {}> = {
  13. preventDefault: () => void;
  14. readonly defaultPrevented: boolean;
  15. } & Params;
  16. interface App extends NodeJS.EventEmitter {
  17. // Docs: https://electronjs.org/docs/api/app
  18. /**
  19. * Emitted when Chrome's accessibility support changes. This event fires when
  20. * assistive technologies, such as screen readers, are enabled or disabled. See
  21. * https://www.chromium.org/developers/design-documents/accessibility for more
  22. * details.
  23. *
  24. * @platform darwin,win32
  25. */
  26. on(event: 'accessibility-support-changed', listener: (event: Event,
  27. /**
  28. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  29. */
  30. accessibilitySupportEnabled: boolean) => void): this;
  31. /**
  32. * @platform darwin,win32
  33. */
  34. off(event: 'accessibility-support-changed', listener: (event: Event,
  35. /**
  36. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  37. */
  38. accessibilitySupportEnabled: boolean) => void): this;
  39. /**
  40. * @platform darwin,win32
  41. */
  42. once(event: 'accessibility-support-changed', listener: (event: Event,
  43. /**
  44. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  45. */
  46. accessibilitySupportEnabled: boolean) => void): this;
  47. /**
  48. * @platform darwin,win32
  49. */
  50. addListener(event: 'accessibility-support-changed', listener: (event: Event,
  51. /**
  52. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  53. */
  54. accessibilitySupportEnabled: boolean) => void): this;
  55. /**
  56. * @platform darwin,win32
  57. */
  58. removeListener(event: 'accessibility-support-changed', listener: (event: Event,
  59. /**
  60. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  61. */
  62. accessibilitySupportEnabled: boolean) => void): this;
  63. /**
  64. * Emitted when the application is activated. Various actions can trigger this
  65. * event, such as launching the application for the first time, attempting to
  66. * re-launch the application when it's already running, or clicking on the
  67. * application's dock or taskbar icon.
  68. *
  69. * @platform darwin
  70. */
  71. on(event: 'activate', listener: (event: Event,
  72. hasVisibleWindows: boolean) => void): this;
  73. /**
  74. * @platform darwin
  75. */
  76. off(event: 'activate', listener: (event: Event,
  77. hasVisibleWindows: boolean) => void): this;
  78. /**
  79. * @platform darwin
  80. */
  81. once(event: 'activate', listener: (event: Event,
  82. hasVisibleWindows: boolean) => void): this;
  83. /**
  84. * @platform darwin
  85. */
  86. addListener(event: 'activate', listener: (event: Event,
  87. hasVisibleWindows: boolean) => void): this;
  88. /**
  89. * @platform darwin
  90. */
  91. removeListener(event: 'activate', listener: (event: Event,
  92. hasVisibleWindows: boolean) => void): this;
  93. /**
  94. * Emitted during Handoff after an activity from this device was successfully
  95. * resumed on another one.
  96. *
  97. * @platform darwin
  98. */
  99. on(event: 'activity-was-continued', listener: (event: Event,
  100. /**
  101. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  102. */
  103. type: string,
  104. /**
  105. * Contains app-specific state stored by the activity.
  106. */
  107. userInfo: unknown) => void): this;
  108. /**
  109. * @platform darwin
  110. */
  111. off(event: 'activity-was-continued', listener: (event: Event,
  112. /**
  113. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  114. */
  115. type: string,
  116. /**
  117. * Contains app-specific state stored by the activity.
  118. */
  119. userInfo: unknown) => void): this;
  120. /**
  121. * @platform darwin
  122. */
  123. once(event: 'activity-was-continued', listener: (event: Event,
  124. /**
  125. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  126. */
  127. type: string,
  128. /**
  129. * Contains app-specific state stored by the activity.
  130. */
  131. userInfo: unknown) => void): this;
  132. /**
  133. * @platform darwin
  134. */
  135. addListener(event: 'activity-was-continued', listener: (event: Event,
  136. /**
  137. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  138. */
  139. type: string,
  140. /**
  141. * Contains app-specific state stored by the activity.
  142. */
  143. userInfo: unknown) => void): this;
  144. /**
  145. * @platform darwin
  146. */
  147. removeListener(event: 'activity-was-continued', listener: (event: Event,
  148. /**
  149. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  150. */
  151. type: string,
  152. /**
  153. * Contains app-specific state stored by the activity.
  154. */
  155. userInfo: unknown) => void): this;
  156. /**
  157. * Emitted before the application starts closing its windows. Calling
  158. * `event.preventDefault()` will prevent the default behavior, which is terminating
  159. * the application.
  160. *
  161. * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
  162. * then `before-quit` is emitted _after_ emitting `close` event on all windows and
  163. * closing them.
  164. *
  165. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  166. * a shutdown/restart of the system or a user logout.
  167. */
  168. on(event: 'before-quit', listener: (event: Event) => void): this;
  169. off(event: 'before-quit', listener: (event: Event) => void): this;
  170. once(event: 'before-quit', listener: (event: Event) => void): this;
  171. addListener(event: 'before-quit', listener: (event: Event) => void): this;
  172. removeListener(event: 'before-quit', listener: (event: Event) => void): this;
  173. /**
  174. * Emitted when a browserWindow gets blurred.
  175. */
  176. on(event: 'browser-window-blur', listener: (event: Event,
  177. window: BrowserWindow) => void): this;
  178. off(event: 'browser-window-blur', listener: (event: Event,
  179. window: BrowserWindow) => void): this;
  180. once(event: 'browser-window-blur', listener: (event: Event,
  181. window: BrowserWindow) => void): this;
  182. addListener(event: 'browser-window-blur', listener: (event: Event,
  183. window: BrowserWindow) => void): this;
  184. removeListener(event: 'browser-window-blur', listener: (event: Event,
  185. window: BrowserWindow) => void): this;
  186. /**
  187. * Emitted when a new browserWindow is created.
  188. */
  189. on(event: 'browser-window-created', listener: (event: Event,
  190. window: BrowserWindow) => void): this;
  191. off(event: 'browser-window-created', listener: (event: Event,
  192. window: BrowserWindow) => void): this;
  193. once(event: 'browser-window-created', listener: (event: Event,
  194. window: BrowserWindow) => void): this;
  195. addListener(event: 'browser-window-created', listener: (event: Event,
  196. window: BrowserWindow) => void): this;
  197. removeListener(event: 'browser-window-created', listener: (event: Event,
  198. window: BrowserWindow) => void): this;
  199. /**
  200. * Emitted when a browserWindow gets focused.
  201. */
  202. on(event: 'browser-window-focus', listener: (event: Event,
  203. window: BrowserWindow) => void): this;
  204. off(event: 'browser-window-focus', listener: (event: Event,
  205. window: BrowserWindow) => void): this;
  206. once(event: 'browser-window-focus', listener: (event: Event,
  207. window: BrowserWindow) => void): this;
  208. addListener(event: 'browser-window-focus', listener: (event: Event,
  209. window: BrowserWindow) => void): this;
  210. removeListener(event: 'browser-window-focus', listener: (event: Event,
  211. window: BrowserWindow) => void): this;
  212. /**
  213. * Emitted when failed to verify the `certificate` for `url`, to trust the
  214. * certificate you should prevent the default behavior with
  215. * `event.preventDefault()` and call `callback(true)`.
  216. */
  217. on(event: 'certificate-error', listener: (event: Event,
  218. webContents: WebContents,
  219. url: string,
  220. /**
  221. * The error code
  222. */
  223. error: string,
  224. certificate: Certificate,
  225. callback: (isTrusted: boolean) => void,
  226. isMainFrame: boolean) => void): this;
  227. off(event: 'certificate-error', listener: (event: Event,
  228. webContents: WebContents,
  229. url: string,
  230. /**
  231. * The error code
  232. */
  233. error: string,
  234. certificate: Certificate,
  235. callback: (isTrusted: boolean) => void,
  236. isMainFrame: boolean) => void): this;
  237. once(event: 'certificate-error', listener: (event: Event,
  238. webContents: WebContents,
  239. url: string,
  240. /**
  241. * The error code
  242. */
  243. error: string,
  244. certificate: Certificate,
  245. callback: (isTrusted: boolean) => void,
  246. isMainFrame: boolean) => void): this;
  247. addListener(event: 'certificate-error', listener: (event: Event,
  248. webContents: WebContents,
  249. url: string,
  250. /**
  251. * The error code
  252. */
  253. error: string,
  254. certificate: Certificate,
  255. callback: (isTrusted: boolean) => void,
  256. isMainFrame: boolean) => void): this;
  257. removeListener(event: 'certificate-error', listener: (event: Event,
  258. webContents: WebContents,
  259. url: string,
  260. /**
  261. * The error code
  262. */
  263. error: string,
  264. certificate: Certificate,
  265. callback: (isTrusted: boolean) => void,
  266. isMainFrame: boolean) => void): this;
  267. /**
  268. * Emitted when the child process unexpectedly disappears. This is normally because
  269. * it was crashed or killed. It does not include renderer processes.
  270. */
  271. on(event: 'child-process-gone', listener: (event: Event,
  272. details: Details) => void): this;
  273. off(event: 'child-process-gone', listener: (event: Event,
  274. details: Details) => void): this;
  275. once(event: 'child-process-gone', listener: (event: Event,
  276. details: Details) => void): this;
  277. addListener(event: 'child-process-gone', listener: (event: Event,
  278. details: Details) => void): this;
  279. removeListener(event: 'child-process-gone', listener: (event: Event,
  280. details: Details) => void): this;
  281. /**
  282. * Emitted during Handoff when an activity from a different device wants to be
  283. * resumed. You should call `event.preventDefault()` if you want to handle this
  284. * event.
  285. *
  286. * A user activity can be continued only in an app that has the same developer Team
  287. * ID as the activity's source app and that supports the activity's type. Supported
  288. * activity types are specified in the app's `Info.plist` under the
  289. * `NSUserActivityTypes` key.
  290. *
  291. * @platform darwin
  292. */
  293. on(event: 'continue-activity', listener: (event: Event,
  294. /**
  295. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  296. */
  297. type: string,
  298. /**
  299. * Contains app-specific state stored by the activity on another device.
  300. */
  301. userInfo: unknown,
  302. details: ContinueActivityDetails) => void): this;
  303. /**
  304. * @platform darwin
  305. */
  306. off(event: 'continue-activity', listener: (event: Event,
  307. /**
  308. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  309. */
  310. type: string,
  311. /**
  312. * Contains app-specific state stored by the activity on another device.
  313. */
  314. userInfo: unknown,
  315. details: ContinueActivityDetails) => void): this;
  316. /**
  317. * @platform darwin
  318. */
  319. once(event: 'continue-activity', listener: (event: Event,
  320. /**
  321. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  322. */
  323. type: string,
  324. /**
  325. * Contains app-specific state stored by the activity on another device.
  326. */
  327. userInfo: unknown,
  328. details: ContinueActivityDetails) => void): this;
  329. /**
  330. * @platform darwin
  331. */
  332. addListener(event: 'continue-activity', listener: (event: Event,
  333. /**
  334. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  335. */
  336. type: string,
  337. /**
  338. * Contains app-specific state stored by the activity on another device.
  339. */
  340. userInfo: unknown,
  341. details: ContinueActivityDetails) => void): this;
  342. /**
  343. * @platform darwin
  344. */
  345. removeListener(event: 'continue-activity', listener: (event: Event,
  346. /**
  347. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  348. */
  349. type: string,
  350. /**
  351. * Contains app-specific state stored by the activity on another device.
  352. */
  353. userInfo: unknown,
  354. details: ContinueActivityDetails) => void): this;
  355. /**
  356. * Emitted during Handoff when an activity from a different device fails to be
  357. * resumed.
  358. *
  359. * @platform darwin
  360. */
  361. on(event: 'continue-activity-error', listener: (event: Event,
  362. /**
  363. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  364. */
  365. type: string,
  366. /**
  367. * A string with the error's localized description.
  368. */
  369. error: string) => void): this;
  370. /**
  371. * @platform darwin
  372. */
  373. off(event: 'continue-activity-error', listener: (event: Event,
  374. /**
  375. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  376. */
  377. type: string,
  378. /**
  379. * A string with the error's localized description.
  380. */
  381. error: string) => void): this;
  382. /**
  383. * @platform darwin
  384. */
  385. once(event: 'continue-activity-error', listener: (event: Event,
  386. /**
  387. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  388. */
  389. type: string,
  390. /**
  391. * A string with the error's localized description.
  392. */
  393. error: string) => void): this;
  394. /**
  395. * @platform darwin
  396. */
  397. addListener(event: 'continue-activity-error', listener: (event: Event,
  398. /**
  399. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  400. */
  401. type: string,
  402. /**
  403. * A string with the error's localized description.
  404. */
  405. error: string) => void): this;
  406. /**
  407. * @platform darwin
  408. */
  409. removeListener(event: 'continue-activity-error', listener: (event: Event,
  410. /**
  411. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  412. */
  413. type: string,
  414. /**
  415. * A string with the error's localized description.
  416. */
  417. error: string) => void): this;
  418. /**
  419. * Emitted when the application becomes active. This differs from the `activate`
  420. * event in that `did-become-active` is emitted every time the app becomes active,
  421. * not only when Dock icon is clicked or application is re-launched. It is also
  422. * emitted when a user switches to the app via the macOS App Switcher.
  423. *
  424. * @platform darwin
  425. */
  426. on(event: 'did-become-active', listener: (event: Event) => void): this;
  427. /**
  428. * @platform darwin
  429. */
  430. off(event: 'did-become-active', listener: (event: Event) => void): this;
  431. /**
  432. * @platform darwin
  433. */
  434. once(event: 'did-become-active', listener: (event: Event) => void): this;
  435. /**
  436. * @platform darwin
  437. */
  438. addListener(event: 'did-become-active', listener: (event: Event) => void): this;
  439. /**
  440. * @platform darwin
  441. */
  442. removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
  443. /**
  444. * Emitted when the app is no longer active and doesn’t have focus. This can be
  445. * triggered, for example, by clicking on another application or by using the macOS
  446. * App Switcher to switch to another application.
  447. *
  448. * @platform darwin
  449. */
  450. on(event: 'did-resign-active', listener: (event: Event) => void): this;
  451. /**
  452. * @platform darwin
  453. */
  454. off(event: 'did-resign-active', listener: (event: Event) => void): this;
  455. /**
  456. * @platform darwin
  457. */
  458. once(event: 'did-resign-active', listener: (event: Event) => void): this;
  459. /**
  460. * @platform darwin
  461. */
  462. addListener(event: 'did-resign-active', listener: (event: Event) => void): this;
  463. /**
  464. * @platform darwin
  465. */
  466. removeListener(event: 'did-resign-active', listener: (event: Event) => void): this;
  467. /**
  468. * Emitted whenever there is a GPU info update.
  469. */
  470. on(event: 'gpu-info-update', listener: Function): this;
  471. off(event: 'gpu-info-update', listener: Function): this;
  472. once(event: 'gpu-info-update', listener: Function): this;
  473. addListener(event: 'gpu-info-update', listener: Function): this;
  474. removeListener(event: 'gpu-info-update', listener: Function): this;
  475. /**
  476. * Emitted when the GPU process crashes or is killed.
  477. *
  478. * **Deprecated:** This event is superceded by the `child-process-gone` event which
  479. * contains more information about why the child process disappeared. It isn't
  480. * always because it crashed. The `killed` boolean can be replaced by checking
  481. * `reason === 'killed'` when you switch to that event.
  482. *
  483. * @deprecated
  484. */
  485. on(event: 'gpu-process-crashed', listener: (event: Event,
  486. killed: boolean) => void): this;
  487. /**
  488. * @deprecated
  489. */
  490. off(event: 'gpu-process-crashed', listener: (event: Event,
  491. killed: boolean) => void): this;
  492. /**
  493. * @deprecated
  494. */
  495. once(event: 'gpu-process-crashed', listener: (event: Event,
  496. killed: boolean) => void): this;
  497. /**
  498. * @deprecated
  499. */
  500. addListener(event: 'gpu-process-crashed', listener: (event: Event,
  501. killed: boolean) => void): this;
  502. /**
  503. * @deprecated
  504. */
  505. removeListener(event: 'gpu-process-crashed', listener: (event: Event,
  506. killed: boolean) => void): this;
  507. /**
  508. * Emitted when `webContents` wants to do basic auth.
  509. *
  510. * The default behavior is to cancel all authentications. To override this you
  511. * should prevent the default behavior with `event.preventDefault()` and call
  512. * `callback(username, password)` with the credentials.
  513. *
  514. * If `callback` is called without a username or password, the authentication
  515. * request will be cancelled and the authentication error will be returned to the
  516. * page.
  517. */
  518. on(event: 'login', listener: (event: Event,
  519. webContents: WebContents,
  520. authenticationResponseDetails: AuthenticationResponseDetails,
  521. authInfo: AuthInfo,
  522. callback: (username?: string, password?: string) => void) => void): this;
  523. off(event: 'login', listener: (event: Event,
  524. webContents: WebContents,
  525. authenticationResponseDetails: AuthenticationResponseDetails,
  526. authInfo: AuthInfo,
  527. callback: (username?: string, password?: string) => void) => void): this;
  528. once(event: 'login', listener: (event: Event,
  529. webContents: WebContents,
  530. authenticationResponseDetails: AuthenticationResponseDetails,
  531. authInfo: AuthInfo,
  532. callback: (username?: string, password?: string) => void) => void): this;
  533. addListener(event: 'login', listener: (event: Event,
  534. webContents: WebContents,
  535. authenticationResponseDetails: AuthenticationResponseDetails,
  536. authInfo: AuthInfo,
  537. callback: (username?: string, password?: string) => void) => void): this;
  538. removeListener(event: 'login', listener: (event: Event,
  539. webContents: WebContents,
  540. authenticationResponseDetails: AuthenticationResponseDetails,
  541. authInfo: AuthInfo,
  542. callback: (username?: string, password?: string) => void) => void): this;
  543. /**
  544. * Emitted when the user clicks the native macOS new tab button. The new tab button
  545. * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
  546. *
  547. * @platform darwin
  548. */
  549. on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  550. /**
  551. * @platform darwin
  552. */
  553. off(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  554. /**
  555. * @platform darwin
  556. */
  557. once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  558. /**
  559. * @platform darwin
  560. */
  561. addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  562. /**
  563. * @platform darwin
  564. */
  565. removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  566. /**
  567. * Emitted when the user wants to open a file with the application. The `open-file`
  568. * event is usually emitted when the application is already open and the OS wants
  569. * to reuse the application to open the file. `open-file` is also emitted when a
  570. * file is dropped onto the dock and the application is not yet running. Make sure
  571. * to listen for the `open-file` event very early in your application startup to
  572. * handle this case (even before the `ready` event is emitted).
  573. *
  574. * You should call `event.preventDefault()` if you want to handle this event.
  575. *
  576. * On Windows, you have to parse `process.argv` (in the main process) to get the
  577. * filepath.
  578. *
  579. * @platform darwin
  580. */
  581. on(event: 'open-file', listener: (event: Event,
  582. path: string) => void): this;
  583. /**
  584. * @platform darwin
  585. */
  586. off(event: 'open-file', listener: (event: Event,
  587. path: string) => void): this;
  588. /**
  589. * @platform darwin
  590. */
  591. once(event: 'open-file', listener: (event: Event,
  592. path: string) => void): this;
  593. /**
  594. * @platform darwin
  595. */
  596. addListener(event: 'open-file', listener: (event: Event,
  597. path: string) => void): this;
  598. /**
  599. * @platform darwin
  600. */
  601. removeListener(event: 'open-file', listener: (event: Event,
  602. path: string) => void): this;
  603. /**
  604. * Emitted when the user wants to open a URL with the application. Your
  605. * application's `Info.plist` file must define the URL scheme within the
  606. * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
  607. *
  608. * As with the `open-file` event, be sure to register a listener for the `open-url`
  609. * event early in your application startup to detect if the application is being
  610. * opened to handle a URL. If you register the listener in response to a `ready`
  611. * event, you'll miss URLs that trigger the launch of your application.
  612. *
  613. * @platform darwin
  614. */
  615. on(event: 'open-url', listener: (event: Event,
  616. url: string) => void): this;
  617. /**
  618. * @platform darwin
  619. */
  620. off(event: 'open-url', listener: (event: Event,
  621. url: string) => void): this;
  622. /**
  623. * @platform darwin
  624. */
  625. once(event: 'open-url', listener: (event: Event,
  626. url: string) => void): this;
  627. /**
  628. * @platform darwin
  629. */
  630. addListener(event: 'open-url', listener: (event: Event,
  631. url: string) => void): this;
  632. /**
  633. * @platform darwin
  634. */
  635. removeListener(event: 'open-url', listener: (event: Event,
  636. url: string) => void): this;
  637. /**
  638. * Emitted when the application is quitting.
  639. *
  640. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  641. * a shutdown/restart of the system or a user logout.
  642. */
  643. on(event: 'quit', listener: (event: Event,
  644. exitCode: number) => void): this;
  645. off(event: 'quit', listener: (event: Event,
  646. exitCode: number) => void): this;
  647. once(event: 'quit', listener: (event: Event,
  648. exitCode: number) => void): this;
  649. addListener(event: 'quit', listener: (event: Event,
  650. exitCode: number) => void): this;
  651. removeListener(event: 'quit', listener: (event: Event,
  652. exitCode: number) => void): this;
  653. /**
  654. * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
  655. * holds the `userInfo` of the `NSUserNotification` or information from
  656. * `UNNotificationResponse` that was used to open the application, if it was
  657. * launched from Notification Center. You can also call `app.isReady()` to check if
  658. * this event has already fired and `app.whenReady()` to get a Promise that is
  659. * fulfilled when Electron is initialized.
  660. */
  661. on(event: 'ready', listener: (event: Event,
  662. /**
  663. * @platform darwin
  664. */
  665. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  666. off(event: 'ready', listener: (event: Event,
  667. /**
  668. * @platform darwin
  669. */
  670. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  671. once(event: 'ready', listener: (event: Event,
  672. /**
  673. * @platform darwin
  674. */
  675. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  676. addListener(event: 'ready', listener: (event: Event,
  677. /**
  678. * @platform darwin
  679. */
  680. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  681. removeListener(event: 'ready', listener: (event: Event,
  682. /**
  683. * @platform darwin
  684. */
  685. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  686. /**
  687. * Emitted when the renderer process unexpectedly disappears. This is normally
  688. * because it was crashed or killed.
  689. */
  690. on(event: 'render-process-gone', listener: (event: Event,
  691. webContents: WebContents,
  692. details: RenderProcessGoneDetails) => void): this;
  693. off(event: 'render-process-gone', listener: (event: Event,
  694. webContents: WebContents,
  695. details: RenderProcessGoneDetails) => void): this;
  696. once(event: 'render-process-gone', listener: (event: Event,
  697. webContents: WebContents,
  698. details: RenderProcessGoneDetails) => void): this;
  699. addListener(event: 'render-process-gone', listener: (event: Event,
  700. webContents: WebContents,
  701. details: RenderProcessGoneDetails) => void): this;
  702. removeListener(event: 'render-process-gone', listener: (event: Event,
  703. webContents: WebContents,
  704. details: RenderProcessGoneDetails) => void): this;
  705. /**
  706. * Emitted when the renderer process of `webContents` crashes or is killed.
  707. *
  708. * **Deprecated:** This event is superceded by the `render-process-gone` event
  709. * which contains more information about why the render process disappeared. It
  710. * isn't always because it crashed. The `killed` boolean can be replaced by
  711. * checking `reason === 'killed'` when you switch to that event.
  712. *
  713. * @deprecated
  714. */
  715. on(event: 'renderer-process-crashed', listener: (event: Event,
  716. webContents: WebContents,
  717. killed: boolean) => void): this;
  718. /**
  719. * @deprecated
  720. */
  721. off(event: 'renderer-process-crashed', listener: (event: Event,
  722. webContents: WebContents,
  723. killed: boolean) => void): this;
  724. /**
  725. * @deprecated
  726. */
  727. once(event: 'renderer-process-crashed', listener: (event: Event,
  728. webContents: WebContents,
  729. killed: boolean) => void): this;
  730. /**
  731. * @deprecated
  732. */
  733. addListener(event: 'renderer-process-crashed', listener: (event: Event,
  734. webContents: WebContents,
  735. killed: boolean) => void): this;
  736. /**
  737. * @deprecated
  738. */
  739. removeListener(event: 'renderer-process-crashed', listener: (event: Event,
  740. webContents: WebContents,
  741. killed: boolean) => void): this;
  742. /**
  743. * This event will be emitted inside the primary instance of your application when
  744. * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
  745. *
  746. * `argv` is an Array of the second instance's command line arguments, and
  747. * `workingDirectory` is its current working directory. Usually applications
  748. * respond to this by making their primary window focused and non-minimized.
  749. *
  750. * **Note:** `argv` will not be exactly the same list of arguments as those passed
  751. * to the second instance. The order might change and additional arguments might be
  752. * appended. If you need to maintain the exact same arguments, it's advised to use
  753. * `additionalData` instead.
  754. *
  755. * **Note:** If the second instance is started by a different user than the first,
  756. * the `argv` array will not include the arguments.
  757. *
  758. * This event is guaranteed to be emitted after the `ready` event of `app` gets
  759. * emitted.
  760. *
  761. * **Note:** Extra command line arguments might be added by Chromium, such as
  762. * `--original-process-start-time`.
  763. */
  764. on(event: 'second-instance', listener: (event: Event,
  765. /**
  766. * An array of the second instance's command line arguments
  767. */
  768. argv: string[],
  769. /**
  770. * The second instance's working directory
  771. */
  772. workingDirectory: string,
  773. /**
  774. * A JSON object of additional data passed from the second instance
  775. */
  776. additionalData: unknown) => void): this;
  777. off(event: 'second-instance', listener: (event: Event,
  778. /**
  779. * An array of the second instance's command line arguments
  780. */
  781. argv: string[],
  782. /**
  783. * The second instance's working directory
  784. */
  785. workingDirectory: string,
  786. /**
  787. * A JSON object of additional data passed from the second instance
  788. */
  789. additionalData: unknown) => void): this;
  790. once(event: 'second-instance', listener: (event: Event,
  791. /**
  792. * An array of the second instance's command line arguments
  793. */
  794. argv: string[],
  795. /**
  796. * The second instance's working directory
  797. */
  798. workingDirectory: string,
  799. /**
  800. * A JSON object of additional data passed from the second instance
  801. */
  802. additionalData: unknown) => void): this;
  803. addListener(event: 'second-instance', listener: (event: Event,
  804. /**
  805. * An array of the second instance's command line arguments
  806. */
  807. argv: string[],
  808. /**
  809. * The second instance's working directory
  810. */
  811. workingDirectory: string,
  812. /**
  813. * A JSON object of additional data passed from the second instance
  814. */
  815. additionalData: unknown) => void): this;
  816. removeListener(event: 'second-instance', listener: (event: Event,
  817. /**
  818. * An array of the second instance's command line arguments
  819. */
  820. argv: string[],
  821. /**
  822. * The second instance's working directory
  823. */
  824. workingDirectory: string,
  825. /**
  826. * A JSON object of additional data passed from the second instance
  827. */
  828. additionalData: unknown) => void): this;
  829. /**
  830. * Emitted when a client certificate is requested.
  831. *
  832. * The `url` corresponds to the navigation entry requesting the client certificate
  833. * and `callback` can be called with an entry filtered from the list. Using
  834. * `event.preventDefault()` prevents the application from using the first
  835. * certificate from the store.
  836. */
  837. on(event: 'select-client-certificate', listener: (event: Event,
  838. webContents: WebContents,
  839. url: string,
  840. certificateList: Certificate[],
  841. callback: (certificate?: Certificate) => void) => void): this;
  842. off(event: 'select-client-certificate', listener: (event: Event,
  843. webContents: WebContents,
  844. url: string,
  845. certificateList: Certificate[],
  846. callback: (certificate?: Certificate) => void) => void): this;
  847. once(event: 'select-client-certificate', listener: (event: Event,
  848. webContents: WebContents,
  849. url: string,
  850. certificateList: Certificate[],
  851. callback: (certificate?: Certificate) => void) => void): this;
  852. addListener(event: 'select-client-certificate', listener: (event: Event,
  853. webContents: WebContents,
  854. url: string,
  855. certificateList: Certificate[],
  856. callback: (certificate?: Certificate) => void) => void): this;
  857. removeListener(event: 'select-client-certificate', listener: (event: Event,
  858. webContents: WebContents,
  859. url: string,
  860. certificateList: Certificate[],
  861. callback: (certificate?: Certificate) => void) => void): this;
  862. /**
  863. * Emitted when Electron has created a new `session`.
  864. */
  865. on(event: 'session-created', listener: (session: Session) => void): this;
  866. off(event: 'session-created', listener: (session: Session) => void): this;
  867. once(event: 'session-created', listener: (session: Session) => void): this;
  868. addListener(event: 'session-created', listener: (session: Session) => void): this;
  869. removeListener(event: 'session-created', listener: (session: Session) => void): this;
  870. /**
  871. * Emitted when Handoff is about to be resumed on another device. If you need to
  872. * update the state to be transferred, you should call `event.preventDefault()`
  873. * immediately, construct a new `userInfo` dictionary and call
  874. * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
  875. * fail and `continue-activity-error` will be called.
  876. *
  877. * @platform darwin
  878. */
  879. on(event: 'update-activity-state', listener: (event: Event,
  880. /**
  881. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  882. */
  883. type: string,
  884. /**
  885. * Contains app-specific state stored by the activity.
  886. */
  887. userInfo: unknown) => void): this;
  888. /**
  889. * @platform darwin
  890. */
  891. off(event: 'update-activity-state', listener: (event: Event,
  892. /**
  893. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  894. */
  895. type: string,
  896. /**
  897. * Contains app-specific state stored by the activity.
  898. */
  899. userInfo: unknown) => void): this;
  900. /**
  901. * @platform darwin
  902. */
  903. once(event: 'update-activity-state', listener: (event: Event,
  904. /**
  905. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  906. */
  907. type: string,
  908. /**
  909. * Contains app-specific state stored by the activity.
  910. */
  911. userInfo: unknown) => void): this;
  912. /**
  913. * @platform darwin
  914. */
  915. addListener(event: 'update-activity-state', listener: (event: Event,
  916. /**
  917. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  918. */
  919. type: string,
  920. /**
  921. * Contains app-specific state stored by the activity.
  922. */
  923. userInfo: unknown) => void): this;
  924. /**
  925. * @platform darwin
  926. */
  927. removeListener(event: 'update-activity-state', listener: (event: Event,
  928. /**
  929. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  930. */
  931. type: string,
  932. /**
  933. * Contains app-specific state stored by the activity.
  934. */
  935. userInfo: unknown) => void): this;
  936. /**
  937. * Emitted when a new webContents is created.
  938. */
  939. on(event: 'web-contents-created', listener: (event: Event,
  940. webContents: WebContents) => void): this;
  941. off(event: 'web-contents-created', listener: (event: Event,
  942. webContents: WebContents) => void): this;
  943. once(event: 'web-contents-created', listener: (event: Event,
  944. webContents: WebContents) => void): this;
  945. addListener(event: 'web-contents-created', listener: (event: Event,
  946. webContents: WebContents) => void): this;
  947. removeListener(event: 'web-contents-created', listener: (event: Event,
  948. webContents: WebContents) => void): this;
  949. /**
  950. * Emitted during Handoff before an activity from a different device wants to be
  951. * resumed. You should call `event.preventDefault()` if you want to handle this
  952. * event.
  953. *
  954. * @platform darwin
  955. */
  956. on(event: 'will-continue-activity', listener: (event: Event,
  957. /**
  958. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  959. */
  960. type: string) => void): this;
  961. /**
  962. * @platform darwin
  963. */
  964. off(event: 'will-continue-activity', listener: (event: Event,
  965. /**
  966. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  967. */
  968. type: string) => void): this;
  969. /**
  970. * @platform darwin
  971. */
  972. once(event: 'will-continue-activity', listener: (event: Event,
  973. /**
  974. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  975. */
  976. type: string) => void): this;
  977. /**
  978. * @platform darwin
  979. */
  980. addListener(event: 'will-continue-activity', listener: (event: Event,
  981. /**
  982. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  983. */
  984. type: string) => void): this;
  985. /**
  986. * @platform darwin
  987. */
  988. removeListener(event: 'will-continue-activity', listener: (event: Event,
  989. /**
  990. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  991. */
  992. type: string) => void): this;
  993. /**
  994. * Emitted when the application has finished basic startup. On Windows and Linux,
  995. * the `will-finish-launching` event is the same as the `ready` event; on macOS,
  996. * this event represents the `applicationWillFinishLaunching` notification of
  997. * `NSApplication`.
  998. *
  999. * In most cases, you should do everything in the `ready` event handler.
  1000. */
  1001. on(event: 'will-finish-launching', listener: Function): this;
  1002. off(event: 'will-finish-launching', listener: Function): this;
  1003. once(event: 'will-finish-launching', listener: Function): this;
  1004. addListener(event: 'will-finish-launching', listener: Function): this;
  1005. removeListener(event: 'will-finish-launching', listener: Function): this;
  1006. /**
  1007. * Emitted when all windows have been closed and the application will quit. Calling
  1008. * `event.preventDefault()` will prevent the default behavior, which is terminating
  1009. * the application.
  1010. *
  1011. * See the description of the `window-all-closed` event for the differences between
  1012. * the `will-quit` and `window-all-closed` events.
  1013. *
  1014. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  1015. * a shutdown/restart of the system or a user logout.
  1016. */
  1017. on(event: 'will-quit', listener: (event: Event) => void): this;
  1018. off(event: 'will-quit', listener: (event: Event) => void): this;
  1019. once(event: 'will-quit', listener: (event: Event) => void): this;
  1020. addListener(event: 'will-quit', listener: (event: Event) => void): this;
  1021. removeListener(event: 'will-quit', listener: (event: Event) => void): this;
  1022. /**
  1023. * Emitted when all windows have been closed.
  1024. *
  1025. * If you do not subscribe to this event and all windows are closed, the default
  1026. * behavior is to quit the app; however, if you subscribe, you control whether the
  1027. * app quits or not. If the user pressed `Cmd + Q`, or the developer called
  1028. * `app.quit()`, Electron will first try to close all the windows and then emit the
  1029. * `will-quit` event, and in this case the `window-all-closed` event would not be
  1030. * emitted.
  1031. */
  1032. on(event: 'window-all-closed', listener: Function): this;
  1033. off(event: 'window-all-closed', listener: Function): this;
  1034. once(event: 'window-all-closed', listener: Function): this;
  1035. addListener(event: 'window-all-closed', listener: Function): this;
  1036. removeListener(event: 'window-all-closed', listener: Function): this;
  1037. /**
  1038. * Adds `path` to the recent documents list.
  1039. *
  1040. * This list is managed by the OS. On Windows, you can visit the list from the task
  1041. * bar, and on macOS, you can visit it from dock menu.
  1042. *
  1043. * @platform darwin,win32
  1044. */
  1045. addRecentDocument(path: string): void;
  1046. /**
  1047. * Clears the recent documents list.
  1048. *
  1049. * @platform darwin,win32
  1050. */
  1051. clearRecentDocuments(): void;
  1052. /**
  1053. * Configures host resolution (DNS and DNS-over-HTTPS). By default, the following
  1054. * resolvers will be used, in order:
  1055. *
  1056. * * DNS-over-HTTPS, if the DNS provider supports it, then
  1057. * * the built-in resolver (enabled on macOS only by default), then
  1058. * * the system's resolver (e.g. `getaddrinfo`).
  1059. *
  1060. * This can be configured to either restrict usage of non-encrypted DNS
  1061. * (`secureDnsMode: "secure"`), or disable DNS-over-HTTPS (`secureDnsMode: "off"`).
  1062. * It is also possible to enable or disable the built-in resolver.
  1063. *
  1064. * To disable insecure DNS, you can specify a `secureDnsMode` of `"secure"`. If you
  1065. * do so, you should make sure to provide a list of DNS-over-HTTPS servers to use,
  1066. * in case the user's DNS configuration does not include a provider that supports
  1067. * DoH.
  1068. *
  1069. * This API must be called after the `ready` event is emitted.
  1070. */
  1071. configureHostResolver(options: ConfigureHostResolverOptions): void;
  1072. /**
  1073. * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
  1074. * basis if the GPU processes crashes too frequently. This function disables that
  1075. * behavior.
  1076. *
  1077. * This method can only be called before app is ready.
  1078. */
  1079. disableDomainBlockingFor3DAPIs(): void;
  1080. /**
  1081. * Disables hardware acceleration for current app.
  1082. *
  1083. * This method can only be called before app is ready.
  1084. */
  1085. disableHardwareAcceleration(): void;
  1086. /**
  1087. * Enables full sandbox mode on the app. This means that all renderers will be
  1088. * launched sandboxed, regardless of the value of the `sandbox` flag in
  1089. * `WebPreferences`.
  1090. *
  1091. * This method can only be called before app is ready.
  1092. */
  1093. enableSandbox(): void;
  1094. /**
  1095. * Exits immediately with `exitCode`. `exitCode` defaults to 0.
  1096. *
  1097. * All windows will be closed immediately without asking the user, and the
  1098. * `before-quit` and `will-quit` events will not be emitted.
  1099. */
  1100. exit(exitCode?: number): void;
  1101. /**
  1102. * On Linux, focuses on the first visible window. On macOS, makes the application
  1103. * the active app. On Windows, focuses on the application's first window.
  1104. *
  1105. * You should seek to use the `steal` option as sparingly as possible.
  1106. */
  1107. focus(options?: FocusOptions): void;
  1108. /**
  1109. * Resolve with an object containing the following:
  1110. *
  1111. * * `icon` NativeImage - the display icon of the app handling the protocol.
  1112. * * `path` string - installation path of the app handling the protocol.
  1113. * * `name` string - display name of the app handling the protocol.
  1114. *
  1115. * This method returns a promise that contains the application name, icon and path
  1116. * of the default handler for the protocol (aka URI scheme) of a URL.
  1117. *
  1118. * @platform darwin,win32
  1119. */
  1120. getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
  1121. /**
  1122. * Name of the application handling the protocol, or an empty string if there is no
  1123. * handler. For instance, if Electron is the default handler of the URL, this could
  1124. * be `Electron` on Windows and Mac. However, don't rely on the precise format
  1125. * which is not guaranteed to remain unchanged. Expect a different format on Linux,
  1126. * possibly with a `.desktop` suffix.
  1127. *
  1128. * This method returns the application name of the default handler for the protocol
  1129. * (aka URI scheme) of a URL.
  1130. */
  1131. getApplicationNameForProtocol(url: string): string;
  1132. /**
  1133. * Array of `ProcessMetric` objects that correspond to memory and CPU usage
  1134. * statistics of all the processes associated with the app.
  1135. */
  1136. getAppMetrics(): ProcessMetric[];
  1137. /**
  1138. * The current application directory.
  1139. */
  1140. getAppPath(): string;
  1141. /**
  1142. * The current value displayed in the counter badge.
  1143. *
  1144. * @platform linux,darwin
  1145. */
  1146. getBadgeCount(): number;
  1147. /**
  1148. * The type of the currently running activity.
  1149. *
  1150. * @platform darwin
  1151. */
  1152. getCurrentActivityType(): string;
  1153. /**
  1154. * fulfilled with the app's icon, which is a NativeImage.
  1155. *
  1156. * Fetches a path's associated icon.
  1157. *
  1158. * On _Windows_, there a 2 kinds of icons:
  1159. *
  1160. * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
  1161. * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
  1162. *
  1163. * On _Linux_ and _macOS_, icons depend on the application associated with file
  1164. * mime type.
  1165. */
  1166. getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
  1167. /**
  1168. * The Graphics Feature Status from `chrome://gpu/`.
  1169. *
  1170. * **Note:** This information is only usable after the `gpu-info-update` event is
  1171. * emitted.
  1172. */
  1173. getGPUFeatureStatus(): GPUFeatureStatus;
  1174. /**
  1175. * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
  1176. * containing all the GPU Information as in chromium's GPUInfo object. This
  1177. * includes the version and driver information that's shown on `chrome://gpu` page.
  1178. *
  1179. * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
  1180. * fewer attributes than when requested with `complete`. Here's an example of basic
  1181. * response:
  1182. *
  1183. * Using `basic` should be preferred if only basic information like `vendorId` or
  1184. * `deviceId` is needed.
  1185. */
  1186. getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
  1187. /**
  1188. * * `minItems` Integer - The minimum number of items that will be shown in the
  1189. * Jump List (for a more detailed description of this value see the MSDN docs).
  1190. * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
  1191. * correspond to items that the user has explicitly removed from custom categories
  1192. * in the Jump List. These items must not be re-added to the Jump List in the
  1193. * **next** call to `app.setJumpList()`, Windows will not display any custom
  1194. * category that contains any of the removed items.
  1195. *
  1196. * @platform win32
  1197. */
  1198. getJumpListSettings(): JumpListSettings;
  1199. /**
  1200. * The current application locale, fetched using Chromium's `l10n_util` library.
  1201. * Possible return values are documented here.
  1202. *
  1203. * To set the locale, you'll want to use a command line switch at app startup,
  1204. * which may be found here.
  1205. *
  1206. * **Note:** When distributing your packaged app, you have to also ship the
  1207. * `locales` folder.
  1208. *
  1209. * **Note:** This API must be called after the `ready` event is emitted.
  1210. *
  1211. * **Note:** To see example return values of this API compared to other locale and
  1212. * language APIs, see `app.getPreferredSystemLanguages()`.
  1213. */
  1214. getLocale(): string;
  1215. /**
  1216. * User operating system's locale two-letter ISO 3166 country code. The value is
  1217. * taken from native OS APIs.
  1218. *
  1219. * **Note:** When unable to detect locale country code, it returns empty string.
  1220. */
  1221. getLocaleCountryCode(): string;
  1222. /**
  1223. * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
  1224. * you need to pass the same arguments here for `openAtLogin` to be set correctly.
  1225. *
  1226. *
  1227. * * `openAtLogin` boolean - `true` if the app is set to open at login.
  1228. * * `openAsHidden` boolean _macOS_ - `true` if the app is set to open as hidden at
  1229. * login. This setting is not available on MAS builds.
  1230. * * `wasOpenedAtLogin` boolean _macOS_ - `true` if the app was opened at login
  1231. * automatically. This setting is not available on MAS builds.
  1232. * * `wasOpenedAsHidden` boolean _macOS_ - `true` if the app was opened as a hidden
  1233. * login item. This indicates that the app should not open any windows at startup.
  1234. * This setting is not available on MAS builds.
  1235. * * `restoreState` boolean _macOS_ - `true` if the app was opened as a login item
  1236. * that should restore the state from the previous session. This indicates that the
  1237. * app should restore the windows that were open the last time the app was closed.
  1238. * This setting is not available on MAS builds.
  1239. * * `executableWillLaunchAtLogin` boolean _Windows_ - `true` if app is set to open
  1240. * at login and its run key is not deactivated. This differs from `openAtLogin` as
  1241. * it ignores the `args` option, this property will be true if the given executable
  1242. * would be launched at login with **any** arguments.
  1243. * * `launchItems` Object[] _Windows_
  1244. * * `name` string _Windows_ - name value of a registry entry.
  1245. * * `path` string _Windows_ - The executable to an app that corresponds to a
  1246. * registry entry.
  1247. * * `args` string[] _Windows_ - the command-line arguments to pass to the
  1248. * executable.
  1249. * * `scope` string _Windows_ - one of `user` or `machine`. Indicates whether the
  1250. * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  1251. * * `enabled` boolean _Windows_ - `true` if the app registry key is startup
  1252. * approved and therefore shows as `enabled` in Task Manager and Windows settings.
  1253. *
  1254. * @platform darwin,win32
  1255. */
  1256. getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
  1257. /**
  1258. * The current application's name, which is the name in the application's
  1259. * `package.json` file.
  1260. *
  1261. * Usually the `name` field of `package.json` is a short lowercase name, according
  1262. * to the npm modules spec. You should usually also specify a `productName` field,
  1263. * which is your application's full capitalized name, and which will be preferred
  1264. * over `name` by Electron.
  1265. */
  1266. getName(): string;
  1267. /**
  1268. * A path to a special directory or file associated with `name`. On failure, an
  1269. * `Error` is thrown.
  1270. *
  1271. * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
  1272. * called first, a default log directory will be created equivalent to calling
  1273. * `app.setAppLogsPath()` without a `path` parameter.
  1274. */
  1275. getPath(name: 'home' | 'appData' | 'userData' | 'sessionData' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps'): string;
  1276. /**
  1277. * The user's preferred system languages from most preferred to least preferred,
  1278. * including the country codes if applicable. A user can modify and add to this
  1279. * list on Windows or macOS through the Language and Region settings.
  1280. *
  1281. * The API uses `GlobalizationPreferences` (with a fallback to
  1282. * `GetSystemPreferredUILanguages`) on Windows, `\[NSLocale preferredLanguages\]`
  1283. * on macOS, and `g_get_language_names` on Linux.
  1284. *
  1285. * This API can be used for purposes such as deciding what language to present the
  1286. * application in.
  1287. *
  1288. * Here are some examples of return values of the various language and locale APIs
  1289. * with different configurations:
  1290. *
  1291. * On Windows, given application locale is German, the regional format is Finnish
  1292. * (Finland), and the preferred system languages from most to least preferred are
  1293. * French (Canada), English (US), Simplified Chinese (China), Finnish, and Spanish
  1294. * (Latin America):
  1295. *
  1296. * On macOS, given the application locale is German, the region is Finland, and the
  1297. * preferred system languages from most to least preferred are French (Canada),
  1298. * English (US), Simplified Chinese, and Spanish (Latin America):
  1299. *
  1300. * Both the available languages and regions and the possible return values differ
  1301. * between the two operating systems.
  1302. *
  1303. * As can be seen with the example above, on Windows, it is possible that a
  1304. * preferred system language has no country code, and that one of the preferred
  1305. * system languages corresponds with the language used for the regional format. On
  1306. * macOS, the region serves more as a default country code: the user doesn't need
  1307. * to have Finnish as a preferred language to use Finland as the region,and the
  1308. * country code `FI` is used as the country code for preferred system languages
  1309. * that do not have associated countries in the language name.
  1310. */
  1311. getPreferredSystemLanguages(): string[];
  1312. /**
  1313. * The current system locale. On Windows and Linux, it is fetched using Chromium's
  1314. * `i18n` library. On macOS, `[NSLocale currentLocale]` is used instead. To get the
  1315. * user's current system language, which is not always the same as the locale, it
  1316. * is better to use `app.getPreferredSystemLanguages()`.
  1317. *
  1318. * Different operating systems also use the regional data differently:
  1319. *
  1320. * * Windows 11 uses the regional format for numbers, dates, and times.
  1321. * * macOS Monterey uses the region for formatting numbers, dates, times, and for
  1322. * selecting the currency symbol to use.
  1323. *
  1324. * Therefore, this API can be used for purposes such as choosing a format for
  1325. * rendering dates and times in a calendar app, especially when the developer wants
  1326. * the format to be consistent with the OS.
  1327. *
  1328. * **Note:** This API must be called after the `ready` event is emitted.
  1329. *
  1330. * **Note:** To see example return values of this API compared to other locale and
  1331. * language APIs, see `app.getPreferredSystemLanguages()`.
  1332. */
  1333. getSystemLocale(): string;
  1334. /**
  1335. * The version of the loaded application. If no version is found in the
  1336. * application's `package.json` file, the version of the current bundle or
  1337. * executable is returned.
  1338. */
  1339. getVersion(): string;
  1340. /**
  1341. * This method returns whether or not this instance of your app is currently
  1342. * holding the single instance lock. You can request the lock with
  1343. * `app.requestSingleInstanceLock()` and release with
  1344. * `app.releaseSingleInstanceLock()`
  1345. */
  1346. hasSingleInstanceLock(): boolean;
  1347. /**
  1348. * Hides all application windows without minimizing them.
  1349. *
  1350. * @platform darwin
  1351. */
  1352. hide(): void;
  1353. /**
  1354. * Imports the certificate in pkcs12 format into the platform certificate store.
  1355. * `callback` is called with the `result` of import operation, a value of `0`
  1356. * indicates success while any other value indicates failure according to Chromium
  1357. * net_error_list.
  1358. *
  1359. * @platform linux
  1360. */
  1361. importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
  1362. /**
  1363. * Invalidates the current Handoff user activity.
  1364. *
  1365. * @platform darwin
  1366. */
  1367. invalidateCurrentActivity(): void;
  1368. /**
  1369. * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
  1370. * will return `true` if the use of assistive technologies, such as screen readers,
  1371. * has been detected. See
  1372. * https://www.chromium.org/developers/design-documents/accessibility for more
  1373. * details.
  1374. *
  1375. * @platform darwin,win32
  1376. */
  1377. isAccessibilitySupportEnabled(): boolean;
  1378. /**
  1379. * Whether the current executable is the default handler for a protocol (aka URI
  1380. * scheme).
  1381. *
  1382. * **Note:** On macOS, you can use this method to check if the app has been
  1383. * registered as the default protocol handler for a protocol. You can also verify
  1384. * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
  1385. * macOS machine. Please refer to Apple's documentation for details.
  1386. *
  1387. * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
  1388. * internally.
  1389. */
  1390. isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1391. /**
  1392. * whether or not the current OS version allows for native emoji pickers.
  1393. */
  1394. isEmojiPanelSupported(): boolean;
  1395. /**
  1396. * `true` if the application—including all of its windows—is hidden (e.g. with
  1397. * `Command-H`), `false` otherwise.
  1398. *
  1399. * @platform darwin
  1400. */
  1401. isHidden(): boolean;
  1402. /**
  1403. * Whether the application is currently running from the systems Application
  1404. * folder. Use in combination with `app.moveToApplicationsFolder()`
  1405. *
  1406. * @platform darwin
  1407. */
  1408. isInApplicationsFolder(): boolean;
  1409. /**
  1410. * `true` if Electron has finished initializing, `false` otherwise. See also
  1411. * `app.whenReady()`.
  1412. */
  1413. isReady(): boolean;
  1414. /**
  1415. * whether `Secure Keyboard Entry` is enabled.
  1416. *
  1417. * By default this API will return `false`.
  1418. *
  1419. * @platform darwin
  1420. */
  1421. isSecureKeyboardEntryEnabled(): boolean;
  1422. /**
  1423. * Whether the current desktop environment is Unity launcher.
  1424. *
  1425. * @platform linux
  1426. */
  1427. isUnityRunning(): boolean;
  1428. /**
  1429. * Whether the move was successful. Please note that if the move is successful,
  1430. * your application will quit and relaunch.
  1431. *
  1432. * No confirmation dialog will be presented by default. If you wish to allow the
  1433. * user to confirm the operation, you may do so using the `dialog` API.
  1434. *
  1435. * **NOTE:** This method throws errors if anything other than the user causes the
  1436. * move to fail. For instance if the user cancels the authorization dialog, this
  1437. * method returns false. If we fail to perform the copy, then this method will
  1438. * throw an error. The message in the error should be informative and tell you
  1439. * exactly what went wrong.
  1440. *
  1441. * By default, if an app of the same name as the one being moved exists in the
  1442. * Applications directory and is _not_ running, the existing app will be trashed
  1443. * and the active app moved into its place. If it _is_ running, the preexisting
  1444. * running app will assume focus and the previously active app will quit itself.
  1445. * This behavior can be changed by providing the optional conflict handler, where
  1446. * the boolean returned by the handler determines whether or not the move conflict
  1447. * is resolved with default behavior. i.e. returning `false` will ensure no
  1448. * further action is taken, returning `true` will result in the default behavior
  1449. * and the method continuing.
  1450. *
  1451. * For example:
  1452. *
  1453. * Would mean that if an app already exists in the user directory, if the user
  1454. * chooses to 'Continue Move' then the function would continue with its default
  1455. * behavior and the existing app will be trashed and the active app moved into its
  1456. * place.
  1457. *
  1458. * @platform darwin
  1459. */
  1460. moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
  1461. /**
  1462. * Try to close all windows. The `before-quit` event will be emitted first. If all
  1463. * windows are successfully closed, the `will-quit` event will be emitted and by
  1464. * default the application will terminate.
  1465. *
  1466. * This method guarantees that all `beforeunload` and `unload` event handlers are
  1467. * correctly executed. It is possible that a window cancels the quitting by
  1468. * returning `false` in the `beforeunload` event handler.
  1469. */
  1470. quit(): void;
  1471. /**
  1472. * Relaunches the app when current instance exits.
  1473. *
  1474. * By default, the new instance will use the same working directory and command
  1475. * line arguments with current instance. When `args` is specified, the `args` will
  1476. * be passed as command line arguments instead. When `execPath` is specified, the
  1477. * `execPath` will be executed for relaunch instead of current app.
  1478. *
  1479. * Note that this method does not quit the app when executed, you have to call
  1480. * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
  1481. *
  1482. * When `app.relaunch` is called for multiple times, multiple instances will be
  1483. * started after current instance exited.
  1484. *
  1485. * An example of restarting current instance immediately and adding a new command
  1486. * line argument to the new instance:
  1487. */
  1488. relaunch(options?: RelaunchOptions): void;
  1489. /**
  1490. * Releases all locks that were created by `requestSingleInstanceLock`. This will
  1491. * allow multiple instances of the application to once again run side by side.
  1492. */
  1493. releaseSingleInstanceLock(): void;
  1494. /**
  1495. * Whether the call succeeded.
  1496. *
  1497. * This method checks if the current executable as the default handler for a
  1498. * protocol (aka URI scheme). If so, it will remove the app as the default handler.
  1499. *
  1500. * @platform darwin,win32
  1501. */
  1502. removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1503. /**
  1504. * The return value of this method indicates whether or not this instance of your
  1505. * application successfully obtained the lock. If it failed to obtain the lock,
  1506. * you can assume that another instance of your application is already running with
  1507. * the lock and exit immediately.
  1508. *
  1509. * I.e. This method returns `true` if your process is the primary instance of your
  1510. * application and your app should continue loading. It returns `false` if your
  1511. * process should immediately quit as it has sent its parameters to another
  1512. * instance that has already acquired the lock.
  1513. *
  1514. * On macOS, the system enforces single instance automatically when users try to
  1515. * open a second instance of your app in Finder, and the `open-file` and `open-url`
  1516. * events will be emitted for that. However when users start your app in command
  1517. * line, the system's single instance mechanism will be bypassed, and you have to
  1518. * use this method to ensure single instance.
  1519. *
  1520. * An example of activating the window of primary instance when a second instance
  1521. * starts:
  1522. */
  1523. requestSingleInstanceLock(additionalData?: Record<any, any>): boolean;
  1524. /**
  1525. * Marks the current Handoff user activity as inactive without invalidating it.
  1526. *
  1527. * @platform darwin
  1528. */
  1529. resignCurrentActivity(): void;
  1530. /**
  1531. * Resolves with the proxy information for `url` that will be used when attempting
  1532. * to make requests using Net in the utility process.
  1533. */
  1534. resolveProxy(url: string): Promise<string>;
  1535. /**
  1536. * Set the about panel options. This will override the values defined in the app's
  1537. * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
  1538. * must be set in order to be shown; there are no defaults.
  1539. *
  1540. * If you do not set `credits` but still wish to surface them in your app, AppKit
  1541. * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
  1542. * that order, in the bundle returned by the NSBundle class method main. The first
  1543. * file found is used, and if none is found, the info area is left blank. See Apple
  1544. * documentation for more information.
  1545. */
  1546. setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
  1547. /**
  1548. * Manually enables Chrome's accessibility support, allowing to expose
  1549. * accessibility switch to users in application settings. See Chromium's
  1550. * accessibility docs for more details. Disabled by default.
  1551. *
  1552. * This API must be called after the `ready` event is emitted.
  1553. *
  1554. * **Note:** Rendering accessibility tree can significantly affect the performance
  1555. * of your app. It should not be enabled by default.
  1556. *
  1557. * @platform darwin,win32
  1558. */
  1559. setAccessibilitySupportEnabled(enabled: boolean): void;
  1560. /**
  1561. * Sets the activation policy for a given app.
  1562. *
  1563. * Activation policy types:
  1564. *
  1565. * * 'regular' - The application is an ordinary app that appears in the Dock and
  1566. * may have a user interface.
  1567. * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
  1568. * menu bar, but it may be activated programmatically or by clicking on one of its
  1569. * windows.
  1570. * * 'prohibited' - The application doesn’t appear in the Dock and may not create
  1571. * windows or be activated.
  1572. *
  1573. * @platform darwin
  1574. */
  1575. setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
  1576. /**
  1577. * Sets or creates a directory your app's logs which can then be manipulated with
  1578. * `app.getPath()` or `app.setPath(pathName, newPath)`.
  1579. *
  1580. * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
  1581. * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
  1582. * `userData` directory on _Linux_ and _Windows_.
  1583. */
  1584. setAppLogsPath(path?: string): void;
  1585. /**
  1586. * Changes the Application User Model ID to `id`.
  1587. *
  1588. * @platform win32
  1589. */
  1590. setAppUserModelId(id: string): void;
  1591. /**
  1592. * Whether the call succeeded.
  1593. *
  1594. * Sets the current executable as the default handler for a protocol (aka URI
  1595. * scheme). It allows you to integrate your app deeper into the operating system.
  1596. * Once registered, all links with `your-protocol://` will be opened with the
  1597. * current executable. The whole link, including protocol, will be passed to your
  1598. * application as a parameter.
  1599. *
  1600. * **Note:** On macOS, you can only register protocols that have been added to your
  1601. * app's `info.plist`, which cannot be modified at runtime. However, you can change
  1602. * the file during build time via Electron Forge, Electron Packager, or by editing
  1603. * `info.plist` with a text editor. Please refer to Apple's documentation for
  1604. * details.
  1605. *
  1606. * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
  1607. * will return `true` for all calls but the registry key it sets won't be
  1608. * accessible by other applications. In order to register your Windows Store
  1609. * application as a default protocol handler you must declare the protocol in your
  1610. * manifest.
  1611. *
  1612. * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
  1613. * internally.
  1614. */
  1615. setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1616. /**
  1617. * Whether the call succeeded.
  1618. *
  1619. * Sets the counter badge for current app. Setting the count to `0` will hide the
  1620. * badge.
  1621. *
  1622. * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
  1623. *
  1624. * **Note:** Unity launcher requires a `.desktop` file to work. For more
  1625. * information, please read the Unity integration documentation.
  1626. *
  1627. * **Note:** On macOS, you need to ensure that your application has the permission
  1628. * to display notifications for this method to work.
  1629. *
  1630. * @platform linux,darwin
  1631. */
  1632. setBadgeCount(count?: number): boolean;
  1633. /**
  1634. * Sets or removes a custom Jump List for the application, and returns one of the
  1635. * following strings:
  1636. *
  1637. * * `ok` - Nothing went wrong.
  1638. * * `error` - One or more errors occurred, enable runtime logging to figure out
  1639. * the likely cause.
  1640. * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
  1641. * category in the Jump List. Separators are only allowed in the standard `Tasks`
  1642. * category.
  1643. * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
  1644. * Jump List for a file type the app isn't registered to handle.
  1645. * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
  1646. * Jump List due to user privacy or group policy settings.
  1647. *
  1648. * If `categories` is `null` the previously set custom Jump List (if any) will be
  1649. * replaced by the standard Jump List for the app (managed by Windows).
  1650. *
  1651. * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
  1652. * property set then its `type` is assumed to be `tasks`. If the `name` property is
  1653. * set but the `type` property is omitted then the `type` is assumed to be
  1654. * `custom`.
  1655. *
  1656. * **Note:** Users can remove items from custom categories, and Windows will not
  1657. * allow a removed item to be added back into a custom category until **after** the
  1658. * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
  1659. * removed item to a custom category earlier than that will result in the entire
  1660. * custom category being omitted from the Jump List. The list of removed items can
  1661. * be obtained using `app.getJumpListSettings()`.
  1662. *
  1663. * **Note:** The maximum length of a Jump List item's `description` property is 260
  1664. * characters. Beyond this limit, the item will not be added to the Jump List, nor
  1665. * will it be displayed.
  1666. *
  1667. * Here's a very simple example of creating a custom Jump List:
  1668. *
  1669. * @platform win32
  1670. */
  1671. setJumpList(categories: (JumpListCategory[]) | (null)): ('ok' | 'error' | 'invalidSeparatorError' | 'fileTypeRegistrationError' | 'customCategoryAccessDeniedError');
  1672. /**
  1673. * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
  1674. * want to set the launch path to Update.exe, and pass arguments that specify your
  1675. * application name. For example:
  1676. *
  1677. * @platform darwin,win32
  1678. */
  1679. setLoginItemSettings(settings: Settings): void;
  1680. /**
  1681. * Overrides the current application's name.
  1682. *
  1683. * **Note:** This function overrides the name used internally by Electron; it does
  1684. * not affect the name that the OS uses.
  1685. */
  1686. setName(name: string): void;
  1687. /**
  1688. * Overrides the `path` to a special directory or file associated with `name`. If
  1689. * the path specifies a directory that does not exist, an `Error` is thrown. In
  1690. * that case, the directory should be created with `fs.mkdirSync` or similar.
  1691. *
  1692. * You can only override paths of a `name` defined in `app.getPath`.
  1693. *
  1694. * By default, web pages' cookies and caches will be stored under the `sessionData`
  1695. * directory. If you want to change this location, you have to override the
  1696. * `sessionData` path before the `ready` event of the `app` module is emitted.
  1697. */
  1698. setPath(name: string, path: string): void;
  1699. setProxy(config: ProxyConfig): void;
  1700. /**
  1701. * Set the `Secure Keyboard Entry` is enabled in your application.
  1702. *
  1703. * By using this API, important information such as password and other sensitive
  1704. * information can be prevented from being intercepted by other processes.
  1705. *
  1706. * See Apple's documentation for more details.
  1707. *
  1708. * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
  1709. * when it is no longer needed.
  1710. *
  1711. * @platform darwin
  1712. */
  1713. setSecureKeyboardEntryEnabled(enabled: boolean): void;
  1714. /**
  1715. * Creates an `NSUserActivity` and sets it as the current activity. The activity is
  1716. * eligible for Handoff to another device afterward.
  1717. *
  1718. * @platform darwin
  1719. */
  1720. setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
  1721. /**
  1722. * Adds `tasks` to the Tasks category of the Jump List on Windows.
  1723. *
  1724. * `tasks` is an array of `Task` objects.
  1725. *
  1726. * Whether the call succeeded.
  1727. *
  1728. * **Note:** If you'd like to customize the Jump List even more use
  1729. * `app.setJumpList(categories)` instead.
  1730. *
  1731. * @platform win32
  1732. */
  1733. setUserTasks(tasks: Task[]): boolean;
  1734. /**
  1735. * Shows application windows after they were hidden. Does not automatically focus
  1736. * them.
  1737. *
  1738. * @platform darwin
  1739. */
  1740. show(): void;
  1741. /**
  1742. * Show the app's about panel options. These options can be overridden with
  1743. * `app.setAboutPanelOptions(options)`. This function runs asynchronously.
  1744. */
  1745. showAboutPanel(): void;
  1746. /**
  1747. * Show the platform's native emoji picker.
  1748. *
  1749. * @platform darwin,win32
  1750. */
  1751. showEmojiPanel(): void;
  1752. /**
  1753. * This function **must** be called once you have finished accessing the security
  1754. * scoped file. If you do not remember to stop accessing the bookmark, kernel
  1755. * resources will be leaked and your app will lose its ability to reach outside the
  1756. * sandbox completely, until your app is restarted.
  1757. *
  1758. * Start accessing a security scoped resource. With this method Electron
  1759. * applications that are packaged for the Mac App Store may reach outside their
  1760. * sandbox to access files chosen by the user. See Apple's documentation for a
  1761. * description of how this system works.
  1762. *
  1763. * @platform mas
  1764. */
  1765. startAccessingSecurityScopedResource(bookmarkData: string): Function;
  1766. /**
  1767. * Updates the current activity if its type matches `type`, merging the entries
  1768. * from `userInfo` into its current `userInfo` dictionary.
  1769. *
  1770. * @platform darwin
  1771. */
  1772. updateCurrentActivity(type: string, userInfo: any): void;
  1773. /**
  1774. * fulfilled when Electron is initialized. May be used as a convenient alternative
  1775. * to checking `app.isReady()` and subscribing to the `ready` event if the app is
  1776. * not ready yet.
  1777. */
  1778. whenReady(): Promise<void>;
  1779. /**
  1780. * A `boolean` property that's `true` if Chrome's accessibility support is enabled,
  1781. * `false` otherwise. This property will be `true` if the use of assistive
  1782. * technologies, such as screen readers, has been detected. Setting this property
  1783. * to `true` manually enables Chrome's accessibility support, allowing developers
  1784. * to expose accessibility switch to users in application settings.
  1785. *
  1786. * See Chromium's accessibility docs for more details. Disabled by default.
  1787. *
  1788. * This API must be called after the `ready` event is emitted.
  1789. *
  1790. * **Note:** Rendering accessibility tree can significantly affect the performance
  1791. * of your app. It should not be enabled by default.
  1792. *
  1793. * @platform darwin,win32
  1794. */
  1795. accessibilitySupportEnabled: boolean;
  1796. /**
  1797. * A `Menu | null` property that returns `Menu` if one has been set and `null`
  1798. * otherwise. Users can pass a Menu to set this property.
  1799. */
  1800. applicationMenu: (Menu) | (null);
  1801. /**
  1802. * An `Integer` property that returns the badge count for current app. Setting the
  1803. * count to `0` will hide the badge.
  1804. *
  1805. * On macOS, setting this with any nonzero integer shows on the dock icon. On
  1806. * Linux, this property only works for Unity launcher.
  1807. *
  1808. * **Note:** Unity launcher requires a `.desktop` file to work. For more
  1809. * information, please read the Unity integration documentation.
  1810. *
  1811. * **Note:** On macOS, you need to ensure that your application has the permission
  1812. * to display notifications for this property to take effect.
  1813. *
  1814. * @platform linux,darwin
  1815. */
  1816. badgeCount: number;
  1817. /**
  1818. * A `CommandLine` object that allows you to read and manipulate the command line
  1819. * arguments that Chromium uses.
  1820. *
  1821. */
  1822. readonly commandLine: CommandLine;
  1823. /**
  1824. * A `Dock` `| undefined` object that allows you to perform actions on your app
  1825. * icon in the user's dock on macOS.
  1826. *
  1827. * @platform darwin
  1828. */
  1829. readonly dock: Dock;
  1830. /**
  1831. * A `boolean` property that returns `true` if the app is packaged, `false`
  1832. * otherwise. For many apps, this property can be used to distinguish development
  1833. * and production environments.
  1834. *
  1835. */
  1836. readonly isPackaged: boolean;
  1837. /**
  1838. * A `string` property that indicates the current application's name, which is the
  1839. * name in the application's `package.json` file.
  1840. *
  1841. * Usually the `name` field of `package.json` is a short lowercase name, according
  1842. * to the npm modules spec. You should usually also specify a `productName` field,
  1843. * which is your application's full capitalized name, and which will be preferred
  1844. * over `name` by Electron.
  1845. */
  1846. name: string;
  1847. /**
  1848. * A `boolean` which when `true` indicates that the app is currently running under
  1849. * an ARM64 translator (like the macOS Rosetta Translator Environment or Windows
  1850. * WOW).
  1851. *
  1852. * You can use this property to prompt users to download the arm64 version of your
  1853. * application when they are mistakenly running the x64 version under Rosetta or
  1854. * WOW.
  1855. *
  1856. * @platform darwin,win32
  1857. */
  1858. readonly runningUnderARM64Translation: boolean;
  1859. /**
  1860. * A `string` which is the user agent string Electron will use as a global
  1861. * fallback.
  1862. *
  1863. * This is the user agent that will be used when no user agent is set at the
  1864. * `webContents` or `session` level. It is useful for ensuring that your entire
  1865. * app has the same user agent. Set to a custom value as early as possible in your
  1866. * app's initialization to ensure that your overridden value is used.
  1867. */
  1868. userAgentFallback: string;
  1869. }
  1870. interface AutoUpdater extends NodeJS.EventEmitter {
  1871. // Docs: https://electronjs.org/docs/api/auto-updater
  1872. /**
  1873. * This event is emitted after a user calls `quitAndInstall()`.
  1874. *
  1875. * When this API is called, the `before-quit` event is not emitted before all
  1876. * windows are closed. As a result you should listen to this event if you wish to
  1877. * perform actions before the windows are closed while a process is quitting, as
  1878. * well as listening to `before-quit`.
  1879. */
  1880. on(event: 'before-quit-for-update', listener: Function): this;
  1881. off(event: 'before-quit-for-update', listener: Function): this;
  1882. once(event: 'before-quit-for-update', listener: Function): this;
  1883. addListener(event: 'before-quit-for-update', listener: Function): this;
  1884. removeListener(event: 'before-quit-for-update', listener: Function): this;
  1885. /**
  1886. * Emitted when checking if an update has started.
  1887. */
  1888. on(event: 'checking-for-update', listener: Function): this;
  1889. off(event: 'checking-for-update', listener: Function): this;
  1890. once(event: 'checking-for-update', listener: Function): this;
  1891. addListener(event: 'checking-for-update', listener: Function): this;
  1892. removeListener(event: 'checking-for-update', listener: Function): this;
  1893. /**
  1894. * Emitted when there is an error while updating.
  1895. */
  1896. on(event: 'error', listener: (error: Error) => void): this;
  1897. off(event: 'error', listener: (error: Error) => void): this;
  1898. once(event: 'error', listener: (error: Error) => void): this;
  1899. addListener(event: 'error', listener: (error: Error) => void): this;
  1900. removeListener(event: 'error', listener: (error: Error) => void): this;
  1901. /**
  1902. * Emitted when there is an available update. The update is downloaded
  1903. * automatically.
  1904. */
  1905. on(event: 'update-available', listener: Function): this;
  1906. off(event: 'update-available', listener: Function): this;
  1907. once(event: 'update-available', listener: Function): this;
  1908. addListener(event: 'update-available', listener: Function): this;
  1909. removeListener(event: 'update-available', listener: Function): this;
  1910. /**
  1911. * Emitted when an update has been downloaded.
  1912. *
  1913. * On Windows only `releaseName` is available.
  1914. *
  1915. * **Note:** It is not strictly necessary to handle this event. A successfully
  1916. * downloaded update will still be applied the next time the application starts.
  1917. */
  1918. on(event: 'update-downloaded', listener: (event: Event,
  1919. releaseNotes: string,
  1920. releaseName: string,
  1921. releaseDate: Date,
  1922. updateURL: string) => void): this;
  1923. off(event: 'update-downloaded', listener: (event: Event,
  1924. releaseNotes: string,
  1925. releaseName: string,
  1926. releaseDate: Date,
  1927. updateURL: string) => void): this;
  1928. once(event: 'update-downloaded', listener: (event: Event,
  1929. releaseNotes: string,
  1930. releaseName: string,
  1931. releaseDate: Date,
  1932. updateURL: string) => void): this;
  1933. addListener(event: 'update-downloaded', listener: (event: Event,
  1934. releaseNotes: string,
  1935. releaseName: string,
  1936. releaseDate: Date,
  1937. updateURL: string) => void): this;
  1938. removeListener(event: 'update-downloaded', listener: (event: Event,
  1939. releaseNotes: string,
  1940. releaseName: string,
  1941. releaseDate: Date,
  1942. updateURL: string) => void): this;
  1943. /**
  1944. * Emitted when there is no available update.
  1945. */
  1946. on(event: 'update-not-available', listener: Function): this;
  1947. off(event: 'update-not-available', listener: Function): this;
  1948. once(event: 'update-not-available', listener: Function): this;
  1949. addListener(event: 'update-not-available', listener: Function): this;
  1950. removeListener(event: 'update-not-available', listener: Function): this;
  1951. /**
  1952. * Asks the server whether there is an update. You must call `setFeedURL` before
  1953. * using this API.
  1954. *
  1955. * **Note:** If an update is available it will be downloaded automatically. Calling
  1956. * `autoUpdater.checkForUpdates()` twice will download the update two times.
  1957. */
  1958. checkForUpdates(): void;
  1959. /**
  1960. * The current update feed URL.
  1961. */
  1962. getFeedURL(): string;
  1963. /**
  1964. * Restarts the app and installs the update after it has been downloaded. It should
  1965. * only be called after `update-downloaded` has been emitted.
  1966. *
  1967. * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
  1968. * windows first, and automatically call `app.quit()` after all windows have been
  1969. * closed.
  1970. *
  1971. * **Note:** It is not strictly necessary to call this function to apply an update,
  1972. * as a successfully downloaded update will always be applied the next time the
  1973. * application starts.
  1974. */
  1975. quitAndInstall(): void;
  1976. /**
  1977. * Sets the `url` and initialize the auto updater.
  1978. */
  1979. setFeedURL(options: FeedURLOptions): void;
  1980. }
  1981. interface BluetoothDevice {
  1982. // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
  1983. deviceId: string;
  1984. deviceName: string;
  1985. }
  1986. class BrowserView {
  1987. // Docs: https://electronjs.org/docs/api/browser-view
  1988. /**
  1989. * BrowserView
  1990. */
  1991. constructor(options?: BrowserViewConstructorOptions);
  1992. /**
  1993. * The `bounds` of this BrowserView instance as `Object`.
  1994. *
  1995. * @experimental
  1996. */
  1997. getBounds(): Rectangle;
  1998. /**
  1999. * @experimental
  2000. */
  2001. setAutoResize(options: AutoResizeOptions): void;
  2002. /**
  2003. * Examples of valid `color` values:
  2004. *
  2005. * * Hex
  2006. * * #fff (RGB)
  2007. * * #ffff (ARGB)
  2008. * * #ffffff (RRGGBB)
  2009. * * #ffffffff (AARRGGBB)
  2010. * * RGB
  2011. * * rgb(([\d]+),\s*([\d]+),\s*([\d]+))
  2012. * * e.g. rgb(255, 255, 255)
  2013. * * RGBA
  2014. * * rgba(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+))
  2015. * * e.g. rgba(255, 255, 255, 1.0)
  2016. * * HSL
  2017. * * hsl((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%)
  2018. * * e.g. hsl(200, 20%, 50%)
  2019. * * HSLA
  2020. * * hsla((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+))
  2021. * * e.g. hsla(200, 20%, 50%, 0.5)
  2022. * * Color name
  2023. * * Options are listed in SkParseColor.cpp
  2024. * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
  2025. * * e.g. `blueviolet` or `red`
  2026. *
  2027. * **Note:** Hex format with alpha takes `AARRGGBB` or `ARGB`, _not_ `RRGGBBA` or
  2028. * `RGA`.
  2029. *
  2030. * @experimental
  2031. */
  2032. setBackgroundColor(color: string): void;
  2033. /**
  2034. * Resizes and moves the view to the supplied bounds relative to the window.
  2035. *
  2036. * @experimental
  2037. */
  2038. setBounds(bounds: Rectangle): void;
  2039. /**
  2040. * A `WebContents` object owned by this view.
  2041. *
  2042. * @experimental
  2043. */
  2044. webContents: WebContents;
  2045. }
  2046. class BrowserWindow extends NodeEventEmitter {
  2047. // Docs: https://electronjs.org/docs/api/browser-window
  2048. /**
  2049. * Emitted when the window is set or unset to show always on top of other windows.
  2050. */
  2051. on(event: 'always-on-top-changed', listener: (event: Event,
  2052. isAlwaysOnTop: boolean) => void): this;
  2053. off(event: 'always-on-top-changed', listener: (event: Event,
  2054. isAlwaysOnTop: boolean) => void): this;
  2055. once(event: 'always-on-top-changed', listener: (event: Event,
  2056. isAlwaysOnTop: boolean) => void): this;
  2057. addListener(event: 'always-on-top-changed', listener: (event: Event,
  2058. isAlwaysOnTop: boolean) => void): this;
  2059. removeListener(event: 'always-on-top-changed', listener: (event: Event,
  2060. isAlwaysOnTop: boolean) => void): this;
  2061. /**
  2062. * Emitted when an App Command is invoked. These are typically related to keyboard
  2063. * media keys or browser commands, as well as the "Back" button built into some
  2064. * mice on Windows.
  2065. *
  2066. * Commands are lowercased, underscores are replaced with hyphens, and the
  2067. * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
  2068. * emitted as `browser-backward`.
  2069. *
  2070. * The following app commands are explicitly supported on Linux:
  2071. *
  2072. * * `browser-backward`
  2073. * * `browser-forward`
  2074. *
  2075. * @platform win32,linux
  2076. */
  2077. on(event: 'app-command', listener: (event: Event,
  2078. command: string) => void): this;
  2079. /**
  2080. * @platform win32,linux
  2081. */
  2082. off(event: 'app-command', listener: (event: Event,
  2083. command: string) => void): this;
  2084. /**
  2085. * @platform win32,linux
  2086. */
  2087. once(event: 'app-command', listener: (event: Event,
  2088. command: string) => void): this;
  2089. /**
  2090. * @platform win32,linux
  2091. */
  2092. addListener(event: 'app-command', listener: (event: Event,
  2093. command: string) => void): this;
  2094. /**
  2095. * @platform win32,linux
  2096. */
  2097. removeListener(event: 'app-command', listener: (event: Event,
  2098. command: string) => void): this;
  2099. /**
  2100. * Emitted when the window loses focus.
  2101. */
  2102. on(event: 'blur', listener: Function): this;
  2103. off(event: 'blur', listener: Function): this;
  2104. once(event: 'blur', listener: Function): this;
  2105. addListener(event: 'blur', listener: Function): this;
  2106. removeListener(event: 'blur', listener: Function): this;
  2107. /**
  2108. * Emitted when the window is going to be closed. It's emitted before the
  2109. * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
  2110. * will cancel the close.
  2111. *
  2112. * Usually you would want to use the `beforeunload` handler to decide whether the
  2113. * window should be closed, which will also be called when the window is reloaded.
  2114. * In Electron, returning any value other than `undefined` would cancel the close.
  2115. * For example:
  2116. *
  2117. * _**Note**: There is a subtle difference between the behaviors of
  2118. * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
  2119. * handler)`. It is recommended to always set the `event.returnValue` explicitly,
  2120. * instead of only returning a value, as the former works more consistently within
  2121. * Electron._
  2122. */
  2123. on(event: 'close', listener: (event: Event) => void): this;
  2124. off(event: 'close', listener: (event: Event) => void): this;
  2125. once(event: 'close', listener: (event: Event) => void): this;
  2126. addListener(event: 'close', listener: (event: Event) => void): this;
  2127. removeListener(event: 'close', listener: (event: Event) => void): this;
  2128. /**
  2129. * Emitted when the window is closed. After you have received this event you should
  2130. * remove the reference to the window and avoid using it any more.
  2131. */
  2132. on(event: 'closed', listener: Function): this;
  2133. off(event: 'closed', listener: Function): this;
  2134. once(event: 'closed', listener: Function): this;
  2135. addListener(event: 'closed', listener: Function): this;
  2136. removeListener(event: 'closed', listener: Function): this;
  2137. /**
  2138. * Emitted when the window enters a full-screen state.
  2139. */
  2140. on(event: 'enter-full-screen', listener: Function): this;
  2141. off(event: 'enter-full-screen', listener: Function): this;
  2142. once(event: 'enter-full-screen', listener: Function): this;
  2143. addListener(event: 'enter-full-screen', listener: Function): this;
  2144. removeListener(event: 'enter-full-screen', listener: Function): this;
  2145. /**
  2146. * Emitted when the window enters a full-screen state triggered by HTML API.
  2147. */
  2148. on(event: 'enter-html-full-screen', listener: Function): this;
  2149. off(event: 'enter-html-full-screen', listener: Function): this;
  2150. once(event: 'enter-html-full-screen', listener: Function): this;
  2151. addListener(event: 'enter-html-full-screen', listener: Function): this;
  2152. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  2153. /**
  2154. * Emitted when the window gains focus.
  2155. */
  2156. on(event: 'focus', listener: Function): this;
  2157. off(event: 'focus', listener: Function): this;
  2158. once(event: 'focus', listener: Function): this;
  2159. addListener(event: 'focus', listener: Function): this;
  2160. removeListener(event: 'focus', listener: Function): this;
  2161. /**
  2162. * Emitted when the window is hidden.
  2163. */
  2164. on(event: 'hide', listener: Function): this;
  2165. off(event: 'hide', listener: Function): this;
  2166. once(event: 'hide', listener: Function): this;
  2167. addListener(event: 'hide', listener: Function): this;
  2168. removeListener(event: 'hide', listener: Function): this;
  2169. /**
  2170. * Emitted when the window leaves a full-screen state.
  2171. */
  2172. on(event: 'leave-full-screen', listener: Function): this;
  2173. off(event: 'leave-full-screen', listener: Function): this;
  2174. once(event: 'leave-full-screen', listener: Function): this;
  2175. addListener(event: 'leave-full-screen', listener: Function): this;
  2176. removeListener(event: 'leave-full-screen', listener: Function): this;
  2177. /**
  2178. * Emitted when the window leaves a full-screen state triggered by HTML API.
  2179. */
  2180. on(event: 'leave-html-full-screen', listener: Function): this;
  2181. off(event: 'leave-html-full-screen', listener: Function): this;
  2182. once(event: 'leave-html-full-screen', listener: Function): this;
  2183. addListener(event: 'leave-html-full-screen', listener: Function): this;
  2184. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  2185. /**
  2186. * Emitted when window is maximized.
  2187. */
  2188. on(event: 'maximize', listener: Function): this;
  2189. off(event: 'maximize', listener: Function): this;
  2190. once(event: 'maximize', listener: Function): this;
  2191. addListener(event: 'maximize', listener: Function): this;
  2192. removeListener(event: 'maximize', listener: Function): this;
  2193. /**
  2194. * Emitted when the window is minimized.
  2195. */
  2196. on(event: 'minimize', listener: Function): this;
  2197. off(event: 'minimize', listener: Function): this;
  2198. once(event: 'minimize', listener: Function): this;
  2199. addListener(event: 'minimize', listener: Function): this;
  2200. removeListener(event: 'minimize', listener: Function): this;
  2201. /**
  2202. * Emitted when the window is being moved to a new position.
  2203. */
  2204. on(event: 'move', listener: Function): this;
  2205. off(event: 'move', listener: Function): this;
  2206. once(event: 'move', listener: Function): this;
  2207. addListener(event: 'move', listener: Function): this;
  2208. removeListener(event: 'move', listener: Function): this;
  2209. /**
  2210. * Emitted once when the window is moved to a new position.
  2211. *
  2212. * **Note**: On macOS this event is an alias of `move`.
  2213. *
  2214. * @platform darwin,win32
  2215. */
  2216. on(event: 'moved', listener: Function): this;
  2217. /**
  2218. * @platform darwin,win32
  2219. */
  2220. off(event: 'moved', listener: Function): this;
  2221. /**
  2222. * @platform darwin,win32
  2223. */
  2224. once(event: 'moved', listener: Function): this;
  2225. /**
  2226. * @platform darwin,win32
  2227. */
  2228. addListener(event: 'moved', listener: Function): this;
  2229. /**
  2230. * @platform darwin,win32
  2231. */
  2232. removeListener(event: 'moved', listener: Function): this;
  2233. /**
  2234. * Emitted when the native new tab button is clicked.
  2235. *
  2236. * @platform darwin
  2237. */
  2238. on(event: 'new-window-for-tab', listener: Function): this;
  2239. /**
  2240. * @platform darwin
  2241. */
  2242. off(event: 'new-window-for-tab', listener: Function): this;
  2243. /**
  2244. * @platform darwin
  2245. */
  2246. once(event: 'new-window-for-tab', listener: Function): this;
  2247. /**
  2248. * @platform darwin
  2249. */
  2250. addListener(event: 'new-window-for-tab', listener: Function): this;
  2251. /**
  2252. * @platform darwin
  2253. */
  2254. removeListener(event: 'new-window-for-tab', listener: Function): this;
  2255. /**
  2256. * Emitted when the document changed its title, calling `event.preventDefault()`
  2257. * will prevent the native window's title from changing. `explicitSet` is false
  2258. * when title is synthesized from file URL.
  2259. */
  2260. on(event: 'page-title-updated', listener: (event: Event,
  2261. title: string,
  2262. explicitSet: boolean) => void): this;
  2263. off(event: 'page-title-updated', listener: (event: Event,
  2264. title: string,
  2265. explicitSet: boolean) => void): this;
  2266. once(event: 'page-title-updated', listener: (event: Event,
  2267. title: string,
  2268. explicitSet: boolean) => void): this;
  2269. addListener(event: 'page-title-updated', listener: (event: Event,
  2270. title: string,
  2271. explicitSet: boolean) => void): this;
  2272. removeListener(event: 'page-title-updated', listener: (event: Event,
  2273. title: string,
  2274. explicitSet: boolean) => void): this;
  2275. /**
  2276. * Emitted when the web page has been rendered (while not being shown) and window
  2277. * can be displayed without a visual flash.
  2278. *
  2279. * Please note that using this event implies that the renderer will be considered
  2280. * "visible" and paint even though `show` is false. This event will never fire if
  2281. * you use `paintWhenInitiallyHidden: false`
  2282. */
  2283. on(event: 'ready-to-show', listener: Function): this;
  2284. off(event: 'ready-to-show', listener: Function): this;
  2285. once(event: 'ready-to-show', listener: Function): this;
  2286. addListener(event: 'ready-to-show', listener: Function): this;
  2287. removeListener(event: 'ready-to-show', listener: Function): this;
  2288. /**
  2289. * Emitted after the window has been resized.
  2290. */
  2291. on(event: 'resize', listener: Function): this;
  2292. off(event: 'resize', listener: Function): this;
  2293. once(event: 'resize', listener: Function): this;
  2294. addListener(event: 'resize', listener: Function): this;
  2295. removeListener(event: 'resize', listener: Function): this;
  2296. /**
  2297. * Emitted once when the window has finished being resized.
  2298. *
  2299. * This is usually emitted when the window has been resized manually. On macOS,
  2300. * resizing the window with `setBounds`/`setSize` and setting the `animate`
  2301. * parameter to `true` will also emit this event once resizing has finished.
  2302. *
  2303. * @platform darwin,win32
  2304. */
  2305. on(event: 'resized', listener: Function): this;
  2306. /**
  2307. * @platform darwin,win32
  2308. */
  2309. off(event: 'resized', listener: Function): this;
  2310. /**
  2311. * @platform darwin,win32
  2312. */
  2313. once(event: 'resized', listener: Function): this;
  2314. /**
  2315. * @platform darwin,win32
  2316. */
  2317. addListener(event: 'resized', listener: Function): this;
  2318. /**
  2319. * @platform darwin,win32
  2320. */
  2321. removeListener(event: 'resized', listener: Function): this;
  2322. /**
  2323. * Emitted when the unresponsive web page becomes responsive again.
  2324. */
  2325. on(event: 'responsive', listener: Function): this;
  2326. off(event: 'responsive', listener: Function): this;
  2327. once(event: 'responsive', listener: Function): this;
  2328. addListener(event: 'responsive', listener: Function): this;
  2329. removeListener(event: 'responsive', listener: Function): this;
  2330. /**
  2331. * Emitted when the window is restored from a minimized state.
  2332. */
  2333. on(event: 'restore', listener: Function): this;
  2334. off(event: 'restore', listener: Function): this;
  2335. once(event: 'restore', listener: Function): this;
  2336. addListener(event: 'restore', listener: Function): this;
  2337. removeListener(event: 'restore', listener: Function): this;
  2338. /**
  2339. * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
  2340. * is ended. The `rotation` value on each emission is the angle in degrees rotated
  2341. * since the last emission. The last emitted event upon a rotation gesture will
  2342. * always be of value `0`. Counter-clockwise rotation values are positive, while
  2343. * clockwise ones are negative.
  2344. *
  2345. * @platform darwin
  2346. */
  2347. on(event: 'rotate-gesture', listener: (event: Event,
  2348. rotation: number) => void): this;
  2349. /**
  2350. * @platform darwin
  2351. */
  2352. off(event: 'rotate-gesture', listener: (event: Event,
  2353. rotation: number) => void): this;
  2354. /**
  2355. * @platform darwin
  2356. */
  2357. once(event: 'rotate-gesture', listener: (event: Event,
  2358. rotation: number) => void): this;
  2359. /**
  2360. * @platform darwin
  2361. */
  2362. addListener(event: 'rotate-gesture', listener: (event: Event,
  2363. rotation: number) => void): this;
  2364. /**
  2365. * @platform darwin
  2366. */
  2367. removeListener(event: 'rotate-gesture', listener: (event: Event,
  2368. rotation: number) => void): this;
  2369. /**
  2370. * Emitted when window session is going to end due to force shutdown or machine
  2371. * restart or session log off.
  2372. *
  2373. * @platform win32
  2374. */
  2375. on(event: 'session-end', listener: Function): this;
  2376. /**
  2377. * @platform win32
  2378. */
  2379. off(event: 'session-end', listener: Function): this;
  2380. /**
  2381. * @platform win32
  2382. */
  2383. once(event: 'session-end', listener: Function): this;
  2384. /**
  2385. * @platform win32
  2386. */
  2387. addListener(event: 'session-end', listener: Function): this;
  2388. /**
  2389. * @platform win32
  2390. */
  2391. removeListener(event: 'session-end', listener: Function): this;
  2392. /**
  2393. * Emitted when the window opens a sheet.
  2394. *
  2395. * @platform darwin
  2396. */
  2397. on(event: 'sheet-begin', listener: Function): this;
  2398. /**
  2399. * @platform darwin
  2400. */
  2401. off(event: 'sheet-begin', listener: Function): this;
  2402. /**
  2403. * @platform darwin
  2404. */
  2405. once(event: 'sheet-begin', listener: Function): this;
  2406. /**
  2407. * @platform darwin
  2408. */
  2409. addListener(event: 'sheet-begin', listener: Function): this;
  2410. /**
  2411. * @platform darwin
  2412. */
  2413. removeListener(event: 'sheet-begin', listener: Function): this;
  2414. /**
  2415. * Emitted when the window has closed a sheet.
  2416. *
  2417. * @platform darwin
  2418. */
  2419. on(event: 'sheet-end', listener: Function): this;
  2420. /**
  2421. * @platform darwin
  2422. */
  2423. off(event: 'sheet-end', listener: Function): this;
  2424. /**
  2425. * @platform darwin
  2426. */
  2427. once(event: 'sheet-end', listener: Function): this;
  2428. /**
  2429. * @platform darwin
  2430. */
  2431. addListener(event: 'sheet-end', listener: Function): this;
  2432. /**
  2433. * @platform darwin
  2434. */
  2435. removeListener(event: 'sheet-end', listener: Function): this;
  2436. /**
  2437. * Emitted when the window is shown.
  2438. */
  2439. on(event: 'show', listener: Function): this;
  2440. off(event: 'show', listener: Function): this;
  2441. once(event: 'show', listener: Function): this;
  2442. addListener(event: 'show', listener: Function): this;
  2443. removeListener(event: 'show', listener: Function): this;
  2444. /**
  2445. * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
  2446. * `left`.
  2447. *
  2448. * The method underlying this event is built to handle older macOS-style trackpad
  2449. * swiping, where the content on the screen doesn't move with the swipe. Most macOS
  2450. * trackpads are not configured to allow this kind of swiping anymore, so in order
  2451. * for it to emit properly the 'Swipe between pages' preference in `System
  2452. * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
  2453. * fingers'.
  2454. *
  2455. * @platform darwin
  2456. */
  2457. on(event: 'swipe', listener: (event: Event,
  2458. direction: string) => void): this;
  2459. /**
  2460. * @platform darwin
  2461. */
  2462. off(event: 'swipe', listener: (event: Event,
  2463. direction: string) => void): this;
  2464. /**
  2465. * @platform darwin
  2466. */
  2467. once(event: 'swipe', listener: (event: Event,
  2468. direction: string) => void): this;
  2469. /**
  2470. * @platform darwin
  2471. */
  2472. addListener(event: 'swipe', listener: (event: Event,
  2473. direction: string) => void): this;
  2474. /**
  2475. * @platform darwin
  2476. */
  2477. removeListener(event: 'swipe', listener: (event: Event,
  2478. direction: string) => void): this;
  2479. /**
  2480. * Emitted when the system context menu is triggered on the window, this is
  2481. * normally only triggered when the user right clicks on the non-client area of
  2482. * your window. This is the window titlebar or any area you have declared as
  2483. * `-webkit-app-region: drag` in a frameless window.
  2484. *
  2485. * Calling `event.preventDefault()` will prevent the menu from being displayed.
  2486. *
  2487. * @platform win32
  2488. */
  2489. on(event: 'system-context-menu', listener: (event: Event,
  2490. /**
  2491. * The screen coordinates the context menu was triggered at
  2492. */
  2493. point: Point) => void): this;
  2494. /**
  2495. * @platform win32
  2496. */
  2497. off(event: 'system-context-menu', listener: (event: Event,
  2498. /**
  2499. * The screen coordinates the context menu was triggered at
  2500. */
  2501. point: Point) => void): this;
  2502. /**
  2503. * @platform win32
  2504. */
  2505. once(event: 'system-context-menu', listener: (event: Event,
  2506. /**
  2507. * The screen coordinates the context menu was triggered at
  2508. */
  2509. point: Point) => void): this;
  2510. /**
  2511. * @platform win32
  2512. */
  2513. addListener(event: 'system-context-menu', listener: (event: Event,
  2514. /**
  2515. * The screen coordinates the context menu was triggered at
  2516. */
  2517. point: Point) => void): this;
  2518. /**
  2519. * @platform win32
  2520. */
  2521. removeListener(event: 'system-context-menu', listener: (event: Event,
  2522. /**
  2523. * The screen coordinates the context menu was triggered at
  2524. */
  2525. point: Point) => void): this;
  2526. /**
  2527. * Emitted when the window exits from a maximized state.
  2528. */
  2529. on(event: 'unmaximize', listener: Function): this;
  2530. off(event: 'unmaximize', listener: Function): this;
  2531. once(event: 'unmaximize', listener: Function): this;
  2532. addListener(event: 'unmaximize', listener: Function): this;
  2533. removeListener(event: 'unmaximize', listener: Function): this;
  2534. /**
  2535. * Emitted when the web page becomes unresponsive.
  2536. */
  2537. on(event: 'unresponsive', listener: Function): this;
  2538. off(event: 'unresponsive', listener: Function): this;
  2539. once(event: 'unresponsive', listener: Function): this;
  2540. addListener(event: 'unresponsive', listener: Function): this;
  2541. removeListener(event: 'unresponsive', listener: Function): this;
  2542. /**
  2543. * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
  2544. * will prevent the window from being moved.
  2545. *
  2546. * Note that this is only emitted when the window is being moved manually. Moving
  2547. * the window with `setPosition`/`setBounds`/`center` will not emit this event.
  2548. *
  2549. * @platform darwin,win32
  2550. */
  2551. on(event: 'will-move', listener: (event: Event,
  2552. /**
  2553. * Location the window is being moved to.
  2554. */
  2555. newBounds: Rectangle) => void): this;
  2556. /**
  2557. * @platform darwin,win32
  2558. */
  2559. off(event: 'will-move', listener: (event: Event,
  2560. /**
  2561. * Location the window is being moved to.
  2562. */
  2563. newBounds: Rectangle) => void): this;
  2564. /**
  2565. * @platform darwin,win32
  2566. */
  2567. once(event: 'will-move', listener: (event: Event,
  2568. /**
  2569. * Location the window is being moved to.
  2570. */
  2571. newBounds: Rectangle) => void): this;
  2572. /**
  2573. * @platform darwin,win32
  2574. */
  2575. addListener(event: 'will-move', listener: (event: Event,
  2576. /**
  2577. * Location the window is being moved to.
  2578. */
  2579. newBounds: Rectangle) => void): this;
  2580. /**
  2581. * @platform darwin,win32
  2582. */
  2583. removeListener(event: 'will-move', listener: (event: Event,
  2584. /**
  2585. * Location the window is being moved to.
  2586. */
  2587. newBounds: Rectangle) => void): this;
  2588. /**
  2589. * Emitted before the window is resized. Calling `event.preventDefault()` will
  2590. * prevent the window from being resized.
  2591. *
  2592. * Note that this is only emitted when the window is being resized manually.
  2593. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2594. *
  2595. * The possible values and behaviors of the `edge` option are platform dependent.
  2596. * Possible values are:
  2597. *
  2598. * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
  2599. * `top-right`, `bottom-left`, `bottom-right`.
  2600. * * On macOS, possible values are `bottom` and `right`.
  2601. * * The value `bottom` is used to denote vertical resizing.
  2602. * * The value `right` is used to denote horizontal resizing.
  2603. *
  2604. * @platform darwin,win32
  2605. */
  2606. on(event: 'will-resize', listener: (event: Event,
  2607. /**
  2608. * Size the window is being resized to.
  2609. */
  2610. newBounds: Rectangle,
  2611. details: WillResizeDetails) => void): this;
  2612. /**
  2613. * @platform darwin,win32
  2614. */
  2615. off(event: 'will-resize', listener: (event: Event,
  2616. /**
  2617. * Size the window is being resized to.
  2618. */
  2619. newBounds: Rectangle,
  2620. details: WillResizeDetails) => void): this;
  2621. /**
  2622. * @platform darwin,win32
  2623. */
  2624. once(event: 'will-resize', listener: (event: Event,
  2625. /**
  2626. * Size the window is being resized to.
  2627. */
  2628. newBounds: Rectangle,
  2629. details: WillResizeDetails) => void): this;
  2630. /**
  2631. * @platform darwin,win32
  2632. */
  2633. addListener(event: 'will-resize', listener: (event: Event,
  2634. /**
  2635. * Size the window is being resized to.
  2636. */
  2637. newBounds: Rectangle,
  2638. details: WillResizeDetails) => void): this;
  2639. /**
  2640. * @platform darwin,win32
  2641. */
  2642. removeListener(event: 'will-resize', listener: (event: Event,
  2643. /**
  2644. * Size the window is being resized to.
  2645. */
  2646. newBounds: Rectangle,
  2647. details: WillResizeDetails) => void): this;
  2648. /**
  2649. * BrowserWindow
  2650. */
  2651. constructor(options?: BrowserWindowConstructorOptions);
  2652. /**
  2653. * The window that owns the given `browserView`. If the given view is not attached
  2654. * to any window, returns `null`.
  2655. */
  2656. static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
  2657. /**
  2658. * The window with the given `id`.
  2659. */
  2660. static fromId(id: number): (BrowserWindow) | (null);
  2661. /**
  2662. * The window that owns the given `webContents` or `null` if the contents are not
  2663. * owned by a window.
  2664. */
  2665. static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
  2666. /**
  2667. * An array of all opened browser windows.
  2668. */
  2669. static getAllWindows(): BrowserWindow[];
  2670. /**
  2671. * The window that is focused in this application, otherwise returns `null`.
  2672. */
  2673. static getFocusedWindow(): (BrowserWindow) | (null);
  2674. /**
  2675. * Replacement API for setBrowserView supporting work with multi browser views.
  2676. *
  2677. * @experimental
  2678. */
  2679. addBrowserView(browserView: BrowserView): void;
  2680. /**
  2681. * Adds a window as a tab on this window, after the tab for the window instance.
  2682. *
  2683. * @platform darwin
  2684. */
  2685. addTabbedWindow(browserWindow: BrowserWindow): void;
  2686. /**
  2687. * Removes focus from the window.
  2688. */
  2689. blur(): void;
  2690. blurWebView(): void;
  2691. /**
  2692. * Resolves with a NativeImage
  2693. *
  2694. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  2695. * whole visible page. If the page is not visible, `rect` may be empty. The page is
  2696. * considered visible when its browser window is hidden and the capturer count is
  2697. * non-zero. If you would like the page to stay hidden, you should ensure that
  2698. * `stayHidden` is set to true.
  2699. */
  2700. capturePage(rect?: Rectangle, opts?: Opts): Promise<Electron.NativeImage>;
  2701. /**
  2702. * Moves window to the center of the screen.
  2703. */
  2704. center(): void;
  2705. /**
  2706. * Try to close the window. This has the same effect as a user manually clicking
  2707. * the close button of the window. The web page may cancel the close though. See
  2708. * the close event.
  2709. */
  2710. close(): void;
  2711. /**
  2712. * Closes the currently open Quick Look panel.
  2713. *
  2714. * @platform darwin
  2715. */
  2716. closeFilePreview(): void;
  2717. /**
  2718. * Force closing the window, the `unload` and `beforeunload` event won't be emitted
  2719. * for the web page, and `close` event will also not be emitted for this window,
  2720. * but it guarantees the `closed` event will be emitted.
  2721. */
  2722. destroy(): void;
  2723. /**
  2724. * Starts or stops flashing the window to attract user's attention.
  2725. */
  2726. flashFrame(flag: boolean): void;
  2727. /**
  2728. * Focuses on the window.
  2729. */
  2730. focus(): void;
  2731. focusOnWebView(): void;
  2732. /**
  2733. * Gets the background color of the window in Hex (`#RRGGBB`) format.
  2734. *
  2735. * See Setting `backgroundColor`.
  2736. *
  2737. * **Note:** The alpha value is _not_ returned alongside the red, green, and blue
  2738. * values.
  2739. */
  2740. getBackgroundColor(): string;
  2741. /**
  2742. * The `bounds` of the window as `Object`.
  2743. *
  2744. * **Note:** On macOS, the y-coordinate value returned will be at minimum the Tray
  2745. * height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height:
  2746. * 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x:
  2747. * 25, y: 38, width: 800, height: 600 }`.
  2748. */
  2749. getBounds(): Rectangle;
  2750. /**
  2751. * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
  2752. * Throws an error if multiple `BrowserView`s are attached.
  2753. *
  2754. * @experimental
  2755. */
  2756. getBrowserView(): (BrowserView) | (null);
  2757. /**
  2758. * a sorted by z-index array of all BrowserViews that have been attached with
  2759. * `addBrowserView` or `setBrowserView`. The top-most BrowserView is the last
  2760. * element of the array.
  2761. *
  2762. * **Note:** The BrowserView API is currently experimental and may change or be
  2763. * removed in future Electron releases.
  2764. *
  2765. * @experimental
  2766. */
  2767. getBrowserViews(): BrowserView[];
  2768. /**
  2769. * All child windows.
  2770. */
  2771. getChildWindows(): BrowserWindow[];
  2772. /**
  2773. * The `bounds` of the window's client area as `Object`.
  2774. */
  2775. getContentBounds(): Rectangle;
  2776. /**
  2777. * Contains the window's client area's width and height.
  2778. */
  2779. getContentSize(): number[];
  2780. /**
  2781. * Contains the window's maximum width and height.
  2782. */
  2783. getMaximumSize(): number[];
  2784. /**
  2785. * Window id in the format of DesktopCapturerSource's id. For example
  2786. * "window:1324:0".
  2787. *
  2788. * More precisely the format is `window:id:other_id` where `id` is `HWND` on
  2789. * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
  2790. * Linux. `other_id` is used to identify web contents (tabs) so within the same top
  2791. * level window.
  2792. */
  2793. getMediaSourceId(): string;
  2794. /**
  2795. * Contains the window's minimum width and height.
  2796. */
  2797. getMinimumSize(): number[];
  2798. /**
  2799. * The platform-specific handle of the window.
  2800. *
  2801. * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
  2802. * `Window` (`unsigned long`) on Linux.
  2803. */
  2804. getNativeWindowHandle(): Buffer;
  2805. /**
  2806. * Contains the window bounds of the normal state
  2807. *
  2808. * **Note:** whatever the current state of the window : maximized, minimized or in
  2809. * fullscreen, this function always returns the position and size of the window in
  2810. * normal state. In normal state, getBounds and getNormalBounds returns the same
  2811. * `Rectangle`.
  2812. */
  2813. getNormalBounds(): Rectangle;
  2814. /**
  2815. * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
  2816. * 1.
  2817. */
  2818. getOpacity(): number;
  2819. /**
  2820. * The parent window or `null` if there is no parent.
  2821. */
  2822. getParentWindow(): (BrowserWindow) | (null);
  2823. /**
  2824. * Contains the window's current position.
  2825. */
  2826. getPosition(): number[];
  2827. /**
  2828. * The pathname of the file the window represents.
  2829. *
  2830. * @platform darwin
  2831. */
  2832. getRepresentedFilename(): string;
  2833. /**
  2834. * Contains the window's width and height.
  2835. */
  2836. getSize(): number[];
  2837. /**
  2838. * The title of the native window.
  2839. *
  2840. * **Note:** The title of the web page can be different from the title of the
  2841. * native window.
  2842. */
  2843. getTitle(): string;
  2844. /**
  2845. * The custom position for the traffic light buttons in frameless window, `null`
  2846. * will be returned when there is no custom position.
  2847. *
  2848. * @platform darwin
  2849. */
  2850. getWindowButtonPosition(): (Point) | (null);
  2851. /**
  2852. * Whether the window has a shadow.
  2853. */
  2854. hasShadow(): boolean;
  2855. /**
  2856. * Hides the window.
  2857. */
  2858. hide(): void;
  2859. /**
  2860. * Hooks a windows message. The `callback` is called when the message is received
  2861. * in the WndProc.
  2862. *
  2863. * @platform win32
  2864. */
  2865. hookWindowMessage(message: number, callback: (wParam: Buffer, lParam: Buffer) => void): void;
  2866. /**
  2867. * Invalidates the window shadow so that it is recomputed based on the current
  2868. * window shape.
  2869. *
  2870. * `BrowserWindows` that are transparent can sometimes leave behind visual
  2871. * artifacts on macOS. This method can be used to clear these artifacts when, for
  2872. * example, performing an animation.
  2873. *
  2874. * @platform darwin
  2875. */
  2876. invalidateShadow(): void;
  2877. /**
  2878. * Whether the window is always on top of other windows.
  2879. */
  2880. isAlwaysOnTop(): boolean;
  2881. /**
  2882. * Whether the window can be manually closed by user.
  2883. *
  2884. * On Linux always returns `true`.
  2885. *
  2886. * @platform darwin,win32
  2887. */
  2888. isClosable(): boolean;
  2889. /**
  2890. * Whether the window is destroyed.
  2891. */
  2892. isDestroyed(): boolean;
  2893. /**
  2894. * Whether the window's document has been edited.
  2895. *
  2896. * @platform darwin
  2897. */
  2898. isDocumentEdited(): boolean;
  2899. /**
  2900. * whether the window is enabled.
  2901. */
  2902. isEnabled(): boolean;
  2903. /**
  2904. * Whether the window can be focused.
  2905. *
  2906. * @platform darwin,win32
  2907. */
  2908. isFocusable(): boolean;
  2909. /**
  2910. * Whether the window is focused.
  2911. */
  2912. isFocused(): boolean;
  2913. /**
  2914. * Whether the window is in fullscreen mode.
  2915. */
  2916. isFullScreen(): boolean;
  2917. /**
  2918. * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
  2919. * window.
  2920. */
  2921. isFullScreenable(): boolean;
  2922. /**
  2923. * Whether the window will be hidden when the user toggles into mission control.
  2924. *
  2925. * @platform darwin
  2926. */
  2927. isHiddenInMissionControl(): boolean;
  2928. /**
  2929. * Whether the window is in kiosk mode.
  2930. */
  2931. isKiosk(): boolean;
  2932. /**
  2933. * Whether the window can be manually maximized by user.
  2934. *
  2935. * On Linux always returns `true`.
  2936. *
  2937. * @platform darwin,win32
  2938. */
  2939. isMaximizable(): boolean;
  2940. /**
  2941. * Whether the window is maximized.
  2942. */
  2943. isMaximized(): boolean;
  2944. /**
  2945. * Whether menu bar automatically hides itself.
  2946. *
  2947. * @platform win32,linux
  2948. */
  2949. isMenuBarAutoHide(): boolean;
  2950. /**
  2951. * Whether the menu bar is visible.
  2952. *
  2953. * @platform win32,linux
  2954. */
  2955. isMenuBarVisible(): boolean;
  2956. /**
  2957. * Whether the window can be manually minimized by the user.
  2958. *
  2959. * On Linux always returns `true`.
  2960. *
  2961. * @platform darwin,win32
  2962. */
  2963. isMinimizable(): boolean;
  2964. /**
  2965. * Whether the window is minimized.
  2966. */
  2967. isMinimized(): boolean;
  2968. /**
  2969. * Whether current window is a modal window.
  2970. */
  2971. isModal(): boolean;
  2972. /**
  2973. * Whether the window can be moved by user.
  2974. *
  2975. * On Linux always returns `true`.
  2976. *
  2977. * @platform darwin,win32
  2978. */
  2979. isMovable(): boolean;
  2980. /**
  2981. * Whether the window is in normal state (not maximized, not minimized, not in
  2982. * fullscreen mode).
  2983. */
  2984. isNormal(): boolean;
  2985. /**
  2986. * Whether the window can be manually resized by the user.
  2987. */
  2988. isResizable(): boolean;
  2989. /**
  2990. * Whether the window is in simple (pre-Lion) fullscreen mode.
  2991. *
  2992. * @platform darwin
  2993. */
  2994. isSimpleFullScreen(): boolean;
  2995. /**
  2996. * Whether the window is in Windows 10 tablet mode.
  2997. *
  2998. * Since Windows 10 users can use their PC as tablet, under this mode apps can
  2999. * choose to optimize their UI for tablets, such as enlarging the titlebar and
  3000. * hiding titlebar buttons.
  3001. *
  3002. * This API returns whether the window is in tablet mode, and the `resize` event
  3003. * can be be used to listen to changes to tablet mode.
  3004. *
  3005. * @platform win32
  3006. */
  3007. isTabletMode(): boolean;
  3008. /**
  3009. * Whether the window is visible to the user in the foreground of the app.
  3010. */
  3011. isVisible(): boolean;
  3012. /**
  3013. * Whether the window is visible on all workspaces.
  3014. *
  3015. * **Note:** This API always returns false on Windows.
  3016. *
  3017. * @platform darwin,linux
  3018. */
  3019. isVisibleOnAllWorkspaces(): boolean;
  3020. /**
  3021. * `true` or `false` depending on whether the message is hooked.
  3022. *
  3023. * @platform win32
  3024. */
  3025. isWindowMessageHooked(message: number): boolean;
  3026. /**
  3027. * the promise will resolve when the page has finished loading (see
  3028. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  3029. *
  3030. * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
  3031. * relative to the root of your application. See the `webContents` docs for more
  3032. * information.
  3033. */
  3034. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  3035. /**
  3036. * the promise will resolve when the page has finished loading (see
  3037. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  3038. *
  3039. * Same as `webContents.loadURL(url[, options])`.
  3040. *
  3041. * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
  3042. * file using the `file://` protocol.
  3043. *
  3044. * To ensure that file URLs are properly formatted, it is recommended to use Node's
  3045. * `url.format` method:
  3046. *
  3047. * You can load a URL using a `POST` request with URL-encoded data by doing the
  3048. * following:
  3049. */
  3050. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  3051. /**
  3052. * Maximizes the window. This will also show (but not focus) the window if it isn't
  3053. * being displayed already.
  3054. */
  3055. maximize(): void;
  3056. /**
  3057. * Merges all windows into one window with multiple tabs when native tabs are
  3058. * enabled and there is more than one open window.
  3059. *
  3060. * @platform darwin
  3061. */
  3062. mergeAllWindows(): void;
  3063. /**
  3064. * Minimizes the window. On some platforms the minimized window will be shown in
  3065. * the Dock.
  3066. */
  3067. minimize(): void;
  3068. /**
  3069. * Moves window above the source window in the sense of z-order. If the
  3070. * `mediaSourceId` is not of type window or if the window does not exist then this
  3071. * method throws an error.
  3072. */
  3073. moveAbove(mediaSourceId: string): void;
  3074. /**
  3075. * Moves the current tab into a new window if native tabs are enabled and there is
  3076. * more than one tab in the current window.
  3077. *
  3078. * @platform darwin
  3079. */
  3080. moveTabToNewWindow(): void;
  3081. /**
  3082. * Moves window to top(z-order) regardless of focus
  3083. */
  3084. moveTop(): void;
  3085. /**
  3086. * Uses Quick Look to preview a file at a given path.
  3087. *
  3088. * @platform darwin
  3089. */
  3090. previewFile(path: string, displayName?: string): void;
  3091. /**
  3092. * Same as `webContents.reload`.
  3093. */
  3094. reload(): void;
  3095. /**
  3096. * @experimental
  3097. */
  3098. removeBrowserView(browserView: BrowserView): void;
  3099. /**
  3100. * Remove the window's menu bar.
  3101. *
  3102. * @platform linux,win32
  3103. */
  3104. removeMenu(): void;
  3105. /**
  3106. * Restores the window from minimized state to its previous state.
  3107. */
  3108. restore(): void;
  3109. /**
  3110. * Selects the next tab when native tabs are enabled and there are other tabs in
  3111. * the window.
  3112. *
  3113. * @platform darwin
  3114. */
  3115. selectNextTab(): void;
  3116. /**
  3117. * Selects the previous tab when native tabs are enabled and there are other tabs
  3118. * in the window.
  3119. *
  3120. * @platform darwin
  3121. */
  3122. selectPreviousTab(): void;
  3123. /**
  3124. * Sets whether the window should show always on top of other windows. After
  3125. * setting this, the window is still a normal window, not a toolbox window which
  3126. * can not be focused on.
  3127. */
  3128. setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
  3129. /**
  3130. * Sets the properties for the window's taskbar button.
  3131. *
  3132. * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
  3133. * together. If one of those properties is not set, then neither will be used.
  3134. *
  3135. * @platform win32
  3136. */
  3137. setAppDetails(options: AppDetailsOptions): void;
  3138. /**
  3139. * This will make a window maintain an aspect ratio. The extra size allows a
  3140. * developer to have space, specified in pixels, not included within the aspect
  3141. * ratio calculations. This API already takes into account the difference between a
  3142. * window's size and its content size.
  3143. *
  3144. * Consider a normal window with an HD video player and associated controls.
  3145. * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
  3146. * on the right edge and 50 pixels of controls below the player. In order to
  3147. * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
  3148. * the player itself we would call this function with arguments of 16/9 and {
  3149. * width: 40, height: 50 }. The second argument doesn't care where the extra width
  3150. * and height are within the content view--only that they exist. Sum any extra
  3151. * width and height areas you have within the overall content view.
  3152. *
  3153. * The aspect ratio is not respected when window is resized programmatically with
  3154. * APIs like `win.setSize`.
  3155. *
  3156. * To reset an aspect ratio, pass 0 as the `aspectRatio` value:
  3157. * `win.setAspectRatio(0)`.
  3158. */
  3159. setAspectRatio(aspectRatio: number, extraSize?: Size): void;
  3160. /**
  3161. * Controls whether to hide cursor when typing.
  3162. *
  3163. * @platform darwin
  3164. */
  3165. setAutoHideCursor(autoHide: boolean): void;
  3166. /**
  3167. * Sets whether the window menu bar should hide itself automatically. Once set the
  3168. * menu bar will only show when users press the single `Alt` key.
  3169. *
  3170. * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
  3171. * hide it immediately.
  3172. *
  3173. * @platform win32,linux
  3174. */
  3175. setAutoHideMenuBar(hide: boolean): void;
  3176. /**
  3177. * Examples of valid `backgroundColor` values:
  3178. *
  3179. * * Hex
  3180. * * #fff (shorthand RGB)
  3181. * * #ffff (shorthand ARGB)
  3182. * * #ffffff (RGB)
  3183. * * #ffffffff (ARGB)
  3184. * * RGB
  3185. * * rgb(([\d]+),\s*([\d]+),\s*([\d]+))
  3186. * * e.g. rgb(255, 255, 255)
  3187. * * RGBA
  3188. * * rgba(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+))
  3189. * * e.g. rgba(255, 255, 255, 1.0)
  3190. * * HSL
  3191. * * hsl((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%)
  3192. * * e.g. hsl(200, 20%, 50%)
  3193. * * HSLA
  3194. * * hsla((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+))
  3195. * * e.g. hsla(200, 20%, 50%, 0.5)
  3196. * * Color name
  3197. * * Options are listed in SkParseColor.cpp
  3198. * * Similar to CSS Color Module Level 3 keywords, but case-sensitive.
  3199. * * e.g. `blueviolet` or `red`
  3200. *
  3201. * Sets the background color of the window. See Setting `backgroundColor`.
  3202. */
  3203. setBackgroundColor(backgroundColor: string): void;
  3204. /**
  3205. * This method sets the browser window's system-drawn background material,
  3206. * including behind the non-client area.
  3207. *
  3208. * See the Windows documentation for more details.
  3209. *
  3210. * **Note:** This method is only supported on Windows 11 22H2 and up.
  3211. *
  3212. * @platform win32
  3213. */
  3214. setBackgroundMaterial(material: 'auto' | 'none' | 'mica' | 'acrylic' | 'tabbed'): void;
  3215. /**
  3216. * Resizes and moves the window to the supplied bounds. Any properties that are not
  3217. * supplied will default to their current values.
  3218. *
  3219. * **Note:** On macOS, the y-coordinate value cannot be smaller than the Tray
  3220. * height. The tray height has changed over time and depends on the operating
  3221. * system, but is between 20-40px. Passing a value lower than the tray height will
  3222. * result in a window that is flush to the tray.
  3223. */
  3224. setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
  3225. /**
  3226. * @experimental
  3227. */
  3228. setBrowserView(browserView: (BrowserView) | (null)): void;
  3229. /**
  3230. * Sets whether the window can be manually closed by user. On Linux does nothing.
  3231. *
  3232. * @platform darwin,win32
  3233. */
  3234. setClosable(closable: boolean): void;
  3235. /**
  3236. * Resizes and moves the window's client area (e.g. the web page) to the supplied
  3237. * bounds.
  3238. */
  3239. setContentBounds(bounds: Rectangle, animate?: boolean): void;
  3240. /**
  3241. * Prevents the window contents from being captured by other apps.
  3242. *
  3243. * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
  3244. * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
  3245. * version 2004 and up the window will be removed from capture entirely, older
  3246. * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
  3247. *
  3248. * @platform darwin,win32
  3249. */
  3250. setContentProtection(enable: boolean): void;
  3251. /**
  3252. * Resizes the window's client area (e.g. the web page) to `width` and `height`.
  3253. */
  3254. setContentSize(width: number, height: number, animate?: boolean): void;
  3255. /**
  3256. * Specifies whether the window’s document has been edited, and the icon in title
  3257. * bar will become gray when set to `true`.
  3258. *
  3259. * @platform darwin
  3260. */
  3261. setDocumentEdited(edited: boolean): void;
  3262. /**
  3263. * Disable or enable the window.
  3264. */
  3265. setEnabled(enable: boolean): void;
  3266. /**
  3267. * Changes whether the window can be focused.
  3268. *
  3269. * On macOS it does not remove the focus from the window.
  3270. *
  3271. * @platform darwin,win32
  3272. */
  3273. setFocusable(focusable: boolean): void;
  3274. /**
  3275. * Sets whether the window should be in fullscreen mode.
  3276. *
  3277. * **Note:** On macOS, fullscreen transitions take place asynchronously. If further
  3278. * actions depend on the fullscreen state, use the 'enter-full-screen' or
  3279. * 'leave-full-screen' events.
  3280. */
  3281. setFullScreen(flag: boolean): void;
  3282. /**
  3283. * Sets whether the maximize/zoom window button toggles fullscreen mode or
  3284. * maximizes the window.
  3285. */
  3286. setFullScreenable(fullscreenable: boolean): void;
  3287. /**
  3288. * Sets whether the window should have a shadow.
  3289. */
  3290. setHasShadow(hasShadow: boolean): void;
  3291. /**
  3292. * Sets whether the window will be hidden when the user toggles into mission
  3293. * control.
  3294. *
  3295. * @platform darwin
  3296. */
  3297. setHiddenInMissionControl(hidden: boolean): void;
  3298. /**
  3299. * Changes window icon.
  3300. *
  3301. * @platform win32,linux
  3302. */
  3303. setIcon(icon: (NativeImage) | (string)): void;
  3304. /**
  3305. * Makes the window ignore all mouse events.
  3306. *
  3307. * All mouse events happened in this window will be passed to the window below this
  3308. * window, but if this window has focus, it will still receive keyboard events.
  3309. */
  3310. setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
  3311. /**
  3312. * Enters or leaves kiosk mode.
  3313. */
  3314. setKiosk(flag: boolean): void;
  3315. /**
  3316. * Sets whether the window can be manually maximized by user. On Linux does
  3317. * nothing.
  3318. *
  3319. * @platform darwin,win32
  3320. */
  3321. setMaximizable(maximizable: boolean): void;
  3322. /**
  3323. * Sets the maximum size of window to `width` and `height`.
  3324. */
  3325. setMaximumSize(width: number, height: number): void;
  3326. /**
  3327. * Sets the `menu` as the window's menu bar.
  3328. *
  3329. * @platform linux,win32
  3330. */
  3331. setMenu(menu: (Menu) | (null)): void;
  3332. /**
  3333. * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
  3334. * can still bring up the menu bar by pressing the single `Alt` key.
  3335. *
  3336. * @platform win32,linux
  3337. */
  3338. setMenuBarVisibility(visible: boolean): void;
  3339. /**
  3340. * Sets whether the window can be manually minimized by user. On Linux does
  3341. * nothing.
  3342. *
  3343. * @platform darwin,win32
  3344. */
  3345. setMinimizable(minimizable: boolean): void;
  3346. /**
  3347. * Sets the minimum size of window to `width` and `height`.
  3348. */
  3349. setMinimumSize(width: number, height: number): void;
  3350. /**
  3351. * Sets whether the window can be moved by user. On Linux does nothing.
  3352. *
  3353. * @platform darwin,win32
  3354. */
  3355. setMovable(movable: boolean): void;
  3356. /**
  3357. * Sets the opacity of the window. On Linux, does nothing. Out of bound number
  3358. * values are clamped to the [0, 1] range.
  3359. *
  3360. * @platform win32,darwin
  3361. */
  3362. setOpacity(opacity: number): void;
  3363. /**
  3364. * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
  3365. * convey some sort of application status or to passively notify the user.
  3366. *
  3367. * @platform win32
  3368. */
  3369. setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
  3370. /**
  3371. * Sets `parent` as current window's parent window, passing `null` will turn
  3372. * current window into a top-level window.
  3373. */
  3374. setParentWindow(parent: (BrowserWindow) | (null)): void;
  3375. /**
  3376. * Moves window to `x` and `y`.
  3377. */
  3378. setPosition(x: number, y: number, animate?: boolean): void;
  3379. /**
  3380. * Sets progress value in progress bar. Valid range is [0, 1.0].
  3381. *
  3382. * Remove progress bar when progress < 0; Change to indeterminate mode when
  3383. * progress > 1.
  3384. *
  3385. * On Linux platform, only supports Unity desktop environment, you need to specify
  3386. * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
  3387. * it will assume `{app.name}.desktop`.
  3388. *
  3389. * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
  3390. * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
  3391. * mode set (but with a value within the valid range), `normal` will be assumed.
  3392. */
  3393. setProgressBar(progress: number, options?: ProgressBarOptions): void;
  3394. /**
  3395. * Sets the pathname of the file the window represents, and the icon of the file
  3396. * will show in window's title bar.
  3397. *
  3398. * @platform darwin
  3399. */
  3400. setRepresentedFilename(filename: string): void;
  3401. /**
  3402. * Sets whether the window can be manually resized by the user.
  3403. */
  3404. setResizable(resizable: boolean): void;
  3405. /**
  3406. * Setting a window shape determines the area within the window where the system
  3407. * permits drawing and user interaction. Outside of the given region, no pixels
  3408. * will be drawn and no mouse events will be registered. Mouse events outside of
  3409. * the region will not be received by that window, but will fall through to
  3410. * whatever is behind the window.
  3411. *
  3412. * @experimental
  3413. * @platform win32,linux
  3414. */
  3415. setShape(rects: Rectangle[]): void;
  3416. /**
  3417. * Changes the attachment point for sheets on macOS. By default, sheets are
  3418. * attached just below the window frame, but you may want to display them beneath a
  3419. * HTML-rendered toolbar. For example:
  3420. *
  3421. * @platform darwin
  3422. */
  3423. setSheetOffset(offsetY: number, offsetX?: number): void;
  3424. /**
  3425. * Enters or leaves simple fullscreen mode.
  3426. *
  3427. * Simple fullscreen mode emulates the native fullscreen behavior found in versions
  3428. * of macOS prior to Lion (10.7).
  3429. *
  3430. * @platform darwin
  3431. */
  3432. setSimpleFullScreen(flag: boolean): void;
  3433. /**
  3434. * Resizes the window to `width` and `height`. If `width` or `height` are below any
  3435. * set minimum size constraints the window will snap to its minimum size.
  3436. */
  3437. setSize(width: number, height: number, animate?: boolean): void;
  3438. /**
  3439. * Makes the window not show in the taskbar.
  3440. *
  3441. * @platform darwin,win32
  3442. */
  3443. setSkipTaskbar(skip: boolean): void;
  3444. /**
  3445. * Whether the buttons were added successfully
  3446. *
  3447. * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
  3448. * of a window in a taskbar button layout. Returns a `boolean` object indicates
  3449. * whether the thumbnail has been added successfully.
  3450. *
  3451. * The number of buttons in thumbnail toolbar should be no greater than 7 due to
  3452. * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
  3453. * removed due to the platform's limitation. But you can call the API with an empty
  3454. * array to clean the buttons.
  3455. *
  3456. * The `buttons` is an array of `Button` objects:
  3457. *
  3458. * * `Button` Object
  3459. * * `icon` NativeImage - The icon showing in thumbnail toolbar.
  3460. * * `click` Function
  3461. * * `tooltip` string (optional) - The text of the button's tooltip.
  3462. * * `flags` string[] (optional) - Control specific states and behaviors of the
  3463. * button. By default, it is `['enabled']`.
  3464. *
  3465. * The `flags` is an array that can include following `string`s:
  3466. *
  3467. * * `enabled` - The button is active and available to the user.
  3468. * * `disabled` - The button is disabled. It is present, but has a visual state
  3469. * indicating it will not respond to user action.
  3470. * * `dismissonclick` - When the button is clicked, the thumbnail window closes
  3471. * immediately.
  3472. * * `nobackground` - Do not draw a button border, use only the image.
  3473. * * `hidden` - The button is not shown to the user.
  3474. * * `noninteractive` - The button is enabled but not interactive; no pressed
  3475. * button state is drawn. This value is intended for instances where the button is
  3476. * used in a notification.
  3477. *
  3478. * @platform win32
  3479. */
  3480. setThumbarButtons(buttons: ThumbarButton[]): boolean;
  3481. /**
  3482. * Sets the region of the window to show as the thumbnail image displayed when
  3483. * hovering over the window in the taskbar. You can reset the thumbnail to be the
  3484. * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
  3485. * }`.
  3486. *
  3487. * @platform win32
  3488. */
  3489. setThumbnailClip(region: Rectangle): void;
  3490. /**
  3491. * Sets the toolTip that is displayed when hovering over the window thumbnail in
  3492. * the taskbar.
  3493. *
  3494. * @platform win32
  3495. */
  3496. setThumbnailToolTip(toolTip: string): void;
  3497. /**
  3498. * Changes the title of native window to `title`.
  3499. */
  3500. setTitle(title: string): void;
  3501. /**
  3502. * On a Window with Window Controls Overlay already enabled, this method updates
  3503. * the style of the title bar overlay.
  3504. *
  3505. * @platform win32
  3506. */
  3507. setTitleBarOverlay(options: TitleBarOverlay): void;
  3508. /**
  3509. * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
  3510. * error if `browserView` is not attached to `win`.
  3511. *
  3512. * @experimental
  3513. */
  3514. setTopBrowserView(browserView: BrowserView): void;
  3515. /**
  3516. * Sets the touchBar layout for the current window. Specifying `null` or
  3517. * `undefined` clears the touch bar. This method only has an effect if the machine
  3518. * has a touch bar.
  3519. *
  3520. * **Note:** The TouchBar API is currently experimental and may change or be
  3521. * removed in future Electron releases.
  3522. *
  3523. * @platform darwin
  3524. */
  3525. setTouchBar(touchBar: (TouchBar) | (null)): void;
  3526. /**
  3527. * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
  3528. * will remove the vibrancy effect on the window.
  3529. *
  3530. * @platform darwin
  3531. */
  3532. setVibrancy(type: (('titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
  3533. /**
  3534. * Sets whether the window should be visible on all workspaces.
  3535. *
  3536. * **Note:** This API does nothing on Windows.
  3537. *
  3538. * @platform darwin,linux
  3539. */
  3540. setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
  3541. /**
  3542. * Set a custom position for the traffic light buttons in frameless window. Passing
  3543. * `null` will reset the position to default.
  3544. *
  3545. * @platform darwin
  3546. */
  3547. setWindowButtonPosition(position: (Point) | (null)): void;
  3548. /**
  3549. * Sets whether the window traffic light buttons should be visible.
  3550. *
  3551. * @platform darwin
  3552. */
  3553. setWindowButtonVisibility(visible: boolean): void;
  3554. /**
  3555. * Shows and gives focus to the window.
  3556. */
  3557. show(): void;
  3558. /**
  3559. * Shows or hides the tab overview when native tabs are enabled.
  3560. *
  3561. * @platform darwin
  3562. */
  3563. showAllTabs(): void;
  3564. /**
  3565. * Same as `webContents.showDefinitionForSelection()`.
  3566. *
  3567. * @platform darwin
  3568. */
  3569. showDefinitionForSelection(): void;
  3570. /**
  3571. * Shows the window but doesn't focus on it.
  3572. */
  3573. showInactive(): void;
  3574. /**
  3575. * Toggles the visibility of the tab bar if native tabs are enabled and there is
  3576. * only one tab in the current window.
  3577. *
  3578. * @platform darwin
  3579. */
  3580. toggleTabBar(): void;
  3581. /**
  3582. * Unhooks all of the window messages.
  3583. *
  3584. * @platform win32
  3585. */
  3586. unhookAllWindowMessages(): void;
  3587. /**
  3588. * Unhook the window message.
  3589. *
  3590. * @platform win32
  3591. */
  3592. unhookWindowMessage(message: number): void;
  3593. /**
  3594. * Unmaximizes the window.
  3595. */
  3596. unmaximize(): void;
  3597. /**
  3598. * A `string` property that defines an alternative title provided only to
  3599. * accessibility tools such as screen readers. This string is not directly visible
  3600. * to users.
  3601. */
  3602. accessibleTitle: string;
  3603. /**
  3604. * A `boolean` property that determines whether the window menu bar should hide
  3605. * itself automatically. Once set, the menu bar will only show when users press the
  3606. * single `Alt` key.
  3607. *
  3608. * If the menu bar is already visible, setting this property to `true` won't hide
  3609. * it immediately.
  3610. */
  3611. autoHideMenuBar: boolean;
  3612. /**
  3613. * A `boolean` property that determines whether the window can be manually closed
  3614. * by user.
  3615. *
  3616. * On Linux the setter is a no-op, although the getter returns `true`.
  3617. *
  3618. * @platform darwin,win32
  3619. */
  3620. closable: boolean;
  3621. /**
  3622. * A `boolean` property that specifies whether the window’s document has been
  3623. * edited.
  3624. *
  3625. * The icon in title bar will become gray when set to `true`.
  3626. *
  3627. * @platform darwin
  3628. */
  3629. documentEdited: boolean;
  3630. /**
  3631. * A `boolean` property that determines whether the window is excluded from the
  3632. * application’s Windows menu. `false` by default.
  3633. *
  3634. * @platform darwin
  3635. */
  3636. excludedFromShownWindowsMenu: boolean;
  3637. /**
  3638. * A `boolean` property that determines whether the window is focusable.
  3639. *
  3640. * @platform win32,darwin
  3641. */
  3642. focusable: boolean;
  3643. /**
  3644. * A `boolean` property that determines whether the window is in fullscreen mode.
  3645. */
  3646. fullScreen: boolean;
  3647. /**
  3648. * A `boolean` property that determines whether the maximize/zoom window button
  3649. * toggles fullscreen mode or maximizes the window.
  3650. */
  3651. fullScreenable: boolean;
  3652. /**
  3653. * A `Integer` property representing the unique ID of the window. Each ID is unique
  3654. * among all `BrowserWindow` instances of the entire Electron application.
  3655. *
  3656. */
  3657. readonly id: number;
  3658. /**
  3659. * A `boolean` property that determines whether the window is in kiosk mode.
  3660. */
  3661. kiosk: boolean;
  3662. /**
  3663. * A `boolean` property that determines whether the window can be manually
  3664. * maximized by user.
  3665. *
  3666. * On Linux the setter is a no-op, although the getter returns `true`.
  3667. *
  3668. * @platform darwin,win32
  3669. */
  3670. maximizable: boolean;
  3671. /**
  3672. * A `boolean` property that determines whether the menu bar should be visible.
  3673. *
  3674. * **Note:** If the menu bar is auto-hide, users can still bring up the menu bar by
  3675. * pressing the single `Alt` key.
  3676. *
  3677. * @platform win32,linux
  3678. */
  3679. menuBarVisible: boolean;
  3680. /**
  3681. * A `boolean` property that determines whether the window can be manually
  3682. * minimized by user.
  3683. *
  3684. * On Linux the setter is a no-op, although the getter returns `true`.
  3685. *
  3686. * @platform darwin,win32
  3687. */
  3688. minimizable: boolean;
  3689. /**
  3690. * A `boolean` property that determines Whether the window can be moved by user.
  3691. *
  3692. * On Linux the setter is a no-op, although the getter returns `true`.
  3693. *
  3694. * @platform darwin,win32
  3695. */
  3696. movable: boolean;
  3697. /**
  3698. * A `string` property that determines the pathname of the file the window
  3699. * represents, and the icon of the file will show in window's title bar.
  3700. *
  3701. * @platform darwin
  3702. */
  3703. representedFilename: string;
  3704. /**
  3705. * A `boolean` property that determines whether the window can be manually resized
  3706. * by user.
  3707. */
  3708. resizable: boolean;
  3709. /**
  3710. * A `boolean` property that determines whether the window has a shadow.
  3711. */
  3712. shadow: boolean;
  3713. /**
  3714. * A `boolean` property that determines whether the window is in simple (pre-Lion)
  3715. * fullscreen mode.
  3716. */
  3717. simpleFullScreen: boolean;
  3718. /**
  3719. * A `string` (optional) property that is equal to the `tabbingIdentifier` passed
  3720. * to the `BrowserWindow` constructor or `undefined` if none was set.
  3721. *
  3722. * @platform darwin
  3723. */
  3724. readonly tabbingIdentifier?: string;
  3725. /**
  3726. * A `string` property that determines the title of the native window.
  3727. *
  3728. * **Note:** The title of the web page can be different from the title of the
  3729. * native window.
  3730. */
  3731. title: string;
  3732. /**
  3733. * A `boolean` property that determines whether the window is visible on all
  3734. * workspaces.
  3735. *
  3736. * **Note:** Always returns false on Windows.
  3737. *
  3738. * @platform darwin,linux
  3739. */
  3740. visibleOnAllWorkspaces: boolean;
  3741. /**
  3742. * A `WebContents` object this window owns. All web page related events and
  3743. * operations will be done via it.
  3744. *
  3745. * See the `webContents` documentation for its methods and events.
  3746. *
  3747. */
  3748. readonly webContents: WebContents;
  3749. }
  3750. interface BrowserWindowConstructorOptions {
  3751. // Docs: https://electronjs.org/docs/api/structures/browser-window-options
  3752. /**
  3753. * Whether clicking an inactive window will also click through to the web contents.
  3754. * Default is `false` on macOS. This option is not configurable on other platforms.
  3755. *
  3756. * @platform darwin
  3757. */
  3758. acceptFirstMouse?: boolean;
  3759. /**
  3760. * Whether the window should always stay on top of other windows. Default is
  3761. * `false`.
  3762. */
  3763. alwaysOnTop?: boolean;
  3764. /**
  3765. * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
  3766. */
  3767. autoHideMenuBar?: boolean;
  3768. /**
  3769. * The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color
  3770. * format. Alpha in #AARRGGBB format is supported if `transparent` is set to
  3771. * `true`. Default is `#FFF` (white). See win.setBackgroundColor for more
  3772. * information.
  3773. */
  3774. backgroundColor?: string;
  3775. /**
  3776. * Set the window's system-drawn background material, including behind the
  3777. * non-client area. Can be `auto`, `none`, `mica`, `acrylic` or `tabbed`. See
  3778. * win.setBackgroundMaterial for more information.
  3779. *
  3780. * @platform win32
  3781. */
  3782. backgroundMaterial?: ('auto' | 'none' | 'mica' | 'acrylic' | 'tabbed');
  3783. /**
  3784. * Show window in the center of the screen. Default is `false`.
  3785. */
  3786. center?: boolean;
  3787. /**
  3788. * Whether window is closable. This is not implemented on Linux. Default is `true`.
  3789. *
  3790. * @platform darwin,win32
  3791. */
  3792. closable?: boolean;
  3793. /**
  3794. * Forces using dark theme for the window, only works on some GTK+3 desktop
  3795. * environments. Default is `false`.
  3796. */
  3797. darkTheme?: boolean;
  3798. /**
  3799. * Whether to hide cursor when typing. Default is `false`.
  3800. */
  3801. disableAutoHideCursor?: boolean;
  3802. /**
  3803. * Enable the window to be resized larger than screen. Only relevant for macOS, as
  3804. * other OSes allow larger-than-screen windows by default. Default is `false`.
  3805. *
  3806. * @platform darwin
  3807. */
  3808. enableLargerThanScreen?: boolean;
  3809. /**
  3810. * Whether the window can be focused. Default is `true`. On Windows setting
  3811. * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
  3812. * `focusable: false` makes the window stop interacting with wm, so the window will
  3813. * always stay on top in all workspaces.
  3814. */
  3815. focusable?: boolean;
  3816. /**
  3817. * Specify `false` to create a frameless window. Default is `true`.
  3818. */
  3819. frame?: boolean;
  3820. /**
  3821. * Whether the window should show in fullscreen. When explicitly set to `false` the
  3822. * fullscreen button will be hidden or disabled on macOS. Default is `false`.
  3823. */
  3824. fullscreen?: boolean;
  3825. /**
  3826. * Whether the window can be put into fullscreen mode. On macOS, also whether the
  3827. * maximize/zoom button should toggle full screen mode or maximize window. Default
  3828. * is `true`.
  3829. */
  3830. fullscreenable?: boolean;
  3831. /**
  3832. * Whether window should have a shadow. Default is `true`.
  3833. */
  3834. hasShadow?: boolean;
  3835. /**
  3836. * Window's height in pixels. Default is `600`.
  3837. */
  3838. height?: number;
  3839. /**
  3840. * Whether window should be hidden when the user toggles into mission control.
  3841. *
  3842. * @platform darwin
  3843. */
  3844. hiddenInMissionControl?: boolean;
  3845. /**
  3846. * The window icon. On Windows it is recommended to use `ICO` icons to get best
  3847. * visual effects, you can also leave it undefined so the executable's icon will be
  3848. * used.
  3849. */
  3850. icon?: (NativeImage) | (string);
  3851. /**
  3852. * Whether the window is in kiosk mode. Default is `false`.
  3853. */
  3854. kiosk?: boolean;
  3855. /**
  3856. * Window's maximum height. Default is no limit.
  3857. */
  3858. maxHeight?: number;
  3859. /**
  3860. * Whether window is maximizable. This is not implemented on Linux. Default is
  3861. * `true`.
  3862. *
  3863. * @platform darwin,win32
  3864. */
  3865. maximizable?: boolean;
  3866. /**
  3867. * Window's maximum width. Default is no limit.
  3868. */
  3869. maxWidth?: number;
  3870. /**
  3871. * Window's minimum height. Default is `0`.
  3872. */
  3873. minHeight?: number;
  3874. /**
  3875. * Whether window is minimizable. This is not implemented on Linux. Default is
  3876. * `true`.
  3877. *
  3878. * @platform darwin,win32
  3879. */
  3880. minimizable?: boolean;
  3881. /**
  3882. * Window's minimum width. Default is `0`.
  3883. */
  3884. minWidth?: number;
  3885. /**
  3886. * Whether this is a modal window. This only works when the window is a child
  3887. * window. Default is `false`.
  3888. */
  3889. modal?: boolean;
  3890. /**
  3891. * Whether window is movable. This is not implemented on Linux. Default is `true`.
  3892. *
  3893. * @platform darwin,win32
  3894. */
  3895. movable?: boolean;
  3896. /**
  3897. * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
  3898. * (fully opaque). This is only implemented on Windows and macOS.
  3899. *
  3900. * @platform darwin,win32
  3901. */
  3902. opacity?: number;
  3903. /**
  3904. * Whether the renderer should be active when `show` is `false` and it has just
  3905. * been created. In order for `document.visibilityState` to work correctly on
  3906. * first load with `show: false` you should set this to `false`. Setting this to
  3907. * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
  3908. */
  3909. paintWhenInitiallyHidden?: boolean;
  3910. /**
  3911. * Specify parent window. Default is `null`.
  3912. */
  3913. parent?: BrowserWindow;
  3914. /**
  3915. * Whether window is resizable. Default is `true`.
  3916. */
  3917. resizable?: boolean;
  3918. /**
  3919. * Whether frameless window should have rounded corners on macOS. Default is
  3920. * `true`. Setting this property to `false` will prevent the window from being
  3921. * fullscreenable.
  3922. *
  3923. * @platform darwin
  3924. */
  3925. roundedCorners?: boolean;
  3926. /**
  3927. * Whether window should be shown when created. Default is `true`.
  3928. */
  3929. show?: boolean;
  3930. /**
  3931. * Use pre-Lion fullscreen on macOS. Default is `false`.
  3932. *
  3933. * @platform darwin
  3934. */
  3935. simpleFullscreen?: boolean;
  3936. /**
  3937. * Whether to show the window in taskbar. Default is `false`.
  3938. *
  3939. * @platform darwin,win32
  3940. */
  3941. skipTaskbar?: boolean;
  3942. /**
  3943. * Tab group name, allows opening the window as a native tab. Windows with the same
  3944. * tabbing identifier will be grouped together. This also adds a native new tab
  3945. * button to your window's tab bar and allows your `app` and window to receive the
  3946. * `new-window-for-tab` event.
  3947. *
  3948. * @platform darwin
  3949. */
  3950. tabbingIdentifier?: string;
  3951. /**
  3952. * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
  3953. * window frame. Setting it to `false` will remove window shadow and window
  3954. * animations. Default is `true`.
  3955. */
  3956. thickFrame?: boolean;
  3957. /**
  3958. * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
  3959. * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
  3960. */
  3961. title?: string;
  3962. /**
  3963. * When using a frameless window in conjunction with
  3964. * `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so
  3965. * that the standard window controls ("traffic lights" on macOS) are visible, this
  3966. * property enables the Window Controls Overlay JavaScript APIs and CSS Environment
  3967. * Variables. Specifying `true` will result in an overlay with default system
  3968. * colors. Default is `false`.
  3969. */
  3970. titleBarOverlay?: (TitleBarOverlay) | (boolean);
  3971. /**
  3972. * The style of window title bar. Default is `default`. Possible values are:
  3973. *
  3974. * @platform darwin,win32
  3975. */
  3976. titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
  3977. /**
  3978. * Set a custom position for the traffic light buttons in frameless windows.
  3979. *
  3980. * @platform darwin
  3981. */
  3982. trafficLightPosition?: Point;
  3983. /**
  3984. * Makes the window transparent. Default is `false`. On Windows, does not work
  3985. * unless the window is frameless.
  3986. */
  3987. transparent?: boolean;
  3988. /**
  3989. * The type of window, default is normal window. See more about this below.
  3990. */
  3991. type?: string;
  3992. /**
  3993. * The `width` and `height` would be used as web page's size, which means the
  3994. * actual window's size will include window frame's size and be slightly larger.
  3995. * Default is `false`.
  3996. */
  3997. useContentSize?: boolean;
  3998. /**
  3999. * Add a type of vibrancy effect to the window, only on macOS. Can be
  4000. * `appearance-based`, `titlebar`, `selection`, `menu`, `popover`, `sidebar`,
  4001. * `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`,
  4002. * `under-window`, or `under-page`.
  4003. *
  4004. * @platform darwin
  4005. */
  4006. vibrancy?: ('appearance-based' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page');
  4007. /**
  4008. * Specify how the material appearance should reflect window activity state on
  4009. * macOS. Must be used with the `vibrancy` property. Possible values are:
  4010. *
  4011. * @platform darwin
  4012. */
  4013. visualEffectState?: ('followWindow' | 'active' | 'inactive');
  4014. /**
  4015. * Settings of web page's features.
  4016. */
  4017. webPreferences?: WebPreferences;
  4018. /**
  4019. * Window's width in pixels. Default is `800`.
  4020. */
  4021. width?: number;
  4022. /**
  4023. * (**required** if y is used) Window's left offset from screen. Default is to
  4024. * center the window.
  4025. */
  4026. x?: number;
  4027. /**
  4028. * (**required** if x is used) Window's top offset from screen. Default is to
  4029. * center the window.
  4030. */
  4031. y?: number;
  4032. /**
  4033. * Controls the behavior on macOS when option-clicking the green stoplight button
  4034. * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
  4035. * will grow to the preferred width of the web page when zoomed, `false` will cause
  4036. * it to zoom to the width of the screen. This will also affect the behavior when
  4037. * calling `maximize()` directly. Default is `false`.
  4038. *
  4039. * @platform darwin
  4040. */
  4041. zoomToPageWidth?: boolean;
  4042. }
  4043. interface Certificate {
  4044. // Docs: https://electronjs.org/docs/api/structures/certificate
  4045. /**
  4046. * PEM encoded data
  4047. */
  4048. data: string;
  4049. /**
  4050. * Fingerprint of the certificate
  4051. */
  4052. fingerprint: string;
  4053. /**
  4054. * Issuer principal
  4055. */
  4056. issuer: CertificatePrincipal;
  4057. /**
  4058. * Issuer certificate (if not self-signed)
  4059. */
  4060. issuerCert: Certificate;
  4061. /**
  4062. * Issuer's Common Name
  4063. */
  4064. issuerName: string;
  4065. /**
  4066. * Hex value represented string
  4067. */
  4068. serialNumber: string;
  4069. /**
  4070. * Subject principal
  4071. */
  4072. subject: CertificatePrincipal;
  4073. /**
  4074. * Subject's Common Name
  4075. */
  4076. subjectName: string;
  4077. /**
  4078. * End date of the certificate being valid in seconds
  4079. */
  4080. validExpiry: number;
  4081. /**
  4082. * Start date of the certificate being valid in seconds
  4083. */
  4084. validStart: number;
  4085. }
  4086. interface CertificatePrincipal {
  4087. // Docs: https://electronjs.org/docs/api/structures/certificate-principal
  4088. /**
  4089. * Common Name.
  4090. */
  4091. commonName: string;
  4092. /**
  4093. * Country or region.
  4094. */
  4095. country: string;
  4096. /**
  4097. * Locality.
  4098. */
  4099. locality: string;
  4100. /**
  4101. * Organization names.
  4102. */
  4103. organizations: string[];
  4104. /**
  4105. * Organization Unit names.
  4106. */
  4107. organizationUnits: string[];
  4108. /**
  4109. * State or province.
  4110. */
  4111. state: string;
  4112. }
  4113. class ClientRequest extends NodeEventEmitter {
  4114. // Docs: https://electronjs.org/docs/api/client-request
  4115. /**
  4116. * Emitted when the `request` is aborted. The `abort` event will not be fired if
  4117. * the `request` is already closed.
  4118. */
  4119. on(event: 'abort', listener: Function): this;
  4120. off(event: 'abort', listener: Function): this;
  4121. once(event: 'abort', listener: Function): this;
  4122. addListener(event: 'abort', listener: Function): this;
  4123. removeListener(event: 'abort', listener: Function): this;
  4124. /**
  4125. * Emitted as the last event in the HTTP request-response transaction. The `close`
  4126. * event indicates that no more events will be emitted on either the `request` or
  4127. * `response` objects.
  4128. */
  4129. on(event: 'close', listener: Function): this;
  4130. off(event: 'close', listener: Function): this;
  4131. once(event: 'close', listener: Function): this;
  4132. addListener(event: 'close', listener: Function): this;
  4133. removeListener(event: 'close', listener: Function): this;
  4134. /**
  4135. * Emitted when the `net` module fails to issue a network request. Typically when
  4136. * the `request` object emits an `error` event, a `close` event will subsequently
  4137. * follow and no response object will be provided.
  4138. */
  4139. on(event: 'error', listener: (
  4140. /**
  4141. * an error object providing some information about the failure.
  4142. */
  4143. error: Error) => void): this;
  4144. off(event: 'error', listener: (
  4145. /**
  4146. * an error object providing some information about the failure.
  4147. */
  4148. error: Error) => void): this;
  4149. once(event: 'error', listener: (
  4150. /**
  4151. * an error object providing some information about the failure.
  4152. */
  4153. error: Error) => void): this;
  4154. addListener(event: 'error', listener: (
  4155. /**
  4156. * an error object providing some information about the failure.
  4157. */
  4158. error: Error) => void): this;
  4159. removeListener(event: 'error', listener: (
  4160. /**
  4161. * an error object providing some information about the failure.
  4162. */
  4163. error: Error) => void): this;
  4164. /**
  4165. * Emitted just after the last chunk of the `request`'s data has been written into
  4166. * the `request` object.
  4167. */
  4168. on(event: 'finish', listener: Function): this;
  4169. off(event: 'finish', listener: Function): this;
  4170. once(event: 'finish', listener: Function): this;
  4171. addListener(event: 'finish', listener: Function): this;
  4172. removeListener(event: 'finish', listener: Function): this;
  4173. /**
  4174. * Emitted when an authenticating proxy is asking for user credentials.
  4175. *
  4176. * The `callback` function is expected to be called back with user credentials:
  4177. *
  4178. * * `username` string
  4179. * * `password` string
  4180. *
  4181. * Providing empty credentials will cancel the request and report an authentication
  4182. * error on the response object:
  4183. */
  4184. on(event: 'login', listener: (authInfo: AuthInfo,
  4185. callback: (username?: string, password?: string) => void) => void): this;
  4186. off(event: 'login', listener: (authInfo: AuthInfo,
  4187. callback: (username?: string, password?: string) => void) => void): this;
  4188. once(event: 'login', listener: (authInfo: AuthInfo,
  4189. callback: (username?: string, password?: string) => void) => void): this;
  4190. addListener(event: 'login', listener: (authInfo: AuthInfo,
  4191. callback: (username?: string, password?: string) => void) => void): this;
  4192. removeListener(event: 'login', listener: (authInfo: AuthInfo,
  4193. callback: (username?: string, password?: string) => void) => void): this;
  4194. /**
  4195. * Emitted when the server returns a redirect response (e.g. 301 Moved
  4196. * Permanently). Calling `request.followRedirect` will continue with the
  4197. * redirection. If this event is handled, `request.followRedirect` must be called
  4198. * **synchronously**, otherwise the request will be cancelled.
  4199. */
  4200. on(event: 'redirect', listener: (statusCode: number,
  4201. method: string,
  4202. redirectUrl: string,
  4203. responseHeaders: Record<string, string[]>) => void): this;
  4204. off(event: 'redirect', listener: (statusCode: number,
  4205. method: string,
  4206. redirectUrl: string,
  4207. responseHeaders: Record<string, string[]>) => void): this;
  4208. once(event: 'redirect', listener: (statusCode: number,
  4209. method: string,
  4210. redirectUrl: string,
  4211. responseHeaders: Record<string, string[]>) => void): this;
  4212. addListener(event: 'redirect', listener: (statusCode: number,
  4213. method: string,
  4214. redirectUrl: string,
  4215. responseHeaders: Record<string, string[]>) => void): this;
  4216. removeListener(event: 'redirect', listener: (statusCode: number,
  4217. method: string,
  4218. redirectUrl: string,
  4219. responseHeaders: Record<string, string[]>) => void): this;
  4220. on(event: 'response', listener: (
  4221. /**
  4222. * An object representing the HTTP response message.
  4223. */
  4224. response: IncomingMessage) => void): this;
  4225. off(event: 'response', listener: (
  4226. /**
  4227. * An object representing the HTTP response message.
  4228. */
  4229. response: IncomingMessage) => void): this;
  4230. once(event: 'response', listener: (
  4231. /**
  4232. * An object representing the HTTP response message.
  4233. */
  4234. response: IncomingMessage) => void): this;
  4235. addListener(event: 'response', listener: (
  4236. /**
  4237. * An object representing the HTTP response message.
  4238. */
  4239. response: IncomingMessage) => void): this;
  4240. removeListener(event: 'response', listener: (
  4241. /**
  4242. * An object representing the HTTP response message.
  4243. */
  4244. response: IncomingMessage) => void): this;
  4245. /**
  4246. * ClientRequest
  4247. */
  4248. constructor(options: (ClientRequestConstructorOptions) | (string));
  4249. /**
  4250. * Cancels an ongoing HTTP transaction. If the request has already emitted the
  4251. * `close` event, the abort operation will have no effect. Otherwise an ongoing
  4252. * event will emit `abort` and `close` events. Additionally, if there is an ongoing
  4253. * response object,it will emit the `aborted` event.
  4254. */
  4255. abort(): void;
  4256. /**
  4257. * Sends the last chunk of the request data. Subsequent write or end operations
  4258. * will not be allowed. The `finish` event is emitted just after the end operation.
  4259. */
  4260. end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): this;
  4261. /**
  4262. * Continues any pending redirection. Can only be called during a `'redirect'`
  4263. * event.
  4264. */
  4265. followRedirect(): void;
  4266. /**
  4267. * The value of a previously set extra header name.
  4268. */
  4269. getHeader(name: string): string;
  4270. /**
  4271. * * `active` boolean - Whether the request is currently active. If this is false
  4272. * no other properties will be set
  4273. * * `started` boolean - Whether the upload has started. If this is false both
  4274. * `current` and `total` will be set to 0.
  4275. * * `current` Integer - The number of bytes that have been uploaded so far
  4276. * * `total` Integer - The number of bytes that will be uploaded this request
  4277. *
  4278. * You can use this method in conjunction with `POST` requests to get the progress
  4279. * of a file upload or other data transfer.
  4280. */
  4281. getUploadProgress(): UploadProgress;
  4282. /**
  4283. * Removes a previously set extra header name. This method can be called only
  4284. * before first write. Trying to call it after the first write will throw an error.
  4285. */
  4286. removeHeader(name: string): void;
  4287. /**
  4288. * Adds an extra HTTP header. The header name will be issued as-is without
  4289. * lowercasing. It can be called only before first write. Calling this method after
  4290. * the first write will throw an error. If the passed value is not a `string`, its
  4291. * `toString()` method will be called to obtain the final value.
  4292. *
  4293. * Certain headers are restricted from being set by apps. These headers are listed
  4294. * below. More information on restricted headers can be found in Chromium's header
  4295. * utils.
  4296. *
  4297. * * `Content-Length`
  4298. * * `Host`
  4299. * * `Trailer` or `Te`
  4300. * * `Upgrade`
  4301. * * `Cookie2`
  4302. * * `Keep-Alive`
  4303. * * `Transfer-Encoding`
  4304. *
  4305. * Additionally, setting the `Connection` header to the value `upgrade` is also
  4306. * disallowed.
  4307. */
  4308. setHeader(name: string, value: string): void;
  4309. /**
  4310. * `callback` is essentially a dummy function introduced in the purpose of keeping
  4311. * similarity with the Node.js API. It is called asynchronously in the next tick
  4312. * after `chunk` content have been delivered to the Chromium networking layer.
  4313. * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
  4314. * content have been flushed on the wire before `callback` is called.
  4315. *
  4316. * Adds a chunk of data to the request body. The first write operation may cause
  4317. * the request headers to be issued on the wire. After the first write operation,
  4318. * it is not allowed to add or remove a custom header.
  4319. */
  4320. write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  4321. /**
  4322. * A `boolean` specifying whether the request will use HTTP chunked transfer
  4323. * encoding or not. Defaults to false. The property is readable and writable,
  4324. * however it can be set only before the first write operation as the HTTP headers
  4325. * are not yet put on the wire. Trying to set the `chunkedEncoding` property after
  4326. * the first write will throw an error.
  4327. *
  4328. * Using chunked encoding is strongly recommended if you need to send a large
  4329. * request body as data will be streamed in small chunks instead of being
  4330. * internally buffered inside Electron process memory.
  4331. */
  4332. chunkedEncoding: boolean;
  4333. }
  4334. interface Clipboard {
  4335. // Docs: https://electronjs.org/docs/api/clipboard
  4336. /**
  4337. * An array of supported formats for the clipboard `type`.
  4338. */
  4339. availableFormats(type?: 'selection' | 'clipboard'): string[];
  4340. /**
  4341. * Clears the clipboard content.
  4342. */
  4343. clear(type?: 'selection' | 'clipboard'): void;
  4344. /**
  4345. * Whether the clipboard supports the specified `format`.
  4346. *
  4347. * @experimental
  4348. */
  4349. has(format: string, type?: 'selection' | 'clipboard'): boolean;
  4350. /**
  4351. * Reads `format` type from the clipboard.
  4352. *
  4353. * `format` should contain valid ASCII characters and have `/` separator. `a/c`,
  4354. * `a/bc` are valid formats while `/abc`, `abc/`, `a/`, `/a`, `a` are not valid.
  4355. *
  4356. * @experimental
  4357. */
  4358. read(format: string): string;
  4359. /**
  4360. * * `title` string
  4361. * * `url` string
  4362. *
  4363. * Returns an Object containing `title` and `url` keys representing the bookmark in
  4364. * the clipboard. The `title` and `url` values will be empty strings when the
  4365. * bookmark is unavailable. The `title` value will always be empty on Windows.
  4366. *
  4367. * @platform darwin,win32
  4368. */
  4369. readBookmark(): ReadBookmark;
  4370. /**
  4371. * Reads `format` type from the clipboard.
  4372. *
  4373. * @experimental
  4374. */
  4375. readBuffer(format: string): Buffer;
  4376. /**
  4377. * The text on the find pasteboard, which is the pasteboard that holds information
  4378. * about the current state of the active application’s find panel.
  4379. *
  4380. * This method uses synchronous IPC when called from the renderer process. The
  4381. * cached value is reread from the find pasteboard whenever the application is
  4382. * activated.
  4383. *
  4384. * @platform darwin
  4385. */
  4386. readFindText(): string;
  4387. /**
  4388. * The content in the clipboard as markup.
  4389. */
  4390. readHTML(type?: 'selection' | 'clipboard'): string;
  4391. /**
  4392. * The image content in the clipboard.
  4393. */
  4394. readImage(type?: 'selection' | 'clipboard'): NativeImage;
  4395. /**
  4396. * The content in the clipboard as RTF.
  4397. */
  4398. readRTF(type?: 'selection' | 'clipboard'): string;
  4399. /**
  4400. * The content in the clipboard as plain text.
  4401. */
  4402. readText(type?: 'selection' | 'clipboard'): string;
  4403. /**
  4404. * Writes `data` to the clipboard.
  4405. */
  4406. write(data: Data, type?: 'selection' | 'clipboard'): void;
  4407. /**
  4408. * Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
  4409. *
  4410. * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
  4411. * can use `clipboard.write` to write both a bookmark and fallback text to the
  4412. * clipboard.
  4413. *
  4414. * @platform darwin,win32
  4415. */
  4416. writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
  4417. /**
  4418. * Writes the `buffer` into the clipboard as `format`.
  4419. *
  4420. * @experimental
  4421. */
  4422. writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
  4423. /**
  4424. * Writes the `text` into the find pasteboard (the pasteboard that holds
  4425. * information about the current state of the active application’s find panel) as
  4426. * plain text. This method uses synchronous IPC when called from the renderer
  4427. * process.
  4428. *
  4429. * @platform darwin
  4430. */
  4431. writeFindText(text: string): void;
  4432. /**
  4433. * Writes `markup` to the clipboard.
  4434. */
  4435. writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
  4436. /**
  4437. * Writes `image` to the clipboard.
  4438. */
  4439. writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
  4440. /**
  4441. * Writes the `text` into the clipboard in RTF.
  4442. */
  4443. writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
  4444. /**
  4445. * Writes the `text` into the clipboard as plain text.
  4446. */
  4447. writeText(text: string, type?: 'selection' | 'clipboard'): void;
  4448. }
  4449. class CommandLine {
  4450. // Docs: https://electronjs.org/docs/api/command-line
  4451. /**
  4452. * Append an argument to Chromium's command line. The argument will be quoted
  4453. * correctly. Switches will precede arguments regardless of appending order.
  4454. *
  4455. * If you're appending an argument like `--switch=value`, consider using
  4456. * `appendSwitch('switch', 'value')` instead.
  4457. *
  4458. * **Note:** This will not affect `process.argv`. The intended usage of this
  4459. * function is to control Chromium's behavior.
  4460. */
  4461. appendArgument(value: string): void;
  4462. /**
  4463. * Append a switch (with optional `value`) to Chromium's command line.
  4464. *
  4465. * **Note:** This will not affect `process.argv`. The intended usage of this
  4466. * function is to control Chromium's behavior.
  4467. */
  4468. appendSwitch(the_switch: string, value?: string): void;
  4469. /**
  4470. * The command-line switch value.
  4471. *
  4472. * **Note:** When the switch is not present or has no value, it returns empty
  4473. * string.
  4474. */
  4475. getSwitchValue(the_switch: string): string;
  4476. /**
  4477. * Whether the command-line switch is present.
  4478. */
  4479. hasSwitch(the_switch: string): boolean;
  4480. /**
  4481. * Removes the specified switch from Chromium's command line.
  4482. *
  4483. * **Note:** This will not affect `process.argv`. The intended usage of this
  4484. * function is to control Chromium's behavior.
  4485. */
  4486. removeSwitch(the_switch: string): void;
  4487. }
  4488. interface ContentTracing {
  4489. // Docs: https://electronjs.org/docs/api/content-tracing
  4490. /**
  4491. * resolves with an array of category groups once all child processes have
  4492. * acknowledged the `getCategories` request
  4493. *
  4494. * Get a set of category groups. The category groups can change as new code paths
  4495. * are reached. See also the list of built-in tracing categories.
  4496. *
  4497. * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
  4498. * This category can be used to capture Electron-specific tracing events.
  4499. */
  4500. getCategories(): Promise<string[]>;
  4501. /**
  4502. * Resolves with an object containing the `value` and `percentage` of trace buffer
  4503. * maximum usage
  4504. *
  4505. * * `value` number
  4506. * * `percentage` number
  4507. *
  4508. * Get the maximum usage across processes of trace buffer as a percentage of the
  4509. * full state.
  4510. */
  4511. getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
  4512. /**
  4513. * resolved once all child processes have acknowledged the `startRecording`
  4514. * request.
  4515. *
  4516. * Start recording on all processes.
  4517. *
  4518. * Recording begins immediately locally and asynchronously on child processes as
  4519. * soon as they receive the EnableRecording request.
  4520. *
  4521. * If a recording is already running, the promise will be immediately resolved, as
  4522. * only one trace operation can be in progress at a time.
  4523. */
  4524. startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
  4525. /**
  4526. * resolves with a path to a file that contains the traced data once all child
  4527. * processes have acknowledged the `stopRecording` request
  4528. *
  4529. * Stop recording on all processes.
  4530. *
  4531. * Child processes typically cache trace data and only rarely flush and send trace
  4532. * data back to the main process. This helps to minimize the runtime overhead of
  4533. * tracing since sending trace data over IPC can be an expensive operation. So, to
  4534. * end tracing, Chromium asynchronously asks all child processes to flush any
  4535. * pending trace data.
  4536. *
  4537. * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
  4538. * or not provided, trace data will be written to a temporary file, and the path
  4539. * will be returned in the promise.
  4540. */
  4541. stopRecording(resultFilePath?: string): Promise<string>;
  4542. }
  4543. interface ContextBridge {
  4544. // Docs: https://electronjs.org/docs/api/context-bridge
  4545. exposeInIsolatedWorld(worldId: number, apiKey: string, api: any): void;
  4546. exposeInMainWorld(apiKey: string, api: any): void;
  4547. }
  4548. interface Cookie {
  4549. // Docs: https://electronjs.org/docs/api/structures/cookie
  4550. /**
  4551. * The domain of the cookie; this will be normalized with a preceding dot so that
  4552. * it's also valid for subdomains.
  4553. */
  4554. domain?: string;
  4555. /**
  4556. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  4557. * Not provided for session cookies.
  4558. */
  4559. expirationDate?: number;
  4560. /**
  4561. * Whether the cookie is a host-only cookie; this will only be `true` if no domain
  4562. * was passed.
  4563. */
  4564. hostOnly?: boolean;
  4565. /**
  4566. * Whether the cookie is marked as HTTP only.
  4567. */
  4568. httpOnly?: boolean;
  4569. /**
  4570. * The name of the cookie.
  4571. */
  4572. name: string;
  4573. /**
  4574. * The path of the cookie.
  4575. */
  4576. path?: string;
  4577. /**
  4578. * The Same Site policy applied to this cookie. Can be `unspecified`,
  4579. * `no_restriction`, `lax` or `strict`.
  4580. */
  4581. sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  4582. /**
  4583. * Whether the cookie is marked as secure.
  4584. */
  4585. secure?: boolean;
  4586. /**
  4587. * Whether the cookie is a session cookie or a persistent cookie with an expiration
  4588. * date.
  4589. */
  4590. session?: boolean;
  4591. /**
  4592. * The value of the cookie.
  4593. */
  4594. value: string;
  4595. }
  4596. class Cookies extends NodeEventEmitter {
  4597. // Docs: https://electronjs.org/docs/api/cookies
  4598. /**
  4599. * Emitted when a cookie is changed because it was added, edited, removed, or
  4600. * expired.
  4601. */
  4602. on(event: 'changed', listener: (event: Event,
  4603. /**
  4604. * The cookie that was changed.
  4605. */
  4606. cookie: Cookie,
  4607. /**
  4608. * The cause of the change with one of the following values:
  4609. */
  4610. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  4611. /**
  4612. * `true` if the cookie was removed, `false` otherwise.
  4613. */
  4614. removed: boolean) => void): this;
  4615. off(event: 'changed', listener: (event: Event,
  4616. /**
  4617. * The cookie that was changed.
  4618. */
  4619. cookie: Cookie,
  4620. /**
  4621. * The cause of the change with one of the following values:
  4622. */
  4623. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  4624. /**
  4625. * `true` if the cookie was removed, `false` otherwise.
  4626. */
  4627. removed: boolean) => void): this;
  4628. once(event: 'changed', listener: (event: Event,
  4629. /**
  4630. * The cookie that was changed.
  4631. */
  4632. cookie: Cookie,
  4633. /**
  4634. * The cause of the change with one of the following values:
  4635. */
  4636. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  4637. /**
  4638. * `true` if the cookie was removed, `false` otherwise.
  4639. */
  4640. removed: boolean) => void): this;
  4641. addListener(event: 'changed', listener: (event: Event,
  4642. /**
  4643. * The cookie that was changed.
  4644. */
  4645. cookie: Cookie,
  4646. /**
  4647. * The cause of the change with one of the following values:
  4648. */
  4649. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  4650. /**
  4651. * `true` if the cookie was removed, `false` otherwise.
  4652. */
  4653. removed: boolean) => void): this;
  4654. removeListener(event: 'changed', listener: (event: Event,
  4655. /**
  4656. * The cookie that was changed.
  4657. */
  4658. cookie: Cookie,
  4659. /**
  4660. * The cause of the change with one of the following values:
  4661. */
  4662. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  4663. /**
  4664. * `true` if the cookie was removed, `false` otherwise.
  4665. */
  4666. removed: boolean) => void): this;
  4667. /**
  4668. * A promise which resolves when the cookie store has been flushed
  4669. *
  4670. * Writes any unwritten cookies data to disk
  4671. *
  4672. * Cookies written by any method will not be written to disk immediately, but will
  4673. * be written every 30 seconds or 512 operations
  4674. *
  4675. * Calling this method can cause the cookie to be written to disk immediately.
  4676. */
  4677. flushStore(): Promise<void>;
  4678. /**
  4679. * A promise which resolves an array of cookie objects.
  4680. *
  4681. * Sends a request to get all cookies matching `filter`, and resolves a promise
  4682. * with the response.
  4683. */
  4684. get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
  4685. /**
  4686. * A promise which resolves when the cookie has been removed
  4687. *
  4688. * Removes the cookies matching `url` and `name`
  4689. */
  4690. remove(url: string, name: string): Promise<void>;
  4691. /**
  4692. * A promise which resolves when the cookie has been set
  4693. *
  4694. * Sets a cookie with `details`.
  4695. */
  4696. set(details: CookiesSetDetails): Promise<void>;
  4697. }
  4698. interface CPUUsage {
  4699. // Docs: https://electronjs.org/docs/api/structures/cpu-usage
  4700. /**
  4701. * The number of average idle CPU wakeups per second since the last call to
  4702. * getCPUUsage. First call returns 0. Will always return 0 on Windows.
  4703. */
  4704. idleWakeupsPerSecond: number;
  4705. /**
  4706. * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
  4707. */
  4708. percentCPUUsage: number;
  4709. }
  4710. interface CrashReport {
  4711. // Docs: https://electronjs.org/docs/api/structures/crash-report
  4712. date: Date;
  4713. id: string;
  4714. }
  4715. interface CrashReporter {
  4716. // Docs: https://electronjs.org/docs/api/crash-reporter
  4717. /**
  4718. * Set an extra parameter to be sent with the crash report. The values specified
  4719. * here will be sent in addition to any values set via the `extra` option when
  4720. * `start` was called.
  4721. *
  4722. * Parameters added in this fashion (or via the `extra` parameter to
  4723. * `crashReporter.start`) are specific to the calling process. Adding extra
  4724. * parameters in the main process will not cause those parameters to be sent along
  4725. * with crashes from renderer or other child processes. Similarly, adding extra
  4726. * parameters in a renderer process will not result in those parameters being sent
  4727. * with crashes that occur in other renderer processes or in the main process.
  4728. *
  4729. * **Note:** Parameters have limits on the length of the keys and values. Key names
  4730. * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
  4731. * Keys with names longer than the maximum will be silently ignored. Key values
  4732. * longer than the maximum length will be truncated.
  4733. */
  4734. addExtraParameter(key: string, value: string): void;
  4735. /**
  4736. * The date and ID of the last crash report. Only crash reports that have been
  4737. * uploaded will be returned; even if a crash report is present on disk it will not
  4738. * be returned until it is uploaded. In the case that there are no uploaded
  4739. * reports, `null` is returned.
  4740. *
  4741. * **Note:** This method is only available in the main process.
  4742. */
  4743. getLastCrashReport(): CrashReport;
  4744. /**
  4745. * The current 'extra' parameters of the crash reporter.
  4746. */
  4747. getParameters(): Record<string, string>;
  4748. /**
  4749. * Returns all uploaded crash reports. Each report contains the date and uploaded
  4750. * ID.
  4751. *
  4752. * **Note:** This method is only available in the main process.
  4753. */
  4754. getUploadedReports(): CrashReport[];
  4755. /**
  4756. * Whether reports should be submitted to the server. Set through the `start`
  4757. * method or `setUploadToServer`.
  4758. *
  4759. * **Note:** This method is only available in the main process.
  4760. */
  4761. getUploadToServer(): boolean;
  4762. /**
  4763. * Remove an extra parameter from the current set of parameters. Future crashes
  4764. * will not include this parameter.
  4765. */
  4766. removeExtraParameter(key: string): void;
  4767. /**
  4768. * This would normally be controlled by user preferences. This has no effect if
  4769. * called before `start` is called.
  4770. *
  4771. * **Note:** This method is only available in the main process.
  4772. */
  4773. setUploadToServer(uploadToServer: boolean): void;
  4774. /**
  4775. * This method must be called before using any other `crashReporter` APIs. Once
  4776. * initialized this way, the crashpad handler collects crashes from all
  4777. * subsequently created processes. The crash reporter cannot be disabled once
  4778. * started.
  4779. *
  4780. * This method should be called as early as possible in app startup, preferably
  4781. * before `app.on('ready')`. If the crash reporter is not initialized at the time a
  4782. * renderer process is created, then that renderer process will not be monitored by
  4783. * the crash reporter.
  4784. *
  4785. * **Note:** You can test out the crash reporter by generating a crash using
  4786. * `process.crash()`.
  4787. *
  4788. * **Note:** If you need to send additional/updated `extra` parameters after your
  4789. * first call `start` you can call `addExtraParameter`.
  4790. *
  4791. * **Note:** Parameters passed in `extra`, `globalExtra` or set with
  4792. * `addExtraParameter` have limits on the length of the keys and values. Key names
  4793. * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
  4794. * with names longer than the maximum will be silently ignored. Key values longer
  4795. * than the maximum length will be truncated.
  4796. *
  4797. * **Note:** This method is only available in the main process.
  4798. */
  4799. start(options: CrashReporterStartOptions): void;
  4800. }
  4801. interface CustomScheme {
  4802. // Docs: https://electronjs.org/docs/api/structures/custom-scheme
  4803. privileges?: Privileges;
  4804. /**
  4805. * Custom schemes to be registered with options.
  4806. */
  4807. scheme: string;
  4808. }
  4809. class Debugger extends NodeEventEmitter {
  4810. // Docs: https://electronjs.org/docs/api/debugger
  4811. /**
  4812. * Emitted when the debugging session is terminated. This happens either when
  4813. * `webContents` is closed or devtools is invoked for the attached `webContents`.
  4814. */
  4815. on(event: 'detach', listener: (event: Event,
  4816. /**
  4817. * Reason for detaching debugger.
  4818. */
  4819. reason: string) => void): this;
  4820. off(event: 'detach', listener: (event: Event,
  4821. /**
  4822. * Reason for detaching debugger.
  4823. */
  4824. reason: string) => void): this;
  4825. once(event: 'detach', listener: (event: Event,
  4826. /**
  4827. * Reason for detaching debugger.
  4828. */
  4829. reason: string) => void): this;
  4830. addListener(event: 'detach', listener: (event: Event,
  4831. /**
  4832. * Reason for detaching debugger.
  4833. */
  4834. reason: string) => void): this;
  4835. removeListener(event: 'detach', listener: (event: Event,
  4836. /**
  4837. * Reason for detaching debugger.
  4838. */
  4839. reason: string) => void): this;
  4840. /**
  4841. * Emitted whenever the debugging target issues an instrumentation event.
  4842. */
  4843. on(event: 'message', listener: (event: Event,
  4844. /**
  4845. * Method name.
  4846. */
  4847. method: string,
  4848. /**
  4849. * Event parameters defined by the 'parameters' attribute in the remote debugging
  4850. * protocol.
  4851. */
  4852. params: any,
  4853. /**
  4854. * Unique identifier of attached debugging session, will match the value sent from
  4855. * `debugger.sendCommand`.
  4856. */
  4857. sessionId: string) => void): this;
  4858. off(event: 'message', listener: (event: Event,
  4859. /**
  4860. * Method name.
  4861. */
  4862. method: string,
  4863. /**
  4864. * Event parameters defined by the 'parameters' attribute in the remote debugging
  4865. * protocol.
  4866. */
  4867. params: any,
  4868. /**
  4869. * Unique identifier of attached debugging session, will match the value sent from
  4870. * `debugger.sendCommand`.
  4871. */
  4872. sessionId: string) => void): this;
  4873. once(event: 'message', listener: (event: Event,
  4874. /**
  4875. * Method name.
  4876. */
  4877. method: string,
  4878. /**
  4879. * Event parameters defined by the 'parameters' attribute in the remote debugging
  4880. * protocol.
  4881. */
  4882. params: any,
  4883. /**
  4884. * Unique identifier of attached debugging session, will match the value sent from
  4885. * `debugger.sendCommand`.
  4886. */
  4887. sessionId: string) => void): this;
  4888. addListener(event: 'message', listener: (event: Event,
  4889. /**
  4890. * Method name.
  4891. */
  4892. method: string,
  4893. /**
  4894. * Event parameters defined by the 'parameters' attribute in the remote debugging
  4895. * protocol.
  4896. */
  4897. params: any,
  4898. /**
  4899. * Unique identifier of attached debugging session, will match the value sent from
  4900. * `debugger.sendCommand`.
  4901. */
  4902. sessionId: string) => void): this;
  4903. removeListener(event: 'message', listener: (event: Event,
  4904. /**
  4905. * Method name.
  4906. */
  4907. method: string,
  4908. /**
  4909. * Event parameters defined by the 'parameters' attribute in the remote debugging
  4910. * protocol.
  4911. */
  4912. params: any,
  4913. /**
  4914. * Unique identifier of attached debugging session, will match the value sent from
  4915. * `debugger.sendCommand`.
  4916. */
  4917. sessionId: string) => void): this;
  4918. /**
  4919. * Attaches the debugger to the `webContents`.
  4920. */
  4921. attach(protocolVersion?: string): void;
  4922. /**
  4923. * Detaches the debugger from the `webContents`.
  4924. */
  4925. detach(): void;
  4926. /**
  4927. * Whether a debugger is attached to the `webContents`.
  4928. */
  4929. isAttached(): boolean;
  4930. /**
  4931. * A promise that resolves with the response defined by the 'returns' attribute of
  4932. * the command description in the remote debugging protocol or is rejected
  4933. * indicating the failure of the command.
  4934. *
  4935. * Send given command to the debugging target.
  4936. */
  4937. sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
  4938. }
  4939. interface DesktopCapturer {
  4940. // Docs: https://electronjs.org/docs/api/desktop-capturer
  4941. /**
  4942. * Resolves with an array of `DesktopCapturerSource` objects, each
  4943. * `DesktopCapturerSource` represents a screen or an individual window that can be
  4944. * captured.
  4945. *
  4946. * **Note** Capturing the screen contents requires user consent on macOS 10.15
  4947. * Catalina or higher, which can detected by
  4948. * `systemPreferences.getMediaAccessStatus`.
  4949. */
  4950. getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
  4951. }
  4952. interface DesktopCapturerSource {
  4953. // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
  4954. /**
  4955. * An icon image of the application that owns the window or null if the source has
  4956. * a type screen. The size of the icon is not known in advance and depends on what
  4957. * the application provides.
  4958. */
  4959. appIcon: NativeImage;
  4960. /**
  4961. * A unique identifier that will correspond to the `id` of the matching Display
  4962. * returned by the Screen API. On some platforms, this is equivalent to the `XX`
  4963. * portion of the `id` field above and on others it will differ. It will be an
  4964. * empty string if not available.
  4965. */
  4966. display_id: string;
  4967. /**
  4968. * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
  4969. * constraint when calling `navigator.getUserMedia`. The format of the identifier
  4970. * will be `window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle. YY is 1 for
  4971. * the current process, and 0 for all others. ZZ is a sequential number that
  4972. * represents the screen, and it does not equal to the index in the source's name.
  4973. */
  4974. id: string;
  4975. /**
  4976. * A screen source will be named either `Entire Screen` or `Screen <index>`, while
  4977. * the name of a window source will match the window title.
  4978. */
  4979. name: string;
  4980. /**
  4981. * A thumbnail image. **Note:** There is no guarantee that the size of the
  4982. * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
  4983. * to `desktopCapturer.getSources`. The actual size depends on the scale of the
  4984. * screen or window.
  4985. */
  4986. thumbnail: NativeImage;
  4987. }
  4988. interface Dialog {
  4989. // Docs: https://electronjs.org/docs/api/dialog
  4990. /**
  4991. * resolves when the certificate trust dialog is shown.
  4992. *
  4993. * On macOS, this displays a modal dialog that shows a message and certificate
  4994. * information, and gives the user the option of trusting/importing the
  4995. * certificate. If you provide a `browserWindow` argument the dialog will be
  4996. * attached to the parent window, making it modal.
  4997. *
  4998. * On Windows the options are more limited, due to the Win32 APIs used:
  4999. *
  5000. * * The `message` argument is not used, as the OS provides its own confirmation
  5001. * dialog.
  5002. * * The `browserWindow` argument is ignored since it is not possible to make this
  5003. * confirmation dialog modal.
  5004. *
  5005. * @platform darwin,win32
  5006. */
  5007. showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
  5008. /**
  5009. * resolves when the certificate trust dialog is shown.
  5010. *
  5011. * On macOS, this displays a modal dialog that shows a message and certificate
  5012. * information, and gives the user the option of trusting/importing the
  5013. * certificate. If you provide a `browserWindow` argument the dialog will be
  5014. * attached to the parent window, making it modal.
  5015. *
  5016. * On Windows the options are more limited, due to the Win32 APIs used:
  5017. *
  5018. * * The `message` argument is not used, as the OS provides its own confirmation
  5019. * dialog.
  5020. * * The `browserWindow` argument is ignored since it is not possible to make this
  5021. * confirmation dialog modal.
  5022. *
  5023. * @platform darwin,win32
  5024. */
  5025. showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
  5026. /**
  5027. * Displays a modal dialog that shows an error message.
  5028. *
  5029. * This API can be called safely before the `ready` event the `app` module emits,
  5030. * it is usually used to report errors in early stage of startup. If called before
  5031. * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
  5032. * dialog will appear.
  5033. */
  5034. showErrorBox(title: string, content: string): void;
  5035. /**
  5036. * resolves with a promise containing the following properties:
  5037. *
  5038. * * `response` number - The index of the clicked button.
  5039. * * `checkboxChecked` boolean - The checked state of the checkbox if
  5040. * `checkboxLabel` was set. Otherwise `false`.
  5041. *
  5042. * Shows a message box.
  5043. *
  5044. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5045. * window, making it modal.
  5046. */
  5047. showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  5048. /**
  5049. * resolves with a promise containing the following properties:
  5050. *
  5051. * * `response` number - The index of the clicked button.
  5052. * * `checkboxChecked` boolean - The checked state of the checkbox if
  5053. * `checkboxLabel` was set. Otherwise `false`.
  5054. *
  5055. * Shows a message box.
  5056. *
  5057. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5058. * window, making it modal.
  5059. */
  5060. showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  5061. /**
  5062. * the index of the clicked button.
  5063. *
  5064. * Shows a message box, it will block the process until the message box is closed.
  5065. * It returns the index of the clicked button.
  5066. *
  5067. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5068. * window, making it modal. If `browserWindow` is not shown dialog will not be
  5069. * attached to it. In such case it will be displayed as an independent window.
  5070. */
  5071. showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
  5072. /**
  5073. * the index of the clicked button.
  5074. *
  5075. * Shows a message box, it will block the process until the message box is closed.
  5076. * It returns the index of the clicked button.
  5077. *
  5078. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5079. * window, making it modal. If `browserWindow` is not shown dialog will not be
  5080. * attached to it. In such case it will be displayed as an independent window.
  5081. */
  5082. showMessageBoxSync(options: MessageBoxSyncOptions): number;
  5083. /**
  5084. * Resolve with an object containing the following:
  5085. *
  5086. * * `canceled` boolean - whether or not the dialog was canceled.
  5087. * * `filePaths` string[] - An array of file paths chosen by the user. If the
  5088. * dialog is cancelled this will be an empty array.
  5089. * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
  5090. * `filePaths` array of base64 encoded strings which contains security scoped
  5091. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  5092. * populated. (For return values, see table here.)
  5093. *
  5094. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5095. * window, making it modal.
  5096. *
  5097. * The `filters` specifies an array of file types that can be displayed or selected
  5098. * when you want to limit the user to a specific type. For example:
  5099. *
  5100. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  5101. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  5102. * `'*'` wildcard (no other wildcard is supported).
  5103. *
  5104. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  5105. * and a directory selector, so if you set `properties` to `['openFile',
  5106. * 'openDirectory']` on these platforms, a directory selector will be shown.
  5107. */
  5108. showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  5109. /**
  5110. * Resolve with an object containing the following:
  5111. *
  5112. * * `canceled` boolean - whether or not the dialog was canceled.
  5113. * * `filePaths` string[] - An array of file paths chosen by the user. If the
  5114. * dialog is cancelled this will be an empty array.
  5115. * * `bookmarks` string[] (optional) _macOS_ _mas_ - An array matching the
  5116. * `filePaths` array of base64 encoded strings which contains security scoped
  5117. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  5118. * populated. (For return values, see table here.)
  5119. *
  5120. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5121. * window, making it modal.
  5122. *
  5123. * The `filters` specifies an array of file types that can be displayed or selected
  5124. * when you want to limit the user to a specific type. For example:
  5125. *
  5126. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  5127. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  5128. * `'*'` wildcard (no other wildcard is supported).
  5129. *
  5130. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  5131. * and a directory selector, so if you set `properties` to `['openFile',
  5132. * 'openDirectory']` on these platforms, a directory selector will be shown.
  5133. */
  5134. showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  5135. /**
  5136. * the file paths chosen by the user; if the dialog is cancelled it returns
  5137. * `undefined`.
  5138. *
  5139. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5140. * window, making it modal.
  5141. *
  5142. * The `filters` specifies an array of file types that can be displayed or selected
  5143. * when you want to limit the user to a specific type. For example:
  5144. *
  5145. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  5146. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  5147. * `'*'` wildcard (no other wildcard is supported).
  5148. *
  5149. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  5150. * and a directory selector, so if you set `properties` to `['openFile',
  5151. * 'openDirectory']` on these platforms, a directory selector will be shown.
  5152. */
  5153. showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
  5154. /**
  5155. * the file paths chosen by the user; if the dialog is cancelled it returns
  5156. * `undefined`.
  5157. *
  5158. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5159. * window, making it modal.
  5160. *
  5161. * The `filters` specifies an array of file types that can be displayed or selected
  5162. * when you want to limit the user to a specific type. For example:
  5163. *
  5164. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  5165. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  5166. * `'*'` wildcard (no other wildcard is supported).
  5167. *
  5168. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  5169. * and a directory selector, so if you set `properties` to `['openFile',
  5170. * 'openDirectory']` on these platforms, a directory selector will be shown.
  5171. */
  5172. showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
  5173. /**
  5174. * Resolve with an object containing the following:
  5175. *
  5176. * * `canceled` boolean - whether or not the dialog was canceled.
  5177. * * `filePath` string - If the dialog is canceled, this will be an empty string.
  5178. * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
  5179. * contains the security scoped bookmark data for the saved file.
  5180. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  5181. * values, see table here.)
  5182. *
  5183. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5184. * window, making it modal.
  5185. *
  5186. * The `filters` specifies an array of file types that can be displayed, see
  5187. * `dialog.showOpenDialog` for an example.
  5188. *
  5189. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  5190. * issues when expanding and collapsing the dialog.
  5191. */
  5192. showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  5193. /**
  5194. * Resolve with an object containing the following:
  5195. *
  5196. * * `canceled` boolean - whether or not the dialog was canceled.
  5197. * * `filePath` string - If the dialog is canceled, this will be an empty string.
  5198. * * `bookmark` string (optional) _macOS_ _mas_ - Base64 encoded string which
  5199. * contains the security scoped bookmark data for the saved file.
  5200. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  5201. * values, see table here.)
  5202. *
  5203. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5204. * window, making it modal.
  5205. *
  5206. * The `filters` specifies an array of file types that can be displayed, see
  5207. * `dialog.showOpenDialog` for an example.
  5208. *
  5209. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  5210. * issues when expanding and collapsing the dialog.
  5211. */
  5212. showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  5213. /**
  5214. * the path of the file chosen by the user; if the dialog is cancelled it returns
  5215. * an empty string.
  5216. *
  5217. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5218. * window, making it modal.
  5219. *
  5220. * The `filters` specifies an array of file types that can be displayed, see
  5221. * `dialog.showOpenDialog` for an example.
  5222. */
  5223. showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): string;
  5224. /**
  5225. * the path of the file chosen by the user; if the dialog is cancelled it returns
  5226. * an empty string.
  5227. *
  5228. * The `browserWindow` argument allows the dialog to attach itself to a parent
  5229. * window, making it modal.
  5230. *
  5231. * The `filters` specifies an array of file types that can be displayed, see
  5232. * `dialog.showOpenDialog` for an example.
  5233. */
  5234. showSaveDialogSync(options: SaveDialogSyncOptions): string;
  5235. }
  5236. interface Display {
  5237. // Docs: https://electronjs.org/docs/api/structures/display
  5238. /**
  5239. * Can be `available`, `unavailable`, `unknown`.
  5240. */
  5241. accelerometerSupport: ('available' | 'unavailable' | 'unknown');
  5242. /**
  5243. * the bounds of the display in DIP points.
  5244. */
  5245. bounds: Rectangle;
  5246. /**
  5247. * The number of bits per pixel.
  5248. */
  5249. colorDepth: number;
  5250. /**
  5251. * represent a color space (three-dimensional object which contains all realizable
  5252. * color combinations) for the purpose of color conversions.
  5253. */
  5254. colorSpace: string;
  5255. /**
  5256. * The number of bits per color component.
  5257. */
  5258. depthPerComponent: number;
  5259. /**
  5260. * `true`` if the display is detected by the system.
  5261. */
  5262. detected: boolean;
  5263. /**
  5264. * The display refresh rate.
  5265. */
  5266. displayFrequency: number;
  5267. /**
  5268. * Unique identifier associated with the display. A value of of -1 means the
  5269. * display is invalid or the correct `id` is not yet known, and a value of -10
  5270. * means the display is a virtual display assigned to a unified desktop.
  5271. */
  5272. id: number;
  5273. /**
  5274. * `true` for an internal display and `false` for an external display.
  5275. */
  5276. internal: boolean;
  5277. /**
  5278. * User-friendly label, determined by the platform.
  5279. */
  5280. label: string;
  5281. /**
  5282. * Maximum cursor size in native pixels.
  5283. */
  5284. maximumCursorSize: Size;
  5285. /**
  5286. * Whether or not the display is a monochrome display.
  5287. */
  5288. monochrome: boolean;
  5289. /**
  5290. * Returns the display's origin in pixel coordinates. Only available on windowing
  5291. * systems like X11 that position displays in pixel coordinates.
  5292. */
  5293. nativeOrigin: Point;
  5294. /**
  5295. * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
  5296. */
  5297. rotation: number;
  5298. /**
  5299. * Output device's pixel scale factor.
  5300. */
  5301. scaleFactor: number;
  5302. size: Size;
  5303. /**
  5304. * Can be `available`, `unavailable`, `unknown`.
  5305. */
  5306. touchSupport: ('available' | 'unavailable' | 'unknown');
  5307. /**
  5308. * the work area of the display in DIP points.
  5309. */
  5310. workArea: Rectangle;
  5311. /**
  5312. * The size of the work area.
  5313. */
  5314. workAreaSize: Size;
  5315. }
  5316. class Dock {
  5317. // Docs: https://electronjs.org/docs/api/dock
  5318. /**
  5319. * an ID representing the request.
  5320. *
  5321. * When `critical` is passed, the dock icon will bounce until either the
  5322. * application becomes active or the request is canceled.
  5323. *
  5324. * When `informational` is passed, the dock icon will bounce for one second.
  5325. * However, the request remains active until either the application becomes active
  5326. * or the request is canceled.
  5327. *
  5328. * **Note:** This method can only be used while the app is not focused; when the
  5329. * app is focused it will return -1.
  5330. *
  5331. * @platform darwin
  5332. */
  5333. bounce(type?: 'critical' | 'informational'): number;
  5334. /**
  5335. * Cancel the bounce of `id`.
  5336. *
  5337. * @platform darwin
  5338. */
  5339. cancelBounce(id: number): void;
  5340. /**
  5341. * Bounces the Downloads stack if the filePath is inside the Downloads folder.
  5342. *
  5343. * @platform darwin
  5344. */
  5345. downloadFinished(filePath: string): void;
  5346. /**
  5347. * The badge string of the dock.
  5348. *
  5349. * @platform darwin
  5350. */
  5351. getBadge(): string;
  5352. /**
  5353. * The application's dock menu.
  5354. *
  5355. * @platform darwin
  5356. */
  5357. getMenu(): (Menu) | (null);
  5358. /**
  5359. * Hides the dock icon.
  5360. *
  5361. * @platform darwin
  5362. */
  5363. hide(): void;
  5364. /**
  5365. * Whether the dock icon is visible.
  5366. *
  5367. * @platform darwin
  5368. */
  5369. isVisible(): boolean;
  5370. /**
  5371. * Sets the string to be displayed in the dock’s badging area.
  5372. *
  5373. * @platform darwin
  5374. */
  5375. setBadge(text: string): void;
  5376. /**
  5377. * Sets the `image` associated with this dock icon.
  5378. *
  5379. * @platform darwin
  5380. */
  5381. setIcon(image: (NativeImage) | (string)): void;
  5382. /**
  5383. * Sets the application's dock menu.
  5384. *
  5385. * @platform darwin
  5386. */
  5387. setMenu(menu: Menu): void;
  5388. /**
  5389. * Resolves when the dock icon is shown.
  5390. *
  5391. * @platform darwin
  5392. */
  5393. show(): Promise<void>;
  5394. }
  5395. class DownloadItem extends NodeEventEmitter {
  5396. // Docs: https://electronjs.org/docs/api/download-item
  5397. /**
  5398. * Emitted when the download is in a terminal state. This includes a completed
  5399. * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
  5400. * download that can't be resumed.
  5401. *
  5402. * The `state` can be one of following:
  5403. *
  5404. * * `completed` - The download completed successfully.
  5405. * * `cancelled` - The download has been cancelled.
  5406. * * `interrupted` - The download has interrupted and can not resume.
  5407. */
  5408. on(event: 'done', listener: (event: Event,
  5409. /**
  5410. * Can be `completed`, `cancelled` or `interrupted`.
  5411. */
  5412. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  5413. off(event: 'done', listener: (event: Event,
  5414. /**
  5415. * Can be `completed`, `cancelled` or `interrupted`.
  5416. */
  5417. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  5418. once(event: 'done', listener: (event: Event,
  5419. /**
  5420. * Can be `completed`, `cancelled` or `interrupted`.
  5421. */
  5422. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  5423. addListener(event: 'done', listener: (event: Event,
  5424. /**
  5425. * Can be `completed`, `cancelled` or `interrupted`.
  5426. */
  5427. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  5428. removeListener(event: 'done', listener: (event: Event,
  5429. /**
  5430. * Can be `completed`, `cancelled` or `interrupted`.
  5431. */
  5432. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  5433. /**
  5434. * Emitted when the download has been updated and is not done.
  5435. *
  5436. * The `state` can be one of following:
  5437. *
  5438. * * `progressing` - The download is in-progress.
  5439. * * `interrupted` - The download has interrupted and can be resumed.
  5440. */
  5441. on(event: 'updated', listener: (event: Event,
  5442. /**
  5443. * Can be `progressing` or `interrupted`.
  5444. */
  5445. state: ('progressing' | 'interrupted')) => void): this;
  5446. off(event: 'updated', listener: (event: Event,
  5447. /**
  5448. * Can be `progressing` or `interrupted`.
  5449. */
  5450. state: ('progressing' | 'interrupted')) => void): this;
  5451. once(event: 'updated', listener: (event: Event,
  5452. /**
  5453. * Can be `progressing` or `interrupted`.
  5454. */
  5455. state: ('progressing' | 'interrupted')) => void): this;
  5456. addListener(event: 'updated', listener: (event: Event,
  5457. /**
  5458. * Can be `progressing` or `interrupted`.
  5459. */
  5460. state: ('progressing' | 'interrupted')) => void): this;
  5461. removeListener(event: 'updated', listener: (event: Event,
  5462. /**
  5463. * Can be `progressing` or `interrupted`.
  5464. */
  5465. state: ('progressing' | 'interrupted')) => void): this;
  5466. /**
  5467. * Cancels the download operation.
  5468. */
  5469. cancel(): void;
  5470. /**
  5471. * Whether the download can resume.
  5472. */
  5473. canResume(): boolean;
  5474. /**
  5475. * The Content-Disposition field from the response header.
  5476. */
  5477. getContentDisposition(): string;
  5478. /**
  5479. * ETag header value.
  5480. */
  5481. getETag(): string;
  5482. /**
  5483. * The file name of the download item.
  5484. *
  5485. * **Note:** The file name is not always the same as the actual one saved in local
  5486. * disk. If user changes the file name in a prompted download saving dialog, the
  5487. * actual name of saved file will be different.
  5488. */
  5489. getFilename(): string;
  5490. /**
  5491. * Last-Modified header value.
  5492. */
  5493. getLastModifiedTime(): string;
  5494. /**
  5495. * The files mime type.
  5496. */
  5497. getMimeType(): string;
  5498. /**
  5499. * The received bytes of the download item.
  5500. */
  5501. getReceivedBytes(): number;
  5502. /**
  5503. * Returns the object previously set by
  5504. * `downloadItem.setSaveDialogOptions(options)`.
  5505. */
  5506. getSaveDialogOptions(): SaveDialogOptions;
  5507. /**
  5508. * The save path of the download item. This will be either the path set via
  5509. * `downloadItem.setSavePath(path)` or the path selected from the shown save
  5510. * dialog.
  5511. */
  5512. getSavePath(): string;
  5513. /**
  5514. * Number of seconds since the UNIX epoch when the download was started.
  5515. */
  5516. getStartTime(): number;
  5517. /**
  5518. * The current state. Can be `progressing`, `completed`, `cancelled` or
  5519. * `interrupted`.
  5520. *
  5521. * **Note:** The following methods are useful specifically to resume a `cancelled`
  5522. * item when session is restarted.
  5523. */
  5524. getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
  5525. /**
  5526. * The total size in bytes of the download item.
  5527. *
  5528. * If the size is unknown, it returns 0.
  5529. */
  5530. getTotalBytes(): number;
  5531. /**
  5532. * The origin URL where the item is downloaded from.
  5533. */
  5534. getURL(): string;
  5535. /**
  5536. * The complete URL chain of the item including any redirects.
  5537. */
  5538. getURLChain(): string[];
  5539. /**
  5540. * Whether the download has user gesture.
  5541. */
  5542. hasUserGesture(): boolean;
  5543. /**
  5544. * Whether the download is paused.
  5545. */
  5546. isPaused(): boolean;
  5547. /**
  5548. * Pauses the download.
  5549. */
  5550. pause(): void;
  5551. /**
  5552. * Resumes the download that has been paused.
  5553. *
  5554. * **Note:** To enable resumable downloads the server you are downloading from must
  5555. * support range requests and provide both `Last-Modified` and `ETag` header
  5556. * values. Otherwise `resume()` will dismiss previously received bytes and restart
  5557. * the download from the beginning.
  5558. */
  5559. resume(): void;
  5560. /**
  5561. * This API allows the user to set custom options for the save dialog that opens
  5562. * for the download item by default. The API is only available in session's
  5563. * `will-download` callback function.
  5564. */
  5565. setSaveDialogOptions(options: SaveDialogOptions): void;
  5566. /**
  5567. * The API is only available in session's `will-download` callback function. If
  5568. * `path` doesn't exist, Electron will try to make the directory recursively. If
  5569. * user doesn't set the save path via the API, Electron will use the original
  5570. * routine to determine the save path; this usually prompts a save dialog.
  5571. */
  5572. setSavePath(path: string): void;
  5573. /**
  5574. * A `string` property that determines the save file path of the download item.
  5575. *
  5576. * The property is only available in session's `will-download` callback function.
  5577. * If user doesn't set the save path via the property, Electron will use the
  5578. * original routine to determine the save path; this usually prompts a save dialog.
  5579. */
  5580. savePath: string;
  5581. }
  5582. interface Extension {
  5583. // Docs: https://electronjs.org/docs/api/structures/extension
  5584. id: string;
  5585. /**
  5586. * Copy of the extension's manifest data.
  5587. */
  5588. manifest: any;
  5589. name: string;
  5590. /**
  5591. * The extension's file path.
  5592. */
  5593. path: string;
  5594. /**
  5595. * The extension's `chrome-extension://` URL.
  5596. */
  5597. url: string;
  5598. version: string;
  5599. }
  5600. interface ExtensionInfo {
  5601. // Docs: https://electronjs.org/docs/api/structures/extension-info
  5602. name: string;
  5603. version: string;
  5604. }
  5605. interface FileFilter {
  5606. // Docs: https://electronjs.org/docs/api/structures/file-filter
  5607. extensions: string[];
  5608. name: string;
  5609. }
  5610. interface FilePathWithHeaders {
  5611. // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
  5612. /**
  5613. * Additional headers to be sent.
  5614. */
  5615. headers?: Record<string, string>;
  5616. /**
  5617. * The path to the file to send.
  5618. */
  5619. path: string;
  5620. }
  5621. interface GlobalShortcut {
  5622. // Docs: https://electronjs.org/docs/api/global-shortcut
  5623. /**
  5624. * Whether this application has registered `accelerator`.
  5625. *
  5626. * When the accelerator is already taken by other applications, this call will
  5627. * still return `false`. This behavior is intended by operating systems, since they
  5628. * don't want applications to fight for global shortcuts.
  5629. */
  5630. isRegistered(accelerator: Accelerator): boolean;
  5631. /**
  5632. * Whether or not the shortcut was registered successfully.
  5633. *
  5634. * Registers a global shortcut of `accelerator`. The `callback` is called when the
  5635. * registered shortcut is pressed by the user.
  5636. *
  5637. * When the accelerator is already taken by other applications, this call will
  5638. * silently fail. This behavior is intended by operating systems, since they don't
  5639. * want applications to fight for global shortcuts.
  5640. *
  5641. * The following accelerators will not be registered successfully on macOS 10.14
  5642. * Mojave unless the app has been authorized as a trusted accessibility client:
  5643. *
  5644. * * "Media Play/Pause"
  5645. * * "Media Next Track"
  5646. * * "Media Previous Track"
  5647. * * "Media Stop"
  5648. */
  5649. register(accelerator: Accelerator, callback: () => void): boolean;
  5650. /**
  5651. * Registers a global shortcut of all `accelerator` items in `accelerators`. The
  5652. * `callback` is called when any of the registered shortcuts are pressed by the
  5653. * user.
  5654. *
  5655. * When a given accelerator is already taken by other applications, this call will
  5656. * silently fail. This behavior is intended by operating systems, since they don't
  5657. * want applications to fight for global shortcuts.
  5658. *
  5659. * The following accelerators will not be registered successfully on macOS 10.14
  5660. * Mojave unless the app has been authorized as a trusted accessibility client:
  5661. *
  5662. * * "Media Play/Pause"
  5663. * * "Media Next Track"
  5664. * * "Media Previous Track"
  5665. * * "Media Stop"
  5666. */
  5667. registerAll(accelerators: Accelerator[], callback: () => void): void;
  5668. /**
  5669. * Unregisters the global shortcut of `accelerator`.
  5670. */
  5671. unregister(accelerator: Accelerator): void;
  5672. /**
  5673. * Unregisters all of the global shortcuts.
  5674. */
  5675. unregisterAll(): void;
  5676. }
  5677. interface GPUFeatureStatus {
  5678. // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
  5679. /**
  5680. * Canvas.
  5681. */
  5682. '2d_canvas': string;
  5683. /**
  5684. * Flash.
  5685. */
  5686. flash_3d: string;
  5687. /**
  5688. * Flash Stage3D.
  5689. */
  5690. flash_stage3d: string;
  5691. /**
  5692. * Flash Stage3D Baseline profile.
  5693. */
  5694. flash_stage3d_baseline: string;
  5695. /**
  5696. * Compositing.
  5697. */
  5698. gpu_compositing: string;
  5699. /**
  5700. * Multiple Raster Threads.
  5701. */
  5702. multiple_raster_threads: string;
  5703. /**
  5704. * Native GpuMemoryBuffers.
  5705. */
  5706. native_gpu_memory_buffers: string;
  5707. /**
  5708. * Rasterization.
  5709. */
  5710. rasterization: string;
  5711. /**
  5712. * Video Decode.
  5713. */
  5714. video_decode: string;
  5715. /**
  5716. * Video Encode.
  5717. */
  5718. video_encode: string;
  5719. /**
  5720. * VPx Video Decode.
  5721. */
  5722. vpx_decode: string;
  5723. /**
  5724. * WebGL.
  5725. */
  5726. webgl: string;
  5727. /**
  5728. * WebGL2.
  5729. */
  5730. webgl2: string;
  5731. }
  5732. interface HIDDevice {
  5733. // Docs: https://electronjs.org/docs/api/structures/hid-device
  5734. /**
  5735. * Unique identifier for the device.
  5736. */
  5737. deviceId: string;
  5738. /**
  5739. * Unique identifier for the HID interface. A device may have multiple HID
  5740. * interfaces.
  5741. */
  5742. guid?: string;
  5743. /**
  5744. * Name of the device.
  5745. */
  5746. name: string;
  5747. /**
  5748. * The USB product ID.
  5749. */
  5750. productId: number;
  5751. /**
  5752. * The USB device serial number.
  5753. */
  5754. serialNumber?: string;
  5755. /**
  5756. * The USB vendor ID.
  5757. */
  5758. vendorId: number;
  5759. }
  5760. interface InAppPurchase extends NodeJS.EventEmitter {
  5761. // Docs: https://electronjs.org/docs/api/in-app-purchase
  5762. on(event: 'transactions-updated', listener: Function): this;
  5763. off(event: 'transactions-updated', listener: Function): this;
  5764. once(event: 'transactions-updated', listener: Function): this;
  5765. addListener(event: 'transactions-updated', listener: Function): this;
  5766. removeListener(event: 'transactions-updated', listener: Function): this;
  5767. /**
  5768. * whether a user can make a payment.
  5769. */
  5770. canMakePayments(): boolean;
  5771. /**
  5772. * Completes all pending transactions.
  5773. */
  5774. finishAllTransactions(): void;
  5775. /**
  5776. * Completes the pending transactions corresponding to the date.
  5777. */
  5778. finishTransactionByDate(date: string): void;
  5779. /**
  5780. * Resolves with an array of `Product` objects.
  5781. *
  5782. * Retrieves the product descriptions.
  5783. */
  5784. getProducts(productIDs: string[]): Promise<Electron.Product[]>;
  5785. /**
  5786. * the path to the receipt.
  5787. */
  5788. getReceiptURL(): string;
  5789. /**
  5790. * Returns `true` if the product is valid and added to the payment queue.
  5791. *
  5792. * You should listen for the `transactions-updated` event as soon as possible and
  5793. * certainly before you call `purchaseProduct`.
  5794. */
  5795. purchaseProduct(productID: string, opts?: (number) | (PurchaseProductOpts)): Promise<boolean>;
  5796. /**
  5797. * Restores finished transactions. This method can be called either to install
  5798. * purchases on additional devices, or to restore purchases for an application that
  5799. * the user deleted and reinstalled.
  5800. *
  5801. * The payment queue delivers a new transaction for each previously completed
  5802. * transaction that can be restored. Each transaction includes a copy of the
  5803. * original transaction.
  5804. */
  5805. restoreCompletedTransactions(): void;
  5806. }
  5807. class IncomingMessage extends NodeEventEmitter {
  5808. // Docs: https://electronjs.org/docs/api/incoming-message
  5809. /**
  5810. * Emitted when a request has been canceled during an ongoing HTTP transaction.
  5811. */
  5812. on(event: 'aborted', listener: Function): this;
  5813. off(event: 'aborted', listener: Function): this;
  5814. once(event: 'aborted', listener: Function): this;
  5815. addListener(event: 'aborted', listener: Function): this;
  5816. removeListener(event: 'aborted', listener: Function): this;
  5817. /**
  5818. * The `data` event is the usual method of transferring response data into
  5819. * applicative code.
  5820. */
  5821. on(event: 'data', listener: (
  5822. /**
  5823. * A chunk of response body's data.
  5824. */
  5825. chunk: Buffer) => void): this;
  5826. off(event: 'data', listener: (
  5827. /**
  5828. * A chunk of response body's data.
  5829. */
  5830. chunk: Buffer) => void): this;
  5831. once(event: 'data', listener: (
  5832. /**
  5833. * A chunk of response body's data.
  5834. */
  5835. chunk: Buffer) => void): this;
  5836. addListener(event: 'data', listener: (
  5837. /**
  5838. * A chunk of response body's data.
  5839. */
  5840. chunk: Buffer) => void): this;
  5841. removeListener(event: 'data', listener: (
  5842. /**
  5843. * A chunk of response body's data.
  5844. */
  5845. chunk: Buffer) => void): this;
  5846. /**
  5847. * Indicates that response body has ended. Must be placed before 'data' event.
  5848. */
  5849. on(event: 'end', listener: Function): this;
  5850. off(event: 'end', listener: Function): this;
  5851. once(event: 'end', listener: Function): this;
  5852. addListener(event: 'end', listener: Function): this;
  5853. removeListener(event: 'end', listener: Function): this;
  5854. /**
  5855. * Returns:
  5856. *
  5857. * `error` Error - Typically holds an error string identifying failure root cause.
  5858. *
  5859. * Emitted when an error was encountered while streaming response data events. For
  5860. * instance, if the server closes the underlying while the response is still
  5861. * streaming, an `error` event will be emitted on the response object and a `close`
  5862. * event will subsequently follow on the request object.
  5863. */
  5864. on(event: 'error', listener: Function): this;
  5865. off(event: 'error', listener: Function): this;
  5866. once(event: 'error', listener: Function): this;
  5867. addListener(event: 'error', listener: Function): this;
  5868. removeListener(event: 'error', listener: Function): this;
  5869. /**
  5870. * A `Record<string, string | string[]>` representing the HTTP response headers.
  5871. * The `headers` object is formatted as follows:
  5872. *
  5873. * * All header names are lowercased.
  5874. * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,
  5875. * `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,
  5876. * `last-modified`, `location`, `max-forwards`, `proxy-authorization`, `referer`,
  5877. * `retry-after`, `server`, or `user-agent` are discarded.
  5878. * * `set-cookie` is always an array. Duplicates are added to the array.
  5879. * * For duplicate `cookie` headers, the values are joined together with '; '.
  5880. * * For all other headers, the values are joined together with ', '.
  5881. */
  5882. headers: Record<string, (string) | (string[])>;
  5883. /**
  5884. * A `string` indicating the HTTP protocol version number. Typical values are '1.0'
  5885. * or '1.1'. Additionally `httpVersionMajor` and `httpVersionMinor` are two
  5886. * Integer-valued readable properties that return respectively the HTTP major and
  5887. * minor version numbers.
  5888. */
  5889. httpVersion: string;
  5890. /**
  5891. * An `Integer` indicating the HTTP protocol major version number.
  5892. */
  5893. httpVersionMajor: number;
  5894. /**
  5895. * An `Integer` indicating the HTTP protocol minor version number.
  5896. */
  5897. httpVersionMinor: number;
  5898. /**
  5899. * A `string[]` containing the raw HTTP response headers exactly as they were
  5900. * received. The keys and values are in the same list. It is not a list of tuples.
  5901. * So, the even-numbered offsets are key values, and the odd-numbered offsets are
  5902. * the associated values. Header names are not lowercased, and duplicates are not
  5903. * merged.
  5904. */
  5905. rawHeaders: string[];
  5906. /**
  5907. * An `Integer` indicating the HTTP response status code.
  5908. */
  5909. statusCode: number;
  5910. /**
  5911. * A `string` representing the HTTP status message.
  5912. */
  5913. statusMessage: string;
  5914. }
  5915. interface InputEvent {
  5916. // Docs: https://electronjs.org/docs/api/structures/input-event
  5917. /**
  5918. * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
  5919. * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
  5920. * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
  5921. */
  5922. modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
  5923. /**
  5924. * Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`,
  5925. * `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`,
  5926. * `char`, `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`,
  5927. * `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`,
  5928. * `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`,
  5929. * `gestureTap`, `gestureTapCancel`, `gestureShortPress`, `gestureLongPress`,
  5930. * `gestureLongTap`, `gestureTwoFingerTap`, `gestureTapUnconfirmed`,
  5931. * `gestureDoubleTap`, `touchStart`, `touchMove`, `touchEnd`, `touchCancel`,
  5932. * `touchScrollStarted`, `pointerDown`, `pointerUp`, `pointerMove`,
  5933. * `pointerRawUpdate`, `pointerCancel` or `pointerCausedUaAction`.
  5934. */
  5935. type: ('undefined' | 'mouseDown' | 'mouseUp' | 'mouseMove' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'rawKeyDown' | 'keyDown' | 'keyUp' | 'char' | 'gestureScrollBegin' | 'gestureScrollEnd' | 'gestureScrollUpdate' | 'gestureFlingStart' | 'gestureFlingCancel' | 'gesturePinchBegin' | 'gesturePinchEnd' | 'gesturePinchUpdate' | 'gestureTapDown' | 'gestureShowPress' | 'gestureTap' | 'gestureTapCancel' | 'gestureShortPress' | 'gestureLongPress' | 'gestureLongTap' | 'gestureTwoFingerTap' | 'gestureTapUnconfirmed' | 'gestureDoubleTap' | 'touchStart' | 'touchMove' | 'touchEnd' | 'touchCancel' | 'touchScrollStarted' | 'pointerDown' | 'pointerUp' | 'pointerMove' | 'pointerRawUpdate' | 'pointerCancel' | 'pointerCausedUaAction');
  5936. }
  5937. interface IOCounters {
  5938. // Docs: https://electronjs.org/docs/api/structures/io-counters
  5939. /**
  5940. * Then number of I/O other operations.
  5941. */
  5942. otherOperationCount: number;
  5943. /**
  5944. * Then number of I/O other transfers.
  5945. */
  5946. otherTransferCount: number;
  5947. /**
  5948. * The number of I/O read operations.
  5949. */
  5950. readOperationCount: number;
  5951. /**
  5952. * The number of I/O read transfers.
  5953. */
  5954. readTransferCount: number;
  5955. /**
  5956. * The number of I/O write operations.
  5957. */
  5958. writeOperationCount: number;
  5959. /**
  5960. * The number of I/O write transfers.
  5961. */
  5962. writeTransferCount: number;
  5963. }
  5964. interface IpcMain extends NodeJS.EventEmitter {
  5965. // Docs: https://electronjs.org/docs/api/ipc-main
  5966. /**
  5967. * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
  5968. * renderer calls `ipcRenderer.invoke(channel, ...args)`.
  5969. *
  5970. * If `listener` returns a Promise, the eventual result of the promise will be
  5971. * returned as a reply to the remote caller. Otherwise, the return value of the
  5972. * listener will be used as the value of the reply.
  5973. *
  5974. * The `event` that is passed as the first argument to the handler is the same as
  5975. * that passed to a regular event listener. It includes information about which
  5976. * WebContents is the source of the invoke request.
  5977. *
  5978. * Errors thrown through `handle` in the main process are not transparent as they
  5979. * are serialized and only the `message` property from the original error is
  5980. * provided to the renderer process. Please refer to #24427 for details.
  5981. */
  5982. handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<any>) | (any)): void;
  5983. /**
  5984. * Handles a single `invoke`able IPC message, then removes the listener. See
  5985. * `ipcMain.handle(channel, listener)`.
  5986. */
  5987. handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<any>) | (any)): void;
  5988. /**
  5989. * Listens to `channel`, when a new message arrives `listener` would be called with
  5990. * `listener(event, args...)`.
  5991. */
  5992. on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  5993. /**
  5994. * Adds a one time `listener` function for the event. This `listener` is invoked
  5995. * only the next time a message is sent to `channel`, after which it is removed.
  5996. */
  5997. once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  5998. /**
  5999. * Removes listeners of the specified `channel`.
  6000. */
  6001. removeAllListeners(channel?: string): this;
  6002. /**
  6003. * Removes any handler for `channel`, if present.
  6004. */
  6005. removeHandler(channel: string): void;
  6006. /**
  6007. * Removes the specified `listener` from the listener array for the specified
  6008. * `channel`.
  6009. */
  6010. removeListener(channel: string, listener: (...args: any[]) => void): this;
  6011. }
  6012. interface IpcMainEvent extends Event {
  6013. // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
  6014. /**
  6015. * The ID of the renderer frame that sent this message
  6016. */
  6017. frameId: number;
  6018. /**
  6019. * A list of MessagePorts that were transferred with this message
  6020. */
  6021. ports: MessagePortMain[];
  6022. /**
  6023. * The internal ID of the renderer process that sent this message
  6024. */
  6025. processId: number;
  6026. /**
  6027. * A function that will send an IPC message to the renderer frame that sent the
  6028. * original message that you are currently handling. You should use this method to
  6029. * "reply" to the sent message in order to guarantee the reply will go to the
  6030. * correct process and frame.
  6031. */
  6032. reply: (channel: string, ...args: any[]) => void;
  6033. /**
  6034. * Set this to the value to be returned in a synchronous message
  6035. */
  6036. returnValue: any;
  6037. /**
  6038. * Returns the `webContents` that sent the message
  6039. */
  6040. sender: WebContents;
  6041. /**
  6042. * The frame that sent this message
  6043. *
  6044. */
  6045. readonly senderFrame: WebFrameMain;
  6046. }
  6047. interface IpcMainInvokeEvent extends Event {
  6048. // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
  6049. /**
  6050. * The ID of the renderer frame that sent this message
  6051. */
  6052. frameId: number;
  6053. /**
  6054. * The internal ID of the renderer process that sent this message
  6055. */
  6056. processId: number;
  6057. /**
  6058. * Returns the `webContents` that sent the message
  6059. */
  6060. sender: WebContents;
  6061. /**
  6062. * The frame that sent this message
  6063. *
  6064. */
  6065. readonly senderFrame: WebFrameMain;
  6066. }
  6067. interface IpcRenderer extends NodeJS.EventEmitter {
  6068. // Docs: https://electronjs.org/docs/api/ipc-renderer
  6069. /**
  6070. * Alias for `ipcRenderer.on`.
  6071. */
  6072. addListener(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  6073. /**
  6074. * Resolves with the response from the main process.
  6075. *
  6076. * Send a message to the main process via `channel` and expect a result
  6077. * asynchronously. Arguments will be serialized with the Structured Clone
  6078. * Algorithm, just like `window.postMessage`, so prototype chains will not be
  6079. * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
  6080. * an exception.
  6081. *
  6082. * The main process should listen for `channel` with `ipcMain.handle()`.
  6083. *
  6084. * For example:
  6085. *
  6086. * If you need to transfer a `MessagePort` to the main process, use
  6087. * `ipcRenderer.postMessage`.
  6088. *
  6089. * If you do not need a response to the message, consider using `ipcRenderer.send`.
  6090. *
  6091. * > **Note** Sending non-standard JavaScript types such as DOM objects or special
  6092. * Electron objects will throw an exception.
  6093. *
  6094. * Since the main process does not have support for DOM objects such as
  6095. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  6096. * Electron's IPC to the main process, as the main process would have no way to
  6097. * decode them. Attempting to send such objects over IPC will result in an error.
  6098. *
  6099. * > **Note** If the handler in the main process throws an error, the promise
  6100. * returned by `invoke` will reject. However, the `Error` object in the renderer
  6101. * process will not be the same as the one thrown in the main process.
  6102. */
  6103. invoke(channel: string, ...args: any[]): Promise<any>;
  6104. /**
  6105. * Alias for `ipcRenderer.removeListener`.
  6106. */
  6107. off(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  6108. /**
  6109. * Listens to `channel`, when a new message arrives `listener` would be called with
  6110. * `listener(event, args...)`.
  6111. */
  6112. on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  6113. /**
  6114. * Adds a one time `listener` function for the event. This `listener` is invoked
  6115. * only the next time a message is sent to `channel`, after which it is removed.
  6116. */
  6117. once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  6118. /**
  6119. * Send a message to the main process, optionally transferring ownership of zero or
  6120. * more `MessagePort` objects.
  6121. *
  6122. * The transferred `MessagePort` objects will be available in the main process as
  6123. * `MessagePortMain` objects by accessing the `ports` property of the emitted
  6124. * event.
  6125. *
  6126. * For example:
  6127. *
  6128. * For more information on using `MessagePort` and `MessageChannel`, see the MDN
  6129. * documentation.
  6130. */
  6131. postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
  6132. /**
  6133. * Removes all listeners, or those of the specified `channel`.
  6134. */
  6135. removeAllListeners(channel: string): this;
  6136. /**
  6137. * Removes the specified `listener` from the listener array for the specified
  6138. * `channel`.
  6139. */
  6140. removeListener(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  6141. /**
  6142. * Send an asynchronous message to the main process via `channel`, along with
  6143. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  6144. * just like `window.postMessage`, so prototype chains will not be included.
  6145. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  6146. * exception.
  6147. *
  6148. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  6149. * Electron objects will throw an exception.
  6150. *
  6151. * Since the main process does not have support for DOM objects such as
  6152. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  6153. * Electron's IPC to the main process, as the main process would have no way to
  6154. * decode them. Attempting to send such objects over IPC will result in an error.
  6155. *
  6156. * The main process handles it by listening for `channel` with the `ipcMain`
  6157. * module.
  6158. *
  6159. * If you need to transfer a `MessagePort` to the main process, use
  6160. * `ipcRenderer.postMessage`.
  6161. *
  6162. * If you want to receive a single response from the main process, like the result
  6163. * of a method call, consider using `ipcRenderer.invoke`.
  6164. */
  6165. send(channel: string, ...args: any[]): void;
  6166. /**
  6167. * The value sent back by the `ipcMain` handler.
  6168. *
  6169. * Send a message to the main process via `channel` and expect a result
  6170. * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
  6171. * just like `window.postMessage`, so prototype chains will not be included.
  6172. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  6173. * exception.
  6174. *
  6175. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  6176. * Electron objects will throw an exception.
  6177. *
  6178. * Since the main process does not have support for DOM objects such as
  6179. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  6180. * Electron's IPC to the main process, as the main process would have no way to
  6181. * decode them. Attempting to send such objects over IPC will result in an error.
  6182. *
  6183. * The main process handles it by listening for `channel` with `ipcMain` module,
  6184. * and replies by setting `event.returnValue`.
  6185. *
  6186. * > :warning: **WARNING**: Sending a synchronous message will block the whole
  6187. * renderer process until the reply is received, so use this method only as a last
  6188. * resort. It's much better to use the asynchronous version, `invoke()`.
  6189. */
  6190. sendSync(channel: string, ...args: any[]): any;
  6191. /**
  6192. * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
  6193. * the host page instead of the main process.
  6194. */
  6195. sendToHost(channel: string, ...args: any[]): void;
  6196. }
  6197. interface IpcRendererEvent extends Event {
  6198. // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
  6199. /**
  6200. * A list of MessagePorts that were transferred with this message
  6201. */
  6202. ports: MessagePort[];
  6203. /**
  6204. * The `IpcRenderer` instance that emitted the event originally
  6205. */
  6206. sender: IpcRenderer;
  6207. }
  6208. interface JumpListCategory {
  6209. // Docs: https://electronjs.org/docs/api/structures/jump-list-category
  6210. /**
  6211. * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
  6212. * should be omitted.
  6213. */
  6214. items?: JumpListItem[];
  6215. /**
  6216. * Must be set if `type` is `custom`, otherwise it should be omitted.
  6217. */
  6218. name?: string;
  6219. /**
  6220. * One of the following:
  6221. */
  6222. type?: ('tasks' | 'frequent' | 'recent' | 'custom');
  6223. }
  6224. interface JumpListItem {
  6225. // Docs: https://electronjs.org/docs/api/structures/jump-list-item
  6226. /**
  6227. * The command line arguments when `program` is executed. Should only be set if
  6228. * `type` is `task`.
  6229. */
  6230. args?: string;
  6231. /**
  6232. * Description of the task (displayed in a tooltip). Should only be set if `type`
  6233. * is `task`. Maximum length 260 characters.
  6234. */
  6235. description?: string;
  6236. /**
  6237. * The index of the icon in the resource file. If a resource file contains multiple
  6238. * icons this value can be used to specify the zero-based index of the icon that
  6239. * should be displayed for this task. If a resource file contains only one icon,
  6240. * this property should be set to zero.
  6241. */
  6242. iconIndex?: number;
  6243. /**
  6244. * The absolute path to an icon to be displayed in a Jump List, which can be an
  6245. * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
  6246. * can usually specify `process.execPath` to show the program icon.
  6247. */
  6248. iconPath?: string;
  6249. /**
  6250. * Path of the file to open, should only be set if `type` is `file`.
  6251. */
  6252. path?: string;
  6253. /**
  6254. * Path of the program to execute, usually you should specify `process.execPath`
  6255. * which opens the current program. Should only be set if `type` is `task`.
  6256. */
  6257. program?: string;
  6258. /**
  6259. * The text to be displayed for the item in the Jump List. Should only be set if
  6260. * `type` is `task`.
  6261. */
  6262. title?: string;
  6263. /**
  6264. * One of the following:
  6265. */
  6266. type?: ('task' | 'separator' | 'file');
  6267. /**
  6268. * The working directory. Default is empty.
  6269. */
  6270. workingDirectory?: string;
  6271. }
  6272. interface KeyboardEvent {
  6273. // Docs: https://electronjs.org/docs/api/structures/keyboard-event
  6274. /**
  6275. * whether an Alt key was used in an accelerator to trigger the Event
  6276. */
  6277. altKey?: boolean;
  6278. /**
  6279. * whether the Control key was used in an accelerator to trigger the Event
  6280. */
  6281. ctrlKey?: boolean;
  6282. /**
  6283. * whether a meta key was used in an accelerator to trigger the Event
  6284. */
  6285. metaKey?: boolean;
  6286. /**
  6287. * whether a Shift key was used in an accelerator to trigger the Event
  6288. */
  6289. shiftKey?: boolean;
  6290. /**
  6291. * whether an accelerator was used to trigger the event as opposed to another user
  6292. * gesture like mouse click
  6293. */
  6294. triggeredByAccelerator?: boolean;
  6295. }
  6296. interface KeyboardInputEvent extends InputEvent {
  6297. // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
  6298. /**
  6299. * The character that will be sent as the keyboard event. Should only use the valid
  6300. * key codes in Accelerator.
  6301. */
  6302. keyCode: string;
  6303. /**
  6304. * The type of the event, can be `rawKeyDown`, `keyDown`, `keyUp` or `char`.
  6305. */
  6306. type: ('rawKeyDown' | 'keyDown' | 'keyUp' | 'char');
  6307. }
  6308. interface MemoryInfo {
  6309. // Docs: https://electronjs.org/docs/api/structures/memory-info
  6310. /**
  6311. * The maximum amount of memory that has ever been pinned to actual physical RAM.
  6312. */
  6313. peakWorkingSetSize: number;
  6314. /**
  6315. * The amount of memory not shared by other processes, such as JS heap or HTML
  6316. * content.
  6317. *
  6318. * @platform win32
  6319. */
  6320. privateBytes?: number;
  6321. /**
  6322. * The amount of memory currently pinned to actual physical RAM.
  6323. */
  6324. workingSetSize: number;
  6325. }
  6326. interface MemoryUsageDetails {
  6327. // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
  6328. count: number;
  6329. liveSize: number;
  6330. size: number;
  6331. }
  6332. class Menu extends NodeEventEmitter {
  6333. // Docs: https://electronjs.org/docs/api/menu
  6334. /**
  6335. * Emitted when a popup is closed either manually or with `menu.closePopup()`.
  6336. */
  6337. on(event: 'menu-will-close', listener: (event: Event) => void): this;
  6338. off(event: 'menu-will-close', listener: (event: Event) => void): this;
  6339. once(event: 'menu-will-close', listener: (event: Event) => void): this;
  6340. addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  6341. removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  6342. /**
  6343. * Emitted when `menu.popup()` is called.
  6344. */
  6345. on(event: 'menu-will-show', listener: (event: Event) => void): this;
  6346. off(event: 'menu-will-show', listener: (event: Event) => void): this;
  6347. once(event: 'menu-will-show', listener: (event: Event) => void): this;
  6348. addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  6349. removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  6350. /**
  6351. * Menu
  6352. */
  6353. constructor();
  6354. /**
  6355. * Generally, the `template` is an array of `options` for constructing a MenuItem.
  6356. * The usage can be referenced above.
  6357. *
  6358. * You can also attach other fields to the element of the `template` and they will
  6359. * become properties of the constructed menu items.
  6360. */
  6361. static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
  6362. /**
  6363. * The application menu, if set, or `null`, if not set.
  6364. *
  6365. * **Note:** The returned `Menu` instance doesn't support dynamic addition or
  6366. * removal of menu items. Instance properties can still be dynamically modified.
  6367. */
  6368. static getApplicationMenu(): (Menu) | (null);
  6369. /**
  6370. * Sends the `action` to the first responder of application. This is used for
  6371. * emulating default macOS menu behaviors. Usually you would use the `role`
  6372. * property of a `MenuItem`.
  6373. *
  6374. * See the macOS Cocoa Event Handling Guide for more information on macOS' native
  6375. * actions.
  6376. *
  6377. * @platform darwin
  6378. */
  6379. static sendActionToFirstResponder(action: string): void;
  6380. /**
  6381. * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
  6382. * will be set as each window's top menu.
  6383. *
  6384. * Also on Windows and Linux, you can use a `&` in the top-level item name to
  6385. * indicate which letter should get a generated accelerator. For example, using
  6386. * `&File` for the file menu would result in a generated `Alt-F` accelerator that
  6387. * opens the associated menu. The indicated character in the button label then gets
  6388. * an underline, and the `&` character is not displayed on the button label.
  6389. *
  6390. * In order to escape the `&` character in an item name, add a proceeding `&`. For
  6391. * example, `&&File` would result in `&File` displayed on the button label.
  6392. *
  6393. * Passing `null` will suppress the default menu. On Windows and Linux, this has
  6394. * the additional effect of removing the menu bar from the window.
  6395. *
  6396. * **Note:** The default menu will be created automatically if the app does not set
  6397. * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
  6398. * `Help`.
  6399. */
  6400. static setApplicationMenu(menu: (Menu) | (null)): void;
  6401. /**
  6402. * Appends the `menuItem` to the menu.
  6403. */
  6404. append(menuItem: MenuItem): void;
  6405. /**
  6406. * Closes the context menu in the `browserWindow`.
  6407. */
  6408. closePopup(browserWindow?: BrowserWindow): void;
  6409. /**
  6410. * the item with the specified `id`
  6411. */
  6412. getMenuItemById(id: string): (MenuItem) | (null);
  6413. /**
  6414. * Inserts the `menuItem` to the `pos` position of the menu.
  6415. */
  6416. insert(pos: number, menuItem: MenuItem): void;
  6417. /**
  6418. * Pops up this menu as a context menu in the `BrowserWindow`.
  6419. */
  6420. popup(options?: PopupOptions): void;
  6421. /**
  6422. * A `MenuItem[]` array containing the menu's items.
  6423. *
  6424. * Each `Menu` consists of multiple `MenuItem`s and each `MenuItem` can have a
  6425. * submenu.
  6426. */
  6427. items: MenuItem[];
  6428. }
  6429. class MenuItem {
  6430. // Docs: https://electronjs.org/docs/api/menu-item
  6431. /**
  6432. * MenuItem
  6433. */
  6434. constructor(options: MenuItemConstructorOptions);
  6435. /**
  6436. * An `Accelerator` (optional) indicating the item's accelerator, if set.
  6437. */
  6438. accelerator?: Accelerator;
  6439. /**
  6440. * A `boolean` indicating whether the item is checked, this property can be
  6441. * dynamically changed.
  6442. *
  6443. * A `checkbox` menu item will toggle the `checked` property on and off when
  6444. * selected.
  6445. *
  6446. * A `radio` menu item will turn on its `checked` property when clicked, and will
  6447. * turn off that property for all adjacent items in the same menu.
  6448. *
  6449. * You can add a `click` function for additional behavior.
  6450. */
  6451. checked: boolean;
  6452. /**
  6453. * A `Function` that is fired when the MenuItem receives a click event. It can be
  6454. * called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
  6455. *
  6456. * * `event` KeyboardEvent
  6457. * * `focusedWindow` BrowserWindow
  6458. * * `focusedWebContents` WebContents
  6459. */
  6460. click: Function;
  6461. /**
  6462. * A `number` indicating an item's sequential unique id.
  6463. */
  6464. commandId: number;
  6465. /**
  6466. * A `boolean` indicating whether the item is enabled, this property can be
  6467. * dynamically changed.
  6468. */
  6469. enabled: boolean;
  6470. /**
  6471. * A `NativeImage | string` (optional) indicating the item's icon, if set.
  6472. */
  6473. icon?: (NativeImage) | (string);
  6474. /**
  6475. * A `string` indicating the item's unique id, this property can be dynamically
  6476. * changed.
  6477. */
  6478. id: string;
  6479. /**
  6480. * A `string` indicating the item's visible label.
  6481. */
  6482. label: string;
  6483. /**
  6484. * A `Menu` that the item is a part of.
  6485. */
  6486. menu: Menu;
  6487. /**
  6488. * A `boolean` indicating if the accelerator should be registered with the system
  6489. * or just displayed.
  6490. *
  6491. * This property can be dynamically changed.
  6492. */
  6493. registerAccelerator: boolean;
  6494. /**
  6495. * A `string` (optional) indicating the item's role, if set. Can be `undo`, `redo`,
  6496. * `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`,
  6497. * `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`,
  6498. * `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`,
  6499. * `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
  6500. * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
  6501. * `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`,
  6502. * `selectPreviousTab`, `showAllTabs`, `mergeAllWindows`, `clearRecentDocuments`,
  6503. * `moveTabToNewWindow` or `windowMenu`
  6504. */
  6505. role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'toggleSpellChecker' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'shareMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'showAllTabs' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  6506. /**
  6507. * A `SharingItem` indicating the item to share when the `role` is `shareMenu`.
  6508. *
  6509. * This property can be dynamically changed.
  6510. *
  6511. * @platform darwin
  6512. */
  6513. sharingItem: SharingItem;
  6514. /**
  6515. * A `string` indicating the item's sublabel.
  6516. */
  6517. sublabel: string;
  6518. /**
  6519. * A `Menu` (optional) containing the menu item's submenu, if present.
  6520. */
  6521. submenu?: Menu;
  6522. /**
  6523. * A `string` indicating the item's hover text.
  6524. *
  6525. * @platform darwin
  6526. */
  6527. toolTip: string;
  6528. /**
  6529. * A `string` indicating the type of the item. Can be `normal`, `separator`,
  6530. * `submenu`, `checkbox` or `radio`.
  6531. */
  6532. type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  6533. /**
  6534. * An `Accelerator | null` indicating the item's user-assigned accelerator for the
  6535. * menu item.
  6536. *
  6537. * **Note:** This property is only initialized after the `MenuItem` has been added
  6538. * to a `Menu`. Either via `Menu.buildFromTemplate` or via
  6539. * `Menu.append()/insert()`. Accessing before initialization will just return
  6540. * `null`.
  6541. *
  6542. * @platform darwin
  6543. */
  6544. readonly userAccelerator: (Accelerator) | (null);
  6545. /**
  6546. * A `boolean` indicating whether the item is visible, this property can be
  6547. * dynamically changed.
  6548. */
  6549. visible: boolean;
  6550. }
  6551. class MessageChannelMain {
  6552. // Docs: https://electronjs.org/docs/api/message-channel-main
  6553. /**
  6554. * A `MessagePortMain` property.
  6555. */
  6556. port1: MessagePortMain;
  6557. /**
  6558. * A `MessagePortMain` property.
  6559. */
  6560. port2: MessagePortMain;
  6561. }
  6562. class MessagePortMain extends NodeEventEmitter {
  6563. // Docs: https://electronjs.org/docs/api/message-port-main
  6564. /**
  6565. * Emitted when the remote end of a MessagePortMain object becomes disconnected.
  6566. */
  6567. on(event: 'close', listener: Function): this;
  6568. off(event: 'close', listener: Function): this;
  6569. once(event: 'close', listener: Function): this;
  6570. addListener(event: 'close', listener: Function): this;
  6571. removeListener(event: 'close', listener: Function): this;
  6572. /**
  6573. * Emitted when a MessagePortMain object receives a message.
  6574. */
  6575. on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  6576. off(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  6577. once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  6578. addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  6579. removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  6580. /**
  6581. * Disconnects the port, so it is no longer active.
  6582. */
  6583. close(): void;
  6584. /**
  6585. * Sends a message from the port, and optionally, transfers ownership of objects to
  6586. * other browsing contexts.
  6587. */
  6588. postMessage(message: any, transfer?: MessagePortMain[]): void;
  6589. /**
  6590. * Starts the sending of messages queued on the port. Messages will be queued until
  6591. * this method is called.
  6592. */
  6593. start(): void;
  6594. }
  6595. interface MimeTypedBuffer {
  6596. // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
  6597. /**
  6598. * Charset of the buffer.
  6599. */
  6600. charset?: string;
  6601. /**
  6602. * The actual Buffer content.
  6603. */
  6604. data: Buffer;
  6605. /**
  6606. * MIME type of the buffer.
  6607. */
  6608. mimeType?: string;
  6609. }
  6610. interface MouseInputEvent extends InputEvent {
  6611. // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
  6612. /**
  6613. * The button pressed, can be `left`, `middle`, `right`.
  6614. */
  6615. button?: ('left' | 'middle' | 'right');
  6616. clickCount?: number;
  6617. globalX?: number;
  6618. globalY?: number;
  6619. movementX?: number;
  6620. movementY?: number;
  6621. /**
  6622. * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
  6623. * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
  6624. */
  6625. type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
  6626. x: number;
  6627. y: number;
  6628. }
  6629. interface MouseWheelInputEvent extends MouseInputEvent {
  6630. // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
  6631. accelerationRatioX?: number;
  6632. accelerationRatioY?: number;
  6633. canScroll?: boolean;
  6634. deltaX?: number;
  6635. deltaY?: number;
  6636. hasPreciseScrollingDeltas?: boolean;
  6637. /**
  6638. * The type of the event, can be `mouseWheel`.
  6639. */
  6640. type: ('mouseWheel');
  6641. wheelTicksX?: number;
  6642. wheelTicksY?: number;
  6643. }
  6644. class NativeImage {
  6645. // Docs: https://electronjs.org/docs/api/native-image
  6646. /**
  6647. * Creates an empty `NativeImage` instance.
  6648. */
  6649. static createEmpty(): NativeImage;
  6650. /**
  6651. * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
  6652. * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
  6653. */
  6654. static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
  6655. /**
  6656. * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
  6657. * JPEG first.
  6658. */
  6659. static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
  6660. /**
  6661. * Creates a new `NativeImage` instance from `dataURL`.
  6662. */
  6663. static createFromDataURL(dataURL: string): NativeImage;
  6664. /**
  6665. * Creates a new `NativeImage` instance from the NSImage that maps to the given
  6666. * image name. See `System Icons` for a list of possible values.
  6667. *
  6668. * The `hslShift` is applied to the image with the following rules:
  6669. *
  6670. * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
  6671. * and 360 on the hue color wheel (red).
  6672. * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
  6673. * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
  6674. * saturate the image.
  6675. * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
  6676. * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
  6677. * leave unchanged. 1 = full lightness (make all pixels white).
  6678. *
  6679. * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
  6680. * 0]` will make the image completely black.
  6681. *
  6682. * In some cases, the `NSImageName` doesn't match its string representation; one
  6683. * example of this is `NSFolderImageName`, whose string representation would
  6684. * actually be `NSFolder`. Therefore, you'll need to determine the correct string
  6685. * representation for your image before passing it in. This can be done with the
  6686. * following:
  6687. *
  6688. * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
  6689. * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
  6690. *
  6691. * where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
  6692. *
  6693. * @platform darwin
  6694. */
  6695. static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
  6696. /**
  6697. * Creates a new `NativeImage` instance from a file located at `path`. This method
  6698. * returns an empty image if the `path` does not exist, cannot be read, or is not a
  6699. * valid image.
  6700. */
  6701. static createFromPath(path: string): NativeImage;
  6702. /**
  6703. * fulfilled with the file's thumbnail preview image, which is a NativeImage.
  6704. *
  6705. * Note: The Windows implementation will ignore `size.height` and scale the height
  6706. * according to `size.width`.
  6707. *
  6708. * @platform darwin,win32
  6709. */
  6710. static createThumbnailFromPath(path: string, size: Size): Promise<Electron.NativeImage>;
  6711. /**
  6712. * Add an image representation for a specific scale factor. This can be used to
  6713. * explicitly add different scale factor representations to an image. This can be
  6714. * called on empty images.
  6715. */
  6716. addRepresentation(options: AddRepresentationOptions): void;
  6717. /**
  6718. * The cropped image.
  6719. */
  6720. crop(rect: Rectangle): NativeImage;
  6721. /**
  6722. * The image's aspect ratio.
  6723. *
  6724. * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
  6725. * the image representation most closely matching the passed value.
  6726. */
  6727. getAspectRatio(scaleFactor?: number): number;
  6728. /**
  6729. * A Buffer that contains the image's raw bitmap pixel data.
  6730. *
  6731. * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
  6732. * not copy the bitmap data, so you have to use the returned Buffer immediately in
  6733. * current event loop tick; otherwise the data might be changed or destroyed.
  6734. */
  6735. getBitmap(options?: BitmapOptions): Buffer;
  6736. /**
  6737. * A Buffer that stores C pointer to underlying native handle of the image. On
  6738. * macOS, a pointer to `NSImage` instance would be returned.
  6739. *
  6740. * Notice that the returned pointer is a weak pointer to the underlying native
  6741. * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
  6742. * instance is kept around.
  6743. *
  6744. * @platform darwin
  6745. */
  6746. getNativeHandle(): Buffer;
  6747. /**
  6748. * An array of all scale factors corresponding to representations for a given
  6749. * nativeImage.
  6750. */
  6751. getScaleFactors(): number[];
  6752. /**
  6753. * If `scaleFactor` is passed, this will return the size corresponding to the image
  6754. * representation most closely matching the passed value.
  6755. */
  6756. getSize(scaleFactor?: number): Size;
  6757. /**
  6758. * Whether the image is empty.
  6759. */
  6760. isEmpty(): boolean;
  6761. /**
  6762. * Whether the image is a template image.
  6763. */
  6764. isTemplateImage(): boolean;
  6765. /**
  6766. * The resized image.
  6767. *
  6768. * If only the `height` or the `width` are specified then the current aspect ratio
  6769. * will be preserved in the resized image.
  6770. */
  6771. resize(options: ResizeOptions): NativeImage;
  6772. /**
  6773. * Marks the image as a template image.
  6774. */
  6775. setTemplateImage(option: boolean): void;
  6776. /**
  6777. * A Buffer that contains a copy of the image's raw bitmap pixel data.
  6778. */
  6779. toBitmap(options?: ToBitmapOptions): Buffer;
  6780. /**
  6781. * The data URL of the image.
  6782. */
  6783. toDataURL(options?: ToDataURLOptions): string;
  6784. /**
  6785. * A Buffer that contains the image's `JPEG` encoded data.
  6786. */
  6787. toJPEG(quality: number): Buffer;
  6788. /**
  6789. * A Buffer that contains the image's `PNG` encoded data.
  6790. */
  6791. toPNG(options?: ToPNGOptions): Buffer;
  6792. /**
  6793. * A `boolean` property that determines whether the image is considered a template
  6794. * image.
  6795. *
  6796. * Please note that this property only has an effect on macOS.
  6797. *
  6798. * @platform darwin
  6799. */
  6800. isMacTemplateImage: boolean;
  6801. }
  6802. interface NativeTheme extends NodeJS.EventEmitter {
  6803. // Docs: https://electronjs.org/docs/api/native-theme
  6804. /**
  6805. * Emitted when something in the underlying NativeTheme has changed. This normally
  6806. * means that either the value of `shouldUseDarkColors`,
  6807. * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
  6808. * will have to check them to determine which one has changed.
  6809. */
  6810. on(event: 'updated', listener: Function): this;
  6811. off(event: 'updated', listener: Function): this;
  6812. once(event: 'updated', listener: Function): this;
  6813. addListener(event: 'updated', listener: Function): this;
  6814. removeListener(event: 'updated', listener: Function): this;
  6815. /**
  6816. * A `boolean` indicating whether Chromium is in forced colors mode, controlled by
  6817. * system accessibility settings. Currently, Windows high contrast is the only
  6818. * system setting that triggers forced colors mode.
  6819. *
  6820. * @platform win32
  6821. */
  6822. readonly inForcedColorsMode: boolean;
  6823. /**
  6824. * A `boolean` for if the OS / Chromium currently has a dark mode enabled or is
  6825. * being instructed to show a dark-style UI. If you want to modify this value you
  6826. * should use `themeSource` below.
  6827. *
  6828. */
  6829. readonly shouldUseDarkColors: boolean;
  6830. /**
  6831. * A `boolean` for if the OS / Chromium currently has high-contrast mode enabled or
  6832. * is being instructed to show a high-contrast UI.
  6833. *
  6834. * @platform darwin,win32
  6835. */
  6836. readonly shouldUseHighContrastColors: boolean;
  6837. /**
  6838. * A `boolean` for if the OS / Chromium currently has an inverted color scheme or
  6839. * is being instructed to use an inverted color scheme.
  6840. *
  6841. * @platform darwin,win32
  6842. */
  6843. readonly shouldUseInvertedColorScheme: boolean;
  6844. /**
  6845. * A `string` property that can be `system`, `light` or `dark`. It is used to
  6846. * override and supersede the value that Chromium has chosen to use internally.
  6847. *
  6848. * Setting this property to `system` will remove the override and everything will
  6849. * be reset to the OS default. By default `themeSource` is `system`.
  6850. *
  6851. * Settings this property to `dark` will have the following effects:
  6852. *
  6853. * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
  6854. * * Any UI Electron renders on Linux and Windows including context menus,
  6855. * devtools, etc. will use the dark UI.
  6856. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  6857. * the dark UI.
  6858. * * The `prefers-color-scheme` CSS query will match `dark` mode.
  6859. * * The `updated` event will be emitted
  6860. *
  6861. * Settings this property to `light` will have the following effects:
  6862. *
  6863. * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
  6864. * * Any UI Electron renders on Linux and Windows including context menus,
  6865. * devtools, etc. will use the light UI.
  6866. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  6867. * the light UI.
  6868. * * The `prefers-color-scheme` CSS query will match `light` mode.
  6869. * * The `updated` event will be emitted
  6870. *
  6871. * The usage of this property should align with a classic "dark mode" state machine
  6872. * in your application where the user has three options.
  6873. *
  6874. * * `Follow OS` --> `themeSource = 'system'`
  6875. * * `Dark Mode` --> `themeSource = 'dark'`
  6876. * * `Light Mode` --> `themeSource = 'light'`
  6877. *
  6878. * Your application should then always use `shouldUseDarkColors` to determine what
  6879. * CSS to apply.
  6880. */
  6881. themeSource: ('system' | 'light' | 'dark');
  6882. }
  6883. interface Net {
  6884. // Docs: https://electronjs.org/docs/api/net
  6885. /**
  6886. * see Response.
  6887. *
  6888. * Sends a request, similarly to how `fetch()` works in the renderer, using
  6889. * Chrome's network stack. This differs from Node's `fetch()`, which uses Node.js's
  6890. * HTTP stack.
  6891. *
  6892. * Example:
  6893. *
  6894. * This method will issue requests from the default session. To send a `fetch`
  6895. * request from another session, use ses.fetch().
  6896. *
  6897. * See the MDN documentation for `fetch()` for more details.
  6898. *
  6899. * Limitations:
  6900. *
  6901. * * `net.fetch()` does not support the `data:` or `blob:` schemes.
  6902. * * The value of the `integrity` option is ignored.
  6903. * * The `.type` and `.url` values of the returned `Response` object are incorrect.
  6904. *
  6905. * By default, requests made with `net.fetch` can be made to custom protocols as
  6906. * well as `file:`, and will trigger webRequest handlers if present. When the
  6907. * non-standard `bypassCustomProtocolHandlers` option is set in RequestInit, custom
  6908. * protocol handlers will not be called for this request. This allows forwarding an
  6909. * intercepted request to the built-in handler. webRequest handlers will still be
  6910. * triggered when bypassing custom protocols.
  6911. *
  6912. * Note: in the utility process custom protocols are not supported.
  6913. */
  6914. fetch(input: (string) | (GlobalRequest), init?: RequestInit & { bypassCustomProtocolHandlers?: boolean }): Promise<GlobalResponse>;
  6915. /**
  6916. * Whether there is currently internet connection.
  6917. *
  6918. * A return value of `false` is a pretty strong indicator that the user won't be
  6919. * able to connect to remote sites. However, a return value of `true` is
  6920. * inconclusive; even if some link is up, it is uncertain whether a particular
  6921. * connection attempt to a particular remote site will be successful.
  6922. */
  6923. isOnline(): boolean;
  6924. /**
  6925. * Creates a `ClientRequest` instance using the provided `options` which are
  6926. * directly forwarded to the `ClientRequest` constructor. The `net.request` method
  6927. * would be used to issue both secure and insecure HTTP requests according to the
  6928. * specified protocol scheme in the `options` object.
  6929. */
  6930. request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
  6931. /**
  6932. * Resolves with the resolved IP addresses for the `host`.
  6933. *
  6934. * This method will resolve hosts from the default session. To resolve a host from
  6935. * another session, use ses.resolveHost().
  6936. */
  6937. resolveHost(host: string, options?: ResolveHostOptions): Promise<Electron.ResolvedHost>;
  6938. /**
  6939. * A `boolean` property. Whether there is currently internet connection.
  6940. *
  6941. * A return value of `false` is a pretty strong indicator that the user won't be
  6942. * able to connect to remote sites. However, a return value of `true` is
  6943. * inconclusive; even if some link is up, it is uncertain whether a particular
  6944. * connection attempt to a particular remote site will be successful.
  6945. *
  6946. */
  6947. readonly online: boolean;
  6948. }
  6949. interface NetLog {
  6950. // Docs: https://electronjs.org/docs/api/net-log
  6951. /**
  6952. * resolves when the net log has begun recording.
  6953. *
  6954. * Starts recording network events to `path`.
  6955. */
  6956. startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
  6957. /**
  6958. * resolves when the net log has been flushed to disk.
  6959. *
  6960. * Stops recording network events. If not called, net logging will automatically
  6961. * end when app quits.
  6962. */
  6963. stopLogging(): Promise<void>;
  6964. /**
  6965. * A `boolean` property that indicates whether network logs are currently being
  6966. * recorded.
  6967. *
  6968. */
  6969. readonly currentlyLogging: boolean;
  6970. }
  6971. class Notification extends NodeEventEmitter {
  6972. // Docs: https://electronjs.org/docs/api/notification
  6973. /**
  6974. * @platform darwin
  6975. */
  6976. on(event: 'action', listener: (event: Event,
  6977. /**
  6978. * The index of the action that was activated.
  6979. */
  6980. index: number) => void): this;
  6981. /**
  6982. * @platform darwin
  6983. */
  6984. off(event: 'action', listener: (event: Event,
  6985. /**
  6986. * The index of the action that was activated.
  6987. */
  6988. index: number) => void): this;
  6989. /**
  6990. * @platform darwin
  6991. */
  6992. once(event: 'action', listener: (event: Event,
  6993. /**
  6994. * The index of the action that was activated.
  6995. */
  6996. index: number) => void): this;
  6997. /**
  6998. * @platform darwin
  6999. */
  7000. addListener(event: 'action', listener: (event: Event,
  7001. /**
  7002. * The index of the action that was activated.
  7003. */
  7004. index: number) => void): this;
  7005. /**
  7006. * @platform darwin
  7007. */
  7008. removeListener(event: 'action', listener: (event: Event,
  7009. /**
  7010. * The index of the action that was activated.
  7011. */
  7012. index: number) => void): this;
  7013. /**
  7014. * Emitted when the notification is clicked by the user.
  7015. */
  7016. on(event: 'click', listener: (event: Event) => void): this;
  7017. off(event: 'click', listener: (event: Event) => void): this;
  7018. once(event: 'click', listener: (event: Event) => void): this;
  7019. addListener(event: 'click', listener: (event: Event) => void): this;
  7020. removeListener(event: 'click', listener: (event: Event) => void): this;
  7021. /**
  7022. * Emitted when the notification is closed by manual intervention from the user.
  7023. *
  7024. * This event is not guaranteed to be emitted in all cases where the notification
  7025. * is closed.
  7026. *
  7027. * On Windows, the `close` event can be emitted in one of three ways: programmatic
  7028. * dismissal with `notification.close()`, by the user closing the notification, or
  7029. * via system timeout. If a notification is in the Action Center after the initial
  7030. * `close` event is emitted, a call to `notification.close()` will remove the
  7031. * notification from the action center but the `close` event will not be emitted
  7032. * again.
  7033. */
  7034. on(event: 'close', listener: (event: Event) => void): this;
  7035. off(event: 'close', listener: (event: Event) => void): this;
  7036. once(event: 'close', listener: (event: Event) => void): this;
  7037. addListener(event: 'close', listener: (event: Event) => void): this;
  7038. removeListener(event: 'close', listener: (event: Event) => void): this;
  7039. /**
  7040. * Emitted when an error is encountered while creating and showing the native
  7041. * notification.
  7042. *
  7043. * @platform win32
  7044. */
  7045. on(event: 'failed', listener: (event: Event,
  7046. /**
  7047. * The error encountered during execution of the `show()` method.
  7048. */
  7049. error: string) => void): this;
  7050. /**
  7051. * @platform win32
  7052. */
  7053. off(event: 'failed', listener: (event: Event,
  7054. /**
  7055. * The error encountered during execution of the `show()` method.
  7056. */
  7057. error: string) => void): this;
  7058. /**
  7059. * @platform win32
  7060. */
  7061. once(event: 'failed', listener: (event: Event,
  7062. /**
  7063. * The error encountered during execution of the `show()` method.
  7064. */
  7065. error: string) => void): this;
  7066. /**
  7067. * @platform win32
  7068. */
  7069. addListener(event: 'failed', listener: (event: Event,
  7070. /**
  7071. * The error encountered during execution of the `show()` method.
  7072. */
  7073. error: string) => void): this;
  7074. /**
  7075. * @platform win32
  7076. */
  7077. removeListener(event: 'failed', listener: (event: Event,
  7078. /**
  7079. * The error encountered during execution of the `show()` method.
  7080. */
  7081. error: string) => void): this;
  7082. /**
  7083. * Emitted when the user clicks the "Reply" button on a notification with
  7084. * `hasReply: true`.
  7085. *
  7086. * @platform darwin
  7087. */
  7088. on(event: 'reply', listener: (event: Event,
  7089. /**
  7090. * The string the user entered into the inline reply field.
  7091. */
  7092. reply: string) => void): this;
  7093. /**
  7094. * @platform darwin
  7095. */
  7096. off(event: 'reply', listener: (event: Event,
  7097. /**
  7098. * The string the user entered into the inline reply field.
  7099. */
  7100. reply: string) => void): this;
  7101. /**
  7102. * @platform darwin
  7103. */
  7104. once(event: 'reply', listener: (event: Event,
  7105. /**
  7106. * The string the user entered into the inline reply field.
  7107. */
  7108. reply: string) => void): this;
  7109. /**
  7110. * @platform darwin
  7111. */
  7112. addListener(event: 'reply', listener: (event: Event,
  7113. /**
  7114. * The string the user entered into the inline reply field.
  7115. */
  7116. reply: string) => void): this;
  7117. /**
  7118. * @platform darwin
  7119. */
  7120. removeListener(event: 'reply', listener: (event: Event,
  7121. /**
  7122. * The string the user entered into the inline reply field.
  7123. */
  7124. reply: string) => void): this;
  7125. /**
  7126. * Emitted when the notification is shown to the user. Note that this event can be
  7127. * fired multiple times as a notification can be shown multiple times through the
  7128. * `show()` method.
  7129. */
  7130. on(event: 'show', listener: (event: Event) => void): this;
  7131. off(event: 'show', listener: (event: Event) => void): this;
  7132. once(event: 'show', listener: (event: Event) => void): this;
  7133. addListener(event: 'show', listener: (event: Event) => void): this;
  7134. removeListener(event: 'show', listener: (event: Event) => void): this;
  7135. /**
  7136. * Notification
  7137. */
  7138. constructor(options?: NotificationConstructorOptions);
  7139. /**
  7140. * Whether or not desktop notifications are supported on the current system
  7141. */
  7142. static isSupported(): boolean;
  7143. /**
  7144. * Dismisses the notification.
  7145. *
  7146. * On Windows, calling `notification.close()` while the notification is visible on
  7147. * screen will dismiss the notification and remove it from the Action Center. If
  7148. * `notification.close()` is called after the notification is no longer visible on
  7149. * screen, calling `notification.close()` will try remove it from the Action
  7150. * Center.
  7151. */
  7152. close(): void;
  7153. /**
  7154. * Immediately shows the notification to the user. Unlike the web notification API,
  7155. * instantiating a `new Notification()` does not immediately show it to the user.
  7156. * Instead, you need to call this method before the OS will display it.
  7157. *
  7158. * If the notification has been shown before, this method will dismiss the
  7159. * previously shown notification and create a new one with identical properties.
  7160. */
  7161. show(): void;
  7162. /**
  7163. * A `NotificationAction[]` property representing the actions of the notification.
  7164. */
  7165. actions: NotificationAction[];
  7166. /**
  7167. * A `string` property representing the body of the notification.
  7168. */
  7169. body: string;
  7170. /**
  7171. * A `string` property representing the close button text of the notification.
  7172. */
  7173. closeButtonText: string;
  7174. /**
  7175. * A `boolean` property representing whether the notification has a reply action.
  7176. */
  7177. hasReply: boolean;
  7178. /**
  7179. * A `string` property representing the reply placeholder of the notification.
  7180. */
  7181. replyPlaceholder: string;
  7182. /**
  7183. * A `boolean` property representing whether the notification is silent.
  7184. */
  7185. silent: boolean;
  7186. /**
  7187. * A `string` property representing the sound of the notification.
  7188. */
  7189. sound: string;
  7190. /**
  7191. * A `string` property representing the subtitle of the notification.
  7192. */
  7193. subtitle: string;
  7194. /**
  7195. * A `string` property representing the type of timeout duration for the
  7196. * notification. Can be 'default' or 'never'.
  7197. *
  7198. * If `timeoutType` is set to 'never', the notification never expires. It stays
  7199. * open until closed by the calling API or the user.
  7200. *
  7201. * @platform linux,win32
  7202. */
  7203. timeoutType: ('default' | 'never');
  7204. /**
  7205. * A `string` property representing the title of the notification.
  7206. */
  7207. title: string;
  7208. /**
  7209. * A `string` property representing the custom Toast XML of the notification.
  7210. *
  7211. * @platform win32
  7212. */
  7213. toastXml: string;
  7214. /**
  7215. * A `string` property representing the urgency level of the notification. Can be
  7216. * 'normal', 'critical', or 'low'.
  7217. *
  7218. * Default is 'low' - see NotifyUrgency for more information.
  7219. *
  7220. * @platform linux
  7221. */
  7222. urgency: ('normal' | 'critical' | 'low');
  7223. }
  7224. interface NotificationAction {
  7225. // Docs: https://electronjs.org/docs/api/structures/notification-action
  7226. /**
  7227. * The label for the given action.
  7228. */
  7229. text?: string;
  7230. /**
  7231. * The type of action, can be `button`.
  7232. */
  7233. type: ('button');
  7234. }
  7235. interface NotificationResponse {
  7236. // Docs: https://electronjs.org/docs/api/structures/notification-response
  7237. /**
  7238. * The identifier string of the action that the user selected.
  7239. */
  7240. actionIdentifier: string;
  7241. /**
  7242. * The delivery date of the notification.
  7243. */
  7244. date: number;
  7245. /**
  7246. * The unique identifier for this notification request.
  7247. */
  7248. identifier: string;
  7249. /**
  7250. * A dictionary of custom information associated with the notification.
  7251. */
  7252. userInfo: Record<string, any>;
  7253. /**
  7254. * The text entered or chosen by the user.
  7255. */
  7256. userText?: string;
  7257. }
  7258. interface ParentPort extends NodeJS.EventEmitter {
  7259. // Docs: https://electronjs.org/docs/api/parent-port
  7260. /**
  7261. * Emitted when the process receives a message. Messages received on this port will
  7262. * be queued up until a handler is registered for this event.
  7263. */
  7264. on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  7265. off(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  7266. once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  7267. addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  7268. removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  7269. /**
  7270. * Sends a message from the process to its parent.
  7271. */
  7272. postMessage(message: any): void;
  7273. }
  7274. interface PaymentDiscount {
  7275. // Docs: https://electronjs.org/docs/api/structures/payment-discount
  7276. /**
  7277. * A string used to uniquely identify a discount offer for a product.
  7278. */
  7279. identifier: string;
  7280. /**
  7281. * A string that identifies the key used to generate the signature.
  7282. */
  7283. keyIdentifier: string;
  7284. /**
  7285. * A universally unique ID (UUID) value that you define.
  7286. */
  7287. nonce: string;
  7288. /**
  7289. * A UTF-8 string representing the properties of a specific discount offer,
  7290. * cryptographically signed.
  7291. */
  7292. signature: string;
  7293. /**
  7294. * The date and time of the signature's creation in milliseconds, formatted in Unix
  7295. * epoch time.
  7296. */
  7297. timestamp: number;
  7298. }
  7299. interface Point {
  7300. // Docs: https://electronjs.org/docs/api/structures/point
  7301. x: number;
  7302. y: number;
  7303. }
  7304. interface PostBody {
  7305. // Docs: https://electronjs.org/docs/api/structures/post-body
  7306. /**
  7307. * The boundary used to separate multiple parts of the message. Only valid when
  7308. * `contentType` is `multipart/form-data`.
  7309. */
  7310. boundary?: string;
  7311. /**
  7312. * The `content-type` header used for the data. One of
  7313. * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
  7314. * `enctype` attribute of the submitted HTML form.
  7315. */
  7316. contentType: string;
  7317. /**
  7318. * The post data to be sent to the new window.
  7319. */
  7320. data: Array<(UploadRawData) | (UploadFile)>;
  7321. }
  7322. interface PowerMonitor extends NodeJS.EventEmitter {
  7323. // Docs: https://electronjs.org/docs/api/power-monitor
  7324. /**
  7325. * Emitted when the system is about to lock the screen.
  7326. *
  7327. * @platform darwin,win32
  7328. */
  7329. on(event: 'lock-screen', listener: Function): this;
  7330. /**
  7331. * @platform darwin,win32
  7332. */
  7333. off(event: 'lock-screen', listener: Function): this;
  7334. /**
  7335. * @platform darwin,win32
  7336. */
  7337. once(event: 'lock-screen', listener: Function): this;
  7338. /**
  7339. * @platform darwin,win32
  7340. */
  7341. addListener(event: 'lock-screen', listener: Function): this;
  7342. /**
  7343. * @platform darwin,win32
  7344. */
  7345. removeListener(event: 'lock-screen', listener: Function): this;
  7346. /**
  7347. * Emitted when the system changes to AC power.
  7348. *
  7349. * @platform darwin,win32
  7350. */
  7351. on(event: 'on-ac', listener: Function): this;
  7352. /**
  7353. * @platform darwin,win32
  7354. */
  7355. off(event: 'on-ac', listener: Function): this;
  7356. /**
  7357. * @platform darwin,win32
  7358. */
  7359. once(event: 'on-ac', listener: Function): this;
  7360. /**
  7361. * @platform darwin,win32
  7362. */
  7363. addListener(event: 'on-ac', listener: Function): this;
  7364. /**
  7365. * @platform darwin,win32
  7366. */
  7367. removeListener(event: 'on-ac', listener: Function): this;
  7368. /**
  7369. * Emitted when system changes to battery power.
  7370. *
  7371. * @platform darwin
  7372. */
  7373. on(event: 'on-battery', listener: Function): this;
  7374. /**
  7375. * @platform darwin
  7376. */
  7377. off(event: 'on-battery', listener: Function): this;
  7378. /**
  7379. * @platform darwin
  7380. */
  7381. once(event: 'on-battery', listener: Function): this;
  7382. /**
  7383. * @platform darwin
  7384. */
  7385. addListener(event: 'on-battery', listener: Function): this;
  7386. /**
  7387. * @platform darwin
  7388. */
  7389. removeListener(event: 'on-battery', listener: Function): this;
  7390. /**
  7391. * Emitted when system is resuming.
  7392. */
  7393. on(event: 'resume', listener: Function): this;
  7394. off(event: 'resume', listener: Function): this;
  7395. once(event: 'resume', listener: Function): this;
  7396. addListener(event: 'resume', listener: Function): this;
  7397. removeListener(event: 'resume', listener: Function): this;
  7398. /**
  7399. * Emitted when the system is about to reboot or shut down. If the event handler
  7400. * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
  7401. * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
  7402. * should exit as soon as possible by calling something like `app.quit()`.
  7403. *
  7404. * @platform linux,darwin
  7405. */
  7406. on(event: 'shutdown', listener: Function): this;
  7407. /**
  7408. * @platform linux,darwin
  7409. */
  7410. off(event: 'shutdown', listener: Function): this;
  7411. /**
  7412. * @platform linux,darwin
  7413. */
  7414. once(event: 'shutdown', listener: Function): this;
  7415. /**
  7416. * @platform linux,darwin
  7417. */
  7418. addListener(event: 'shutdown', listener: Function): this;
  7419. /**
  7420. * @platform linux,darwin
  7421. */
  7422. removeListener(event: 'shutdown', listener: Function): this;
  7423. /**
  7424. * Notification of a change in the operating system's advertised speed limit for
  7425. * CPUs, in percent. Values below 100 indicate that the system is impairing
  7426. * processing power due to thermal management.
  7427. *
  7428. * @platform darwin,win32
  7429. */
  7430. on(event: 'speed-limit-change', listener: Function): this;
  7431. /**
  7432. * @platform darwin,win32
  7433. */
  7434. off(event: 'speed-limit-change', listener: Function): this;
  7435. /**
  7436. * @platform darwin,win32
  7437. */
  7438. once(event: 'speed-limit-change', listener: Function): this;
  7439. /**
  7440. * @platform darwin,win32
  7441. */
  7442. addListener(event: 'speed-limit-change', listener: Function): this;
  7443. /**
  7444. * @platform darwin,win32
  7445. */
  7446. removeListener(event: 'speed-limit-change', listener: Function): this;
  7447. /**
  7448. * Emitted when the system is suspending.
  7449. */
  7450. on(event: 'suspend', listener: Function): this;
  7451. off(event: 'suspend', listener: Function): this;
  7452. once(event: 'suspend', listener: Function): this;
  7453. addListener(event: 'suspend', listener: Function): this;
  7454. removeListener(event: 'suspend', listener: Function): this;
  7455. /**
  7456. * Emitted when the thermal state of the system changes. Notification of a change
  7457. * in the thermal status of the system, such as entering a critical temperature
  7458. * range. Depending on the severity, the system might take steps to reduce said
  7459. * temperature, for example, throttling the CPU or switching on the fans if
  7460. * available.
  7461. *
  7462. * Apps may react to the new state by reducing expensive computing tasks (e.g.
  7463. * video encoding), or notifying the user. The same state might be received
  7464. * repeatedly.
  7465. *
  7466. * See
  7467. * https://developer.apple.com/library/archive/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/RespondToThermalStateChanges.html
  7468. *
  7469. * @platform darwin
  7470. */
  7471. on(event: 'thermal-state-change', listener: Function): this;
  7472. /**
  7473. * @platform darwin
  7474. */
  7475. off(event: 'thermal-state-change', listener: Function): this;
  7476. /**
  7477. * @platform darwin
  7478. */
  7479. once(event: 'thermal-state-change', listener: Function): this;
  7480. /**
  7481. * @platform darwin
  7482. */
  7483. addListener(event: 'thermal-state-change', listener: Function): this;
  7484. /**
  7485. * @platform darwin
  7486. */
  7487. removeListener(event: 'thermal-state-change', listener: Function): this;
  7488. /**
  7489. * Emitted as soon as the systems screen is unlocked.
  7490. *
  7491. * @platform darwin,win32
  7492. */
  7493. on(event: 'unlock-screen', listener: Function): this;
  7494. /**
  7495. * @platform darwin,win32
  7496. */
  7497. off(event: 'unlock-screen', listener: Function): this;
  7498. /**
  7499. * @platform darwin,win32
  7500. */
  7501. once(event: 'unlock-screen', listener: Function): this;
  7502. /**
  7503. * @platform darwin,win32
  7504. */
  7505. addListener(event: 'unlock-screen', listener: Function): this;
  7506. /**
  7507. * @platform darwin,win32
  7508. */
  7509. removeListener(event: 'unlock-screen', listener: Function): this;
  7510. /**
  7511. * Emitted when a login session is activated. See documentation for more
  7512. * information.
  7513. *
  7514. * @platform darwin
  7515. */
  7516. on(event: 'user-did-become-active', listener: Function): this;
  7517. /**
  7518. * @platform darwin
  7519. */
  7520. off(event: 'user-did-become-active', listener: Function): this;
  7521. /**
  7522. * @platform darwin
  7523. */
  7524. once(event: 'user-did-become-active', listener: Function): this;
  7525. /**
  7526. * @platform darwin
  7527. */
  7528. addListener(event: 'user-did-become-active', listener: Function): this;
  7529. /**
  7530. * @platform darwin
  7531. */
  7532. removeListener(event: 'user-did-become-active', listener: Function): this;
  7533. /**
  7534. * Emitted when a login session is deactivated. See documentation for more
  7535. * information.
  7536. *
  7537. * @platform darwin
  7538. */
  7539. on(event: 'user-did-resign-active', listener: Function): this;
  7540. /**
  7541. * @platform darwin
  7542. */
  7543. off(event: 'user-did-resign-active', listener: Function): this;
  7544. /**
  7545. * @platform darwin
  7546. */
  7547. once(event: 'user-did-resign-active', listener: Function): this;
  7548. /**
  7549. * @platform darwin
  7550. */
  7551. addListener(event: 'user-did-resign-active', listener: Function): this;
  7552. /**
  7553. * @platform darwin
  7554. */
  7555. removeListener(event: 'user-did-resign-active', listener: Function): this;
  7556. /**
  7557. * The system's current thermal state. Can be `unknown`, `nominal`, `fair`,
  7558. * `serious`, or `critical`.
  7559. *
  7560. * @platform darwin
  7561. */
  7562. getCurrentThermalState(): ('unknown' | 'nominal' | 'fair' | 'serious' | 'critical');
  7563. /**
  7564. * The system's current idle state. Can be `active`, `idle`, `locked` or `unknown`.
  7565. *
  7566. * Calculate the system idle state. `idleThreshold` is the amount of time (in
  7567. * seconds) before considered idle. `locked` is available on supported systems
  7568. * only.
  7569. */
  7570. getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
  7571. /**
  7572. * Idle time in seconds
  7573. *
  7574. * Calculate system idle time in seconds.
  7575. */
  7576. getSystemIdleTime(): number;
  7577. /**
  7578. * Whether the system is on battery power.
  7579. *
  7580. * To monitor for changes in this property, use the `on-battery` and `on-ac`
  7581. * events.
  7582. */
  7583. isOnBatteryPower(): boolean;
  7584. /**
  7585. * A `boolean` property. True if the system is on battery power.
  7586. *
  7587. * See `powerMonitor.isOnBatteryPower()`.
  7588. */
  7589. onBatteryPower: boolean;
  7590. }
  7591. interface PowerSaveBlocker {
  7592. // Docs: https://electronjs.org/docs/api/power-save-blocker
  7593. /**
  7594. * Whether the corresponding `powerSaveBlocker` has started.
  7595. */
  7596. isStarted(id: number): boolean;
  7597. /**
  7598. * The blocker ID that is assigned to this power blocker.
  7599. *
  7600. * Starts preventing the system from entering lower-power mode. Returns an integer
  7601. * identifying the power save blocker.
  7602. *
  7603. * **Note:** `prevent-display-sleep` has higher precedence over
  7604. * `prevent-app-suspension`. Only the highest precedence type takes effect. In
  7605. * other words, `prevent-display-sleep` always takes precedence over
  7606. * `prevent-app-suspension`.
  7607. *
  7608. * For example, an API calling A requests for `prevent-app-suspension`, and another
  7609. * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
  7610. * used until B stops its request. After that, `prevent-app-suspension` is used.
  7611. */
  7612. start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
  7613. /**
  7614. * Stops the specified power save blocker.
  7615. *
  7616. * Whether the specified `powerSaveBlocker` has been stopped.
  7617. */
  7618. stop(id: number): boolean;
  7619. }
  7620. interface PrinterInfo {
  7621. // Docs: https://electronjs.org/docs/api/structures/printer-info
  7622. /**
  7623. * a longer description of the printer's type.
  7624. */
  7625. description: string;
  7626. /**
  7627. * the name of the printer as shown in Print Preview.
  7628. */
  7629. displayName: string;
  7630. /**
  7631. * whether or not a given printer is set as the default printer on the OS.
  7632. */
  7633. isDefault: boolean;
  7634. /**
  7635. * the name of the printer as understood by the OS.
  7636. */
  7637. name: string;
  7638. /**
  7639. * an object containing a variable number of platform-specific printer information.
  7640. */
  7641. options: Options;
  7642. /**
  7643. * the current status of the printer.
  7644. */
  7645. status: number;
  7646. }
  7647. interface ProcessMemoryInfo {
  7648. // Docs: https://electronjs.org/docs/api/structures/process-memory-info
  7649. /**
  7650. * The amount of memory not shared by other processes, such as JS heap or HTML
  7651. * content in Kilobytes.
  7652. */
  7653. private: number;
  7654. /**
  7655. * The amount of memory currently pinned to actual physical RAM in Kilobytes.
  7656. *
  7657. * @platform linux,win32
  7658. */
  7659. residentSet: number;
  7660. /**
  7661. * The amount of memory shared between processes, typically memory consumed by the
  7662. * Electron code itself in Kilobytes.
  7663. */
  7664. shared: number;
  7665. }
  7666. interface ProcessMetric {
  7667. // Docs: https://electronjs.org/docs/api/structures/process-metric
  7668. /**
  7669. * CPU usage of the process.
  7670. */
  7671. cpu: CPUUsage;
  7672. /**
  7673. * Creation time for this process. The time is represented as number of
  7674. * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
  7675. * is useful to use both the `pid` and the `creationTime` to uniquely identify a
  7676. * process.
  7677. */
  7678. creationTime: number;
  7679. /**
  7680. * One of the following values:
  7681. *
  7682. * @platform win32
  7683. */
  7684. integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
  7685. /**
  7686. * Memory information for the process.
  7687. */
  7688. memory: MemoryInfo;
  7689. /**
  7690. * The name of the process. Examples for utility: `Audio Service`, `Content
  7691. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  7692. */
  7693. name?: string;
  7694. /**
  7695. * Process id of the process.
  7696. */
  7697. pid: number;
  7698. /**
  7699. * Whether the process is sandboxed on OS level.
  7700. *
  7701. * @platform darwin,win32
  7702. */
  7703. sandboxed?: boolean;
  7704. /**
  7705. * The non-localized name of the process.
  7706. */
  7707. serviceName?: string;
  7708. /**
  7709. * Process type. One of the following values:
  7710. */
  7711. type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  7712. }
  7713. interface Product {
  7714. // Docs: https://electronjs.org/docs/api/structures/product
  7715. /**
  7716. * 3 character code presenting a product's currency based on the ISO 4217 standard.
  7717. */
  7718. currencyCode: string;
  7719. /**
  7720. * An array of discount offers
  7721. */
  7722. discounts: ProductDiscount[];
  7723. /**
  7724. * The total size of the content, in bytes.
  7725. */
  7726. downloadContentLengths: number[];
  7727. /**
  7728. * A string that identifies the version of the content.
  7729. */
  7730. downloadContentVersion: string;
  7731. /**
  7732. * The locale formatted price of the product.
  7733. */
  7734. formattedPrice: string;
  7735. /**
  7736. * The object containing introductory price information for the product. available
  7737. * for the product.
  7738. */
  7739. introductoryPrice?: ProductDiscount;
  7740. /**
  7741. * A boolean value that indicates whether the App Store has downloadable content
  7742. * for this product. `true` if at least one file has been associated with the
  7743. * product.
  7744. */
  7745. isDownloadable: boolean;
  7746. /**
  7747. * A description of the product.
  7748. */
  7749. localizedDescription: string;
  7750. /**
  7751. * The name of the product.
  7752. */
  7753. localizedTitle: string;
  7754. /**
  7755. * The cost of the product in the local currency.
  7756. */
  7757. price: number;
  7758. /**
  7759. * The string that identifies the product to the Apple App Store.
  7760. */
  7761. productIdentifier: string;
  7762. /**
  7763. * The identifier of the subscription group to which the subscription belongs.
  7764. */
  7765. subscriptionGroupIdentifier: string;
  7766. /**
  7767. * The period details for products that are subscriptions.
  7768. */
  7769. subscriptionPeriod?: ProductSubscriptionPeriod;
  7770. }
  7771. interface ProductDiscount {
  7772. // Docs: https://electronjs.org/docs/api/structures/product-discount
  7773. /**
  7774. * A string used to uniquely identify a discount offer for a product.
  7775. */
  7776. identifier: string;
  7777. /**
  7778. * An integer that indicates the number of periods the product discount is
  7779. * available.
  7780. */
  7781. numberOfPeriods: number;
  7782. /**
  7783. * The payment mode for this product discount. Can be `payAsYouGo`, `payUpFront`,
  7784. * or `freeTrial`.
  7785. */
  7786. paymentMode: ('payAsYouGo' | 'payUpFront' | 'freeTrial');
  7787. /**
  7788. * The discount price of the product in the local currency.
  7789. */
  7790. price: number;
  7791. /**
  7792. * The locale used to format the discount price of the product.
  7793. */
  7794. priceLocale: string;
  7795. /**
  7796. * An object that defines the period for the product discount.
  7797. */
  7798. subscriptionPeriod?: ProductSubscriptionPeriod;
  7799. /**
  7800. * The type of discount offer.
  7801. */
  7802. type: number;
  7803. }
  7804. interface ProductSubscriptionPeriod {
  7805. // Docs: https://electronjs.org/docs/api/structures/product-subscription-period
  7806. /**
  7807. * The number of units per subscription period.
  7808. */
  7809. numberOfUnits: number;
  7810. /**
  7811. * The increment of time that a subscription period is specified in. Can be `day`,
  7812. * `week`, `month`, `year`.
  7813. */
  7814. unit: ('day' | 'week' | 'month' | 'year');
  7815. }
  7816. interface Protocol {
  7817. // Docs: https://electronjs.org/docs/api/protocol
  7818. /**
  7819. * Register a protocol handler for `scheme`. Requests made to URLs with this scheme
  7820. * will delegate to this handler to determine what response should be sent.
  7821. *
  7822. * Either a `Response` or a `Promise<Response>` can be returned.
  7823. *
  7824. * Example:
  7825. *
  7826. * See the MDN docs for `Request` and `Response` for more details.
  7827. */
  7828. handle(scheme: string, handler: (request: GlobalRequest) => (GlobalResponse) | (Promise<GlobalResponse>)): void;
  7829. /**
  7830. * Whether the protocol was successfully intercepted
  7831. *
  7832. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  7833. * which sends a `Buffer` as a response.
  7834. *
  7835. * @deprecated
  7836. */
  7837. interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  7838. /**
  7839. * Whether the protocol was successfully intercepted
  7840. *
  7841. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  7842. * which sends a file as a response.
  7843. *
  7844. * @deprecated
  7845. */
  7846. interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  7847. /**
  7848. * Whether the protocol was successfully intercepted
  7849. *
  7850. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  7851. * which sends a new HTTP request as a response.
  7852. *
  7853. * @deprecated
  7854. */
  7855. interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  7856. /**
  7857. * Whether the protocol was successfully intercepted
  7858. *
  7859. * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
  7860. * protocol handler.
  7861. *
  7862. * @deprecated
  7863. */
  7864. interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  7865. /**
  7866. * Whether the protocol was successfully intercepted
  7867. *
  7868. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  7869. * which sends a `string` as a response.
  7870. *
  7871. * @deprecated
  7872. */
  7873. interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  7874. /**
  7875. * Whether `scheme` is already handled.
  7876. */
  7877. isProtocolHandled(scheme: string): boolean;
  7878. /**
  7879. * Whether `scheme` is already intercepted.
  7880. *
  7881. * @deprecated
  7882. */
  7883. isProtocolIntercepted(scheme: string): boolean;
  7884. /**
  7885. * Whether `scheme` is already registered.
  7886. *
  7887. * @deprecated
  7888. */
  7889. isProtocolRegistered(scheme: string): boolean;
  7890. /**
  7891. * Whether the protocol was successfully registered
  7892. *
  7893. * Registers a protocol of `scheme` that will send a `Buffer` as a response.
  7894. *
  7895. * The usage is the same with `registerFileProtocol`, except that the `callback`
  7896. * should be called with either a `Buffer` object or an object that has the `data`
  7897. * property.
  7898. *
  7899. * Example:
  7900. *
  7901. * @deprecated
  7902. */
  7903. registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  7904. /**
  7905. * Whether the protocol was successfully registered
  7906. *
  7907. * Registers a protocol of `scheme` that will send a file as the response. The
  7908. * `handler` will be called with `request` and `callback` where `request` is an
  7909. * incoming request for the `scheme`.
  7910. *
  7911. * To handle the `request`, the `callback` should be called with either the file's
  7912. * path or an object that has a `path` property, e.g. `callback(filePath)` or
  7913. * `callback({ path: filePath })`. The `filePath` must be an absolute path.
  7914. *
  7915. * By default the `scheme` is treated like `http:`, which is parsed differently
  7916. * from protocols that follow the "generic URI syntax" like `file:`.
  7917. *
  7918. * @deprecated
  7919. */
  7920. registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  7921. /**
  7922. * Whether the protocol was successfully registered
  7923. *
  7924. * Registers a protocol of `scheme` that will send an HTTP request as a response.
  7925. *
  7926. * The usage is the same with `registerFileProtocol`, except that the `callback`
  7927. * should be called with an object that has the `url` property.
  7928. *
  7929. * @deprecated
  7930. */
  7931. registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  7932. /**
  7933. * **Note:** This method can only be used before the `ready` event of the `app`
  7934. * module gets emitted and can be called only once.
  7935. *
  7936. * Registers the `scheme` as standard, secure, bypasses content security policy for
  7937. * resources, allows registering ServiceWorker, supports fetch API, streaming
  7938. * video/audio, and V8 code cache. Specify a privilege with the value of `true` to
  7939. * enable the capability.
  7940. *
  7941. * An example of registering a privileged scheme, that bypasses Content Security
  7942. * Policy:
  7943. *
  7944. * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
  7945. * `http` and `https` are standard schemes, while `file` is not.
  7946. *
  7947. * Registering a scheme as standard allows relative and absolute resources to be
  7948. * resolved correctly when served. Otherwise the scheme will behave like the `file`
  7949. * protocol, but without the ability to resolve relative URLs.
  7950. *
  7951. * For example when you load following page with custom protocol without
  7952. * registering it as standard scheme, the image will not be loaded because
  7953. * non-standard schemes can not recognize relative URLs:
  7954. *
  7955. * Registering a scheme as standard will allow access to files through the
  7956. * FileSystem API. Otherwise the renderer will throw a security error for the
  7957. * scheme.
  7958. *
  7959. * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
  7960. * cookies) are disabled for non standard schemes. So in general if you want to
  7961. * register a custom protocol to replace the `http` protocol, you have to register
  7962. * it as a standard scheme.
  7963. *
  7964. * Protocols that use streams (http and stream protocols) should set `stream:
  7965. * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
  7966. * their responses by default. The `stream` flag configures those elements to
  7967. * correctly expect streaming responses.
  7968. */
  7969. registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
  7970. /**
  7971. * Whether the protocol was successfully registered
  7972. *
  7973. * Registers a protocol of `scheme` that will send a stream as a response.
  7974. *
  7975. * The usage is the same with `registerFileProtocol`, except that the `callback`
  7976. * should be called with either a `ReadableStream` object or an object that has the
  7977. * `data` property.
  7978. *
  7979. * Example:
  7980. *
  7981. * It is possible to pass any object that implements the readable stream API (emits
  7982. * `data`/`end`/`error` events). For example, here's how a file could be returned:
  7983. *
  7984. * @deprecated
  7985. */
  7986. registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  7987. /**
  7988. * Whether the protocol was successfully registered
  7989. *
  7990. * Registers a protocol of `scheme` that will send a `string` as a response.
  7991. *
  7992. * The usage is the same with `registerFileProtocol`, except that the `callback`
  7993. * should be called with either a `string` or an object that has the `data`
  7994. * property.
  7995. *
  7996. * @deprecated
  7997. */
  7998. registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  7999. /**
  8000. * Removes a protocol handler registered with `protocol.handle`.
  8001. */
  8002. unhandle(scheme: string): void;
  8003. /**
  8004. * Whether the protocol was successfully unintercepted
  8005. *
  8006. * Remove the interceptor installed for `scheme` and restore its original handler.
  8007. *
  8008. * @deprecated
  8009. */
  8010. uninterceptProtocol(scheme: string): boolean;
  8011. /**
  8012. * Whether the protocol was successfully unregistered
  8013. *
  8014. * Unregisters the custom protocol of `scheme`.
  8015. *
  8016. * @deprecated
  8017. */
  8018. unregisterProtocol(scheme: string): boolean;
  8019. }
  8020. interface ProtocolRequest {
  8021. // Docs: https://electronjs.org/docs/api/structures/protocol-request
  8022. headers: Record<string, string>;
  8023. method: string;
  8024. referrer: string;
  8025. uploadData?: UploadData[];
  8026. url: string;
  8027. }
  8028. interface ProtocolResponse {
  8029. // Docs: https://electronjs.org/docs/api/structures/protocol-response
  8030. /**
  8031. * The charset of response body, default is `"utf-8"`.
  8032. */
  8033. charset?: string;
  8034. /**
  8035. * The response body. When returning stream as response, this is a Node.js readable
  8036. * stream representing the response body. When returning `Buffer` as response, this
  8037. * is a `Buffer`. When returning `string` as response, this is a `string`. This is
  8038. * ignored for other types of responses.
  8039. */
  8040. data?: (Buffer) | (string) | (NodeJS.ReadableStream);
  8041. /**
  8042. * When assigned, the `request` will fail with the `error` number . For the
  8043. * available error numbers you can use, please see the net error list.
  8044. */
  8045. error?: number;
  8046. /**
  8047. * An object containing the response headers. The keys must be string, and values
  8048. * must be either string or Array of string.
  8049. */
  8050. headers?: Record<string, (string) | (string[])>;
  8051. /**
  8052. * The HTTP `method`. This is only used for file and URL responses.
  8053. */
  8054. method?: string;
  8055. /**
  8056. * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
  8057. * would implicitly set the `content-type` header in response, but if
  8058. * `content-type` is already set in `headers`, the `mimeType` would be ignored.
  8059. */
  8060. mimeType?: string;
  8061. /**
  8062. * Path to the file which would be sent as response body. This is only used for
  8063. * file responses.
  8064. */
  8065. path?: string;
  8066. /**
  8067. * The `referrer` URL. This is only used for file and URL responses.
  8068. */
  8069. referrer?: string;
  8070. /**
  8071. * The session used for requesting URL, by default the HTTP request will reuse the
  8072. * current session. Setting `session` to `null` would use a random independent
  8073. * session. This is only used for URL responses.
  8074. */
  8075. session?: Session;
  8076. /**
  8077. * The HTTP response code, default is 200.
  8078. */
  8079. statusCode?: number;
  8080. /**
  8081. * The data used as upload data. This is only used for URL responses when `method`
  8082. * is `"POST"`.
  8083. */
  8084. uploadData?: ProtocolResponseUploadData;
  8085. /**
  8086. * Download the `url` and pipe the result as response body. This is only used for
  8087. * URL responses.
  8088. */
  8089. url?: string;
  8090. }
  8091. interface ProtocolResponseUploadData {
  8092. // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
  8093. /**
  8094. * MIME type of the content.
  8095. */
  8096. contentType: string;
  8097. /**
  8098. * Content to be sent.
  8099. */
  8100. data: (string) | (Buffer);
  8101. }
  8102. interface ProxyConfig {
  8103. // Docs: https://electronjs.org/docs/api/structures/proxy-config
  8104. /**
  8105. * The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`,
  8106. * `fixed_servers` or `system`. Defaults to `pac_script` proxy mode if `pacScript`
  8107. * option is specified otherwise defaults to `fixed_servers`.
  8108. */
  8109. mode?: ('direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system');
  8110. /**
  8111. * The URL associated with the PAC file.
  8112. */
  8113. pacScript?: string;
  8114. /**
  8115. * Rules indicating which URLs should bypass the proxy settings.
  8116. */
  8117. proxyBypassRules?: string;
  8118. /**
  8119. * Rules indicating which proxies to use.
  8120. */
  8121. proxyRules?: string;
  8122. }
  8123. interface PushNotifications extends NodeJS.EventEmitter {
  8124. // Docs: https://electronjs.org/docs/api/push-notifications
  8125. /**
  8126. * Emitted when the app receives a remote notification while running. See:
  8127. * https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428430-application?language=objc
  8128. *
  8129. * @platform darwin
  8130. */
  8131. on(event: 'received-apns-notification', listener: (event: Event,
  8132. userInfo: Record<string, any>) => void): this;
  8133. /**
  8134. * @platform darwin
  8135. */
  8136. off(event: 'received-apns-notification', listener: (event: Event,
  8137. userInfo: Record<string, any>) => void): this;
  8138. /**
  8139. * @platform darwin
  8140. */
  8141. once(event: 'received-apns-notification', listener: (event: Event,
  8142. userInfo: Record<string, any>) => void): this;
  8143. /**
  8144. * @platform darwin
  8145. */
  8146. addListener(event: 'received-apns-notification', listener: (event: Event,
  8147. userInfo: Record<string, any>) => void): this;
  8148. /**
  8149. * @platform darwin
  8150. */
  8151. removeListener(event: 'received-apns-notification', listener: (event: Event,
  8152. userInfo: Record<string, any>) => void): this;
  8153. /**
  8154. * Registers the app with Apple Push Notification service (APNS) to receive Badge,
  8155. * Sound, and Alert notifications. If registration is successful, the promise will
  8156. * be resolved with the APNS device token. Otherwise, the promise will be rejected
  8157. * with an error message. See:
  8158. * https://developer.apple.com/documentation/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc
  8159. *
  8160. * @platform darwin
  8161. */
  8162. registerForAPNSNotifications(): Promise<string>;
  8163. /**
  8164. * Unregisters the app from notifications received from APNS. See:
  8165. * https://developer.apple.com/documentation/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc
  8166. *
  8167. * @platform darwin
  8168. */
  8169. unregisterForAPNSNotifications(): void;
  8170. }
  8171. interface Rectangle {
  8172. // Docs: https://electronjs.org/docs/api/structures/rectangle
  8173. /**
  8174. * The height of the rectangle (must be an integer).
  8175. */
  8176. height: number;
  8177. /**
  8178. * The width of the rectangle (must be an integer).
  8179. */
  8180. width: number;
  8181. /**
  8182. * The x coordinate of the origin of the rectangle (must be an integer).
  8183. */
  8184. x: number;
  8185. /**
  8186. * The y coordinate of the origin of the rectangle (must be an integer).
  8187. */
  8188. y: number;
  8189. }
  8190. interface Referrer {
  8191. // Docs: https://electronjs.org/docs/api/structures/referrer
  8192. /**
  8193. * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
  8194. * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
  8195. * See the Referrer-Policy spec for more details on the meaning of these values.
  8196. */
  8197. policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
  8198. /**
  8199. * HTTP Referrer URL.
  8200. */
  8201. url: string;
  8202. }
  8203. interface RenderProcessGoneDetails {
  8204. // Docs: https://electronjs.org/docs/api/structures/render-process-gone-details
  8205. /**
  8206. * The exit code of the process, unless `reason` is `launch-failed`, in which case
  8207. * `exitCode` will be a platform-specific launch failure error code.
  8208. */
  8209. exitCode: number;
  8210. /**
  8211. * The reason the render process is gone. Possible values:
  8212. */
  8213. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  8214. }
  8215. interface ResolvedEndpoint {
  8216. // Docs: https://electronjs.org/docs/api/structures/resolved-endpoint
  8217. address: string;
  8218. /**
  8219. * One of the following:
  8220. */
  8221. family: ('ipv4' | 'ipv6' | 'unspec');
  8222. }
  8223. interface ResolvedHost {
  8224. // Docs: https://electronjs.org/docs/api/structures/resolved-host
  8225. /**
  8226. * resolved DNS entries for the hostname
  8227. */
  8228. endpoints: ResolvedEndpoint[];
  8229. }
  8230. interface SafeStorage extends NodeJS.EventEmitter {
  8231. // Docs: https://electronjs.org/docs/api/safe-storage
  8232. /**
  8233. * the decrypted string. Decrypts the encrypted buffer obtained with
  8234. * `safeStorage.encryptString` back into a string.
  8235. *
  8236. * This function will throw an error if decryption fails.
  8237. */
  8238. decryptString(encrypted: Buffer): string;
  8239. /**
  8240. * An array of bytes representing the encrypted string.
  8241. *
  8242. * This function will throw an error if encryption fails.
  8243. */
  8244. encryptString(plainText: string): Buffer;
  8245. /**
  8246. * User friendly name of the password manager selected on Linux.
  8247. *
  8248. * This function will return one of the following values:
  8249. *
  8250. * * `basic_text` - When the desktop environment is not recognised or if the
  8251. * following command line flag is provided `--password-store="basic"`.
  8252. * * `gnome_libsecret` - When the desktop environment is `X-Cinnamon`, `Deepin`,
  8253. * `GNOME`, `Pantheon`, `XFCE`, `UKUI`, `unity` or if the following command line
  8254. * flag is provided `--password-store="gnome-libsecret"`.
  8255. * * `kwallet` - When the desktop session is `kde4` or if the following command
  8256. * line flag is provided `--password-store="kwallet"`.
  8257. * * `kwallet5` - When the desktop session is `kde5` or if the following command
  8258. * line flag is provided `--password-store="kwallet5"`.
  8259. * * `kwallet6` - When the desktop session is `kde6`.
  8260. * * `unknown` - When the function is called before app has emitted the `ready`
  8261. * event.
  8262. *
  8263. * @platform linux
  8264. */
  8265. getSelectedStorageBackend(): ('basic_text' | 'gnome_libsecret' | 'kwallet' | 'kwallet5' | 'kwallet6' | 'unknown');
  8266. /**
  8267. * Whether encryption is available.
  8268. *
  8269. * On Linux, returns true if the app has emitted the `ready` event and the secret
  8270. * key is available. On MacOS, returns true if Keychain is available. On Windows,
  8271. * returns true once the app has emitted the `ready` event.
  8272. */
  8273. isEncryptionAvailable(): boolean;
  8274. /**
  8275. * This function on Linux will force the module to use an in memory password for
  8276. * creating symmetric key that is used for encrypt/decrypt functions when a valid
  8277. * OS password manager cannot be determined for the current active desktop
  8278. * environment. This function is a no-op on Windows and MacOS.
  8279. */
  8280. setUsePlainTextEncryption(usePlainText: boolean): void;
  8281. }
  8282. interface Screen extends NodeJS.EventEmitter {
  8283. // Docs: https://electronjs.org/docs/api/screen
  8284. /**
  8285. * Emitted when `newDisplay` has been added.
  8286. */
  8287. on(event: 'display-added', listener: (event: Event,
  8288. newDisplay: Display) => void): this;
  8289. off(event: 'display-added', listener: (event: Event,
  8290. newDisplay: Display) => void): this;
  8291. once(event: 'display-added', listener: (event: Event,
  8292. newDisplay: Display) => void): this;
  8293. addListener(event: 'display-added', listener: (event: Event,
  8294. newDisplay: Display) => void): this;
  8295. removeListener(event: 'display-added', listener: (event: Event,
  8296. newDisplay: Display) => void): this;
  8297. /**
  8298. * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
  8299. * an array of strings that describe the changes. Possible changes are `bounds`,
  8300. * `workArea`, `scaleFactor` and `rotation`.
  8301. */
  8302. on(event: 'display-metrics-changed', listener: (event: Event,
  8303. display: Display,
  8304. changedMetrics: string[]) => void): this;
  8305. off(event: 'display-metrics-changed', listener: (event: Event,
  8306. display: Display,
  8307. changedMetrics: string[]) => void): this;
  8308. once(event: 'display-metrics-changed', listener: (event: Event,
  8309. display: Display,
  8310. changedMetrics: string[]) => void): this;
  8311. addListener(event: 'display-metrics-changed', listener: (event: Event,
  8312. display: Display,
  8313. changedMetrics: string[]) => void): this;
  8314. removeListener(event: 'display-metrics-changed', listener: (event: Event,
  8315. display: Display,
  8316. changedMetrics: string[]) => void): this;
  8317. /**
  8318. * Emitted when `oldDisplay` has been removed.
  8319. */
  8320. on(event: 'display-removed', listener: (event: Event,
  8321. oldDisplay: Display) => void): this;
  8322. off(event: 'display-removed', listener: (event: Event,
  8323. oldDisplay: Display) => void): this;
  8324. once(event: 'display-removed', listener: (event: Event,
  8325. oldDisplay: Display) => void): this;
  8326. addListener(event: 'display-removed', listener: (event: Event,
  8327. oldDisplay: Display) => void): this;
  8328. removeListener(event: 'display-removed', listener: (event: Event,
  8329. oldDisplay: Display) => void): this;
  8330. /**
  8331. * Converts a screen DIP point to a screen physical point. The DPI scale is
  8332. * performed relative to the display containing the DIP point.
  8333. *
  8334. * @platform win32
  8335. */
  8336. dipToScreenPoint(point: Point): Point;
  8337. /**
  8338. * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
  8339. * relative to the display nearest to `window`. If `window` is null, scaling will
  8340. * be performed to the display nearest to `rect`.
  8341. *
  8342. * @platform win32
  8343. */
  8344. dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  8345. /**
  8346. * An array of displays that are currently available.
  8347. */
  8348. getAllDisplays(): Display[];
  8349. /**
  8350. * The current absolute position of the mouse pointer.
  8351. *
  8352. * **Note:** The return value is a DIP point, not a screen physical point.
  8353. */
  8354. getCursorScreenPoint(): Point;
  8355. /**
  8356. * The display that most closely intersects the provided bounds.
  8357. */
  8358. getDisplayMatching(rect: Rectangle): Display;
  8359. /**
  8360. * The display nearest the specified point.
  8361. */
  8362. getDisplayNearestPoint(point: Point): Display;
  8363. /**
  8364. * The primary display.
  8365. */
  8366. getPrimaryDisplay(): Display;
  8367. /**
  8368. * Converts a screen physical point to a screen DIP point. The DPI scale is
  8369. * performed relative to the display containing the physical point.
  8370. *
  8371. * @platform win32
  8372. */
  8373. screenToDipPoint(point: Point): Point;
  8374. /**
  8375. * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
  8376. * relative to the display nearest to `window`. If `window` is null, scaling will
  8377. * be performed to the display nearest to `rect`.
  8378. *
  8379. * @platform win32
  8380. */
  8381. screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  8382. }
  8383. interface ScrubberItem {
  8384. // Docs: https://electronjs.org/docs/api/structures/scrubber-item
  8385. /**
  8386. * The image to appear in this item.
  8387. */
  8388. icon?: NativeImage;
  8389. /**
  8390. * The text to appear in this item.
  8391. */
  8392. label?: string;
  8393. }
  8394. interface SegmentedControlSegment {
  8395. // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
  8396. /**
  8397. * Whether this segment is selectable. Default: true.
  8398. */
  8399. enabled?: boolean;
  8400. /**
  8401. * The image to appear in this segment.
  8402. */
  8403. icon?: NativeImage;
  8404. /**
  8405. * The text to appear in this segment.
  8406. */
  8407. label?: string;
  8408. }
  8409. interface SerialPort {
  8410. // Docs: https://electronjs.org/docs/api/structures/serial-port
  8411. /**
  8412. * A stable identifier on Windows that can be used for device permissions.
  8413. *
  8414. * @platform win32
  8415. */
  8416. deviceInstanceId?: string;
  8417. /**
  8418. * A string suitable for display to the user for describing this device.
  8419. */
  8420. displayName?: string;
  8421. /**
  8422. * Unique identifier for the port.
  8423. */
  8424. portId: string;
  8425. /**
  8426. * Name of the port.
  8427. */
  8428. portName: string;
  8429. /**
  8430. * The USB product ID.
  8431. */
  8432. productId?: string;
  8433. /**
  8434. * The USB device serial number.
  8435. */
  8436. serialNumber?: string;
  8437. /**
  8438. * Represents a single serial port on macOS can be enumerated by multiple drivers.
  8439. *
  8440. * @platform darwin
  8441. */
  8442. usbDriverName?: string;
  8443. /**
  8444. * The USB vendor ID.
  8445. */
  8446. vendorId?: string;
  8447. }
  8448. interface ServiceWorkerInfo {
  8449. // Docs: https://electronjs.org/docs/api/structures/service-worker-info
  8450. /**
  8451. * The virtual ID of the process that this service worker is running in. This is
  8452. * not an OS level PID. This aligns with the ID set used for
  8453. * `webContents.getProcessId()`.
  8454. */
  8455. renderProcessId: number;
  8456. /**
  8457. * The base URL that this service worker is active for.
  8458. */
  8459. scope: string;
  8460. /**
  8461. * The full URL to the script that this service worker runs
  8462. */
  8463. scriptUrl: string;
  8464. }
  8465. class ServiceWorkers extends NodeEventEmitter {
  8466. // Docs: https://electronjs.org/docs/api/service-workers
  8467. /**
  8468. * Emitted when a service worker logs something to the console.
  8469. */
  8470. on(event: 'console-message', listener: (event: Event,
  8471. /**
  8472. * Information about the console message
  8473. */
  8474. messageDetails: MessageDetails) => void): this;
  8475. off(event: 'console-message', listener: (event: Event,
  8476. /**
  8477. * Information about the console message
  8478. */
  8479. messageDetails: MessageDetails) => void): this;
  8480. once(event: 'console-message', listener: (event: Event,
  8481. /**
  8482. * Information about the console message
  8483. */
  8484. messageDetails: MessageDetails) => void): this;
  8485. addListener(event: 'console-message', listener: (event: Event,
  8486. /**
  8487. * Information about the console message
  8488. */
  8489. messageDetails: MessageDetails) => void): this;
  8490. removeListener(event: 'console-message', listener: (event: Event,
  8491. /**
  8492. * Information about the console message
  8493. */
  8494. messageDetails: MessageDetails) => void): this;
  8495. /**
  8496. * Emitted when a service worker has been registered. Can occur after a call to
  8497. * `navigator.serviceWorker.register('/sw.js')` successfully resolves or when a
  8498. * Chrome extension is loaded.
  8499. */
  8500. on(event: 'registration-completed', listener: (event: Event,
  8501. /**
  8502. * Information about the registered service worker
  8503. */
  8504. details: RegistrationCompletedDetails) => void): this;
  8505. off(event: 'registration-completed', listener: (event: Event,
  8506. /**
  8507. * Information about the registered service worker
  8508. */
  8509. details: RegistrationCompletedDetails) => void): this;
  8510. once(event: 'registration-completed', listener: (event: Event,
  8511. /**
  8512. * Information about the registered service worker
  8513. */
  8514. details: RegistrationCompletedDetails) => void): this;
  8515. addListener(event: 'registration-completed', listener: (event: Event,
  8516. /**
  8517. * Information about the registered service worker
  8518. */
  8519. details: RegistrationCompletedDetails) => void): this;
  8520. removeListener(event: 'registration-completed', listener: (event: Event,
  8521. /**
  8522. * Information about the registered service worker
  8523. */
  8524. details: RegistrationCompletedDetails) => void): this;
  8525. /**
  8526. * A ServiceWorkerInfo object where the keys are the service worker version ID and
  8527. * the values are the information about that service worker.
  8528. */
  8529. getAllRunning(): Record<number, ServiceWorkerInfo>;
  8530. /**
  8531. * Information about this service worker
  8532. *
  8533. * If the service worker does not exist or is not running this method will throw an
  8534. * exception.
  8535. */
  8536. getFromVersionID(versionId: number): ServiceWorkerInfo;
  8537. }
  8538. class Session extends NodeEventEmitter {
  8539. // Docs: https://electronjs.org/docs/api/session
  8540. /**
  8541. * A session instance from `partition` string. When there is an existing `Session`
  8542. * with the same `partition`, it will be returned; otherwise a new `Session`
  8543. * instance will be created with `options`.
  8544. *
  8545. * If `partition` starts with `persist:`, the page will use a persistent session
  8546. * available to all pages in the app with the same `partition`. if there is no
  8547. * `persist:` prefix, the page will use an in-memory session. If the `partition` is
  8548. * empty then default session of the app will be returned.
  8549. *
  8550. * To create a `Session` with `options`, you have to ensure the `Session` with the
  8551. * `partition` has never been used before. There is no way to change the `options`
  8552. * of an existing `Session` object.
  8553. */
  8554. static fromPartition(partition: string, options?: FromPartitionOptions): Session;
  8555. /**
  8556. * A session instance from the absolute path as specified by the `path` string.
  8557. * When there is an existing `Session` with the same absolute path, it will be
  8558. * returned; otherwise a new `Session` instance will be created with `options`. The
  8559. * call will throw an error if the path is not an absolute path. Additionally, an
  8560. * error will be thrown if an empty string is provided.
  8561. *
  8562. * To create a `Session` with `options`, you have to ensure the `Session` with the
  8563. * `path` has never been used before. There is no way to change the `options` of an
  8564. * existing `Session` object.
  8565. */
  8566. static fromPath(path: string, options?: FromPathOptions): Session;
  8567. /**
  8568. * A `Session` object, the default session object of the app.
  8569. */
  8570. static defaultSession: Session;
  8571. /**
  8572. * Emitted after an extension is loaded. This occurs whenever an extension is added
  8573. * to the "enabled" set of extensions. This includes:
  8574. *
  8575. * * Extensions being loaded from `Session.loadExtension`.
  8576. * * Extensions being reloaded:
  8577. * * from a crash.
  8578. * * if the extension requested it (`chrome.runtime.reload()`).
  8579. */
  8580. on(event: 'extension-loaded', listener: (event: Event,
  8581. extension: Extension) => void): this;
  8582. off(event: 'extension-loaded', listener: (event: Event,
  8583. extension: Extension) => void): this;
  8584. once(event: 'extension-loaded', listener: (event: Event,
  8585. extension: Extension) => void): this;
  8586. addListener(event: 'extension-loaded', listener: (event: Event,
  8587. extension: Extension) => void): this;
  8588. removeListener(event: 'extension-loaded', listener: (event: Event,
  8589. extension: Extension) => void): this;
  8590. /**
  8591. * Emitted after an extension is loaded and all necessary browser state is
  8592. * initialized to support the start of the extension's background page.
  8593. */
  8594. on(event: 'extension-ready', listener: (event: Event,
  8595. extension: Extension) => void): this;
  8596. off(event: 'extension-ready', listener: (event: Event,
  8597. extension: Extension) => void): this;
  8598. once(event: 'extension-ready', listener: (event: Event,
  8599. extension: Extension) => void): this;
  8600. addListener(event: 'extension-ready', listener: (event: Event,
  8601. extension: Extension) => void): this;
  8602. removeListener(event: 'extension-ready', listener: (event: Event,
  8603. extension: Extension) => void): this;
  8604. /**
  8605. * Emitted after an extension is unloaded. This occurs when
  8606. * `Session.removeExtension` is called.
  8607. */
  8608. on(event: 'extension-unloaded', listener: (event: Event,
  8609. extension: Extension) => void): this;
  8610. off(event: 'extension-unloaded', listener: (event: Event,
  8611. extension: Extension) => void): this;
  8612. once(event: 'extension-unloaded', listener: (event: Event,
  8613. extension: Extension) => void): this;
  8614. addListener(event: 'extension-unloaded', listener: (event: Event,
  8615. extension: Extension) => void): this;
  8616. removeListener(event: 'extension-unloaded', listener: (event: Event,
  8617. extension: Extension) => void): this;
  8618. /**
  8619. * Emitted after `navigator.hid.requestDevice` has been called and
  8620. * `select-hid-device` has fired if a new device becomes available before the
  8621. * callback from `select-hid-device` is called. This event is intended for use
  8622. * when using a UI to ask users to pick a device so that the UI can be updated with
  8623. * the newly added device.
  8624. */
  8625. on(event: 'hid-device-added', listener: (event: Event,
  8626. details: HidDeviceAddedDetails) => void): this;
  8627. off(event: 'hid-device-added', listener: (event: Event,
  8628. details: HidDeviceAddedDetails) => void): this;
  8629. once(event: 'hid-device-added', listener: (event: Event,
  8630. details: HidDeviceAddedDetails) => void): this;
  8631. addListener(event: 'hid-device-added', listener: (event: Event,
  8632. details: HidDeviceAddedDetails) => void): this;
  8633. removeListener(event: 'hid-device-added', listener: (event: Event,
  8634. details: HidDeviceAddedDetails) => void): this;
  8635. /**
  8636. * Emitted after `navigator.hid.requestDevice` has been called and
  8637. * `select-hid-device` has fired if a device has been removed before the callback
  8638. * from `select-hid-device` is called. This event is intended for use when using a
  8639. * UI to ask users to pick a device so that the UI can be updated to remove the
  8640. * specified device.
  8641. */
  8642. on(event: 'hid-device-removed', listener: (event: Event,
  8643. details: HidDeviceRemovedDetails) => void): this;
  8644. off(event: 'hid-device-removed', listener: (event: Event,
  8645. details: HidDeviceRemovedDetails) => void): this;
  8646. once(event: 'hid-device-removed', listener: (event: Event,
  8647. details: HidDeviceRemovedDetails) => void): this;
  8648. addListener(event: 'hid-device-removed', listener: (event: Event,
  8649. details: HidDeviceRemovedDetails) => void): this;
  8650. removeListener(event: 'hid-device-removed', listener: (event: Event,
  8651. details: HidDeviceRemovedDetails) => void): this;
  8652. /**
  8653. * Emitted after `HIDDevice.forget()` has been called. This event can be used to
  8654. * help maintain persistent storage of permissions when
  8655. * `setDevicePermissionHandler` is used.
  8656. */
  8657. on(event: 'hid-device-revoked', listener: (event: Event,
  8658. details: HidDeviceRevokedDetails) => void): this;
  8659. off(event: 'hid-device-revoked', listener: (event: Event,
  8660. details: HidDeviceRevokedDetails) => void): this;
  8661. once(event: 'hid-device-revoked', listener: (event: Event,
  8662. details: HidDeviceRevokedDetails) => void): this;
  8663. addListener(event: 'hid-device-revoked', listener: (event: Event,
  8664. details: HidDeviceRevokedDetails) => void): this;
  8665. removeListener(event: 'hid-device-revoked', listener: (event: Event,
  8666. details: HidDeviceRevokedDetails) => void): this;
  8667. /**
  8668. * Emitted when a render process requests preconnection to a URL, generally due to
  8669. * a resource hint.
  8670. */
  8671. on(event: 'preconnect', listener: (event: Event,
  8672. /**
  8673. * The URL being requested for preconnection by the renderer.
  8674. */
  8675. preconnectUrl: string,
  8676. /**
  8677. * True if the renderer is requesting that the connection include credentials (see
  8678. * the spec for more details.)
  8679. */
  8680. allowCredentials: boolean) => void): this;
  8681. off(event: 'preconnect', listener: (event: Event,
  8682. /**
  8683. * The URL being requested for preconnection by the renderer.
  8684. */
  8685. preconnectUrl: string,
  8686. /**
  8687. * True if the renderer is requesting that the connection include credentials (see
  8688. * the spec for more details.)
  8689. */
  8690. allowCredentials: boolean) => void): this;
  8691. once(event: 'preconnect', listener: (event: Event,
  8692. /**
  8693. * The URL being requested for preconnection by the renderer.
  8694. */
  8695. preconnectUrl: string,
  8696. /**
  8697. * True if the renderer is requesting that the connection include credentials (see
  8698. * the spec for more details.)
  8699. */
  8700. allowCredentials: boolean) => void): this;
  8701. addListener(event: 'preconnect', listener: (event: Event,
  8702. /**
  8703. * The URL being requested for preconnection by the renderer.
  8704. */
  8705. preconnectUrl: string,
  8706. /**
  8707. * True if the renderer is requesting that the connection include credentials (see
  8708. * the spec for more details.)
  8709. */
  8710. allowCredentials: boolean) => void): this;
  8711. removeListener(event: 'preconnect', listener: (event: Event,
  8712. /**
  8713. * The URL being requested for preconnection by the renderer.
  8714. */
  8715. preconnectUrl: string,
  8716. /**
  8717. * True if the renderer is requesting that the connection include credentials (see
  8718. * the spec for more details.)
  8719. */
  8720. allowCredentials: boolean) => void): this;
  8721. /**
  8722. * Emitted when a HID device needs to be selected when a call to
  8723. * `navigator.hid.requestDevice` is made. `callback` should be called with
  8724. * `deviceId` to be selected; passing no arguments to `callback` will cancel the
  8725. * request. Additionally, permissioning on `navigator.hid` can be further managed
  8726. * by using `ses.setPermissionCheckHandler(handler)` and
  8727. * `ses.setDevicePermissionHandler(handler)`.
  8728. */
  8729. on(event: 'select-hid-device', listener: (event: Event,
  8730. details: SelectHidDeviceDetails,
  8731. callback: (deviceId?: (string) | (null)) => void) => void): this;
  8732. off(event: 'select-hid-device', listener: (event: Event,
  8733. details: SelectHidDeviceDetails,
  8734. callback: (deviceId?: (string) | (null)) => void) => void): this;
  8735. once(event: 'select-hid-device', listener: (event: Event,
  8736. details: SelectHidDeviceDetails,
  8737. callback: (deviceId?: (string) | (null)) => void) => void): this;
  8738. addListener(event: 'select-hid-device', listener: (event: Event,
  8739. details: SelectHidDeviceDetails,
  8740. callback: (deviceId?: (string) | (null)) => void) => void): this;
  8741. removeListener(event: 'select-hid-device', listener: (event: Event,
  8742. details: SelectHidDeviceDetails,
  8743. callback: (deviceId?: (string) | (null)) => void) => void): this;
  8744. /**
  8745. * Emitted when a serial port needs to be selected when a call to
  8746. * `navigator.serial.requestPort` is made. `callback` should be called with
  8747. * `portId` to be selected, passing an empty string to `callback` will cancel the
  8748. * request. Additionally, permissioning on `navigator.serial` can be managed by
  8749. * using ses.setPermissionCheckHandler(handler) with the `serial` permission.
  8750. */
  8751. on(event: 'select-serial-port', listener: (event: Event,
  8752. portList: SerialPort[],
  8753. webContents: WebContents,
  8754. callback: (portId: string) => void) => void): this;
  8755. off(event: 'select-serial-port', listener: (event: Event,
  8756. portList: SerialPort[],
  8757. webContents: WebContents,
  8758. callback: (portId: string) => void) => void): this;
  8759. once(event: 'select-serial-port', listener: (event: Event,
  8760. portList: SerialPort[],
  8761. webContents: WebContents,
  8762. callback: (portId: string) => void) => void): this;
  8763. addListener(event: 'select-serial-port', listener: (event: Event,
  8764. portList: SerialPort[],
  8765. webContents: WebContents,
  8766. callback: (portId: string) => void) => void): this;
  8767. removeListener(event: 'select-serial-port', listener: (event: Event,
  8768. portList: SerialPort[],
  8769. webContents: WebContents,
  8770. callback: (portId: string) => void) => void): this;
  8771. /**
  8772. * Emitted when a USB device needs to be selected when a call to
  8773. * `navigator.usb.requestDevice` is made. `callback` should be called with
  8774. * `deviceId` to be selected; passing no arguments to `callback` will cancel the
  8775. * request. Additionally, permissioning on `navigator.usb` can be further managed
  8776. * by using `ses.setPermissionCheckHandler(handler)` and
  8777. * `ses.setDevicePermissionHandler(handler)`.
  8778. */
  8779. on(event: 'select-usb-device', listener: (event: Event,
  8780. details: SelectUsbDeviceDetails,
  8781. callback: (deviceId?: string) => void) => void): this;
  8782. off(event: 'select-usb-device', listener: (event: Event,
  8783. details: SelectUsbDeviceDetails,
  8784. callback: (deviceId?: string) => void) => void): this;
  8785. once(event: 'select-usb-device', listener: (event: Event,
  8786. details: SelectUsbDeviceDetails,
  8787. callback: (deviceId?: string) => void) => void): this;
  8788. addListener(event: 'select-usb-device', listener: (event: Event,
  8789. details: SelectUsbDeviceDetails,
  8790. callback: (deviceId?: string) => void) => void): this;
  8791. removeListener(event: 'select-usb-device', listener: (event: Event,
  8792. details: SelectUsbDeviceDetails,
  8793. callback: (deviceId?: string) => void) => void): this;
  8794. /**
  8795. * Emitted after `navigator.serial.requestPort` has been called and
  8796. * `select-serial-port` has fired if a new serial port becomes available before the
  8797. * callback from `select-serial-port` is called. This event is intended for use
  8798. * when using a UI to ask users to pick a port so that the UI can be updated with
  8799. * the newly added port.
  8800. */
  8801. on(event: 'serial-port-added', listener: (event: Event,
  8802. port: SerialPort,
  8803. webContents: WebContents) => void): this;
  8804. off(event: 'serial-port-added', listener: (event: Event,
  8805. port: SerialPort,
  8806. webContents: WebContents) => void): this;
  8807. once(event: 'serial-port-added', listener: (event: Event,
  8808. port: SerialPort,
  8809. webContents: WebContents) => void): this;
  8810. addListener(event: 'serial-port-added', listener: (event: Event,
  8811. port: SerialPort,
  8812. webContents: WebContents) => void): this;
  8813. removeListener(event: 'serial-port-added', listener: (event: Event,
  8814. port: SerialPort,
  8815. webContents: WebContents) => void): this;
  8816. /**
  8817. * Emitted after `navigator.serial.requestPort` has been called and
  8818. * `select-serial-port` has fired if a serial port has been removed before the
  8819. * callback from `select-serial-port` is called. This event is intended for use
  8820. * when using a UI to ask users to pick a port so that the UI can be updated to
  8821. * remove the specified port.
  8822. */
  8823. on(event: 'serial-port-removed', listener: (event: Event,
  8824. port: SerialPort,
  8825. webContents: WebContents) => void): this;
  8826. off(event: 'serial-port-removed', listener: (event: Event,
  8827. port: SerialPort,
  8828. webContents: WebContents) => void): this;
  8829. once(event: 'serial-port-removed', listener: (event: Event,
  8830. port: SerialPort,
  8831. webContents: WebContents) => void): this;
  8832. addListener(event: 'serial-port-removed', listener: (event: Event,
  8833. port: SerialPort,
  8834. webContents: WebContents) => void): this;
  8835. removeListener(event: 'serial-port-removed', listener: (event: Event,
  8836. port: SerialPort,
  8837. webContents: WebContents) => void): this;
  8838. /**
  8839. * Emitted after `SerialPort.forget()` has been called. This event can be used to
  8840. * help maintain persistent storage of permissions when
  8841. * `setDevicePermissionHandler` is used.
  8842. */
  8843. on(event: 'serial-port-revoked', listener: (event: Event,
  8844. details: SerialPortRevokedDetails) => void): this;
  8845. off(event: 'serial-port-revoked', listener: (event: Event,
  8846. details: SerialPortRevokedDetails) => void): this;
  8847. once(event: 'serial-port-revoked', listener: (event: Event,
  8848. details: SerialPortRevokedDetails) => void): this;
  8849. addListener(event: 'serial-port-revoked', listener: (event: Event,
  8850. details: SerialPortRevokedDetails) => void): this;
  8851. removeListener(event: 'serial-port-revoked', listener: (event: Event,
  8852. details: SerialPortRevokedDetails) => void): this;
  8853. /**
  8854. * Emitted when a hunspell dictionary file starts downloading
  8855. */
  8856. on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  8857. /**
  8858. * The language code of the dictionary file
  8859. */
  8860. languageCode: string) => void): this;
  8861. off(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  8862. /**
  8863. * The language code of the dictionary file
  8864. */
  8865. languageCode: string) => void): this;
  8866. once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  8867. /**
  8868. * The language code of the dictionary file
  8869. */
  8870. languageCode: string) => void): this;
  8871. addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  8872. /**
  8873. * The language code of the dictionary file
  8874. */
  8875. languageCode: string) => void): this;
  8876. removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  8877. /**
  8878. * The language code of the dictionary file
  8879. */
  8880. languageCode: string) => void): this;
  8881. /**
  8882. * Emitted when a hunspell dictionary file download fails. For details on the
  8883. * failure you should collect a netlog and inspect the download request.
  8884. */
  8885. on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  8886. /**
  8887. * The language code of the dictionary file
  8888. */
  8889. languageCode: string) => void): this;
  8890. off(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  8891. /**
  8892. * The language code of the dictionary file
  8893. */
  8894. languageCode: string) => void): this;
  8895. once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  8896. /**
  8897. * The language code of the dictionary file
  8898. */
  8899. languageCode: string) => void): this;
  8900. addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  8901. /**
  8902. * The language code of the dictionary file
  8903. */
  8904. languageCode: string) => void): this;
  8905. removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  8906. /**
  8907. * The language code of the dictionary file
  8908. */
  8909. languageCode: string) => void): this;
  8910. /**
  8911. * Emitted when a hunspell dictionary file has been successfully downloaded
  8912. */
  8913. on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  8914. /**
  8915. * The language code of the dictionary file
  8916. */
  8917. languageCode: string) => void): this;
  8918. off(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  8919. /**
  8920. * The language code of the dictionary file
  8921. */
  8922. languageCode: string) => void): this;
  8923. once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  8924. /**
  8925. * The language code of the dictionary file
  8926. */
  8927. languageCode: string) => void): this;
  8928. addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  8929. /**
  8930. * The language code of the dictionary file
  8931. */
  8932. languageCode: string) => void): this;
  8933. removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  8934. /**
  8935. * The language code of the dictionary file
  8936. */
  8937. languageCode: string) => void): this;
  8938. /**
  8939. * Emitted when a hunspell dictionary file has been successfully initialized. This
  8940. * occurs after the file has been downloaded.
  8941. */
  8942. on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  8943. /**
  8944. * The language code of the dictionary file
  8945. */
  8946. languageCode: string) => void): this;
  8947. off(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  8948. /**
  8949. * The language code of the dictionary file
  8950. */
  8951. languageCode: string) => void): this;
  8952. once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  8953. /**
  8954. * The language code of the dictionary file
  8955. */
  8956. languageCode: string) => void): this;
  8957. addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  8958. /**
  8959. * The language code of the dictionary file
  8960. */
  8961. languageCode: string) => void): this;
  8962. removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  8963. /**
  8964. * The language code of the dictionary file
  8965. */
  8966. languageCode: string) => void): this;
  8967. /**
  8968. * Emitted after `navigator.usb.requestDevice` has been called and
  8969. * `select-usb-device` has fired if a new device becomes available before the
  8970. * callback from `select-usb-device` is called. This event is intended for use
  8971. * when using a UI to ask users to pick a device so that the UI can be updated with
  8972. * the newly added device.
  8973. */
  8974. on(event: 'usb-device-added', listener: (event: Event,
  8975. device: USBDevice,
  8976. webContents: WebContents) => void): this;
  8977. off(event: 'usb-device-added', listener: (event: Event,
  8978. device: USBDevice,
  8979. webContents: WebContents) => void): this;
  8980. once(event: 'usb-device-added', listener: (event: Event,
  8981. device: USBDevice,
  8982. webContents: WebContents) => void): this;
  8983. addListener(event: 'usb-device-added', listener: (event: Event,
  8984. device: USBDevice,
  8985. webContents: WebContents) => void): this;
  8986. removeListener(event: 'usb-device-added', listener: (event: Event,
  8987. device: USBDevice,
  8988. webContents: WebContents) => void): this;
  8989. /**
  8990. * Emitted after `navigator.usb.requestDevice` has been called and
  8991. * `select-usb-device` has fired if a device has been removed before the callback
  8992. * from `select-usb-device` is called. This event is intended for use when using a
  8993. * UI to ask users to pick a device so that the UI can be updated to remove the
  8994. * specified device.
  8995. */
  8996. on(event: 'usb-device-removed', listener: (event: Event,
  8997. device: USBDevice,
  8998. webContents: WebContents) => void): this;
  8999. off(event: 'usb-device-removed', listener: (event: Event,
  9000. device: USBDevice,
  9001. webContents: WebContents) => void): this;
  9002. once(event: 'usb-device-removed', listener: (event: Event,
  9003. device: USBDevice,
  9004. webContents: WebContents) => void): this;
  9005. addListener(event: 'usb-device-removed', listener: (event: Event,
  9006. device: USBDevice,
  9007. webContents: WebContents) => void): this;
  9008. removeListener(event: 'usb-device-removed', listener: (event: Event,
  9009. device: USBDevice,
  9010. webContents: WebContents) => void): this;
  9011. /**
  9012. * Emitted after `USBDevice.forget()` has been called. This event can be used to
  9013. * help maintain persistent storage of permissions when
  9014. * `setDevicePermissionHandler` is used.
  9015. */
  9016. on(event: 'usb-device-revoked', listener: (event: Event,
  9017. details: UsbDeviceRevokedDetails) => void): this;
  9018. off(event: 'usb-device-revoked', listener: (event: Event,
  9019. details: UsbDeviceRevokedDetails) => void): this;
  9020. once(event: 'usb-device-revoked', listener: (event: Event,
  9021. details: UsbDeviceRevokedDetails) => void): this;
  9022. addListener(event: 'usb-device-revoked', listener: (event: Event,
  9023. details: UsbDeviceRevokedDetails) => void): this;
  9024. removeListener(event: 'usb-device-revoked', listener: (event: Event,
  9025. details: UsbDeviceRevokedDetails) => void): this;
  9026. /**
  9027. * Emitted when Electron is about to download `item` in `webContents`.
  9028. *
  9029. * Calling `event.preventDefault()` will cancel the download and `item` will not be
  9030. * available from next tick of the process.
  9031. */
  9032. on(event: 'will-download', listener: (event: Event,
  9033. item: DownloadItem,
  9034. webContents: WebContents) => void): this;
  9035. off(event: 'will-download', listener: (event: Event,
  9036. item: DownloadItem,
  9037. webContents: WebContents) => void): this;
  9038. once(event: 'will-download', listener: (event: Event,
  9039. item: DownloadItem,
  9040. webContents: WebContents) => void): this;
  9041. addListener(event: 'will-download', listener: (event: Event,
  9042. item: DownloadItem,
  9043. webContents: WebContents) => void): this;
  9044. removeListener(event: 'will-download', listener: (event: Event,
  9045. item: DownloadItem,
  9046. webContents: WebContents) => void): this;
  9047. /**
  9048. * Whether the word was successfully written to the custom dictionary. This API
  9049. * will not work on non-persistent (in-memory) sessions.
  9050. *
  9051. * **Note:** On macOS and Windows 10 this word will be written to the OS custom
  9052. * dictionary as well
  9053. */
  9054. addWordToSpellCheckerDictionary(word: string): boolean;
  9055. /**
  9056. * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
  9057. * authentication.
  9058. */
  9059. allowNTLMCredentialsForDomains(domains: string): void;
  9060. /**
  9061. * resolves when the session’s HTTP authentication cache has been cleared.
  9062. */
  9063. clearAuthCache(): Promise<void>;
  9064. /**
  9065. * resolves when the cache clear operation is complete.
  9066. *
  9067. * Clears the session’s HTTP cache.
  9068. */
  9069. clearCache(): Promise<void>;
  9070. /**
  9071. * resolves when the code cache clear operation is complete.
  9072. */
  9073. clearCodeCaches(options: ClearCodeCachesOptions): Promise<void>;
  9074. /**
  9075. * Resolves when the operation is complete.
  9076. *
  9077. * Clears the host resolver cache.
  9078. */
  9079. clearHostResolverCache(): Promise<void>;
  9080. /**
  9081. * resolves when the storage data has been cleared.
  9082. */
  9083. clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
  9084. /**
  9085. * Resolves when all connections are closed.
  9086. *
  9087. * **Note:** It will terminate / fail all requests currently in flight.
  9088. */
  9089. closeAllConnections(): Promise<void>;
  9090. /**
  9091. * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
  9092. * The API will generate a DownloadItem that can be accessed with the will-download
  9093. * event. The DownloadItem will not have any `WebContents` associated with it and
  9094. * the initial state will be `interrupted`. The download will start only when the
  9095. * `resume` API is called on the DownloadItem.
  9096. */
  9097. createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
  9098. /**
  9099. * Disables any network emulation already active for the `session`. Resets to the
  9100. * original network configuration.
  9101. */
  9102. disableNetworkEmulation(): void;
  9103. /**
  9104. * Initiates a download of the resource at `url`. The API will generate a
  9105. * DownloadItem that can be accessed with the will-download event.
  9106. *
  9107. * **Note:** This does not perform any security checks that relate to a page's
  9108. * origin, unlike `webContents.downloadURL`.
  9109. */
  9110. downloadURL(url: string, options?: DownloadURLOptions): void;
  9111. /**
  9112. * Emulates network with the given configuration for the `session`.
  9113. */
  9114. enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
  9115. /**
  9116. * see Response.
  9117. *
  9118. * Sends a request, similarly to how `fetch()` works in the renderer, using
  9119. * Chrome's network stack. This differs from Node's `fetch()`, which uses Node.js's
  9120. * HTTP stack.
  9121. *
  9122. * Example:
  9123. *
  9124. * See also `net.fetch()`, a convenience method which issues requests from the
  9125. * default session.
  9126. *
  9127. * See the MDN documentation for `fetch()` for more details.
  9128. *
  9129. * Limitations:
  9130. *
  9131. * * `net.fetch()` does not support the `data:` or `blob:` schemes.
  9132. * * The value of the `integrity` option is ignored.
  9133. * * The `.type` and `.url` values of the returned `Response` object are incorrect.
  9134. *
  9135. * By default, requests made with `net.fetch` can be made to custom protocols as
  9136. * well as `file:`, and will trigger webRequest handlers if present. When the
  9137. * non-standard `bypassCustomProtocolHandlers` option is set in RequestInit, custom
  9138. * protocol handlers will not be called for this request. This allows forwarding an
  9139. * intercepted request to the built-in handler. webRequest handlers will still be
  9140. * triggered when bypassing custom protocols.
  9141. */
  9142. fetch(input: (string) | (GlobalRequest), init?: RequestInit & { bypassCustomProtocolHandlers?: boolean }): Promise<GlobalResponse>;
  9143. /**
  9144. * Writes any unwritten DOMStorage data to disk.
  9145. */
  9146. flushStorageData(): void;
  9147. /**
  9148. * Resolves when the all internal states of proxy service is reset and the latest
  9149. * proxy configuration is reapplied if it's already available. The pac script will
  9150. * be fetched from `pacScript` again if the proxy mode is `pac_script`.
  9151. */
  9152. forceReloadProxyConfig(): Promise<void>;
  9153. /**
  9154. * A list of all loaded extensions.
  9155. *
  9156. * **Note:** This API cannot be called before the `ready` event of the `app` module
  9157. * is emitted.
  9158. */
  9159. getAllExtensions(): Extension[];
  9160. /**
  9161. * resolves with blob data.
  9162. */
  9163. getBlobData(identifier: string): Promise<Buffer>;
  9164. /**
  9165. * the session's current cache size, in bytes.
  9166. */
  9167. getCacheSize(): Promise<number>;
  9168. /**
  9169. * The loaded extension with the given ID.
  9170. *
  9171. * **Note:** This API cannot be called before the `ready` event of the `app` module
  9172. * is emitted.
  9173. */
  9174. getExtension(extensionId: string): (Extension) | (null);
  9175. /**
  9176. * an array of paths to preload scripts that have been registered.
  9177. */
  9178. getPreloads(): string[];
  9179. /**
  9180. * An array of language codes the spellchecker is enabled for. If this list is
  9181. * empty the spellchecker will fallback to using `en-US`. By default on launch if
  9182. * this setting is an empty list Electron will try to populate this setting with
  9183. * the current OS locale. This setting is persisted across restarts.
  9184. *
  9185. * **Note:** On macOS the OS spellchecker is used and has its own list of
  9186. * languages. On macOS, this API will return whichever languages have been
  9187. * configured by the OS.
  9188. */
  9189. getSpellCheckerLanguages(): string[];
  9190. /**
  9191. * The absolute file system path where data for this session is persisted on disk.
  9192. * For in memory sessions this returns `null`.
  9193. */
  9194. getStoragePath(): (string) | (null);
  9195. /**
  9196. * The user agent for this session.
  9197. */
  9198. getUserAgent(): string;
  9199. /**
  9200. * Whether or not this session is a persistent one. The default `webContents`
  9201. * session of a `BrowserWindow` is persistent. When creating a session from a
  9202. * partition, session prefixed with `persist:` will be persistent, while others
  9203. * will be temporary.
  9204. */
  9205. isPersistent(): boolean;
  9206. /**
  9207. * Whether the builtin spell checker is enabled.
  9208. */
  9209. isSpellCheckerEnabled(): boolean;
  9210. /**
  9211. * An array of all words in app's custom dictionary. Resolves when the full
  9212. * dictionary is loaded from disk.
  9213. */
  9214. listWordsInSpellCheckerDictionary(): Promise<string[]>;
  9215. /**
  9216. * resolves when the extension is loaded.
  9217. *
  9218. * This method will raise an exception if the extension could not be loaded. If
  9219. * there are warnings when installing the extension (e.g. if the extension requests
  9220. * an API that Electron does not support) then they will be logged to the console.
  9221. *
  9222. * Note that Electron does not support the full range of Chrome extensions APIs.
  9223. * See Supported Extensions APIs for more details on what is supported.
  9224. *
  9225. * Note that in previous versions of Electron, extensions that were loaded would be
  9226. * remembered for future runs of the application. This is no longer the case:
  9227. * `loadExtension` must be called on every boot of your app if you want the
  9228. * extension to be loaded.
  9229. *
  9230. * This API does not support loading packed (.crx) extensions.
  9231. *
  9232. * **Note:** This API cannot be called before the `ready` event of the `app` module
  9233. * is emitted.
  9234. *
  9235. * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
  9236. * supported and will throw an error.
  9237. */
  9238. loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
  9239. /**
  9240. * Preconnects the given number of sockets to an origin.
  9241. */
  9242. preconnect(options: PreconnectOptions): void;
  9243. /**
  9244. * Unloads an extension.
  9245. *
  9246. * **Note:** This API cannot be called before the `ready` event of the `app` module
  9247. * is emitted.
  9248. */
  9249. removeExtension(extensionId: string): void;
  9250. /**
  9251. * Whether the word was successfully removed from the custom dictionary. This API
  9252. * will not work on non-persistent (in-memory) sessions.
  9253. *
  9254. * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
  9255. * dictionary as well
  9256. */
  9257. removeWordFromSpellCheckerDictionary(word: string): boolean;
  9258. /**
  9259. * Resolves with the resolved IP addresses for the `host`.
  9260. */
  9261. resolveHost(host: string, options?: ResolveHostOptions): Promise<Electron.ResolvedHost>;
  9262. /**
  9263. * Resolves with the proxy information for `url`.
  9264. */
  9265. resolveProxy(url: string): Promise<string>;
  9266. /**
  9267. * Sets a handler to respond to Bluetooth pairing requests. This handler allows
  9268. * developers to handle devices that require additional validation before pairing.
  9269. * When a handler is not defined, any pairing on Linux or Windows that requires
  9270. * additional validation will be automatically cancelled. macOS does not require a
  9271. * handler because macOS handles the pairing automatically. To clear the handler,
  9272. * call `setBluetoothPairingHandler(null)`.
  9273. *
  9274. * @platform win32,linux
  9275. */
  9276. setBluetoothPairingHandler(handler: ((details: BluetoothPairingHandlerHandlerDetails, callback: (response: Response) => void) => void) | (null)): void;
  9277. /**
  9278. * Sets the certificate verify proc for `session`, the `proc` will be called with
  9279. * `proc(request, callback)` whenever a server certificate verification is
  9280. * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
  9281. * rejects it.
  9282. *
  9283. * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
  9284. * verify proc.
  9285. *
  9286. * > **NOTE:** The result of this procedure is cached by the network service.
  9287. */
  9288. setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
  9289. /**
  9290. * Sets the directory to store the generated JS code cache for this session. The
  9291. * directory is not required to be created by the user before this call, the
  9292. * runtime will create if it does not exist otherwise will use the existing
  9293. * directory. If directory cannot be created, then code cache will not be used and
  9294. * all operations related to code cache will fail silently inside the runtime. By
  9295. * default, the directory will be `Code Cache` under the respective user data
  9296. * folder.
  9297. *
  9298. * Note that by default code cache is only enabled for http(s) URLs, to enable code
  9299. * cache for custom protocols, `codeCache: true` and `standard: true` must be
  9300. * specified when registering the protocol.
  9301. */
  9302. setCodeCachePath(path: string): void;
  9303. /**
  9304. * Sets the handler which can be used to respond to device permission checks for
  9305. * the `session`. Returning `true` will allow the device to be permitted and
  9306. * `false` will reject it. To clear the handler, call
  9307. * `setDevicePermissionHandler(null)`. This handler can be used to provide default
  9308. * permissioning to devices without first calling for permission to devices (eg via
  9309. * `navigator.hid.requestDevice`). If this handler is not defined, the default
  9310. * device permissions as granted through device selection (eg via
  9311. * `navigator.hid.requestDevice`) will be used. Additionally, the default behavior
  9312. * of Electron is to store granted device permission in memory. If longer term
  9313. * storage is needed, a developer can store granted device permissions (eg when
  9314. * handling the `select-hid-device` event) and then read from that storage with
  9315. * `setDevicePermissionHandler`.
  9316. */
  9317. setDevicePermissionHandler(handler: ((details: DevicePermissionHandlerHandlerDetails) => boolean) | (null)): void;
  9318. /**
  9319. * This handler will be called when web content requests access to display media
  9320. * via the `navigator.mediaDevices.getDisplayMedia` API. Use the desktopCapturer
  9321. * API to choose which stream(s) to grant access to.
  9322. *
  9323. * Passing a WebFrameMain object as a video or audio stream will capture the video
  9324. * or audio stream from that frame.
  9325. *
  9326. * Passing `null` instead of a function resets the handler to its default state.
  9327. */
  9328. setDisplayMediaRequestHandler(handler: ((request: DisplayMediaRequestHandlerHandlerRequest, callback: (streams: Streams) => void) => void) | (null)): void;
  9329. /**
  9330. * Sets download saving directory. By default, the download directory will be the
  9331. * `Downloads` under the respective app folder.
  9332. */
  9333. setDownloadPath(path: string): void;
  9334. /**
  9335. * Sets the handler which can be used to respond to permission checks for the
  9336. * `session`. Returning `true` will allow the permission and `false` will reject
  9337. * it. Please note that you must also implement `setPermissionRequestHandler` to
  9338. * get complete permission handling. Most web APIs do a permission check and then
  9339. * make a permission request if the check is denied. To clear the handler, call
  9340. * `setPermissionCheckHandler(null)`.
  9341. */
  9342. setPermissionCheckHandler(handler: ((webContents: (WebContents) | (null), permission: 'clipboard-read' | 'clipboard-sanitized-write' | 'geolocation' | 'fullscreen' | 'hid' | 'idle-detection' | 'media' | 'mediaKeySystem' | 'midi' | 'midiSysex' | 'notifications' | 'openExternal' | 'pointerLock' | 'serial' | 'storage-access' | 'top-level-storage-access' | 'usb', requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
  9343. /**
  9344. * Sets the handler which can be used to respond to permission requests for the
  9345. * `session`. Calling `callback(true)` will allow the permission and
  9346. * `callback(false)` will reject it. To clear the handler, call
  9347. * `setPermissionRequestHandler(null)`. Please note that you must also implement
  9348. * `setPermissionCheckHandler` to get complete permission handling. Most web APIs
  9349. * do a permission check and then make a permission request if the check is denied.
  9350. */
  9351. setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'clipboard-sanitized-write' | 'display-capture' | 'fullscreen' | 'geolocation' | 'idle-detection' | 'media' | 'mediaKeySystem' | 'midi' | 'midiSysex' | 'notifications' | 'pointerLock' | 'keyboardLock' | 'openExternal' | 'storage-access' | 'top-level-storage-access' | 'window-management' | 'unknown', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
  9352. /**
  9353. * Adds scripts that will be executed on ALL web contents that are associated with
  9354. * this session just before normal `preload` scripts run.
  9355. */
  9356. setPreloads(preloads: string[]): void;
  9357. /**
  9358. * Resolves when the proxy setting process is complete.
  9359. *
  9360. * Sets the proxy settings.
  9361. *
  9362. * You may need `ses.closeAllConnections` to close currently in flight connections
  9363. * to prevent pooled sockets using previous proxy from being reused by future
  9364. * requests.
  9365. */
  9366. setProxy(config: ProxyConfig): Promise<void>;
  9367. /**
  9368. * By default Electron will download hunspell dictionaries from the Chromium CDN.
  9369. * If you want to override this behavior you can use this API to point the
  9370. * dictionary downloader at your own hosted version of the hunspell dictionaries.
  9371. * We publish a `hunspell_dictionaries.zip` file with each release which contains
  9372. * the files you need to host here.
  9373. *
  9374. * The file server must be **case insensitive**. If you cannot do this, you must
  9375. * upload each file twice: once with the case it has in the ZIP file and once with
  9376. * the filename as all lowercase.
  9377. *
  9378. * If the files present in `hunspell_dictionaries.zip` are available at
  9379. * `https://example.com/dictionaries/language-code.bdic` then you should call this
  9380. * api with
  9381. * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
  9382. * Please note the trailing slash. The URL to the dictionaries is formed as
  9383. * `${url}${filename}`.
  9384. *
  9385. * **Note:** On macOS the OS spellchecker is used and therefore we do not download
  9386. * any dictionary files. This API is a no-op on macOS.
  9387. */
  9388. setSpellCheckerDictionaryDownloadURL(url: string): void;
  9389. /**
  9390. * Sets whether to enable the builtin spell checker.
  9391. */
  9392. setSpellCheckerEnabled(enable: boolean): void;
  9393. /**
  9394. * The built in spellchecker does not automatically detect what language a user is
  9395. * typing in. In order for the spell checker to correctly check their words you
  9396. * must call this API with an array of language codes. You can get the list of
  9397. * supported language codes with the `ses.availableSpellCheckerLanguages` property.
  9398. *
  9399. * **Note:** On macOS the OS spellchecker is used and will detect your language
  9400. * automatically. This API is a no-op on macOS.
  9401. */
  9402. setSpellCheckerLanguages(languages: string[]): void;
  9403. /**
  9404. * Sets the SSL configuration for the session. All subsequent network requests will
  9405. * use the new configuration. Existing network connections (such as WebSocket
  9406. * connections) will not be terminated, but old sockets in the pool will not be
  9407. * reused for new connections.
  9408. */
  9409. setSSLConfig(config: Config): void;
  9410. /**
  9411. * Sets the handler which can be used to override which USB classes are protected.
  9412. * The return value for the handler is a string array of USB classes which should
  9413. * be considered protected (eg not available in the renderer). Valid values for
  9414. * the array are:
  9415. *
  9416. * * `audio`
  9417. * * `audio-video`
  9418. * * `hid`
  9419. * * `mass-storage`
  9420. * * `smart-card`
  9421. * * `video`
  9422. * * `wireless`
  9423. *
  9424. * Returning an empty string array from the handler will allow all USB classes;
  9425. * returning the passed in array will maintain the default list of protected USB
  9426. * classes (this is also the default behavior if a handler is not defined). To
  9427. * clear the handler, call `setUSBProtectedClassesHandler(null)`.
  9428. */
  9429. setUSBProtectedClassesHandler(handler: ((details: USBProtectedClassesHandlerHandlerDetails) => string[]) | (null)): void;
  9430. /**
  9431. * Overrides the `userAgent` and `acceptLanguages` for this session.
  9432. *
  9433. * The `acceptLanguages` must a comma separated ordered list of language codes, for
  9434. * example `"en-US,fr,de,ko,zh-CN,ja"`.
  9435. *
  9436. * This doesn't affect existing `WebContents`, and each `WebContents` can use
  9437. * `webContents.setUserAgent` to override the session-wide user agent.
  9438. */
  9439. setUserAgent(userAgent: string, acceptLanguages?: string): void;
  9440. /**
  9441. * A `string[]` array which consists of all the known available spell checker
  9442. * languages. Providing a language code to the `setSpellCheckerLanguages` API that
  9443. * isn't in this array will result in an error.
  9444. *
  9445. */
  9446. readonly availableSpellCheckerLanguages: string[];
  9447. /**
  9448. * A `Cookies` object for this session.
  9449. *
  9450. */
  9451. readonly cookies: Cookies;
  9452. /**
  9453. * A `NetLog` object for this session.
  9454. *
  9455. */
  9456. readonly netLog: NetLog;
  9457. /**
  9458. * A `Protocol` object for this session.
  9459. *
  9460. */
  9461. readonly protocol: Protocol;
  9462. /**
  9463. * A `ServiceWorkers` object for this session.
  9464. *
  9465. */
  9466. readonly serviceWorkers: ServiceWorkers;
  9467. /**
  9468. * A `boolean` indicating whether builtin spell checker is enabled.
  9469. */
  9470. spellCheckerEnabled: boolean;
  9471. /**
  9472. * A `string | null` indicating the absolute file system path where data for this
  9473. * session is persisted on disk. For in memory sessions this returns `null`.
  9474. *
  9475. */
  9476. readonly storagePath: (string) | (null);
  9477. /**
  9478. * A `WebRequest` object for this session.
  9479. *
  9480. */
  9481. readonly webRequest: WebRequest;
  9482. }
  9483. interface SharedWorkerInfo {
  9484. // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
  9485. /**
  9486. * The unique id of the shared worker.
  9487. */
  9488. id: string;
  9489. /**
  9490. * The url of the shared worker.
  9491. */
  9492. url: string;
  9493. }
  9494. class ShareMenu extends NodeEventEmitter {
  9495. // Docs: https://electronjs.org/docs/api/share-menu
  9496. /**
  9497. * ShareMenu
  9498. */
  9499. constructor(sharingItem: SharingItem);
  9500. /**
  9501. * Closes the context menu in the `browserWindow`.
  9502. */
  9503. closePopup(browserWindow?: BrowserWindow): void;
  9504. /**
  9505. * Pops up this menu as a context menu in the `BrowserWindow`.
  9506. */
  9507. popup(options?: PopupOptions): void;
  9508. }
  9509. interface SharingItem {
  9510. // Docs: https://electronjs.org/docs/api/structures/sharing-item
  9511. /**
  9512. * An array of files to share.
  9513. */
  9514. filePaths?: string[];
  9515. /**
  9516. * An array of text to share.
  9517. */
  9518. texts?: string[];
  9519. /**
  9520. * An array of URLs to share.
  9521. */
  9522. urls?: string[];
  9523. }
  9524. interface Shell {
  9525. // Docs: https://electronjs.org/docs/api/shell
  9526. /**
  9527. * Play the beep sound.
  9528. */
  9529. beep(): void;
  9530. /**
  9531. * Open the given external protocol URL in the desktop's default manner. (For
  9532. * example, mailto: URLs in the user's default mail agent).
  9533. */
  9534. openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
  9535. /**
  9536. * Resolves with a string containing the error message corresponding to the failure
  9537. * if a failure occurred, otherwise "".
  9538. *
  9539. * Open the given file in the desktop's default manner.
  9540. */
  9541. openPath(path: string): Promise<string>;
  9542. /**
  9543. * Resolves the shortcut link at `shortcutPath`.
  9544. *
  9545. * An exception will be thrown when any error happens.
  9546. *
  9547. * @platform win32
  9548. */
  9549. readShortcutLink(shortcutPath: string): ShortcutDetails;
  9550. /**
  9551. * Show the given file in a file manager. If possible, select the file.
  9552. */
  9553. showItemInFolder(fullPath: string): void;
  9554. /**
  9555. * Resolves when the operation has been completed. Rejects if there was an error
  9556. * while deleting the requested item.
  9557. *
  9558. * This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin
  9559. * on Windows, and a desktop-environment-specific location on Linux).
  9560. */
  9561. trashItem(path: string): Promise<void>;
  9562. /**
  9563. * Whether the shortcut was created successfully.
  9564. *
  9565. * Creates or updates a shortcut link at `shortcutPath`.
  9566. *
  9567. * @platform win32
  9568. */
  9569. writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
  9570. /**
  9571. * Whether the shortcut was created successfully.
  9572. *
  9573. * Creates or updates a shortcut link at `shortcutPath`.
  9574. *
  9575. * @platform win32
  9576. */
  9577. writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
  9578. }
  9579. interface ShortcutDetails {
  9580. // Docs: https://electronjs.org/docs/api/structures/shortcut-details
  9581. /**
  9582. * The Application User Model ID. Default is empty.
  9583. */
  9584. appUserModelId?: string;
  9585. /**
  9586. * The arguments to be applied to `target` when launching from this shortcut.
  9587. * Default is empty.
  9588. */
  9589. args?: string;
  9590. /**
  9591. * The working directory. Default is empty.
  9592. */
  9593. cwd?: string;
  9594. /**
  9595. * The description of the shortcut. Default is empty.
  9596. */
  9597. description?: string;
  9598. /**
  9599. * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
  9600. * together. Default is empty, which uses the target's icon.
  9601. */
  9602. icon?: string;
  9603. /**
  9604. * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
  9605. */
  9606. iconIndex?: number;
  9607. /**
  9608. * The target to launch from this shortcut.
  9609. */
  9610. target: string;
  9611. /**
  9612. * The Application Toast Activator CLSID. Needed for participating in Action
  9613. * Center.
  9614. */
  9615. toastActivatorClsid?: string;
  9616. }
  9617. interface Size {
  9618. // Docs: https://electronjs.org/docs/api/structures/size
  9619. height: number;
  9620. width: number;
  9621. }
  9622. interface SystemPreferences extends NodeJS.EventEmitter {
  9623. // Docs: https://electronjs.org/docs/api/system-preferences
  9624. /**
  9625. * @platform win32
  9626. */
  9627. on(event: 'accent-color-changed', listener: (event: Event,
  9628. /**
  9629. * The new RGBA color the user assigned to be their system accent color.
  9630. */
  9631. newColor: string) => void): this;
  9632. /**
  9633. * @platform win32
  9634. */
  9635. off(event: 'accent-color-changed', listener: (event: Event,
  9636. /**
  9637. * The new RGBA color the user assigned to be their system accent color.
  9638. */
  9639. newColor: string) => void): this;
  9640. /**
  9641. * @platform win32
  9642. */
  9643. once(event: 'accent-color-changed', listener: (event: Event,
  9644. /**
  9645. * The new RGBA color the user assigned to be their system accent color.
  9646. */
  9647. newColor: string) => void): this;
  9648. /**
  9649. * @platform win32
  9650. */
  9651. addListener(event: 'accent-color-changed', listener: (event: Event,
  9652. /**
  9653. * The new RGBA color the user assigned to be their system accent color.
  9654. */
  9655. newColor: string) => void): this;
  9656. /**
  9657. * @platform win32
  9658. */
  9659. removeListener(event: 'accent-color-changed', listener: (event: Event,
  9660. /**
  9661. * The new RGBA color the user assigned to be their system accent color.
  9662. */
  9663. newColor: string) => void): this;
  9664. /**
  9665. * @platform win32
  9666. */
  9667. on(event: 'color-changed', listener: (event: Event) => void): this;
  9668. /**
  9669. * @platform win32
  9670. */
  9671. off(event: 'color-changed', listener: (event: Event) => void): this;
  9672. /**
  9673. * @platform win32
  9674. */
  9675. once(event: 'color-changed', listener: (event: Event) => void): this;
  9676. /**
  9677. * @platform win32
  9678. */
  9679. addListener(event: 'color-changed', listener: (event: Event) => void): this;
  9680. /**
  9681. * @platform win32
  9682. */
  9683. removeListener(event: 'color-changed', listener: (event: Event) => void): this;
  9684. /**
  9685. * A promise that resolves with `true` if consent was granted and `false` if it was
  9686. * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
  9687. * access request was denied and later is changed through the System Preferences
  9688. * pane, a restart of the app will be required for the new permissions to take
  9689. * effect. If access has already been requested and denied, it _must_ be changed
  9690. * through the preference pane; an alert will not pop up and the promise will
  9691. * resolve with the existing access status.
  9692. *
  9693. * **Important:** In order to properly leverage this API, you must set the
  9694. * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
  9695. * app's `Info.plist` file. The values for these keys will be used to populate the
  9696. * permission dialogs so that the user will be properly informed as to the purpose
  9697. * of the permission request. See Electron Application Distribution for more
  9698. * information about how to set these in the context of Electron.
  9699. *
  9700. * This user consent was not required until macOS 10.14 Mojave, so this method will
  9701. * always return `true` if your system is running 10.13 High Sierra.
  9702. *
  9703. * @platform darwin
  9704. */
  9705. askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
  9706. /**
  9707. * whether or not this device has the ability to use Touch ID.
  9708. *
  9709. * @platform darwin
  9710. */
  9711. canPromptTouchID(): boolean;
  9712. /**
  9713. * The users current system wide accent color preference in RGBA hexadecimal form.
  9714. *
  9715. * This API is only available on macOS 10.14 Mojave or newer.
  9716. *
  9717. * @platform win32,darwin
  9718. */
  9719. getAccentColor(): string;
  9720. /**
  9721. * * `shouldRenderRichAnimation` boolean - Returns true if rich animations should
  9722. * be rendered. Looks at session type (e.g. remote desktop) and accessibility
  9723. * settings to give guidance for heavy animations.
  9724. * * `scrollAnimationsEnabledBySystem` boolean - Determines on a per-platform basis
  9725. * whether scroll animations (e.g. produced by home/end key) should be enabled.
  9726. * * `prefersReducedMotion` boolean - Determines whether the user desires reduced
  9727. * motion based on platform APIs.
  9728. *
  9729. * Returns an object with system animation settings.
  9730. */
  9731. getAnimationSettings(): AnimationSettings;
  9732. /**
  9733. * The system color setting in RGBA hexadecimal form (`#RRGGBBAA`). See the Windows
  9734. * docs and the macOS docs for more details.
  9735. *
  9736. * The following colors are only available on macOS 10.14: `find-highlight`,
  9737. * `selected-content-background`, `separator`,
  9738. * `unemphasized-selected-content-background`,
  9739. * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
  9740. *
  9741. * @platform win32,darwin
  9742. */
  9743. getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text' | 'control-background' | 'control' | 'control-text' | 'disabled-control-text' | 'find-highlight' | 'grid' | 'header-text' | 'highlight' | 'keyboard-focus-indicator' | 'label' | 'link' | 'placeholder-text' | 'quaternary-label' | 'scrubber-textured-background' | 'secondary-label' | 'selected-content-background' | 'selected-control' | 'selected-control-text' | 'selected-menu-item-text' | 'selected-text-background' | 'selected-text' | 'separator' | 'shadow' | 'tertiary-label' | 'text-background' | 'text' | 'under-page-background' | 'unemphasized-selected-content-background' | 'unemphasized-selected-text-background' | 'unemphasized-selected-text' | 'window-background' | 'window-frame-text'): string;
  9744. /**
  9745. * Can be `dark`, `light` or `unknown`.
  9746. *
  9747. * Gets the macOS appearance setting that is currently applied to your application,
  9748. * maps to NSApplication.effectiveAppearance
  9749. *
  9750. * @platform darwin
  9751. */
  9752. getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
  9753. /**
  9754. * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
  9755. *
  9756. * This user consent was not required on macOS 10.13 High Sierra so this method
  9757. * will always return `granted`. macOS 10.14 Mojave or higher requires consent for
  9758. * `microphone` and `camera` access. macOS 10.15 Catalina or higher requires
  9759. * consent for `screen` access.
  9760. *
  9761. * Windows 10 has a global setting controlling `microphone` and `camera` access for
  9762. * all win32 applications. It will always return `granted` for `screen` and for all
  9763. * media types on older versions of Windows.
  9764. *
  9765. * @platform win32,darwin
  9766. */
  9767. getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
  9768. /**
  9769. * The standard system color formatted as `#RRGGBBAA`.
  9770. *
  9771. * Returns one of several standard system colors that automatically adapt to
  9772. * vibrancy and changes in accessibility settings like 'Increase contrast' and
  9773. * 'Reduce transparency'. See Apple Documentation for more details.
  9774. *
  9775. * @platform darwin
  9776. */
  9777. getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
  9778. /**
  9779. * The value of `key` in `NSUserDefaults`.
  9780. *
  9781. * Some popular `key` and `type`s are:
  9782. *
  9783. * * `AppleInterfaceStyle`: `string`
  9784. * * `AppleAquaColorVariant`: `integer`
  9785. * * `AppleHighlightColor`: `string`
  9786. * * `AppleShowScrollBars`: `string`
  9787. * * `NSNavRecentPlaces`: `array`
  9788. * * `NSPreferredWebServices`: `dictionary`
  9789. * * `NSUserDictionaryReplacementItems`: `array`
  9790. *
  9791. * @platform darwin
  9792. */
  9793. getUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type): UserDefaultTypes[Type];
  9794. /**
  9795. * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
  9796. *
  9797. * An example of using it to determine if you should create a transparent window or
  9798. * not (transparent windows won't work correctly when DWM composition is disabled):
  9799. *
  9800. * @platform win32
  9801. */
  9802. isAeroGlassEnabled(): boolean;
  9803. /**
  9804. * Whether the Swipe between pages setting is on.
  9805. *
  9806. * @platform darwin
  9807. */
  9808. isSwipeTrackingFromScrollEventsEnabled(): boolean;
  9809. /**
  9810. * `true` if the current process is a trusted accessibility client and `false` if
  9811. * it is not.
  9812. *
  9813. * @platform darwin
  9814. */
  9815. isTrustedAccessibilityClient(prompt: boolean): boolean;
  9816. /**
  9817. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  9818. * contains the user information dictionary sent along with the notification.
  9819. *
  9820. * @platform darwin
  9821. */
  9822. postLocalNotification(event: string, userInfo: Record<string, any>): void;
  9823. /**
  9824. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  9825. * contains the user information dictionary sent along with the notification.
  9826. *
  9827. * @platform darwin
  9828. */
  9829. postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
  9830. /**
  9831. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  9832. * contains the user information dictionary sent along with the notification.
  9833. *
  9834. * @platform darwin
  9835. */
  9836. postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
  9837. /**
  9838. * resolves if the user has successfully authenticated with Touch ID.
  9839. *
  9840. * This API itself will not protect your user data; rather, it is a mechanism to
  9841. * allow you to do so. Native apps will need to set Access Control Constants like
  9842. * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
  9843. * auto-prompt for Touch ID biometric consent. This could be done with
  9844. * `node-keytar`, such that one would store an encryption key with `node-keytar`
  9845. * and only fetch it if `promptTouchID()` resolves.
  9846. *
  9847. * @platform darwin
  9848. */
  9849. promptTouchID(reason: string): Promise<void>;
  9850. /**
  9851. * Add the specified defaults to your application's `NSUserDefaults`.
  9852. *
  9853. * @platform darwin
  9854. */
  9855. registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
  9856. /**
  9857. * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
  9858. * or global value of a `key` previously set with `setUserDefault`.
  9859. *
  9860. * @platform darwin
  9861. */
  9862. removeUserDefault(key: string): void;
  9863. /**
  9864. * Set the value of `key` in `NSUserDefaults`.
  9865. *
  9866. * Note that `type` should match actual type of `value`. An exception is thrown if
  9867. * they don't.
  9868. *
  9869. * Some popular `key` and `type`s are:
  9870. *
  9871. * * `ApplePressAndHoldEnabled`: `boolean`
  9872. *
  9873. * @platform darwin
  9874. */
  9875. setUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type, value: UserDefaultTypes[Type]): void;
  9876. /**
  9877. * The ID of this subscription
  9878. *
  9879. * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
  9880. * defaults. This is necessary for events such as
  9881. * `NSUserDefaultsDidChangeNotification`.
  9882. *
  9883. * If `event` is null, the `NSNotificationCenter` doesn’t use it as criteria for
  9884. * delivery to the observer. See docs for more information.
  9885. *
  9886. * @platform darwin
  9887. */
  9888. subscribeLocalNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  9889. /**
  9890. * The ID of this subscription
  9891. *
  9892. * Subscribes to native notifications of macOS, `callback` will be called with
  9893. * `callback(event, userInfo)` when the corresponding `event` happens. The
  9894. * `userInfo` is an Object that contains the user information dictionary sent along
  9895. * with the notification. The `object` is the sender of the notification, and only
  9896. * supports `NSString` values for now.
  9897. *
  9898. * The `id` of the subscriber is returned, which can be used to unsubscribe the
  9899. * `event`.
  9900. *
  9901. * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
  9902. * values of `event` are:
  9903. *
  9904. * * `AppleInterfaceThemeChangedNotification`
  9905. * * `AppleAquaColorVariantChanged`
  9906. * * `AppleColorPreferencesChangedNotification`
  9907. * * `AppleShowScrollBarsSettingChanged`
  9908. *
  9909. * If `event` is null, the `NSDistributedNotificationCenter` doesn’t use it as
  9910. * criteria for delivery to the observer. See docs for more information.
  9911. *
  9912. * @platform darwin
  9913. */
  9914. subscribeNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  9915. /**
  9916. * The ID of this subscription
  9917. *
  9918. * Same as `subscribeNotification`, but uses
  9919. * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
  9920. * such as `NSWorkspaceDidActivateApplicationNotification`.
  9921. *
  9922. * If `event` is null, the `NSWorkspaceNotificationCenter` doesn’t use it as
  9923. * criteria for delivery to the observer. See docs for more information.
  9924. *
  9925. * @platform darwin
  9926. */
  9927. subscribeWorkspaceNotification(event: (string) | (null), callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  9928. /**
  9929. * Same as `unsubscribeNotification`, but removes the subscriber from
  9930. * `NSNotificationCenter`.
  9931. *
  9932. * @platform darwin
  9933. */
  9934. unsubscribeLocalNotification(id: number): void;
  9935. /**
  9936. * Removes the subscriber with `id`.
  9937. *
  9938. * @platform darwin
  9939. */
  9940. unsubscribeNotification(id: number): void;
  9941. /**
  9942. * Same as `unsubscribeNotification`, but removes the subscriber from
  9943. * `NSWorkspace.sharedWorkspace.notificationCenter`.
  9944. *
  9945. * @platform darwin
  9946. */
  9947. unsubscribeWorkspaceNotification(id: number): void;
  9948. /**
  9949. * A `boolean` property which determines whether the app avoids using
  9950. * semitransparent backgrounds. This maps to
  9951. * NSWorkspace.accessibilityDisplayShouldReduceTransparency
  9952. *
  9953. * @platform darwin
  9954. */
  9955. accessibilityDisplayShouldReduceTransparency(): boolean;
  9956. /**
  9957. * A `string` property that can be `dark`, `light` or `unknown`.
  9958. *
  9959. * Returns the macOS appearance setting that is currently applied to your
  9960. * application, maps to NSApplication.effectiveAppearance
  9961. *
  9962. * @platform darwin
  9963. */
  9964. readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
  9965. }
  9966. interface Task {
  9967. // Docs: https://electronjs.org/docs/api/structures/task
  9968. /**
  9969. * The command line arguments when `program` is executed.
  9970. */
  9971. arguments: string;
  9972. /**
  9973. * Description of this task.
  9974. */
  9975. description: string;
  9976. /**
  9977. * The icon index in the icon file. If an icon file consists of two or more icons,
  9978. * set this value to identify the icon. If an icon file consists of one icon, this
  9979. * value is 0.
  9980. */
  9981. iconIndex: number;
  9982. /**
  9983. * The absolute path to an icon to be displayed in a JumpList, which can be an
  9984. * arbitrary resource file that contains an icon. You can usually specify
  9985. * `process.execPath` to show the icon of the program.
  9986. */
  9987. iconPath: string;
  9988. /**
  9989. * Path of the program to execute, usually you should specify `process.execPath`
  9990. * which opens the current program.
  9991. */
  9992. program: string;
  9993. /**
  9994. * The string to be displayed in a JumpList.
  9995. */
  9996. title: string;
  9997. /**
  9998. * The working directory. Default is empty.
  9999. */
  10000. workingDirectory?: string;
  10001. }
  10002. interface ThumbarButton {
  10003. // Docs: https://electronjs.org/docs/api/structures/thumbar-button
  10004. click: () => void;
  10005. /**
  10006. * Control specific states and behaviors of the button. By default, it is
  10007. * `['enabled']`.
  10008. */
  10009. flags?: string[];
  10010. /**
  10011. * The icon showing in thumbnail toolbar.
  10012. */
  10013. icon: NativeImage;
  10014. /**
  10015. * The text of the button's tooltip.
  10016. */
  10017. tooltip?: string;
  10018. }
  10019. class TouchBar {
  10020. // Docs: https://electronjs.org/docs/api/touch-bar
  10021. /**
  10022. * TouchBar
  10023. */
  10024. constructor(options: TouchBarConstructorOptions);
  10025. /**
  10026. * A `TouchBarItem` that will replace the "esc" button on the touch bar when set.
  10027. * Setting to `null` restores the default "esc" button. Changing this value
  10028. * immediately updates the escape item in the touch bar.
  10029. */
  10030. escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
  10031. /**
  10032. * A `typeof TouchBarButton` reference to the `TouchBarButton` class.
  10033. */
  10034. static TouchBarButton: typeof TouchBarButton;
  10035. /**
  10036. * A `typeof TouchBarColorPicker` reference to the `TouchBarColorPicker` class.
  10037. */
  10038. static TouchBarColorPicker: typeof TouchBarColorPicker;
  10039. /**
  10040. * A `typeof TouchBarGroup` reference to the `TouchBarGroup` class.
  10041. */
  10042. static TouchBarGroup: typeof TouchBarGroup;
  10043. /**
  10044. * A `typeof TouchBarLabel` reference to the `TouchBarLabel` class.
  10045. */
  10046. static TouchBarLabel: typeof TouchBarLabel;
  10047. /**
  10048. * A `typeof TouchBarOtherItemsProxy` reference to the `TouchBarOtherItemsProxy`
  10049. * class.
  10050. */
  10051. static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
  10052. /**
  10053. * A `typeof TouchBarPopover` reference to the `TouchBarPopover` class.
  10054. */
  10055. static TouchBarPopover: typeof TouchBarPopover;
  10056. /**
  10057. * A `typeof TouchBarScrubber` reference to the `TouchBarScrubber` class.
  10058. */
  10059. static TouchBarScrubber: typeof TouchBarScrubber;
  10060. /**
  10061. * A `typeof TouchBarSegmentedControl` reference to the `TouchBarSegmentedControl`
  10062. * class.
  10063. */
  10064. static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
  10065. /**
  10066. * A `typeof TouchBarSlider` reference to the `TouchBarSlider` class.
  10067. */
  10068. static TouchBarSlider: typeof TouchBarSlider;
  10069. /**
  10070. * A `typeof TouchBarSpacer` reference to the `TouchBarSpacer` class.
  10071. */
  10072. static TouchBarSpacer: typeof TouchBarSpacer;
  10073. }
  10074. class TouchBarButton {
  10075. // Docs: https://electronjs.org/docs/api/touch-bar-button
  10076. /**
  10077. * TouchBarButton
  10078. */
  10079. constructor(options: TouchBarButtonConstructorOptions);
  10080. /**
  10081. * A `string` representing the description of the button to be read by a screen
  10082. * reader. Will only be read by screen readers if no label is set.
  10083. */
  10084. accessibilityLabel: string;
  10085. /**
  10086. * A `string` hex code representing the button's current background color. Changing
  10087. * this value immediately updates the button in the touch bar.
  10088. */
  10089. backgroundColor: string;
  10090. /**
  10091. * A `boolean` representing whether the button is in an enabled state.
  10092. */
  10093. enabled: boolean;
  10094. /**
  10095. * A `NativeImage` representing the button's current icon. Changing this value
  10096. * immediately updates the button in the touch bar.
  10097. */
  10098. icon: NativeImage;
  10099. /**
  10100. * A `string` - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
  10101. */
  10102. iconPosition: ('left' | 'right' | 'overlay');
  10103. /**
  10104. * A `string` representing the button's current text. Changing this value
  10105. * immediately updates the button in the touch bar.
  10106. */
  10107. label: string;
  10108. }
  10109. class TouchBarColorPicker extends NodeEventEmitter {
  10110. // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
  10111. /**
  10112. * TouchBarColorPicker
  10113. */
  10114. constructor(options: TouchBarColorPickerConstructorOptions);
  10115. /**
  10116. * A `string[]` array representing the color picker's available colors to select.
  10117. * Changing this value immediately updates the color picker in the touch bar.
  10118. */
  10119. availableColors: string[];
  10120. /**
  10121. * A `string` hex code representing the color picker's currently selected color.
  10122. * Changing this value immediately updates the color picker in the touch bar.
  10123. */
  10124. selectedColor: string;
  10125. }
  10126. class TouchBarGroup extends NodeEventEmitter {
  10127. // Docs: https://electronjs.org/docs/api/touch-bar-group
  10128. /**
  10129. * TouchBarGroup
  10130. */
  10131. constructor(options: TouchBarGroupConstructorOptions);
  10132. }
  10133. class TouchBarLabel extends NodeEventEmitter {
  10134. // Docs: https://electronjs.org/docs/api/touch-bar-label
  10135. /**
  10136. * TouchBarLabel
  10137. */
  10138. constructor(options: TouchBarLabelConstructorOptions);
  10139. /**
  10140. * A `string` representing the description of the label to be read by a screen
  10141. * reader.
  10142. */
  10143. accessibilityLabel: string;
  10144. /**
  10145. * A `string` representing the label's current text. Changing this value
  10146. * immediately updates the label in the touch bar.
  10147. */
  10148. label: string;
  10149. /**
  10150. * A `string` hex code representing the label's current text color. Changing this
  10151. * value immediately updates the label in the touch bar.
  10152. */
  10153. textColor: string;
  10154. }
  10155. class TouchBarOtherItemsProxy extends NodeEventEmitter {
  10156. // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
  10157. /**
  10158. * TouchBarOtherItemsProxy
  10159. */
  10160. constructor();
  10161. }
  10162. class TouchBarPopover extends NodeEventEmitter {
  10163. // Docs: https://electronjs.org/docs/api/touch-bar-popover
  10164. /**
  10165. * TouchBarPopover
  10166. */
  10167. constructor(options: TouchBarPopoverConstructorOptions);
  10168. /**
  10169. * A `NativeImage` representing the popover's current button icon. Changing this
  10170. * value immediately updates the popover in the touch bar.
  10171. */
  10172. icon: NativeImage;
  10173. /**
  10174. * A `string` representing the popover's current button text. Changing this value
  10175. * immediately updates the popover in the touch bar.
  10176. */
  10177. label: string;
  10178. }
  10179. class TouchBarScrubber extends NodeEventEmitter {
  10180. // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
  10181. /**
  10182. * TouchBarScrubber
  10183. */
  10184. constructor(options: TouchBarScrubberConstructorOptions);
  10185. /**
  10186. * A `boolean` representing whether this scrubber is continuous or not. Updating
  10187. * this value immediately updates the control in the touch bar.
  10188. */
  10189. continuous: boolean;
  10190. /**
  10191. * A `ScrubberItem[]` array representing the items in this scrubber. Updating this
  10192. * value immediately updates the control in the touch bar. Updating deep properties
  10193. * inside this array **does not update the touch bar**.
  10194. */
  10195. items: ScrubberItem[];
  10196. /**
  10197. * A `string` representing the mode of this scrubber. Updating this value
  10198. * immediately updates the control in the touch bar. Possible values:
  10199. *
  10200. * * `fixed` - Maps to `NSScrubberModeFixed`.
  10201. * * `free` - Maps to `NSScrubberModeFree`.
  10202. */
  10203. mode: ('fixed' | 'free');
  10204. /**
  10205. * A `string` representing the style that selected items in the scrubber should
  10206. * have. This style is overlayed on top of the scrubber item instead of being
  10207. * placed behind it. Updating this value immediately updates the control in the
  10208. * touch bar. Possible values:
  10209. *
  10210. * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
  10211. * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
  10212. * * `none` - Removes all styles.
  10213. */
  10214. overlayStyle: ('background' | 'outline' | 'none');
  10215. /**
  10216. * A `string` representing the style that selected items in the scrubber should
  10217. * have. Updating this value immediately updates the control in the touch bar.
  10218. * Possible values:
  10219. *
  10220. * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
  10221. * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
  10222. * * `none` - Removes all styles.
  10223. */
  10224. selectedStyle: ('background' | 'outline' | 'none');
  10225. /**
  10226. * A `boolean` representing whether to show the left / right selection arrows in
  10227. * this scrubber. Updating this value immediately updates the control in the touch
  10228. * bar.
  10229. */
  10230. showArrowButtons: boolean;
  10231. }
  10232. class TouchBarSegmentedControl extends NodeEventEmitter {
  10233. // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
  10234. /**
  10235. * TouchBarSegmentedControl
  10236. */
  10237. constructor(options: TouchBarSegmentedControlConstructorOptions);
  10238. /**
  10239. * A `string` representing the current selection mode of the control. Can be
  10240. * `single`, `multiple` or `buttons`.
  10241. */
  10242. mode: ('single' | 'multiple' | 'buttons');
  10243. /**
  10244. * A `SegmentedControlSegment[]` array representing the segments in this control.
  10245. * Updating this value immediately updates the control in the touch bar. Updating
  10246. * deep properties inside this array **does not update the touch bar**.
  10247. */
  10248. segments: SegmentedControlSegment[];
  10249. /**
  10250. * A `string` representing the controls current segment style. Updating this value
  10251. * immediately updates the control in the touch bar.
  10252. */
  10253. segmentStyle: string;
  10254. /**
  10255. * An `Integer` representing the currently selected segment. Changing this value
  10256. * immediately updates the control in the touch bar. User interaction with the
  10257. * touch bar will update this value automatically.
  10258. */
  10259. selectedIndex: number;
  10260. }
  10261. class TouchBarSlider extends NodeEventEmitter {
  10262. // Docs: https://electronjs.org/docs/api/touch-bar-slider
  10263. /**
  10264. * TouchBarSlider
  10265. */
  10266. constructor(options: TouchBarSliderConstructorOptions);
  10267. /**
  10268. * A `string` representing the slider's current text. Changing this value
  10269. * immediately updates the slider in the touch bar.
  10270. */
  10271. label: string;
  10272. /**
  10273. * A `number` representing the slider's current maximum value. Changing this value
  10274. * immediately updates the slider in the touch bar.
  10275. */
  10276. maxValue: number;
  10277. /**
  10278. * A `number` representing the slider's current minimum value. Changing this value
  10279. * immediately updates the slider in the touch bar.
  10280. */
  10281. minValue: number;
  10282. /**
  10283. * A `number` representing the slider's current value. Changing this value
  10284. * immediately updates the slider in the touch bar.
  10285. */
  10286. value: number;
  10287. }
  10288. class TouchBarSpacer extends NodeEventEmitter {
  10289. // Docs: https://electronjs.org/docs/api/touch-bar-spacer
  10290. /**
  10291. * TouchBarSpacer
  10292. */
  10293. constructor(options: TouchBarSpacerConstructorOptions);
  10294. /**
  10295. * A `string` representing the size of the spacer. Can be `small`, `large` or
  10296. * `flexible`.
  10297. */
  10298. size: ('small' | 'large' | 'flexible');
  10299. }
  10300. interface TraceCategoriesAndOptions {
  10301. // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
  10302. /**
  10303. * A filter to control what category groups should be traced. A filter can have an
  10304. * optional '-' prefix to exclude category groups that contain a matching category.
  10305. * Having both included and excluded category patterns in the same list is not
  10306. * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
  10307. * `-excluded_category1,-excluded_category2`.
  10308. */
  10309. categoryFilter: string;
  10310. /**
  10311. * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
  10312. * the following strings: `record-until-full`, `record-continuously`,
  10313. * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
  10314. * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
  10315. * modes and hence mutually exclusive. If more than one trace recording modes
  10316. * appear in the `traceOptions` string, the last one takes precedence. If none of
  10317. * the trace recording modes are specified, recording mode is `record-until-full`.
  10318. * The trace option will first be reset to the default option (`record_mode` set to
  10319. * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
  10320. * before options parsed from `traceOptions` are applied on it.
  10321. */
  10322. traceOptions: string;
  10323. }
  10324. interface TraceConfig {
  10325. // Docs: https://electronjs.org/docs/api/structures/trace-config
  10326. /**
  10327. * if true, filter event data according to a specific list of events that have been
  10328. * manually vetted to not include any PII. See the implementation in Chromium for
  10329. * specifics.
  10330. */
  10331. enable_argument_filter?: boolean;
  10332. /**
  10333. * a list of tracing categories to exclude. Can include glob-like patterns using
  10334. * `*` at the end of the category name. See tracing categories for the list of
  10335. * categories.
  10336. */
  10337. excluded_categories?: string[];
  10338. /**
  10339. * a list of histogram names to report with the trace.
  10340. */
  10341. histogram_names?: string[];
  10342. /**
  10343. * a list of tracing categories to include. Can include glob-like patterns using
  10344. * `*` at the end of the category name. See tracing categories for the list of
  10345. * categories.
  10346. */
  10347. included_categories?: string[];
  10348. /**
  10349. * a list of process IDs to include in the trace. If not specified, trace all
  10350. * processes.
  10351. */
  10352. included_process_ids?: number[];
  10353. /**
  10354. * if the `disabled-by-default-memory-infra` category is enabled, this contains
  10355. * optional additional configuration for data collection. See the Chromium
  10356. * memory-infra docs for more information.
  10357. */
  10358. memory_dump_config?: Record<string, any>;
  10359. /**
  10360. * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
  10361. * or `trace-to-console`. Defaults to `record-until-full`.
  10362. */
  10363. recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
  10364. /**
  10365. * maximum size of the trace recording buffer in events.
  10366. */
  10367. trace_buffer_size_in_events?: number;
  10368. /**
  10369. * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
  10370. */
  10371. trace_buffer_size_in_kb?: number;
  10372. }
  10373. interface Transaction {
  10374. // Docs: https://electronjs.org/docs/api/structures/transaction
  10375. /**
  10376. * The error code if an error occurred while processing the transaction.
  10377. */
  10378. errorCode: number;
  10379. /**
  10380. * The error message if an error occurred while processing the transaction.
  10381. */
  10382. errorMessage: string;
  10383. /**
  10384. * The identifier of the restored transaction by the App Store.
  10385. */
  10386. originalTransactionIdentifier: string;
  10387. payment: Payment;
  10388. /**
  10389. * The date the transaction was added to the App Store’s payment queue.
  10390. */
  10391. transactionDate: string;
  10392. /**
  10393. * A string that uniquely identifies a successful payment transaction.
  10394. */
  10395. transactionIdentifier: string;
  10396. /**
  10397. * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
  10398. * `deferred`.
  10399. */
  10400. transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
  10401. }
  10402. class Tray extends NodeEventEmitter {
  10403. // Docs: https://electronjs.org/docs/api/tray
  10404. /**
  10405. * Emitted when the tray balloon is clicked.
  10406. *
  10407. * @platform win32
  10408. */
  10409. on(event: 'balloon-click', listener: Function): this;
  10410. /**
  10411. * @platform win32
  10412. */
  10413. off(event: 'balloon-click', listener: Function): this;
  10414. /**
  10415. * @platform win32
  10416. */
  10417. once(event: 'balloon-click', listener: Function): this;
  10418. /**
  10419. * @platform win32
  10420. */
  10421. addListener(event: 'balloon-click', listener: Function): this;
  10422. /**
  10423. * @platform win32
  10424. */
  10425. removeListener(event: 'balloon-click', listener: Function): this;
  10426. /**
  10427. * Emitted when the tray balloon is closed because of timeout or user manually
  10428. * closes it.
  10429. *
  10430. * @platform win32
  10431. */
  10432. on(event: 'balloon-closed', listener: Function): this;
  10433. /**
  10434. * @platform win32
  10435. */
  10436. off(event: 'balloon-closed', listener: Function): this;
  10437. /**
  10438. * @platform win32
  10439. */
  10440. once(event: 'balloon-closed', listener: Function): this;
  10441. /**
  10442. * @platform win32
  10443. */
  10444. addListener(event: 'balloon-closed', listener: Function): this;
  10445. /**
  10446. * @platform win32
  10447. */
  10448. removeListener(event: 'balloon-closed', listener: Function): this;
  10449. /**
  10450. * Emitted when the tray balloon shows.
  10451. *
  10452. * @platform win32
  10453. */
  10454. on(event: 'balloon-show', listener: Function): this;
  10455. /**
  10456. * @platform win32
  10457. */
  10458. off(event: 'balloon-show', listener: Function): this;
  10459. /**
  10460. * @platform win32
  10461. */
  10462. once(event: 'balloon-show', listener: Function): this;
  10463. /**
  10464. * @platform win32
  10465. */
  10466. addListener(event: 'balloon-show', listener: Function): this;
  10467. /**
  10468. * @platform win32
  10469. */
  10470. removeListener(event: 'balloon-show', listener: Function): this;
  10471. /**
  10472. * Emitted when the tray icon is clicked.
  10473. *
  10474. * Note that on Linux this event is emitted when the tray icon receives an
  10475. * activation, which might not necessarily be left mouse click.
  10476. */
  10477. on(event: 'click', listener: (event: KeyboardEvent,
  10478. /**
  10479. * The bounds of tray icon.
  10480. */
  10481. bounds: Rectangle,
  10482. /**
  10483. * The position of the event.
  10484. */
  10485. position: Point) => void): this;
  10486. off(event: 'click', listener: (event: KeyboardEvent,
  10487. /**
  10488. * The bounds of tray icon.
  10489. */
  10490. bounds: Rectangle,
  10491. /**
  10492. * The position of the event.
  10493. */
  10494. position: Point) => void): this;
  10495. once(event: 'click', listener: (event: KeyboardEvent,
  10496. /**
  10497. * The bounds of tray icon.
  10498. */
  10499. bounds: Rectangle,
  10500. /**
  10501. * The position of the event.
  10502. */
  10503. position: Point) => void): this;
  10504. addListener(event: 'click', listener: (event: KeyboardEvent,
  10505. /**
  10506. * The bounds of tray icon.
  10507. */
  10508. bounds: Rectangle,
  10509. /**
  10510. * The position of the event.
  10511. */
  10512. position: Point) => void): this;
  10513. removeListener(event: 'click', listener: (event: KeyboardEvent,
  10514. /**
  10515. * The bounds of tray icon.
  10516. */
  10517. bounds: Rectangle,
  10518. /**
  10519. * The position of the event.
  10520. */
  10521. position: Point) => void): this;
  10522. /**
  10523. * Emitted when the tray icon is double clicked.
  10524. *
  10525. * @platform darwin,win32
  10526. */
  10527. on(event: 'double-click', listener: (event: KeyboardEvent,
  10528. /**
  10529. * The bounds of tray icon.
  10530. */
  10531. bounds: Rectangle) => void): this;
  10532. /**
  10533. * @platform darwin,win32
  10534. */
  10535. off(event: 'double-click', listener: (event: KeyboardEvent,
  10536. /**
  10537. * The bounds of tray icon.
  10538. */
  10539. bounds: Rectangle) => void): this;
  10540. /**
  10541. * @platform darwin,win32
  10542. */
  10543. once(event: 'double-click', listener: (event: KeyboardEvent,
  10544. /**
  10545. * The bounds of tray icon.
  10546. */
  10547. bounds: Rectangle) => void): this;
  10548. /**
  10549. * @platform darwin,win32
  10550. */
  10551. addListener(event: 'double-click', listener: (event: KeyboardEvent,
  10552. /**
  10553. * The bounds of tray icon.
  10554. */
  10555. bounds: Rectangle) => void): this;
  10556. /**
  10557. * @platform darwin,win32
  10558. */
  10559. removeListener(event: 'double-click', listener: (event: KeyboardEvent,
  10560. /**
  10561. * The bounds of tray icon.
  10562. */
  10563. bounds: Rectangle) => void): this;
  10564. /**
  10565. * Emitted when a drag operation ends on the tray or ends at another location.
  10566. *
  10567. * @platform darwin
  10568. */
  10569. on(event: 'drag-end', listener: Function): this;
  10570. /**
  10571. * @platform darwin
  10572. */
  10573. off(event: 'drag-end', listener: Function): this;
  10574. /**
  10575. * @platform darwin
  10576. */
  10577. once(event: 'drag-end', listener: Function): this;
  10578. /**
  10579. * @platform darwin
  10580. */
  10581. addListener(event: 'drag-end', listener: Function): this;
  10582. /**
  10583. * @platform darwin
  10584. */
  10585. removeListener(event: 'drag-end', listener: Function): this;
  10586. /**
  10587. * Emitted when a drag operation enters the tray icon.
  10588. *
  10589. * @platform darwin
  10590. */
  10591. on(event: 'drag-enter', listener: Function): this;
  10592. /**
  10593. * @platform darwin
  10594. */
  10595. off(event: 'drag-enter', listener: Function): this;
  10596. /**
  10597. * @platform darwin
  10598. */
  10599. once(event: 'drag-enter', listener: Function): this;
  10600. /**
  10601. * @platform darwin
  10602. */
  10603. addListener(event: 'drag-enter', listener: Function): this;
  10604. /**
  10605. * @platform darwin
  10606. */
  10607. removeListener(event: 'drag-enter', listener: Function): this;
  10608. /**
  10609. * Emitted when a drag operation exits the tray icon.
  10610. *
  10611. * @platform darwin
  10612. */
  10613. on(event: 'drag-leave', listener: Function): this;
  10614. /**
  10615. * @platform darwin
  10616. */
  10617. off(event: 'drag-leave', listener: Function): this;
  10618. /**
  10619. * @platform darwin
  10620. */
  10621. once(event: 'drag-leave', listener: Function): this;
  10622. /**
  10623. * @platform darwin
  10624. */
  10625. addListener(event: 'drag-leave', listener: Function): this;
  10626. /**
  10627. * @platform darwin
  10628. */
  10629. removeListener(event: 'drag-leave', listener: Function): this;
  10630. /**
  10631. * Emitted when any dragged items are dropped on the tray icon.
  10632. *
  10633. * @platform darwin
  10634. */
  10635. on(event: 'drop', listener: Function): this;
  10636. /**
  10637. * @platform darwin
  10638. */
  10639. off(event: 'drop', listener: Function): this;
  10640. /**
  10641. * @platform darwin
  10642. */
  10643. once(event: 'drop', listener: Function): this;
  10644. /**
  10645. * @platform darwin
  10646. */
  10647. addListener(event: 'drop', listener: Function): this;
  10648. /**
  10649. * @platform darwin
  10650. */
  10651. removeListener(event: 'drop', listener: Function): this;
  10652. /**
  10653. * Emitted when dragged files are dropped in the tray icon.
  10654. *
  10655. * @platform darwin
  10656. */
  10657. on(event: 'drop-files', listener: (event: Event,
  10658. /**
  10659. * The paths of the dropped files.
  10660. */
  10661. files: string[]) => void): this;
  10662. /**
  10663. * @platform darwin
  10664. */
  10665. off(event: 'drop-files', listener: (event: Event,
  10666. /**
  10667. * The paths of the dropped files.
  10668. */
  10669. files: string[]) => void): this;
  10670. /**
  10671. * @platform darwin
  10672. */
  10673. once(event: 'drop-files', listener: (event: Event,
  10674. /**
  10675. * The paths of the dropped files.
  10676. */
  10677. files: string[]) => void): this;
  10678. /**
  10679. * @platform darwin
  10680. */
  10681. addListener(event: 'drop-files', listener: (event: Event,
  10682. /**
  10683. * The paths of the dropped files.
  10684. */
  10685. files: string[]) => void): this;
  10686. /**
  10687. * @platform darwin
  10688. */
  10689. removeListener(event: 'drop-files', listener: (event: Event,
  10690. /**
  10691. * The paths of the dropped files.
  10692. */
  10693. files: string[]) => void): this;
  10694. /**
  10695. * Emitted when dragged text is dropped in the tray icon.
  10696. *
  10697. * @platform darwin
  10698. */
  10699. on(event: 'drop-text', listener: (event: Event,
  10700. /**
  10701. * the dropped text string.
  10702. */
  10703. text: string) => void): this;
  10704. /**
  10705. * @platform darwin
  10706. */
  10707. off(event: 'drop-text', listener: (event: Event,
  10708. /**
  10709. * the dropped text string.
  10710. */
  10711. text: string) => void): this;
  10712. /**
  10713. * @platform darwin
  10714. */
  10715. once(event: 'drop-text', listener: (event: Event,
  10716. /**
  10717. * the dropped text string.
  10718. */
  10719. text: string) => void): this;
  10720. /**
  10721. * @platform darwin
  10722. */
  10723. addListener(event: 'drop-text', listener: (event: Event,
  10724. /**
  10725. * the dropped text string.
  10726. */
  10727. text: string) => void): this;
  10728. /**
  10729. * @platform darwin
  10730. */
  10731. removeListener(event: 'drop-text', listener: (event: Event,
  10732. /**
  10733. * the dropped text string.
  10734. */
  10735. text: string) => void): this;
  10736. /**
  10737. * Emitted when the tray icon is middle clicked.
  10738. *
  10739. * @platform win32
  10740. */
  10741. on(event: 'middle-click', listener: (event: KeyboardEvent,
  10742. /**
  10743. * The bounds of tray icon.
  10744. */
  10745. bounds: Rectangle) => void): this;
  10746. /**
  10747. * @platform win32
  10748. */
  10749. off(event: 'middle-click', listener: (event: KeyboardEvent,
  10750. /**
  10751. * The bounds of tray icon.
  10752. */
  10753. bounds: Rectangle) => void): this;
  10754. /**
  10755. * @platform win32
  10756. */
  10757. once(event: 'middle-click', listener: (event: KeyboardEvent,
  10758. /**
  10759. * The bounds of tray icon.
  10760. */
  10761. bounds: Rectangle) => void): this;
  10762. /**
  10763. * @platform win32
  10764. */
  10765. addListener(event: 'middle-click', listener: (event: KeyboardEvent,
  10766. /**
  10767. * The bounds of tray icon.
  10768. */
  10769. bounds: Rectangle) => void): this;
  10770. /**
  10771. * @platform win32
  10772. */
  10773. removeListener(event: 'middle-click', listener: (event: KeyboardEvent,
  10774. /**
  10775. * The bounds of tray icon.
  10776. */
  10777. bounds: Rectangle) => void): this;
  10778. /**
  10779. * Emitted when the mouse clicks the tray icon.
  10780. *
  10781. * @platform darwin
  10782. */
  10783. on(event: 'mouse-down', listener: (event: KeyboardEvent,
  10784. /**
  10785. * The position of the event.
  10786. */
  10787. position: Point) => void): this;
  10788. /**
  10789. * @platform darwin
  10790. */
  10791. off(event: 'mouse-down', listener: (event: KeyboardEvent,
  10792. /**
  10793. * The position of the event.
  10794. */
  10795. position: Point) => void): this;
  10796. /**
  10797. * @platform darwin
  10798. */
  10799. once(event: 'mouse-down', listener: (event: KeyboardEvent,
  10800. /**
  10801. * The position of the event.
  10802. */
  10803. position: Point) => void): this;
  10804. /**
  10805. * @platform darwin
  10806. */
  10807. addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  10808. /**
  10809. * The position of the event.
  10810. */
  10811. position: Point) => void): this;
  10812. /**
  10813. * @platform darwin
  10814. */
  10815. removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  10816. /**
  10817. * The position of the event.
  10818. */
  10819. position: Point) => void): this;
  10820. /**
  10821. * Emitted when the mouse enters the tray icon.
  10822. *
  10823. * @platform darwin,win32
  10824. */
  10825. on(event: 'mouse-enter', listener: (event: KeyboardEvent,
  10826. /**
  10827. * The position of the event.
  10828. */
  10829. position: Point) => void): this;
  10830. /**
  10831. * @platform darwin,win32
  10832. */
  10833. off(event: 'mouse-enter', listener: (event: KeyboardEvent,
  10834. /**
  10835. * The position of the event.
  10836. */
  10837. position: Point) => void): this;
  10838. /**
  10839. * @platform darwin,win32
  10840. */
  10841. once(event: 'mouse-enter', listener: (event: KeyboardEvent,
  10842. /**
  10843. * The position of the event.
  10844. */
  10845. position: Point) => void): this;
  10846. /**
  10847. * @platform darwin,win32
  10848. */
  10849. addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  10850. /**
  10851. * The position of the event.
  10852. */
  10853. position: Point) => void): this;
  10854. /**
  10855. * @platform darwin,win32
  10856. */
  10857. removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  10858. /**
  10859. * The position of the event.
  10860. */
  10861. position: Point) => void): this;
  10862. /**
  10863. * Emitted when the mouse exits the tray icon.
  10864. *
  10865. * @platform darwin,win32
  10866. */
  10867. on(event: 'mouse-leave', listener: (event: KeyboardEvent,
  10868. /**
  10869. * The position of the event.
  10870. */
  10871. position: Point) => void): this;
  10872. /**
  10873. * @platform darwin,win32
  10874. */
  10875. off(event: 'mouse-leave', listener: (event: KeyboardEvent,
  10876. /**
  10877. * The position of the event.
  10878. */
  10879. position: Point) => void): this;
  10880. /**
  10881. * @platform darwin,win32
  10882. */
  10883. once(event: 'mouse-leave', listener: (event: KeyboardEvent,
  10884. /**
  10885. * The position of the event.
  10886. */
  10887. position: Point) => void): this;
  10888. /**
  10889. * @platform darwin,win32
  10890. */
  10891. addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  10892. /**
  10893. * The position of the event.
  10894. */
  10895. position: Point) => void): this;
  10896. /**
  10897. * @platform darwin,win32
  10898. */
  10899. removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  10900. /**
  10901. * The position of the event.
  10902. */
  10903. position: Point) => void): this;
  10904. /**
  10905. * Emitted when the mouse moves in the tray icon.
  10906. *
  10907. * @platform darwin,win32
  10908. */
  10909. on(event: 'mouse-move', listener: (event: KeyboardEvent,
  10910. /**
  10911. * The position of the event.
  10912. */
  10913. position: Point) => void): this;
  10914. /**
  10915. * @platform darwin,win32
  10916. */
  10917. off(event: 'mouse-move', listener: (event: KeyboardEvent,
  10918. /**
  10919. * The position of the event.
  10920. */
  10921. position: Point) => void): this;
  10922. /**
  10923. * @platform darwin,win32
  10924. */
  10925. once(event: 'mouse-move', listener: (event: KeyboardEvent,
  10926. /**
  10927. * The position of the event.
  10928. */
  10929. position: Point) => void): this;
  10930. /**
  10931. * @platform darwin,win32
  10932. */
  10933. addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  10934. /**
  10935. * The position of the event.
  10936. */
  10937. position: Point) => void): this;
  10938. /**
  10939. * @platform darwin,win32
  10940. */
  10941. removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  10942. /**
  10943. * The position of the event.
  10944. */
  10945. position: Point) => void): this;
  10946. /**
  10947. * Emitted when the mouse is released from clicking the tray icon.
  10948. *
  10949. * Note: This will not be emitted if you have set a context menu for your Tray
  10950. * using `tray.setContextMenu`, as a result of macOS-level constraints.
  10951. *
  10952. * @platform darwin
  10953. */
  10954. on(event: 'mouse-up', listener: (event: KeyboardEvent,
  10955. /**
  10956. * The position of the event.
  10957. */
  10958. position: Point) => void): this;
  10959. /**
  10960. * @platform darwin
  10961. */
  10962. off(event: 'mouse-up', listener: (event: KeyboardEvent,
  10963. /**
  10964. * The position of the event.
  10965. */
  10966. position: Point) => void): this;
  10967. /**
  10968. * @platform darwin
  10969. */
  10970. once(event: 'mouse-up', listener: (event: KeyboardEvent,
  10971. /**
  10972. * The position of the event.
  10973. */
  10974. position: Point) => void): this;
  10975. /**
  10976. * @platform darwin
  10977. */
  10978. addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  10979. /**
  10980. * The position of the event.
  10981. */
  10982. position: Point) => void): this;
  10983. /**
  10984. * @platform darwin
  10985. */
  10986. removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  10987. /**
  10988. * The position of the event.
  10989. */
  10990. position: Point) => void): this;
  10991. /**
  10992. * Emitted when the tray icon is right clicked.
  10993. *
  10994. * @platform darwin,win32
  10995. */
  10996. on(event: 'right-click', listener: (event: KeyboardEvent,
  10997. /**
  10998. * The bounds of tray icon.
  10999. */
  11000. bounds: Rectangle) => void): this;
  11001. /**
  11002. * @platform darwin,win32
  11003. */
  11004. off(event: 'right-click', listener: (event: KeyboardEvent,
  11005. /**
  11006. * The bounds of tray icon.
  11007. */
  11008. bounds: Rectangle) => void): this;
  11009. /**
  11010. * @platform darwin,win32
  11011. */
  11012. once(event: 'right-click', listener: (event: KeyboardEvent,
  11013. /**
  11014. * The bounds of tray icon.
  11015. */
  11016. bounds: Rectangle) => void): this;
  11017. /**
  11018. * @platform darwin,win32
  11019. */
  11020. addListener(event: 'right-click', listener: (event: KeyboardEvent,
  11021. /**
  11022. * The bounds of tray icon.
  11023. */
  11024. bounds: Rectangle) => void): this;
  11025. /**
  11026. * @platform darwin,win32
  11027. */
  11028. removeListener(event: 'right-click', listener: (event: KeyboardEvent,
  11029. /**
  11030. * The bounds of tray icon.
  11031. */
  11032. bounds: Rectangle) => void): this;
  11033. /**
  11034. * Tray
  11035. */
  11036. constructor(image: (NativeImage) | (string), guid?: string);
  11037. /**
  11038. * Closes an open context menu, as set by `tray.setContextMenu()`.
  11039. *
  11040. * @platform darwin,win32
  11041. */
  11042. closeContextMenu(): void;
  11043. /**
  11044. * Destroys the tray icon immediately.
  11045. */
  11046. destroy(): void;
  11047. /**
  11048. * Displays a tray balloon.
  11049. *
  11050. * @platform win32
  11051. */
  11052. displayBalloon(options: DisplayBalloonOptions): void;
  11053. /**
  11054. * Returns focus to the taskbar notification area. Notification area icons should
  11055. * use this message when they have completed their UI operation. For example, if
  11056. * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
  11057. * `tray.focus()` to return focus to the notification area.
  11058. *
  11059. * @platform win32
  11060. */
  11061. focus(): void;
  11062. /**
  11063. * The `bounds` of this tray icon as `Object`.
  11064. *
  11065. * @platform darwin,win32
  11066. */
  11067. getBounds(): Rectangle;
  11068. /**
  11069. * Whether double click events will be ignored.
  11070. *
  11071. * @platform darwin
  11072. */
  11073. getIgnoreDoubleClickEvents(): boolean;
  11074. /**
  11075. * the title displayed next to the tray icon in the status bar
  11076. *
  11077. * @platform darwin
  11078. */
  11079. getTitle(): string;
  11080. /**
  11081. * Whether the tray icon is destroyed.
  11082. */
  11083. isDestroyed(): boolean;
  11084. /**
  11085. * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
  11086. * will be shown instead of the tray icon's context menu.
  11087. *
  11088. * The `position` is only available on Windows, and it is (0, 0) by default.
  11089. *
  11090. * @platform darwin,win32
  11091. */
  11092. popUpContextMenu(menu?: Menu, position?: Point): void;
  11093. /**
  11094. * Removes a tray balloon.
  11095. *
  11096. * @platform win32
  11097. */
  11098. removeBalloon(): void;
  11099. /**
  11100. * Sets the context menu for this icon.
  11101. */
  11102. setContextMenu(menu: (Menu) | (null)): void;
  11103. /**
  11104. * Sets the option to ignore double click events. Ignoring these events allows you
  11105. * to detect every individual click of the tray icon.
  11106. *
  11107. * This value is set to false by default.
  11108. *
  11109. * @platform darwin
  11110. */
  11111. setIgnoreDoubleClickEvents(ignore: boolean): void;
  11112. /**
  11113. * Sets the `image` associated with this tray icon.
  11114. */
  11115. setImage(image: (NativeImage) | (string)): void;
  11116. /**
  11117. * Sets the `image` associated with this tray icon when pressed on macOS.
  11118. *
  11119. * @platform darwin
  11120. */
  11121. setPressedImage(image: (NativeImage) | (string)): void;
  11122. /**
  11123. * Sets the title displayed next to the tray icon in the status bar (Support ANSI
  11124. * colors).
  11125. *
  11126. * @platform darwin
  11127. */
  11128. setTitle(title: string, options?: TitleOptions): void;
  11129. /**
  11130. * Sets the hover text for this tray icon.
  11131. */
  11132. setToolTip(toolTip: string): void;
  11133. }
  11134. interface UploadData {
  11135. // Docs: https://electronjs.org/docs/api/structures/upload-data
  11136. /**
  11137. * UUID of blob data. Use ses.getBlobData method to retrieve the data.
  11138. */
  11139. blobUUID?: string;
  11140. /**
  11141. * Content being sent.
  11142. */
  11143. bytes: Buffer;
  11144. /**
  11145. * Path of file being uploaded.
  11146. */
  11147. file?: string;
  11148. }
  11149. interface UploadFile {
  11150. // Docs: https://electronjs.org/docs/api/structures/upload-file
  11151. /**
  11152. * Path of file to be uploaded.
  11153. */
  11154. filePath: string;
  11155. /**
  11156. * Number of bytes to read from `offset`. Defaults to `0`.
  11157. */
  11158. length?: number;
  11159. /**
  11160. * Last Modification time in number of seconds since the UNIX epoch. Defaults to
  11161. * `0`.
  11162. */
  11163. modificationTime?: number;
  11164. /**
  11165. * Defaults to `0`.
  11166. */
  11167. offset?: number;
  11168. /**
  11169. * `file`.
  11170. */
  11171. type: 'file';
  11172. }
  11173. interface UploadRawData {
  11174. // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
  11175. /**
  11176. * Data to be uploaded.
  11177. */
  11178. bytes: Buffer;
  11179. /**
  11180. * `rawData`.
  11181. */
  11182. type: 'rawData';
  11183. }
  11184. interface USBDevice {
  11185. // Docs: https://electronjs.org/docs/api/structures/usb-device
  11186. /**
  11187. * The device class for the communication interface supported by the device
  11188. */
  11189. deviceClass: number;
  11190. /**
  11191. * Unique identifier for the device.
  11192. */
  11193. deviceId: string;
  11194. /**
  11195. * The device protocol for the communication interface supported by the device
  11196. */
  11197. deviceProtocol: number;
  11198. /**
  11199. * The device subclass for the communication interface supported by the device
  11200. */
  11201. deviceSubclass: number;
  11202. /**
  11203. * The major version number of the device as defined by the device manufacturer.
  11204. */
  11205. deviceVersionMajor: number;
  11206. /**
  11207. * The minor version number of the device as defined by the device manufacturer.
  11208. */
  11209. deviceVersionMinor: number;
  11210. /**
  11211. * The subminor version number of the device as defined by the device manufacturer.
  11212. */
  11213. deviceVersionSubminor: number;
  11214. /**
  11215. * The manufacturer name of the device.
  11216. */
  11217. manufacturerName?: string;
  11218. /**
  11219. * The USB product ID.
  11220. */
  11221. productId: number;
  11222. /**
  11223. * Name of the device.
  11224. */
  11225. productName?: string;
  11226. /**
  11227. * The USB device serial number.
  11228. */
  11229. serialNumber?: string;
  11230. /**
  11231. * The USB protocol major version supported by the device
  11232. */
  11233. usbVersionMajor: number;
  11234. /**
  11235. * The USB protocol minor version supported by the device
  11236. */
  11237. usbVersionMinor: number;
  11238. /**
  11239. * The USB protocol subminor version supported by the device
  11240. */
  11241. usbVersionSubminor: number;
  11242. /**
  11243. * The USB vendor ID.
  11244. */
  11245. vendorId: number;
  11246. }
  11247. interface UserDefaultTypes {
  11248. // Docs: https://electronjs.org/docs/api/structures/user-default-types
  11249. array: Array<unknown>;
  11250. boolean: boolean;
  11251. dictionary: Record<string, unknown>;
  11252. double: number;
  11253. float: number;
  11254. integer: number;
  11255. string: string;
  11256. url: string;
  11257. }
  11258. class UtilityProcess extends NodeEventEmitter {
  11259. // Docs: https://electronjs.org/docs/api/utility-process
  11260. static fork(modulePath: string, args?: string[], options?: ForkOptions): UtilityProcess;
  11261. /**
  11262. * Emitted after the child process ends.
  11263. */
  11264. on(event: 'exit', listener: (
  11265. /**
  11266. * Contains the exit code for the process obtained from waitpid on posix, or
  11267. * GetExitCodeProcess on windows.
  11268. */
  11269. code: number) => void): this;
  11270. off(event: 'exit', listener: (
  11271. /**
  11272. * Contains the exit code for the process obtained from waitpid on posix, or
  11273. * GetExitCodeProcess on windows.
  11274. */
  11275. code: number) => void): this;
  11276. once(event: 'exit', listener: (
  11277. /**
  11278. * Contains the exit code for the process obtained from waitpid on posix, or
  11279. * GetExitCodeProcess on windows.
  11280. */
  11281. code: number) => void): this;
  11282. addListener(event: 'exit', listener: (
  11283. /**
  11284. * Contains the exit code for the process obtained from waitpid on posix, or
  11285. * GetExitCodeProcess on windows.
  11286. */
  11287. code: number) => void): this;
  11288. removeListener(event: 'exit', listener: (
  11289. /**
  11290. * Contains the exit code for the process obtained from waitpid on posix, or
  11291. * GetExitCodeProcess on windows.
  11292. */
  11293. code: number) => void): this;
  11294. /**
  11295. * Emitted when the child process sends a message using
  11296. * `process.parentPort.postMessage()`.
  11297. */
  11298. on(event: 'message', listener: (message: any) => void): this;
  11299. off(event: 'message', listener: (message: any) => void): this;
  11300. once(event: 'message', listener: (message: any) => void): this;
  11301. addListener(event: 'message', listener: (message: any) => void): this;
  11302. removeListener(event: 'message', listener: (message: any) => void): this;
  11303. /**
  11304. * Emitted once the child process has spawned successfully.
  11305. */
  11306. on(event: 'spawn', listener: Function): this;
  11307. off(event: 'spawn', listener: Function): this;
  11308. once(event: 'spawn', listener: Function): this;
  11309. addListener(event: 'spawn', listener: Function): this;
  11310. removeListener(event: 'spawn', listener: Function): this;
  11311. /**
  11312. * Terminates the process gracefully. On POSIX, it uses SIGTERM but will ensure the
  11313. * process is reaped on exit. This function returns true if the kill is successful,
  11314. * and false otherwise.
  11315. */
  11316. kill(): boolean;
  11317. /**
  11318. * Send a message to the child process, optionally transferring ownership of zero
  11319. * or more `MessagePortMain` objects.
  11320. *
  11321. * For example:
  11322. */
  11323. postMessage(message: any, transfer?: MessagePortMain[]): void;
  11324. /**
  11325. * A `Integer | undefined` representing the process identifier (PID) of the child
  11326. * process. If the child process fails to spawn due to errors, then the value is
  11327. * `undefined`. When the child process exits, then the value is `undefined` after
  11328. * the `exit` event is emitted.
  11329. */
  11330. pid: (number) | (undefined);
  11331. /**
  11332. * A `NodeJS.ReadableStream | null` that represents the child process's stderr. If
  11333. * the child was spawned with options.stdio[2] set to anything other than 'pipe',
  11334. * then this will be `null`. When the child process exits, then the value is `null`
  11335. * after the `exit` event is emitted.
  11336. */
  11337. stderr: (NodeJS.ReadableStream) | (null);
  11338. /**
  11339. * A `NodeJS.ReadableStream | null` that represents the child process's stdout. If
  11340. * the child was spawned with options.stdio[1] set to anything other than 'pipe',
  11341. * then this will be `null`. When the child process exits, then the value is `null`
  11342. * after the `exit` event is emitted.
  11343. */
  11344. stdout: (NodeJS.ReadableStream) | (null);
  11345. }
  11346. class WebContents extends NodeEventEmitter {
  11347. // Docs: https://electronjs.org/docs/api/web-contents
  11348. /**
  11349. * A WebContents instance with the given TargetID, or `undefined` if there is no
  11350. * WebContents associated with the given TargetID.
  11351. *
  11352. * When communicating with the Chrome DevTools Protocol, it can be useful to lookup
  11353. * a WebContents instance based on its assigned TargetID.
  11354. */
  11355. static fromDevToolsTargetId(targetId: string): (WebContents) | (undefined);
  11356. /**
  11357. * A WebContents instance with the given WebFrameMain, or `undefined` if there is
  11358. * no WebContents associated with the given WebFrameMain.
  11359. */
  11360. static fromFrame(frame: WebFrameMain): (WebContents) | (undefined);
  11361. /**
  11362. * A WebContents instance with the given ID, or `undefined` if there is no
  11363. * WebContents associated with the given ID.
  11364. */
  11365. static fromId(id: number): (WebContents) | (undefined);
  11366. /**
  11367. * An array of all `WebContents` instances. This will contain web contents for all
  11368. * windows, webviews, opened devtools, and devtools extension background pages.
  11369. */
  11370. static getAllWebContents(): WebContents[];
  11371. /**
  11372. * The web contents that is focused in this application, otherwise returns `null`.
  11373. */
  11374. static getFocusedWebContents(): (WebContents) | (null);
  11375. /**
  11376. * Emitted when media becomes audible or inaudible.
  11377. */
  11378. on(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  11379. off(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  11380. once(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  11381. addListener(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  11382. removeListener(event: 'audio-state-changed', listener: (event: Event<WebContentsAudioStateChangedEventParams>) => void): this;
  11383. /**
  11384. * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
  11385. * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
  11386. * menu shortcuts.
  11387. *
  11388. * To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
  11389. */
  11390. on(event: 'before-input-event', listener: (event: Event,
  11391. /**
  11392. * Input properties.
  11393. */
  11394. input: Input) => void): this;
  11395. off(event: 'before-input-event', listener: (event: Event,
  11396. /**
  11397. * Input properties.
  11398. */
  11399. input: Input) => void): this;
  11400. once(event: 'before-input-event', listener: (event: Event,
  11401. /**
  11402. * Input properties.
  11403. */
  11404. input: Input) => void): this;
  11405. addListener(event: 'before-input-event', listener: (event: Event,
  11406. /**
  11407. * Input properties.
  11408. */
  11409. input: Input) => void): this;
  11410. removeListener(event: 'before-input-event', listener: (event: Event,
  11411. /**
  11412. * Input properties.
  11413. */
  11414. input: Input) => void): this;
  11415. /**
  11416. * Emitted when the `WebContents` loses focus.
  11417. */
  11418. on(event: 'blur', listener: Function): this;
  11419. off(event: 'blur', listener: Function): this;
  11420. once(event: 'blur', listener: Function): this;
  11421. addListener(event: 'blur', listener: Function): this;
  11422. removeListener(event: 'blur', listener: Function): this;
  11423. /**
  11424. * Emitted when failed to verify the `certificate` for `url`.
  11425. *
  11426. * The usage is the same with the `certificate-error` event of `app`.
  11427. */
  11428. on(event: 'certificate-error', listener: (event: Event,
  11429. url: string,
  11430. /**
  11431. * The error code.
  11432. */
  11433. error: string,
  11434. certificate: Certificate,
  11435. callback: (isTrusted: boolean) => void,
  11436. isMainFrame: boolean) => void): this;
  11437. off(event: 'certificate-error', listener: (event: Event,
  11438. url: string,
  11439. /**
  11440. * The error code.
  11441. */
  11442. error: string,
  11443. certificate: Certificate,
  11444. callback: (isTrusted: boolean) => void,
  11445. isMainFrame: boolean) => void): this;
  11446. once(event: 'certificate-error', listener: (event: Event,
  11447. url: string,
  11448. /**
  11449. * The error code.
  11450. */
  11451. error: string,
  11452. certificate: Certificate,
  11453. callback: (isTrusted: boolean) => void,
  11454. isMainFrame: boolean) => void): this;
  11455. addListener(event: 'certificate-error', listener: (event: Event,
  11456. url: string,
  11457. /**
  11458. * The error code.
  11459. */
  11460. error: string,
  11461. certificate: Certificate,
  11462. callback: (isTrusted: boolean) => void,
  11463. isMainFrame: boolean) => void): this;
  11464. removeListener(event: 'certificate-error', listener: (event: Event,
  11465. url: string,
  11466. /**
  11467. * The error code.
  11468. */
  11469. error: string,
  11470. certificate: Certificate,
  11471. callback: (isTrusted: boolean) => void,
  11472. isMainFrame: boolean) => void): this;
  11473. /**
  11474. * Emitted when the associated window logs a console message.
  11475. */
  11476. on(event: 'console-message', listener: (event: Event,
  11477. /**
  11478. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  11479. * `error`.
  11480. */
  11481. level: number,
  11482. /**
  11483. * The actual console message
  11484. */
  11485. message: string,
  11486. /**
  11487. * The line number of the source that triggered this console message
  11488. */
  11489. line: number,
  11490. sourceId: string) => void): this;
  11491. off(event: 'console-message', listener: (event: Event,
  11492. /**
  11493. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  11494. * `error`.
  11495. */
  11496. level: number,
  11497. /**
  11498. * The actual console message
  11499. */
  11500. message: string,
  11501. /**
  11502. * The line number of the source that triggered this console message
  11503. */
  11504. line: number,
  11505. sourceId: string) => void): this;
  11506. once(event: 'console-message', listener: (event: Event,
  11507. /**
  11508. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  11509. * `error`.
  11510. */
  11511. level: number,
  11512. /**
  11513. * The actual console message
  11514. */
  11515. message: string,
  11516. /**
  11517. * The line number of the source that triggered this console message
  11518. */
  11519. line: number,
  11520. sourceId: string) => void): this;
  11521. addListener(event: 'console-message', listener: (event: Event,
  11522. /**
  11523. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  11524. * `error`.
  11525. */
  11526. level: number,
  11527. /**
  11528. * The actual console message
  11529. */
  11530. message: string,
  11531. /**
  11532. * The line number of the source that triggered this console message
  11533. */
  11534. line: number,
  11535. sourceId: string) => void): this;
  11536. removeListener(event: 'console-message', listener: (event: Event,
  11537. /**
  11538. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  11539. * `error`.
  11540. */
  11541. level: number,
  11542. /**
  11543. * The actual console message
  11544. */
  11545. message: string,
  11546. /**
  11547. * The line number of the source that triggered this console message
  11548. */
  11549. line: number,
  11550. sourceId: string) => void): this;
  11551. /**
  11552. * Emitted when the page calls `window.moveTo`, `window.resizeTo` or related APIs.
  11553. *
  11554. * By default, this will move the window. To prevent that behavior, call
  11555. * `event.preventDefault()`.
  11556. */
  11557. on(event: 'content-bounds-updated', listener: (event: Event,
  11558. /**
  11559. * requested new content bounds
  11560. */
  11561. bounds: Rectangle) => void): this;
  11562. off(event: 'content-bounds-updated', listener: (event: Event,
  11563. /**
  11564. * requested new content bounds
  11565. */
  11566. bounds: Rectangle) => void): this;
  11567. once(event: 'content-bounds-updated', listener: (event: Event,
  11568. /**
  11569. * requested new content bounds
  11570. */
  11571. bounds: Rectangle) => void): this;
  11572. addListener(event: 'content-bounds-updated', listener: (event: Event,
  11573. /**
  11574. * requested new content bounds
  11575. */
  11576. bounds: Rectangle) => void): this;
  11577. removeListener(event: 'content-bounds-updated', listener: (event: Event,
  11578. /**
  11579. * requested new content bounds
  11580. */
  11581. bounds: Rectangle) => void): this;
  11582. /**
  11583. * Emitted when there is a new context menu that needs to be handled.
  11584. */
  11585. on(event: 'context-menu', listener: (event: Event,
  11586. params: ContextMenuParams) => void): this;
  11587. off(event: 'context-menu', listener: (event: Event,
  11588. params: ContextMenuParams) => void): this;
  11589. once(event: 'context-menu', listener: (event: Event,
  11590. params: ContextMenuParams) => void): this;
  11591. addListener(event: 'context-menu', listener: (event: Event,
  11592. params: ContextMenuParams) => void): this;
  11593. removeListener(event: 'context-menu', listener: (event: Event,
  11594. params: ContextMenuParams) => void): this;
  11595. /**
  11596. * Emitted when the renderer process crashes or is killed.
  11597. *
  11598. * **Deprecated:** This event is superceded by the `render-process-gone` event
  11599. * which contains more information about why the render process disappeared. It
  11600. * isn't always because it crashed. The `killed` boolean can be replaced by
  11601. * checking `reason === 'killed'` when you switch to that event.
  11602. *
  11603. * @deprecated
  11604. */
  11605. on(event: 'crashed', listener: (event: Event,
  11606. killed: boolean) => void): this;
  11607. /**
  11608. * @deprecated
  11609. */
  11610. off(event: 'crashed', listener: (event: Event,
  11611. killed: boolean) => void): this;
  11612. /**
  11613. * @deprecated
  11614. */
  11615. once(event: 'crashed', listener: (event: Event,
  11616. killed: boolean) => void): this;
  11617. /**
  11618. * @deprecated
  11619. */
  11620. addListener(event: 'crashed', listener: (event: Event,
  11621. killed: boolean) => void): this;
  11622. /**
  11623. * @deprecated
  11624. */
  11625. removeListener(event: 'crashed', listener: (event: Event,
  11626. killed: boolean) => void): this;
  11627. /**
  11628. * Emitted when the cursor's type changes. The `type` parameter can be `pointer`,
  11629. * `crosshair`, `hand`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
  11630. * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
  11631. * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
  11632. * `row-resize`, `m-panning`, `m-panning-vertical`, `m-panning-horizontal`,
  11633. * `e-panning`, `n-panning`, `ne-panning`, `nw-panning`, `s-panning`, `se-panning`,
  11634. * `sw-panning`, `w-panning`, `move`, `vertical-text`, `cell`, `context-menu`,
  11635. * `alias`, `progress`, `nodrop`, `copy`, `none`, `not-allowed`, `zoom-in`,
  11636. * `zoom-out`, `grab`, `grabbing`, `custom`, `null`, `drag-drop-none`,
  11637. * `drag-drop-move`, `drag-drop-copy`, `drag-drop-link`, `ns-no-resize`,
  11638. * `ew-no-resize`, `nesw-no-resize`, `nwse-no-resize`, or `default`.
  11639. *
  11640. * If the `type` parameter is `custom`, the `image` parameter will hold the custom
  11641. * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
  11642. * additional information about the custom cursor.
  11643. */
  11644. on(event: 'cursor-changed', listener: (event: Event,
  11645. type: string,
  11646. image: NativeImage,
  11647. /**
  11648. * scaling factor for the custom cursor.
  11649. */
  11650. scale: number,
  11651. /**
  11652. * the size of the `image`.
  11653. */
  11654. size: Size,
  11655. /**
  11656. * coordinates of the custom cursor's hotspot.
  11657. */
  11658. hotspot: Point) => void): this;
  11659. off(event: 'cursor-changed', listener: (event: Event,
  11660. type: string,
  11661. image: NativeImage,
  11662. /**
  11663. * scaling factor for the custom cursor.
  11664. */
  11665. scale: number,
  11666. /**
  11667. * the size of the `image`.
  11668. */
  11669. size: Size,
  11670. /**
  11671. * coordinates of the custom cursor's hotspot.
  11672. */
  11673. hotspot: Point) => void): this;
  11674. once(event: 'cursor-changed', listener: (event: Event,
  11675. type: string,
  11676. image: NativeImage,
  11677. /**
  11678. * scaling factor for the custom cursor.
  11679. */
  11680. scale: number,
  11681. /**
  11682. * the size of the `image`.
  11683. */
  11684. size: Size,
  11685. /**
  11686. * coordinates of the custom cursor's hotspot.
  11687. */
  11688. hotspot: Point) => void): this;
  11689. addListener(event: 'cursor-changed', listener: (event: Event,
  11690. type: string,
  11691. image: NativeImage,
  11692. /**
  11693. * scaling factor for the custom cursor.
  11694. */
  11695. scale: number,
  11696. /**
  11697. * the size of the `image`.
  11698. */
  11699. size: Size,
  11700. /**
  11701. * coordinates of the custom cursor's hotspot.
  11702. */
  11703. hotspot: Point) => void): this;
  11704. removeListener(event: 'cursor-changed', listener: (event: Event,
  11705. type: string,
  11706. image: NativeImage,
  11707. /**
  11708. * scaling factor for the custom cursor.
  11709. */
  11710. scale: number,
  11711. /**
  11712. * the size of the `image`.
  11713. */
  11714. size: Size,
  11715. /**
  11716. * coordinates of the custom cursor's hotspot.
  11717. */
  11718. hotspot: Point) => void): this;
  11719. /**
  11720. * Emitted when `webContents` is destroyed.
  11721. */
  11722. on(event: 'destroyed', listener: Function): this;
  11723. off(event: 'destroyed', listener: Function): this;
  11724. once(event: 'destroyed', listener: Function): this;
  11725. addListener(event: 'destroyed', listener: Function): this;
  11726. removeListener(event: 'destroyed', listener: Function): this;
  11727. /**
  11728. * Emitted when DevTools is closed.
  11729. */
  11730. on(event: 'devtools-closed', listener: Function): this;
  11731. off(event: 'devtools-closed', listener: Function): this;
  11732. once(event: 'devtools-closed', listener: Function): this;
  11733. addListener(event: 'devtools-closed', listener: Function): this;
  11734. removeListener(event: 'devtools-closed', listener: Function): this;
  11735. /**
  11736. * Emitted when DevTools is focused / opened.
  11737. */
  11738. on(event: 'devtools-focused', listener: Function): this;
  11739. off(event: 'devtools-focused', listener: Function): this;
  11740. once(event: 'devtools-focused', listener: Function): this;
  11741. addListener(event: 'devtools-focused', listener: Function): this;
  11742. removeListener(event: 'devtools-focused', listener: Function): this;
  11743. /**
  11744. * Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for
  11745. * a link in its context menu.
  11746. */
  11747. on(event: 'devtools-open-url', listener: (event: Event,
  11748. /**
  11749. * URL of the link that was clicked or selected.
  11750. */
  11751. url: string) => void): this;
  11752. off(event: 'devtools-open-url', listener: (event: Event,
  11753. /**
  11754. * URL of the link that was clicked or selected.
  11755. */
  11756. url: string) => void): this;
  11757. once(event: 'devtools-open-url', listener: (event: Event,
  11758. /**
  11759. * URL of the link that was clicked or selected.
  11760. */
  11761. url: string) => void): this;
  11762. addListener(event: 'devtools-open-url', listener: (event: Event,
  11763. /**
  11764. * URL of the link that was clicked or selected.
  11765. */
  11766. url: string) => void): this;
  11767. removeListener(event: 'devtools-open-url', listener: (event: Event,
  11768. /**
  11769. * URL of the link that was clicked or selected.
  11770. */
  11771. url: string) => void): this;
  11772. /**
  11773. * Emitted when DevTools is opened.
  11774. */
  11775. on(event: 'devtools-opened', listener: Function): this;
  11776. off(event: 'devtools-opened', listener: Function): this;
  11777. once(event: 'devtools-opened', listener: Function): this;
  11778. addListener(event: 'devtools-opened', listener: Function): this;
  11779. removeListener(event: 'devtools-opened', listener: Function): this;
  11780. /**
  11781. * Emitted when the devtools window instructs the webContents to reload
  11782. */
  11783. on(event: 'devtools-reload-page', listener: Function): this;
  11784. off(event: 'devtools-reload-page', listener: Function): this;
  11785. once(event: 'devtools-reload-page', listener: Function): this;
  11786. addListener(event: 'devtools-reload-page', listener: Function): this;
  11787. removeListener(event: 'devtools-reload-page', listener: Function): this;
  11788. /**
  11789. * Emitted when a `<webview>` has been attached to this web contents.
  11790. */
  11791. on(event: 'did-attach-webview', listener: (event: Event,
  11792. /**
  11793. * The guest web contents that is used by the `<webview>`.
  11794. */
  11795. webContents: WebContents) => void): this;
  11796. off(event: 'did-attach-webview', listener: (event: Event,
  11797. /**
  11798. * The guest web contents that is used by the `<webview>`.
  11799. */
  11800. webContents: WebContents) => void): this;
  11801. once(event: 'did-attach-webview', listener: (event: Event,
  11802. /**
  11803. * The guest web contents that is used by the `<webview>`.
  11804. */
  11805. webContents: WebContents) => void): this;
  11806. addListener(event: 'did-attach-webview', listener: (event: Event,
  11807. /**
  11808. * The guest web contents that is used by the `<webview>`.
  11809. */
  11810. webContents: WebContents) => void): this;
  11811. removeListener(event: 'did-attach-webview', listener: (event: Event,
  11812. /**
  11813. * The guest web contents that is used by the `<webview>`.
  11814. */
  11815. webContents: WebContents) => void): this;
  11816. /**
  11817. * Emitted when a page's theme color changes. This is usually due to encountering a
  11818. * meta tag:
  11819. */
  11820. on(event: 'did-change-theme-color', listener: (event: Event,
  11821. /**
  11822. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  11823. */
  11824. color: (string) | (null)) => void): this;
  11825. off(event: 'did-change-theme-color', listener: (event: Event,
  11826. /**
  11827. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  11828. */
  11829. color: (string) | (null)) => void): this;
  11830. once(event: 'did-change-theme-color', listener: (event: Event,
  11831. /**
  11832. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  11833. */
  11834. color: (string) | (null)) => void): this;
  11835. addListener(event: 'did-change-theme-color', listener: (event: Event,
  11836. /**
  11837. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  11838. */
  11839. color: (string) | (null)) => void): this;
  11840. removeListener(event: 'did-change-theme-color', listener: (event: Event,
  11841. /**
  11842. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  11843. */
  11844. color: (string) | (null)) => void): this;
  11845. /**
  11846. * Emitted _after_ successful creation of a window via `window.open` in the
  11847. * renderer. Not emitted if the creation of the window is canceled from
  11848. * `webContents.setWindowOpenHandler`.
  11849. *
  11850. * See `window.open()` for more details and how to use this in conjunction with
  11851. * `webContents.setWindowOpenHandler`.
  11852. */
  11853. on(event: 'did-create-window', listener: (window: BrowserWindow,
  11854. details: DidCreateWindowDetails) => void): this;
  11855. off(event: 'did-create-window', listener: (window: BrowserWindow,
  11856. details: DidCreateWindowDetails) => void): this;
  11857. once(event: 'did-create-window', listener: (window: BrowserWindow,
  11858. details: DidCreateWindowDetails) => void): this;
  11859. addListener(event: 'did-create-window', listener: (window: BrowserWindow,
  11860. details: DidCreateWindowDetails) => void): this;
  11861. removeListener(event: 'did-create-window', listener: (window: BrowserWindow,
  11862. details: DidCreateWindowDetails) => void): this;
  11863. /**
  11864. * This event is like `did-finish-load` but emitted when the load failed. The full
  11865. * list of error codes and their meaning is available here.
  11866. */
  11867. on(event: 'did-fail-load', listener: (event: Event,
  11868. errorCode: number,
  11869. errorDescription: string,
  11870. validatedURL: string,
  11871. isMainFrame: boolean,
  11872. frameProcessId: number,
  11873. frameRoutingId: number) => void): this;
  11874. off(event: 'did-fail-load', listener: (event: Event,
  11875. errorCode: number,
  11876. errorDescription: string,
  11877. validatedURL: string,
  11878. isMainFrame: boolean,
  11879. frameProcessId: number,
  11880. frameRoutingId: number) => void): this;
  11881. once(event: 'did-fail-load', listener: (event: Event,
  11882. errorCode: number,
  11883. errorDescription: string,
  11884. validatedURL: string,
  11885. isMainFrame: boolean,
  11886. frameProcessId: number,
  11887. frameRoutingId: number) => void): this;
  11888. addListener(event: 'did-fail-load', listener: (event: Event,
  11889. errorCode: number,
  11890. errorDescription: string,
  11891. validatedURL: string,
  11892. isMainFrame: boolean,
  11893. frameProcessId: number,
  11894. frameRoutingId: number) => void): this;
  11895. removeListener(event: 'did-fail-load', listener: (event: Event,
  11896. errorCode: number,
  11897. errorDescription: string,
  11898. validatedURL: string,
  11899. isMainFrame: boolean,
  11900. frameProcessId: number,
  11901. frameRoutingId: number) => void): this;
  11902. /**
  11903. * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
  11904. * `window.stop()` was invoked).
  11905. */
  11906. on(event: 'did-fail-provisional-load', listener: (event: Event,
  11907. errorCode: number,
  11908. errorDescription: string,
  11909. validatedURL: string,
  11910. isMainFrame: boolean,
  11911. frameProcessId: number,
  11912. frameRoutingId: number) => void): this;
  11913. off(event: 'did-fail-provisional-load', listener: (event: Event,
  11914. errorCode: number,
  11915. errorDescription: string,
  11916. validatedURL: string,
  11917. isMainFrame: boolean,
  11918. frameProcessId: number,
  11919. frameRoutingId: number) => void): this;
  11920. once(event: 'did-fail-provisional-load', listener: (event: Event,
  11921. errorCode: number,
  11922. errorDescription: string,
  11923. validatedURL: string,
  11924. isMainFrame: boolean,
  11925. frameProcessId: number,
  11926. frameRoutingId: number) => void): this;
  11927. addListener(event: 'did-fail-provisional-load', listener: (event: Event,
  11928. errorCode: number,
  11929. errorDescription: string,
  11930. validatedURL: string,
  11931. isMainFrame: boolean,
  11932. frameProcessId: number,
  11933. frameRoutingId: number) => void): this;
  11934. removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
  11935. errorCode: number,
  11936. errorDescription: string,
  11937. validatedURL: string,
  11938. isMainFrame: boolean,
  11939. frameProcessId: number,
  11940. frameRoutingId: number) => void): this;
  11941. /**
  11942. * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
  11943. * spinning, and the `onload` event was dispatched.
  11944. */
  11945. on(event: 'did-finish-load', listener: Function): this;
  11946. off(event: 'did-finish-load', listener: Function): this;
  11947. once(event: 'did-finish-load', listener: Function): this;
  11948. addListener(event: 'did-finish-load', listener: Function): this;
  11949. removeListener(event: 'did-finish-load', listener: Function): this;
  11950. /**
  11951. * Emitted when a frame has done navigation.
  11952. */
  11953. on(event: 'did-frame-finish-load', listener: (event: Event,
  11954. isMainFrame: boolean,
  11955. frameProcessId: number,
  11956. frameRoutingId: number) => void): this;
  11957. off(event: 'did-frame-finish-load', listener: (event: Event,
  11958. isMainFrame: boolean,
  11959. frameProcessId: number,
  11960. frameRoutingId: number) => void): this;
  11961. once(event: 'did-frame-finish-load', listener: (event: Event,
  11962. isMainFrame: boolean,
  11963. frameProcessId: number,
  11964. frameRoutingId: number) => void): this;
  11965. addListener(event: 'did-frame-finish-load', listener: (event: Event,
  11966. isMainFrame: boolean,
  11967. frameProcessId: number,
  11968. frameRoutingId: number) => void): this;
  11969. removeListener(event: 'did-frame-finish-load', listener: (event: Event,
  11970. isMainFrame: boolean,
  11971. frameProcessId: number,
  11972. frameRoutingId: number) => void): this;
  11973. /**
  11974. * Emitted when any frame navigation is done.
  11975. *
  11976. * This event is not emitted for in-page navigations, such as clicking anchor links
  11977. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  11978. * this purpose.
  11979. */
  11980. on(event: 'did-frame-navigate', listener: (event: Event,
  11981. url: string,
  11982. /**
  11983. * -1 for non HTTP navigations
  11984. */
  11985. httpResponseCode: number,
  11986. /**
  11987. * empty for non HTTP navigations,
  11988. */
  11989. httpStatusText: string,
  11990. isMainFrame: boolean,
  11991. frameProcessId: number,
  11992. frameRoutingId: number) => void): this;
  11993. off(event: 'did-frame-navigate', listener: (event: Event,
  11994. url: string,
  11995. /**
  11996. * -1 for non HTTP navigations
  11997. */
  11998. httpResponseCode: number,
  11999. /**
  12000. * empty for non HTTP navigations,
  12001. */
  12002. httpStatusText: string,
  12003. isMainFrame: boolean,
  12004. frameProcessId: number,
  12005. frameRoutingId: number) => void): this;
  12006. once(event: 'did-frame-navigate', listener: (event: Event,
  12007. url: string,
  12008. /**
  12009. * -1 for non HTTP navigations
  12010. */
  12011. httpResponseCode: number,
  12012. /**
  12013. * empty for non HTTP navigations,
  12014. */
  12015. httpStatusText: string,
  12016. isMainFrame: boolean,
  12017. frameProcessId: number,
  12018. frameRoutingId: number) => void): this;
  12019. addListener(event: 'did-frame-navigate', listener: (event: Event,
  12020. url: string,
  12021. /**
  12022. * -1 for non HTTP navigations
  12023. */
  12024. httpResponseCode: number,
  12025. /**
  12026. * empty for non HTTP navigations,
  12027. */
  12028. httpStatusText: string,
  12029. isMainFrame: boolean,
  12030. frameProcessId: number,
  12031. frameRoutingId: number) => void): this;
  12032. removeListener(event: 'did-frame-navigate', listener: (event: Event,
  12033. url: string,
  12034. /**
  12035. * -1 for non HTTP navigations
  12036. */
  12037. httpResponseCode: number,
  12038. /**
  12039. * empty for non HTTP navigations,
  12040. */
  12041. httpStatusText: string,
  12042. isMainFrame: boolean,
  12043. frameProcessId: number,
  12044. frameRoutingId: number) => void): this;
  12045. /**
  12046. * Emitted when a main frame navigation is done.
  12047. *
  12048. * This event is not emitted for in-page navigations, such as clicking anchor links
  12049. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  12050. * this purpose.
  12051. */
  12052. on(event: 'did-navigate', listener: (event: Event,
  12053. url: string,
  12054. /**
  12055. * -1 for non HTTP navigations
  12056. */
  12057. httpResponseCode: number,
  12058. /**
  12059. * empty for non HTTP navigations
  12060. */
  12061. httpStatusText: string) => void): this;
  12062. off(event: 'did-navigate', listener: (event: Event,
  12063. url: string,
  12064. /**
  12065. * -1 for non HTTP navigations
  12066. */
  12067. httpResponseCode: number,
  12068. /**
  12069. * empty for non HTTP navigations
  12070. */
  12071. httpStatusText: string) => void): this;
  12072. once(event: 'did-navigate', listener: (event: Event,
  12073. url: string,
  12074. /**
  12075. * -1 for non HTTP navigations
  12076. */
  12077. httpResponseCode: number,
  12078. /**
  12079. * empty for non HTTP navigations
  12080. */
  12081. httpStatusText: string) => void): this;
  12082. addListener(event: 'did-navigate', listener: (event: Event,
  12083. url: string,
  12084. /**
  12085. * -1 for non HTTP navigations
  12086. */
  12087. httpResponseCode: number,
  12088. /**
  12089. * empty for non HTTP navigations
  12090. */
  12091. httpStatusText: string) => void): this;
  12092. removeListener(event: 'did-navigate', listener: (event: Event,
  12093. url: string,
  12094. /**
  12095. * -1 for non HTTP navigations
  12096. */
  12097. httpResponseCode: number,
  12098. /**
  12099. * empty for non HTTP navigations
  12100. */
  12101. httpStatusText: string) => void): this;
  12102. /**
  12103. * Emitted when an in-page navigation happened in any frame.
  12104. *
  12105. * When in-page navigation happens, the page URL changes but does not cause
  12106. * navigation outside of the page. Examples of this occurring are when anchor links
  12107. * are clicked or when the DOM `hashchange` event is triggered.
  12108. */
  12109. on(event: 'did-navigate-in-page', listener: (event: Event,
  12110. url: string,
  12111. isMainFrame: boolean,
  12112. frameProcessId: number,
  12113. frameRoutingId: number) => void): this;
  12114. off(event: 'did-navigate-in-page', listener: (event: Event,
  12115. url: string,
  12116. isMainFrame: boolean,
  12117. frameProcessId: number,
  12118. frameRoutingId: number) => void): this;
  12119. once(event: 'did-navigate-in-page', listener: (event: Event,
  12120. url: string,
  12121. isMainFrame: boolean,
  12122. frameProcessId: number,
  12123. frameRoutingId: number) => void): this;
  12124. addListener(event: 'did-navigate-in-page', listener: (event: Event,
  12125. url: string,
  12126. isMainFrame: boolean,
  12127. frameProcessId: number,
  12128. frameRoutingId: number) => void): this;
  12129. removeListener(event: 'did-navigate-in-page', listener: (event: Event,
  12130. url: string,
  12131. isMainFrame: boolean,
  12132. frameProcessId: number,
  12133. frameRoutingId: number) => void): this;
  12134. /**
  12135. * Emitted after a server side redirect occurs during navigation. For example a
  12136. * 302 redirect.
  12137. *
  12138. * This event cannot be prevented, if you want to prevent redirects you should
  12139. * checkout out the `will-redirect` event above.
  12140. */
  12141. on(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  12142. /**
  12143. * @deprecated
  12144. */
  12145. url: string,
  12146. /**
  12147. * @deprecated
  12148. */
  12149. isInPlace: boolean,
  12150. /**
  12151. * @deprecated
  12152. */
  12153. isMainFrame: boolean,
  12154. /**
  12155. * @deprecated
  12156. */
  12157. frameProcessId: number,
  12158. /**
  12159. * @deprecated
  12160. */
  12161. frameRoutingId: number) => void): this;
  12162. off(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  12163. /**
  12164. * @deprecated
  12165. */
  12166. url: string,
  12167. /**
  12168. * @deprecated
  12169. */
  12170. isInPlace: boolean,
  12171. /**
  12172. * @deprecated
  12173. */
  12174. isMainFrame: boolean,
  12175. /**
  12176. * @deprecated
  12177. */
  12178. frameProcessId: number,
  12179. /**
  12180. * @deprecated
  12181. */
  12182. frameRoutingId: number) => void): this;
  12183. once(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  12184. /**
  12185. * @deprecated
  12186. */
  12187. url: string,
  12188. /**
  12189. * @deprecated
  12190. */
  12191. isInPlace: boolean,
  12192. /**
  12193. * @deprecated
  12194. */
  12195. isMainFrame: boolean,
  12196. /**
  12197. * @deprecated
  12198. */
  12199. frameProcessId: number,
  12200. /**
  12201. * @deprecated
  12202. */
  12203. frameRoutingId: number) => void): this;
  12204. addListener(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  12205. /**
  12206. * @deprecated
  12207. */
  12208. url: string,
  12209. /**
  12210. * @deprecated
  12211. */
  12212. isInPlace: boolean,
  12213. /**
  12214. * @deprecated
  12215. */
  12216. isMainFrame: boolean,
  12217. /**
  12218. * @deprecated
  12219. */
  12220. frameProcessId: number,
  12221. /**
  12222. * @deprecated
  12223. */
  12224. frameRoutingId: number) => void): this;
  12225. removeListener(event: 'did-redirect-navigation', listener: (details: Event<WebContentsDidRedirectNavigationEventParams>,
  12226. /**
  12227. * @deprecated
  12228. */
  12229. url: string,
  12230. /**
  12231. * @deprecated
  12232. */
  12233. isInPlace: boolean,
  12234. /**
  12235. * @deprecated
  12236. */
  12237. isMainFrame: boolean,
  12238. /**
  12239. * @deprecated
  12240. */
  12241. frameProcessId: number,
  12242. /**
  12243. * @deprecated
  12244. */
  12245. frameRoutingId: number) => void): this;
  12246. /**
  12247. * Corresponds to the points in time when the spinner of the tab started spinning.
  12248. */
  12249. on(event: 'did-start-loading', listener: Function): this;
  12250. off(event: 'did-start-loading', listener: Function): this;
  12251. once(event: 'did-start-loading', listener: Function): this;
  12252. addListener(event: 'did-start-loading', listener: Function): this;
  12253. removeListener(event: 'did-start-loading', listener: Function): this;
  12254. /**
  12255. * Emitted when any frame (including main) starts navigating.
  12256. */
  12257. on(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  12258. /**
  12259. * @deprecated
  12260. */
  12261. url: string,
  12262. /**
  12263. * @deprecated
  12264. */
  12265. isInPlace: boolean,
  12266. /**
  12267. * @deprecated
  12268. */
  12269. isMainFrame: boolean,
  12270. /**
  12271. * @deprecated
  12272. */
  12273. frameProcessId: number,
  12274. /**
  12275. * @deprecated
  12276. */
  12277. frameRoutingId: number) => void): this;
  12278. off(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  12279. /**
  12280. * @deprecated
  12281. */
  12282. url: string,
  12283. /**
  12284. * @deprecated
  12285. */
  12286. isInPlace: boolean,
  12287. /**
  12288. * @deprecated
  12289. */
  12290. isMainFrame: boolean,
  12291. /**
  12292. * @deprecated
  12293. */
  12294. frameProcessId: number,
  12295. /**
  12296. * @deprecated
  12297. */
  12298. frameRoutingId: number) => void): this;
  12299. once(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  12300. /**
  12301. * @deprecated
  12302. */
  12303. url: string,
  12304. /**
  12305. * @deprecated
  12306. */
  12307. isInPlace: boolean,
  12308. /**
  12309. * @deprecated
  12310. */
  12311. isMainFrame: boolean,
  12312. /**
  12313. * @deprecated
  12314. */
  12315. frameProcessId: number,
  12316. /**
  12317. * @deprecated
  12318. */
  12319. frameRoutingId: number) => void): this;
  12320. addListener(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  12321. /**
  12322. * @deprecated
  12323. */
  12324. url: string,
  12325. /**
  12326. * @deprecated
  12327. */
  12328. isInPlace: boolean,
  12329. /**
  12330. * @deprecated
  12331. */
  12332. isMainFrame: boolean,
  12333. /**
  12334. * @deprecated
  12335. */
  12336. frameProcessId: number,
  12337. /**
  12338. * @deprecated
  12339. */
  12340. frameRoutingId: number) => void): this;
  12341. removeListener(event: 'did-start-navigation', listener: (details: Event<WebContentsDidStartNavigationEventParams>,
  12342. /**
  12343. * @deprecated
  12344. */
  12345. url: string,
  12346. /**
  12347. * @deprecated
  12348. */
  12349. isInPlace: boolean,
  12350. /**
  12351. * @deprecated
  12352. */
  12353. isMainFrame: boolean,
  12354. /**
  12355. * @deprecated
  12356. */
  12357. frameProcessId: number,
  12358. /**
  12359. * @deprecated
  12360. */
  12361. frameRoutingId: number) => void): this;
  12362. /**
  12363. * Corresponds to the points in time when the spinner of the tab stopped spinning.
  12364. */
  12365. on(event: 'did-stop-loading', listener: Function): this;
  12366. off(event: 'did-stop-loading', listener: Function): this;
  12367. once(event: 'did-stop-loading', listener: Function): this;
  12368. addListener(event: 'did-stop-loading', listener: Function): this;
  12369. removeListener(event: 'did-stop-loading', listener: Function): this;
  12370. /**
  12371. * Emitted when the document in the top-level frame is loaded.
  12372. */
  12373. on(event: 'dom-ready', listener: Function): this;
  12374. off(event: 'dom-ready', listener: Function): this;
  12375. once(event: 'dom-ready', listener: Function): this;
  12376. addListener(event: 'dom-ready', listener: Function): this;
  12377. removeListener(event: 'dom-ready', listener: Function): this;
  12378. /**
  12379. * Emitted when the window enters a full-screen state triggered by HTML API.
  12380. */
  12381. on(event: 'enter-html-full-screen', listener: Function): this;
  12382. off(event: 'enter-html-full-screen', listener: Function): this;
  12383. once(event: 'enter-html-full-screen', listener: Function): this;
  12384. addListener(event: 'enter-html-full-screen', listener: Function): this;
  12385. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  12386. /**
  12387. * Emitted when the `WebContents` gains focus.
  12388. *
  12389. * Note that on macOS, having focus means the `WebContents` is the first responder
  12390. * of window, so switching focus between windows would not trigger the `focus` and
  12391. * `blur` events of `WebContents`, as the first responder of each window is not
  12392. * changed.
  12393. *
  12394. * The `focus` and `blur` events of `WebContents` should only be used to detect
  12395. * focus change between different `WebContents` and `BrowserView` in the same
  12396. * window.
  12397. */
  12398. on(event: 'focus', listener: Function): this;
  12399. off(event: 'focus', listener: Function): this;
  12400. once(event: 'focus', listener: Function): this;
  12401. addListener(event: 'focus', listener: Function): this;
  12402. removeListener(event: 'focus', listener: Function): this;
  12403. /**
  12404. * Emitted when a result is available for `webContents.findInPage` request.
  12405. */
  12406. on(event: 'found-in-page', listener: (event: Event,
  12407. result: Result) => void): this;
  12408. off(event: 'found-in-page', listener: (event: Event,
  12409. result: Result) => void): this;
  12410. once(event: 'found-in-page', listener: (event: Event,
  12411. result: Result) => void): this;
  12412. addListener(event: 'found-in-page', listener: (event: Event,
  12413. result: Result) => void): this;
  12414. removeListener(event: 'found-in-page', listener: (event: Event,
  12415. result: Result) => void): this;
  12416. /**
  12417. * Emitted when the mainFrame, an `<iframe>`, or a nested `<iframe>` is loaded
  12418. * within the page.
  12419. */
  12420. on(event: 'frame-created', listener: (event: Event,
  12421. details: FrameCreatedDetails) => void): this;
  12422. off(event: 'frame-created', listener: (event: Event,
  12423. details: FrameCreatedDetails) => void): this;
  12424. once(event: 'frame-created', listener: (event: Event,
  12425. details: FrameCreatedDetails) => void): this;
  12426. addListener(event: 'frame-created', listener: (event: Event,
  12427. details: FrameCreatedDetails) => void): this;
  12428. removeListener(event: 'frame-created', listener: (event: Event,
  12429. details: FrameCreatedDetails) => void): this;
  12430. /**
  12431. * Emitted when an input event is sent to the WebContents. See InputEvent for
  12432. * details.
  12433. */
  12434. on(event: 'input-event', listener: (event: Event,
  12435. inputEvent: InputEvent) => void): this;
  12436. off(event: 'input-event', listener: (event: Event,
  12437. inputEvent: InputEvent) => void): this;
  12438. once(event: 'input-event', listener: (event: Event,
  12439. inputEvent: InputEvent) => void): this;
  12440. addListener(event: 'input-event', listener: (event: Event,
  12441. inputEvent: InputEvent) => void): this;
  12442. removeListener(event: 'input-event', listener: (event: Event,
  12443. inputEvent: InputEvent) => void): this;
  12444. /**
  12445. * Emitted when the renderer process sends an asynchronous message via
  12446. * `ipcRenderer.send()`.
  12447. *
  12448. * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
  12449. * responding to IPC messages specifically from this WebContents.
  12450. */
  12451. on(event: 'ipc-message', listener: (event: IpcMainEvent,
  12452. channel: string,
  12453. ...args: any[]) => void): this;
  12454. off(event: 'ipc-message', listener: (event: IpcMainEvent,
  12455. channel: string,
  12456. ...args: any[]) => void): this;
  12457. once(event: 'ipc-message', listener: (event: IpcMainEvent,
  12458. channel: string,
  12459. ...args: any[]) => void): this;
  12460. addListener(event: 'ipc-message', listener: (event: IpcMainEvent,
  12461. channel: string,
  12462. ...args: any[]) => void): this;
  12463. removeListener(event: 'ipc-message', listener: (event: IpcMainEvent,
  12464. channel: string,
  12465. ...args: any[]) => void): this;
  12466. /**
  12467. * Emitted when the renderer process sends a synchronous message via
  12468. * `ipcRenderer.sendSync()`.
  12469. *
  12470. * See also `webContents.ipc`, which provides an `IpcMain`-like interface for
  12471. * responding to IPC messages specifically from this WebContents.
  12472. */
  12473. on(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  12474. channel: string,
  12475. ...args: any[]) => void): this;
  12476. off(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  12477. channel: string,
  12478. ...args: any[]) => void): this;
  12479. once(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  12480. channel: string,
  12481. ...args: any[]) => void): this;
  12482. addListener(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  12483. channel: string,
  12484. ...args: any[]) => void): this;
  12485. removeListener(event: 'ipc-message-sync', listener: (event: IpcMainEvent,
  12486. channel: string,
  12487. ...args: any[]) => void): this;
  12488. /**
  12489. * Emitted when the window leaves a full-screen state triggered by HTML API.
  12490. */
  12491. on(event: 'leave-html-full-screen', listener: Function): this;
  12492. off(event: 'leave-html-full-screen', listener: Function): this;
  12493. once(event: 'leave-html-full-screen', listener: Function): this;
  12494. addListener(event: 'leave-html-full-screen', listener: Function): this;
  12495. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  12496. /**
  12497. * Emitted when `webContents` wants to do basic auth.
  12498. *
  12499. * The usage is the same with the `login` event of `app`.
  12500. */
  12501. on(event: 'login', listener: (event: Event,
  12502. authenticationResponseDetails: AuthenticationResponseDetails,
  12503. authInfo: AuthInfo,
  12504. callback: (username?: string, password?: string) => void) => void): this;
  12505. off(event: 'login', listener: (event: Event,
  12506. authenticationResponseDetails: AuthenticationResponseDetails,
  12507. authInfo: AuthInfo,
  12508. callback: (username?: string, password?: string) => void) => void): this;
  12509. once(event: 'login', listener: (event: Event,
  12510. authenticationResponseDetails: AuthenticationResponseDetails,
  12511. authInfo: AuthInfo,
  12512. callback: (username?: string, password?: string) => void) => void): this;
  12513. addListener(event: 'login', listener: (event: Event,
  12514. authenticationResponseDetails: AuthenticationResponseDetails,
  12515. authInfo: AuthInfo,
  12516. callback: (username?: string, password?: string) => void) => void): this;
  12517. removeListener(event: 'login', listener: (event: Event,
  12518. authenticationResponseDetails: AuthenticationResponseDetails,
  12519. authInfo: AuthInfo,
  12520. callback: (username?: string, password?: string) => void) => void): this;
  12521. /**
  12522. * Emitted when media is paused or done playing.
  12523. */
  12524. on(event: 'media-paused', listener: Function): this;
  12525. off(event: 'media-paused', listener: Function): this;
  12526. once(event: 'media-paused', listener: Function): this;
  12527. addListener(event: 'media-paused', listener: Function): this;
  12528. removeListener(event: 'media-paused', listener: Function): this;
  12529. /**
  12530. * Emitted when media starts playing.
  12531. */
  12532. on(event: 'media-started-playing', listener: Function): this;
  12533. off(event: 'media-started-playing', listener: Function): this;
  12534. once(event: 'media-started-playing', listener: Function): this;
  12535. addListener(event: 'media-started-playing', listener: Function): this;
  12536. removeListener(event: 'media-started-playing', listener: Function): this;
  12537. /**
  12538. * Emitted when page receives favicon urls.
  12539. */
  12540. on(event: 'page-favicon-updated', listener: (event: Event,
  12541. /**
  12542. * Array of URLs.
  12543. */
  12544. favicons: string[]) => void): this;
  12545. off(event: 'page-favicon-updated', listener: (event: Event,
  12546. /**
  12547. * Array of URLs.
  12548. */
  12549. favicons: string[]) => void): this;
  12550. once(event: 'page-favicon-updated', listener: (event: Event,
  12551. /**
  12552. * Array of URLs.
  12553. */
  12554. favicons: string[]) => void): this;
  12555. addListener(event: 'page-favicon-updated', listener: (event: Event,
  12556. /**
  12557. * Array of URLs.
  12558. */
  12559. favicons: string[]) => void): this;
  12560. removeListener(event: 'page-favicon-updated', listener: (event: Event,
  12561. /**
  12562. * Array of URLs.
  12563. */
  12564. favicons: string[]) => void): this;
  12565. /**
  12566. * Fired when page title is set during navigation. `explicitSet` is false when
  12567. * title is synthesized from file url.
  12568. */
  12569. on(event: 'page-title-updated', listener: (event: Event,
  12570. title: string,
  12571. explicitSet: boolean) => void): this;
  12572. off(event: 'page-title-updated', listener: (event: Event,
  12573. title: string,
  12574. explicitSet: boolean) => void): this;
  12575. once(event: 'page-title-updated', listener: (event: Event,
  12576. title: string,
  12577. explicitSet: boolean) => void): this;
  12578. addListener(event: 'page-title-updated', listener: (event: Event,
  12579. title: string,
  12580. explicitSet: boolean) => void): this;
  12581. removeListener(event: 'page-title-updated', listener: (event: Event,
  12582. title: string,
  12583. explicitSet: boolean) => void): this;
  12584. /**
  12585. * Emitted when a new frame is generated. Only the dirty area is passed in the
  12586. * buffer.
  12587. */
  12588. on(event: 'paint', listener: (event: Event,
  12589. dirtyRect: Rectangle,
  12590. /**
  12591. * The image data of the whole frame.
  12592. */
  12593. image: NativeImage) => void): this;
  12594. off(event: 'paint', listener: (event: Event,
  12595. dirtyRect: Rectangle,
  12596. /**
  12597. * The image data of the whole frame.
  12598. */
  12599. image: NativeImage) => void): this;
  12600. once(event: 'paint', listener: (event: Event,
  12601. dirtyRect: Rectangle,
  12602. /**
  12603. * The image data of the whole frame.
  12604. */
  12605. image: NativeImage) => void): this;
  12606. addListener(event: 'paint', listener: (event: Event,
  12607. dirtyRect: Rectangle,
  12608. /**
  12609. * The image data of the whole frame.
  12610. */
  12611. image: NativeImage) => void): this;
  12612. removeListener(event: 'paint', listener: (event: Event,
  12613. dirtyRect: Rectangle,
  12614. /**
  12615. * The image data of the whole frame.
  12616. */
  12617. image: NativeImage) => void): this;
  12618. /**
  12619. * Emitted when a plugin process has crashed.
  12620. */
  12621. on(event: 'plugin-crashed', listener: (event: Event,
  12622. name: string,
  12623. version: string) => void): this;
  12624. off(event: 'plugin-crashed', listener: (event: Event,
  12625. name: string,
  12626. version: string) => void): this;
  12627. once(event: 'plugin-crashed', listener: (event: Event,
  12628. name: string,
  12629. version: string) => void): this;
  12630. addListener(event: 'plugin-crashed', listener: (event: Event,
  12631. name: string,
  12632. version: string) => void): this;
  12633. removeListener(event: 'plugin-crashed', listener: (event: Event,
  12634. name: string,
  12635. version: string) => void): this;
  12636. /**
  12637. * Emitted when the `WebContents` preferred size has changed.
  12638. *
  12639. * This event will only be emitted when `enablePreferredSizeMode` is set to `true`
  12640. * in `webPreferences`.
  12641. */
  12642. on(event: 'preferred-size-changed', listener: (event: Event,
  12643. /**
  12644. * The minimum size needed to contain the layout of the document—without requiring
  12645. * scrolling.
  12646. */
  12647. preferredSize: Size) => void): this;
  12648. off(event: 'preferred-size-changed', listener: (event: Event,
  12649. /**
  12650. * The minimum size needed to contain the layout of the document—without requiring
  12651. * scrolling.
  12652. */
  12653. preferredSize: Size) => void): this;
  12654. once(event: 'preferred-size-changed', listener: (event: Event,
  12655. /**
  12656. * The minimum size needed to contain the layout of the document—without requiring
  12657. * scrolling.
  12658. */
  12659. preferredSize: Size) => void): this;
  12660. addListener(event: 'preferred-size-changed', listener: (event: Event,
  12661. /**
  12662. * The minimum size needed to contain the layout of the document—without requiring
  12663. * scrolling.
  12664. */
  12665. preferredSize: Size) => void): this;
  12666. removeListener(event: 'preferred-size-changed', listener: (event: Event,
  12667. /**
  12668. * The minimum size needed to contain the layout of the document—without requiring
  12669. * scrolling.
  12670. */
  12671. preferredSize: Size) => void): this;
  12672. /**
  12673. * Emitted when the preload script `preloadPath` throws an unhandled exception
  12674. * `error`.
  12675. */
  12676. on(event: 'preload-error', listener: (event: Event,
  12677. preloadPath: string,
  12678. error: Error) => void): this;
  12679. off(event: 'preload-error', listener: (event: Event,
  12680. preloadPath: string,
  12681. error: Error) => void): this;
  12682. once(event: 'preload-error', listener: (event: Event,
  12683. preloadPath: string,
  12684. error: Error) => void): this;
  12685. addListener(event: 'preload-error', listener: (event: Event,
  12686. preloadPath: string,
  12687. error: Error) => void): this;
  12688. removeListener(event: 'preload-error', listener: (event: Event,
  12689. preloadPath: string,
  12690. error: Error) => void): this;
  12691. /**
  12692. * Emitted when the renderer process unexpectedly disappears. This is normally
  12693. * because it was crashed or killed.
  12694. */
  12695. on(event: 'render-process-gone', listener: (event: Event,
  12696. details: RenderProcessGoneDetails) => void): this;
  12697. off(event: 'render-process-gone', listener: (event: Event,
  12698. details: RenderProcessGoneDetails) => void): this;
  12699. once(event: 'render-process-gone', listener: (event: Event,
  12700. details: RenderProcessGoneDetails) => void): this;
  12701. addListener(event: 'render-process-gone', listener: (event: Event,
  12702. details: RenderProcessGoneDetails) => void): this;
  12703. removeListener(event: 'render-process-gone', listener: (event: Event,
  12704. details: RenderProcessGoneDetails) => void): this;
  12705. /**
  12706. * Emitted when the unresponsive web page becomes responsive again.
  12707. */
  12708. on(event: 'responsive', listener: Function): this;
  12709. off(event: 'responsive', listener: Function): this;
  12710. once(event: 'responsive', listener: Function): this;
  12711. addListener(event: 'responsive', listener: Function): this;
  12712. removeListener(event: 'responsive', listener: Function): this;
  12713. /**
  12714. * Emitted when a bluetooth device needs to be selected when a call to
  12715. * `navigator.bluetooth.requestDevice` is made. `callback` should be called with
  12716. * the `deviceId` of the device to be selected. Passing an empty string to
  12717. * `callback` will cancel the request.
  12718. *
  12719. * If an event listener is not added for this event, or if `event.preventDefault`
  12720. * is not called when handling this event, the first available device will be
  12721. * automatically selected.
  12722. *
  12723. * Due to the nature of bluetooth, scanning for devices when
  12724. * `navigator.bluetooth.requestDevice` is called may take time and will cause
  12725. * `select-bluetooth-device` to fire multiple times until `callback` is called with
  12726. * either a device id or an empty string to cancel the request.
  12727. */
  12728. on(event: 'select-bluetooth-device', listener: (event: Event,
  12729. devices: BluetoothDevice[],
  12730. callback: (deviceId: string) => void) => void): this;
  12731. off(event: 'select-bluetooth-device', listener: (event: Event,
  12732. devices: BluetoothDevice[],
  12733. callback: (deviceId: string) => void) => void): this;
  12734. once(event: 'select-bluetooth-device', listener: (event: Event,
  12735. devices: BluetoothDevice[],
  12736. callback: (deviceId: string) => void) => void): this;
  12737. addListener(event: 'select-bluetooth-device', listener: (event: Event,
  12738. devices: BluetoothDevice[],
  12739. callback: (deviceId: string) => void) => void): this;
  12740. removeListener(event: 'select-bluetooth-device', listener: (event: Event,
  12741. devices: BluetoothDevice[],
  12742. callback: (deviceId: string) => void) => void): this;
  12743. /**
  12744. * Emitted when a client certificate is requested.
  12745. *
  12746. * The usage is the same with the `select-client-certificate` event of `app`.
  12747. */
  12748. on(event: 'select-client-certificate', listener: (event: Event,
  12749. url: string,
  12750. certificateList: Certificate[],
  12751. callback: (certificate: Certificate) => void) => void): this;
  12752. off(event: 'select-client-certificate', listener: (event: Event,
  12753. url: string,
  12754. certificateList: Certificate[],
  12755. callback: (certificate: Certificate) => void) => void): this;
  12756. once(event: 'select-client-certificate', listener: (event: Event,
  12757. url: string,
  12758. certificateList: Certificate[],
  12759. callback: (certificate: Certificate) => void) => void): this;
  12760. addListener(event: 'select-client-certificate', listener: (event: Event,
  12761. url: string,
  12762. certificateList: Certificate[],
  12763. callback: (certificate: Certificate) => void) => void): this;
  12764. removeListener(event: 'select-client-certificate', listener: (event: Event,
  12765. url: string,
  12766. certificateList: Certificate[],
  12767. callback: (certificate: Certificate) => void) => void): this;
  12768. /**
  12769. * Emitted when the web page becomes unresponsive.
  12770. */
  12771. on(event: 'unresponsive', listener: Function): this;
  12772. off(event: 'unresponsive', listener: Function): this;
  12773. once(event: 'unresponsive', listener: Function): this;
  12774. addListener(event: 'unresponsive', listener: Function): this;
  12775. removeListener(event: 'unresponsive', listener: Function): this;
  12776. /**
  12777. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  12778. */
  12779. on(event: 'update-target-url', listener: (event: Event,
  12780. url: string) => void): this;
  12781. off(event: 'update-target-url', listener: (event: Event,
  12782. url: string) => void): this;
  12783. once(event: 'update-target-url', listener: (event: Event,
  12784. url: string) => void): this;
  12785. addListener(event: 'update-target-url', listener: (event: Event,
  12786. url: string) => void): this;
  12787. removeListener(event: 'update-target-url', listener: (event: Event,
  12788. url: string) => void): this;
  12789. /**
  12790. * Emitted when a `<webview>`'s web contents is being attached to this web
  12791. * contents. Calling `event.preventDefault()` will destroy the guest page.
  12792. *
  12793. * This event can be used to configure `webPreferences` for the `webContents` of a
  12794. * `<webview>` before it's loaded, and provides the ability to set settings that
  12795. * can't be set via `<webview>` attributes.
  12796. */
  12797. on(event: 'will-attach-webview', listener: (event: Event,
  12798. /**
  12799. * The web preferences that will be used by the guest page. This object can be
  12800. * modified to adjust the preferences for the guest page.
  12801. */
  12802. webPreferences: WebPreferences,
  12803. /**
  12804. * The other `<webview>` parameters such as the `src` URL. This object can be
  12805. * modified to adjust the parameters of the guest page.
  12806. */
  12807. params: Record<string, string>) => void): this;
  12808. off(event: 'will-attach-webview', listener: (event: Event,
  12809. /**
  12810. * The web preferences that will be used by the guest page. This object can be
  12811. * modified to adjust the preferences for the guest page.
  12812. */
  12813. webPreferences: WebPreferences,
  12814. /**
  12815. * The other `<webview>` parameters such as the `src` URL. This object can be
  12816. * modified to adjust the parameters of the guest page.
  12817. */
  12818. params: Record<string, string>) => void): this;
  12819. once(event: 'will-attach-webview', listener: (event: Event,
  12820. /**
  12821. * The web preferences that will be used by the guest page. This object can be
  12822. * modified to adjust the preferences for the guest page.
  12823. */
  12824. webPreferences: WebPreferences,
  12825. /**
  12826. * The other `<webview>` parameters such as the `src` URL. This object can be
  12827. * modified to adjust the parameters of the guest page.
  12828. */
  12829. params: Record<string, string>) => void): this;
  12830. addListener(event: 'will-attach-webview', listener: (event: Event,
  12831. /**
  12832. * The web preferences that will be used by the guest page. This object can be
  12833. * modified to adjust the preferences for the guest page.
  12834. */
  12835. webPreferences: WebPreferences,
  12836. /**
  12837. * The other `<webview>` parameters such as the `src` URL. This object can be
  12838. * modified to adjust the parameters of the guest page.
  12839. */
  12840. params: Record<string, string>) => void): this;
  12841. removeListener(event: 'will-attach-webview', listener: (event: Event,
  12842. /**
  12843. * The web preferences that will be used by the guest page. This object can be
  12844. * modified to adjust the preferences for the guest page.
  12845. */
  12846. webPreferences: WebPreferences,
  12847. /**
  12848. * The other `<webview>` parameters such as the `src` URL. This object can be
  12849. * modified to adjust the parameters of the guest page.
  12850. */
  12851. params: Record<string, string>) => void): this;
  12852. /**
  12853. * Emitted when a user or the page wants to start navigation in any frame. It can
  12854. * happen when the `window.location` object is changed or a user clicks a link in
  12855. * the page.
  12856. *
  12857. * Unlike `will-navigate`, `will-frame-navigate` is fired when the main frame or
  12858. * any of its subframes attempts to navigate. When the navigation event comes from
  12859. * the main frame, `isMainFrame` will be `true`.
  12860. *
  12861. * This event will not emit when the navigation is started programmatically with
  12862. * APIs like `webContents.loadURL` and `webContents.back`.
  12863. *
  12864. * It is also not emitted for in-page navigations, such as clicking anchor links or
  12865. * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
  12866. * purpose.
  12867. *
  12868. * Calling `event.preventDefault()` will prevent the navigation.
  12869. */
  12870. on(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  12871. off(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  12872. once(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  12873. addListener(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  12874. removeListener(event: 'will-frame-navigate', listener: (details: Event<WebContentsWillFrameNavigateEventParams>) => void): this;
  12875. /**
  12876. * Emitted when a user or the page wants to start navigation on the main frame. It
  12877. * can happen when the `window.location` object is changed or a user clicks a link
  12878. * in the page.
  12879. *
  12880. * This event will not emit when the navigation is started programmatically with
  12881. * APIs like `webContents.loadURL` and `webContents.back`.
  12882. *
  12883. * It is also not emitted for in-page navigations, such as clicking anchor links or
  12884. * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
  12885. * purpose.
  12886. *
  12887. * Calling `event.preventDefault()` will prevent the navigation.
  12888. */
  12889. on(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  12890. /**
  12891. * @deprecated
  12892. */
  12893. url: string,
  12894. /**
  12895. * @deprecated
  12896. */
  12897. isInPlace: boolean,
  12898. /**
  12899. * @deprecated
  12900. */
  12901. isMainFrame: boolean,
  12902. /**
  12903. * @deprecated
  12904. */
  12905. frameProcessId: number,
  12906. /**
  12907. * @deprecated
  12908. */
  12909. frameRoutingId: number) => void): this;
  12910. off(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  12911. /**
  12912. * @deprecated
  12913. */
  12914. url: string,
  12915. /**
  12916. * @deprecated
  12917. */
  12918. isInPlace: boolean,
  12919. /**
  12920. * @deprecated
  12921. */
  12922. isMainFrame: boolean,
  12923. /**
  12924. * @deprecated
  12925. */
  12926. frameProcessId: number,
  12927. /**
  12928. * @deprecated
  12929. */
  12930. frameRoutingId: number) => void): this;
  12931. once(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  12932. /**
  12933. * @deprecated
  12934. */
  12935. url: string,
  12936. /**
  12937. * @deprecated
  12938. */
  12939. isInPlace: boolean,
  12940. /**
  12941. * @deprecated
  12942. */
  12943. isMainFrame: boolean,
  12944. /**
  12945. * @deprecated
  12946. */
  12947. frameProcessId: number,
  12948. /**
  12949. * @deprecated
  12950. */
  12951. frameRoutingId: number) => void): this;
  12952. addListener(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  12953. /**
  12954. * @deprecated
  12955. */
  12956. url: string,
  12957. /**
  12958. * @deprecated
  12959. */
  12960. isInPlace: boolean,
  12961. /**
  12962. * @deprecated
  12963. */
  12964. isMainFrame: boolean,
  12965. /**
  12966. * @deprecated
  12967. */
  12968. frameProcessId: number,
  12969. /**
  12970. * @deprecated
  12971. */
  12972. frameRoutingId: number) => void): this;
  12973. removeListener(event: 'will-navigate', listener: (details: Event<WebContentsWillNavigateEventParams>,
  12974. /**
  12975. * @deprecated
  12976. */
  12977. url: string,
  12978. /**
  12979. * @deprecated
  12980. */
  12981. isInPlace: boolean,
  12982. /**
  12983. * @deprecated
  12984. */
  12985. isMainFrame: boolean,
  12986. /**
  12987. * @deprecated
  12988. */
  12989. frameProcessId: number,
  12990. /**
  12991. * @deprecated
  12992. */
  12993. frameRoutingId: number) => void): this;
  12994. /**
  12995. * Emitted when a `beforeunload` event handler is attempting to cancel a page
  12996. * unload.
  12997. *
  12998. * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
  12999. * and allow the page to be unloaded.
  13000. *
  13001. * **Note:** This will be emitted for `BrowserViews` but will _not_ be respected -
  13002. * this is because we have chosen not to tie the `BrowserView` lifecycle to its
  13003. * owning BrowserWindow should one exist per the specification.
  13004. */
  13005. on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  13006. off(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  13007. once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  13008. addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  13009. removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  13010. /**
  13011. * Emitted when a server side redirect occurs during navigation. For example a 302
  13012. * redirect.
  13013. *
  13014. * This event will be emitted after `did-start-navigation` and always before the
  13015. * `did-redirect-navigation` event for the same navigation.
  13016. *
  13017. * Calling `event.preventDefault()` will prevent the navigation (not just the
  13018. * redirect).
  13019. */
  13020. on(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  13021. /**
  13022. * @deprecated
  13023. */
  13024. url: string,
  13025. /**
  13026. * @deprecated
  13027. */
  13028. isInPlace: boolean,
  13029. /**
  13030. * @deprecated
  13031. */
  13032. isMainFrame: boolean,
  13033. /**
  13034. * @deprecated
  13035. */
  13036. frameProcessId: number,
  13037. /**
  13038. * @deprecated
  13039. */
  13040. frameRoutingId: number) => void): this;
  13041. off(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  13042. /**
  13043. * @deprecated
  13044. */
  13045. url: string,
  13046. /**
  13047. * @deprecated
  13048. */
  13049. isInPlace: boolean,
  13050. /**
  13051. * @deprecated
  13052. */
  13053. isMainFrame: boolean,
  13054. /**
  13055. * @deprecated
  13056. */
  13057. frameProcessId: number,
  13058. /**
  13059. * @deprecated
  13060. */
  13061. frameRoutingId: number) => void): this;
  13062. once(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  13063. /**
  13064. * @deprecated
  13065. */
  13066. url: string,
  13067. /**
  13068. * @deprecated
  13069. */
  13070. isInPlace: boolean,
  13071. /**
  13072. * @deprecated
  13073. */
  13074. isMainFrame: boolean,
  13075. /**
  13076. * @deprecated
  13077. */
  13078. frameProcessId: number,
  13079. /**
  13080. * @deprecated
  13081. */
  13082. frameRoutingId: number) => void): this;
  13083. addListener(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  13084. /**
  13085. * @deprecated
  13086. */
  13087. url: string,
  13088. /**
  13089. * @deprecated
  13090. */
  13091. isInPlace: boolean,
  13092. /**
  13093. * @deprecated
  13094. */
  13095. isMainFrame: boolean,
  13096. /**
  13097. * @deprecated
  13098. */
  13099. frameProcessId: number,
  13100. /**
  13101. * @deprecated
  13102. */
  13103. frameRoutingId: number) => void): this;
  13104. removeListener(event: 'will-redirect', listener: (details: Event<WebContentsWillRedirectEventParams>,
  13105. /**
  13106. * @deprecated
  13107. */
  13108. url: string,
  13109. /**
  13110. * @deprecated
  13111. */
  13112. isInPlace: boolean,
  13113. /**
  13114. * @deprecated
  13115. */
  13116. isMainFrame: boolean,
  13117. /**
  13118. * @deprecated
  13119. */
  13120. frameProcessId: number,
  13121. /**
  13122. * @deprecated
  13123. */
  13124. frameRoutingId: number) => void): this;
  13125. /**
  13126. * Emitted when the user is requesting to change the zoom level using the mouse
  13127. * wheel.
  13128. */
  13129. on(event: 'zoom-changed', listener: (event: Event,
  13130. /**
  13131. * Can be `in` or `out`.
  13132. */
  13133. zoomDirection: ('in' | 'out')) => void): this;
  13134. off(event: 'zoom-changed', listener: (event: Event,
  13135. /**
  13136. * Can be `in` or `out`.
  13137. */
  13138. zoomDirection: ('in' | 'out')) => void): this;
  13139. once(event: 'zoom-changed', listener: (event: Event,
  13140. /**
  13141. * Can be `in` or `out`.
  13142. */
  13143. zoomDirection: ('in' | 'out')) => void): this;
  13144. addListener(event: 'zoom-changed', listener: (event: Event,
  13145. /**
  13146. * Can be `in` or `out`.
  13147. */
  13148. zoomDirection: ('in' | 'out')) => void): this;
  13149. removeListener(event: 'zoom-changed', listener: (event: Event,
  13150. /**
  13151. * Can be `in` or `out`.
  13152. */
  13153. zoomDirection: ('in' | 'out')) => void): this;
  13154. /**
  13155. * Adds the specified path to DevTools workspace. Must be used after DevTools
  13156. * creation:
  13157. */
  13158. addWorkSpace(path: string): void;
  13159. /**
  13160. * Adjusts the current text selection starting and ending points in the focused
  13161. * frame by the given amounts. A negative amount moves the selection towards the
  13162. * beginning of the document, and a positive amount moves the selection towards the
  13163. * end of the document.
  13164. *
  13165. * Example:
  13166. *
  13167. * For a call of `win.webContents.adjustSelection({ start: 1, end: 5 })`
  13168. *
  13169. * Before:
  13170. *
  13171. * <img width="487" alt="Image Before Text Selection Adjustment"
  13172. * src="../images/web-contents-text-selection-before.png"/>
  13173. *
  13174. * After:
  13175. *
  13176. * <img width="487" alt="Image After Text Selection Adjustment"
  13177. * src="../images/web-contents-text-selection-after.png"/>
  13178. */
  13179. adjustSelection(options: AdjustSelectionOptions): void;
  13180. /**
  13181. * Begin subscribing for presentation events and captured frames, the `callback`
  13182. * will be called with `callback(image, dirtyRect)` when there is a presentation
  13183. * event.
  13184. *
  13185. * The `image` is an instance of NativeImage that stores the captured frame.
  13186. *
  13187. * The `dirtyRect` is an object with `x, y, width, height` properties that
  13188. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  13189. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  13190. */
  13191. beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  13192. /**
  13193. * Begin subscribing for presentation events and captured frames, the `callback`
  13194. * will be called with `callback(image, dirtyRect)` when there is a presentation
  13195. * event.
  13196. *
  13197. * The `image` is an instance of NativeImage that stores the captured frame.
  13198. *
  13199. * The `dirtyRect` is an object with `x, y, width, height` properties that
  13200. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  13201. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  13202. */
  13203. beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  13204. /**
  13205. * Whether the browser can go back to previous web page.
  13206. */
  13207. canGoBack(): boolean;
  13208. /**
  13209. * Whether the browser can go forward to next web page.
  13210. */
  13211. canGoForward(): boolean;
  13212. /**
  13213. * Whether the web page can go to `offset`.
  13214. */
  13215. canGoToOffset(offset: number): boolean;
  13216. /**
  13217. * Resolves with a NativeImage
  13218. *
  13219. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  13220. * whole visible page. The page is considered visible when its browser window is
  13221. * hidden and the capturer count is non-zero. If you would like the page to stay
  13222. * hidden, you should ensure that `stayHidden` is set to true.
  13223. */
  13224. capturePage(rect?: Rectangle, opts?: Opts): Promise<Electron.NativeImage>;
  13225. /**
  13226. * Centers the current text selection in web page.
  13227. */
  13228. centerSelection(): void;
  13229. /**
  13230. * Clears the navigation history.
  13231. */
  13232. clearHistory(): void;
  13233. /**
  13234. * Closes the page, as if the web content had called `window.close()`.
  13235. *
  13236. * If the page is successfully closed (i.e. the unload is not prevented by the
  13237. * page, or `waitForBeforeUnload` is false or unspecified), the WebContents will be
  13238. * destroyed and no longer usable. The `destroyed` event will be emitted.
  13239. */
  13240. close(opts?: CloseOpts): void;
  13241. /**
  13242. * Closes the devtools.
  13243. */
  13244. closeDevTools(): void;
  13245. /**
  13246. * Executes the editing command `copy` in web page.
  13247. */
  13248. copy(): void;
  13249. /**
  13250. * Copy the image at the given position to the clipboard.
  13251. */
  13252. copyImageAt(x: number, y: number): void;
  13253. /**
  13254. * Executes the editing command `cut` in web page.
  13255. */
  13256. cut(): void;
  13257. /**
  13258. * Executes the editing command `delete` in web page.
  13259. */
  13260. delete(): void;
  13261. /**
  13262. * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
  13263. */
  13264. disableDeviceEmulation(): void;
  13265. /**
  13266. * Initiates a download of the resource at `url` without navigating. The
  13267. * `will-download` event of `session` will be triggered.
  13268. */
  13269. downloadURL(url: string, options?: DownloadURLOptions): void;
  13270. /**
  13271. * Enable device emulation with the given parameters.
  13272. */
  13273. enableDeviceEmulation(parameters: Parameters): void;
  13274. /**
  13275. * End subscribing for frame presentation events.
  13276. */
  13277. endFrameSubscription(): void;
  13278. /**
  13279. * A promise that resolves with the result of the executed code or is rejected if
  13280. * the result of the code is a rejected promise.
  13281. *
  13282. * Evaluates `code` in page.
  13283. *
  13284. * In the browser window some HTML APIs like `requestFullScreen` can only be
  13285. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  13286. * this limitation.
  13287. *
  13288. * Code execution will be suspended until web page stop loading.
  13289. */
  13290. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  13291. /**
  13292. * A promise that resolves with the result of the executed code or is rejected if
  13293. * the result of the code is a rejected promise.
  13294. *
  13295. * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  13296. */
  13297. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
  13298. /**
  13299. * The request id used for the request.
  13300. *
  13301. * Starts a request to find all matches for the `text` in the web page. The result
  13302. * of the request can be obtained by subscribing to `found-in-page` event.
  13303. */
  13304. findInPage(text: string, options?: FindInPageOptions): number;
  13305. /**
  13306. * Focuses the web page.
  13307. */
  13308. focus(): void;
  13309. /**
  13310. * Forcefully terminates the renderer process that is currently hosting this
  13311. * `webContents`. This will cause the `render-process-gone` event to be emitted
  13312. * with the `reason=killed || reason=crashed`. Please note that some webContents
  13313. * share renderer processes and therefore calling this method may also crash the
  13314. * host process for other webContents as well.
  13315. *
  13316. * Calling `reload()` immediately after calling this method will force the reload
  13317. * to occur in a new process. This should be used when this process is unstable or
  13318. * unusable, for instance in order to recover from the `unresponsive` event.
  13319. */
  13320. forcefullyCrashRenderer(): void;
  13321. /**
  13322. * Information about all Shared Workers.
  13323. */
  13324. getAllSharedWorkers(): SharedWorkerInfo[];
  13325. /**
  13326. * whether or not this WebContents will throttle animations and timers when the
  13327. * page becomes backgrounded. This also affects the Page Visibility API.
  13328. */
  13329. getBackgroundThrottling(): boolean;
  13330. /**
  13331. * the current title of the DevTools window. This will only be visible if DevTools
  13332. * is opened in `undocked` or `detach` mode.
  13333. */
  13334. getDevToolsTitle(): string;
  13335. /**
  13336. * If _offscreen rendering_ is enabled returns the current frame rate.
  13337. */
  13338. getFrameRate(): number;
  13339. /**
  13340. * The identifier of a WebContents stream. This identifier can be used with
  13341. * `navigator.mediaDevices.getUserMedia` using a `chromeMediaSource` of `tab`. The
  13342. * identifier is restricted to the web contents that it is registered to and is
  13343. * only valid for 10 seconds.
  13344. */
  13345. getMediaSourceId(requestWebContents: WebContents): string;
  13346. /**
  13347. * The operating system `pid` of the associated renderer process.
  13348. */
  13349. getOSProcessId(): number;
  13350. /**
  13351. * Get the system printer list.
  13352. *
  13353. * Resolves with a `PrinterInfo[]`
  13354. */
  13355. getPrintersAsync(): Promise<Electron.PrinterInfo[]>;
  13356. /**
  13357. * The Chromium internal `pid` of the associated renderer. Can be compared to the
  13358. * `frameProcessId` passed by frame specific navigation events (e.g.
  13359. * `did-frame-navigate`)
  13360. */
  13361. getProcessId(): number;
  13362. /**
  13363. * The title of the current web page.
  13364. */
  13365. getTitle(): string;
  13366. /**
  13367. * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
  13368. * `remote`, `webview` or `offscreen`.
  13369. */
  13370. getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
  13371. /**
  13372. * The URL of the current web page.
  13373. */
  13374. getURL(): string;
  13375. /**
  13376. * The user agent for this web page.
  13377. */
  13378. getUserAgent(): string;
  13379. /**
  13380. * Returns the WebRTC IP Handling Policy.
  13381. */
  13382. getWebRTCIPHandlingPolicy(): string;
  13383. /**
  13384. * * `min` Integer - The minimum UDP port number that WebRTC should use.
  13385. * * `max` Integer - The maximum UDP port number that WebRTC should use.
  13386. *
  13387. * By default this value is `{ min: 0, max: 0 }` , which would apply no restriction
  13388. * on the udp port range.
  13389. */
  13390. getWebRTCUDPPortRange(): WebRTCUDPPortRange;
  13391. /**
  13392. * the current zoom factor.
  13393. */
  13394. getZoomFactor(): number;
  13395. /**
  13396. * the current zoom level.
  13397. */
  13398. getZoomLevel(): number;
  13399. /**
  13400. * Makes the browser go back a web page.
  13401. */
  13402. goBack(): void;
  13403. /**
  13404. * Makes the browser go forward a web page.
  13405. */
  13406. goForward(): void;
  13407. /**
  13408. * Navigates browser to the specified absolute web page index.
  13409. */
  13410. goToIndex(index: number): void;
  13411. /**
  13412. * Navigates to the specified offset from the "current entry".
  13413. */
  13414. goToOffset(offset: number): void;
  13415. /**
  13416. * A promise that resolves with a key for the inserted CSS that can later be used
  13417. * to remove the CSS via `contents.removeInsertedCSS(key)`.
  13418. *
  13419. * Injects CSS into the current web page and returns a unique key for the inserted
  13420. * stylesheet.
  13421. */
  13422. insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
  13423. /**
  13424. * Inserts `text` to the focused element.
  13425. */
  13426. insertText(text: string): Promise<void>;
  13427. /**
  13428. * Starts inspecting element at position (`x`, `y`).
  13429. */
  13430. inspectElement(x: number, y: number): void;
  13431. /**
  13432. * Opens the developer tools for the service worker context.
  13433. */
  13434. inspectServiceWorker(): void;
  13435. /**
  13436. * Opens the developer tools for the shared worker context.
  13437. */
  13438. inspectSharedWorker(): void;
  13439. /**
  13440. * Inspects the shared worker based on its ID.
  13441. */
  13442. inspectSharedWorkerById(workerId: string): void;
  13443. /**
  13444. * Schedules a full repaint of the window this web contents is in.
  13445. *
  13446. * If _offscreen rendering_ is enabled invalidates the frame and generates a new
  13447. * one through the `'paint'` event.
  13448. */
  13449. invalidate(): void;
  13450. /**
  13451. * Whether this page has been muted.
  13452. */
  13453. isAudioMuted(): boolean;
  13454. /**
  13455. * Whether this page is being captured. It returns true when the capturer count is
  13456. * large then 0.
  13457. */
  13458. isBeingCaptured(): boolean;
  13459. /**
  13460. * Whether the renderer process has crashed.
  13461. */
  13462. isCrashed(): boolean;
  13463. /**
  13464. * Whether audio is currently playing.
  13465. */
  13466. isCurrentlyAudible(): boolean;
  13467. /**
  13468. * Whether the web page is destroyed.
  13469. */
  13470. isDestroyed(): boolean;
  13471. /**
  13472. * Whether the devtools view is focused .
  13473. */
  13474. isDevToolsFocused(): boolean;
  13475. /**
  13476. * Whether the devtools is opened.
  13477. */
  13478. isDevToolsOpened(): boolean;
  13479. /**
  13480. * Whether the web page is focused.
  13481. */
  13482. isFocused(): boolean;
  13483. /**
  13484. * Whether web page is still loading resources.
  13485. */
  13486. isLoading(): boolean;
  13487. /**
  13488. * Whether the main frame (and not just iframes or frames within it) is still
  13489. * loading.
  13490. */
  13491. isLoadingMainFrame(): boolean;
  13492. /**
  13493. * Indicates whether _offscreen rendering_ is enabled.
  13494. */
  13495. isOffscreen(): boolean;
  13496. /**
  13497. * If _offscreen rendering_ is enabled returns whether it is currently painting.
  13498. */
  13499. isPainting(): boolean;
  13500. /**
  13501. * Whether the web page is waiting for a first-response from the main resource of
  13502. * the page.
  13503. */
  13504. isWaitingForResponse(): boolean;
  13505. /**
  13506. * the promise will resolve when the page has finished loading (see
  13507. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  13508. *
  13509. * Loads the given file in the window, `filePath` should be a path to an HTML file
  13510. * relative to the root of your application. For instance an app structure like
  13511. * this:
  13512. *
  13513. * Would require code like this
  13514. */
  13515. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  13516. /**
  13517. * the promise will resolve when the page has finished loading (see
  13518. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  13519. * A noop rejection handler is already attached, which avoids unhandled rejection
  13520. * errors.
  13521. *
  13522. * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
  13523. * the `http://` or `file://`. If the load should bypass http cache then use the
  13524. * `pragma` header to achieve it.
  13525. */
  13526. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  13527. /**
  13528. * Opens the devtools.
  13529. *
  13530. * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
  13531. * explicitly passing an empty `mode` can force using last used dock state.
  13532. *
  13533. * On Windows, if Windows Control Overlay is enabled, Devtools will be opened with
  13534. * `mode: 'detach'`.
  13535. */
  13536. openDevTools(options?: OpenDevToolsOptions): void;
  13537. /**
  13538. * Executes the editing command `paste` in web page.
  13539. */
  13540. paste(): void;
  13541. /**
  13542. * Executes the editing command `pasteAndMatchStyle` in web page.
  13543. */
  13544. pasteAndMatchStyle(): void;
  13545. /**
  13546. * Send a message to the renderer process, optionally transferring ownership of
  13547. * zero or more `MessagePortMain` objects.
  13548. *
  13549. * The transferred `MessagePortMain` objects will be available in the renderer
  13550. * process by accessing the `ports` property of the emitted event. When they arrive
  13551. * in the renderer, they will be native DOM `MessagePort` objects.
  13552. *
  13553. * For example:
  13554. */
  13555. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  13556. /**
  13557. * When a custom `pageSize` is passed, Chromium attempts to validate platform
  13558. * specific minimum values for `width_microns` and `height_microns`. Width and
  13559. * height must both be minimum 353 microns but may be higher on some operating
  13560. * systems.
  13561. *
  13562. * Prints window's web page. When `silent` is set to `true`, Electron will pick the
  13563. * system's default printer if `deviceName` is empty and the default settings for
  13564. * printing.
  13565. *
  13566. * Use `page-break-before: always;` CSS style to force to print to a new page.
  13567. *
  13568. * Example usage:
  13569. */
  13570. print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
  13571. /**
  13572. * Resolves with the generated PDF data.
  13573. *
  13574. * Prints the window's web page as PDF.
  13575. *
  13576. * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
  13577. *
  13578. * An example of `webContents.printToPDF`:
  13579. *
  13580. * See Page.printToPdf for more information.
  13581. */
  13582. printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
  13583. /**
  13584. * Executes the editing command `redo` in web page.
  13585. */
  13586. redo(): void;
  13587. /**
  13588. * Reloads the current web page.
  13589. */
  13590. reload(): void;
  13591. /**
  13592. * Reloads current page and ignores cache.
  13593. */
  13594. reloadIgnoringCache(): void;
  13595. /**
  13596. * Resolves if the removal was successful.
  13597. *
  13598. * Removes the inserted CSS from the current web page. The stylesheet is identified
  13599. * by its key, which is returned from `contents.insertCSS(css)`.
  13600. */
  13601. removeInsertedCSS(key: string): Promise<void>;
  13602. /**
  13603. * Removes the specified path from DevTools workspace.
  13604. */
  13605. removeWorkSpace(path: string): void;
  13606. /**
  13607. * Executes the editing command `replace` in web page.
  13608. */
  13609. replace(text: string): void;
  13610. /**
  13611. * Executes the editing command `replaceMisspelling` in web page.
  13612. */
  13613. replaceMisspelling(text: string): void;
  13614. /**
  13615. * resolves if the page is saved.
  13616. */
  13617. savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
  13618. /**
  13619. * Scrolls to the bottom of the current `webContents`.
  13620. */
  13621. scrollToBottom(): void;
  13622. /**
  13623. * Scrolls to the top of the current `webContents`.
  13624. */
  13625. scrollToTop(): void;
  13626. /**
  13627. * Executes the editing command `selectAll` in web page.
  13628. */
  13629. selectAll(): void;
  13630. /**
  13631. * Send an asynchronous message to the renderer process via `channel`, along with
  13632. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  13633. * just like `postMessage`, so prototype chains will not be included. Sending
  13634. * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
  13635. *
  13636. * :::warning
  13637. *
  13638. * Sending non-standard JavaScript types such as DOM objects or special Electron
  13639. * objects will throw an exception.
  13640. *
  13641. * :::
  13642. *
  13643. * For additional reading, refer to Electron's IPC guide.
  13644. */
  13645. send(channel: string, ...args: any[]): void;
  13646. /**
  13647. * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
  13648. * contents needs to be focused for `sendInputEvent()` to work.
  13649. */
  13650. sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
  13651. /**
  13652. * Send an asynchronous message to a specific frame in a renderer process via
  13653. * `channel`, along with arguments. Arguments will be serialized with the
  13654. * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
  13655. * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
  13656. * will throw an exception.
  13657. *
  13658. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  13659. * Electron objects will throw an exception.
  13660. *
  13661. * The renderer process can handle the message by listening to `channel` with the
  13662. * `ipcRenderer` module.
  13663. *
  13664. * If you want to get the `frameId` of a given renderer context you should use the
  13665. * `webFrame.routingId` value. E.g.
  13666. *
  13667. * You can also read `frameId` from all incoming IPC messages in the main process.
  13668. */
  13669. sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
  13670. /**
  13671. * Mute the audio on the current web page.
  13672. */
  13673. setAudioMuted(muted: boolean): void;
  13674. /**
  13675. * Controls whether or not this WebContents will throttle animations and timers
  13676. * when the page becomes backgrounded. This also affects the Page Visibility API.
  13677. */
  13678. setBackgroundThrottling(allowed: boolean): void;
  13679. /**
  13680. * Changes the title of the DevTools window to `title`. This will only be visible
  13681. * if DevTools is opened in `undocked` or `detach` mode.
  13682. */
  13683. setDevToolsTitle(title: string): void;
  13684. /**
  13685. * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
  13686. *
  13687. * The `devToolsWebContents` must not have done any navigation, and it should not
  13688. * be used for other purposes after the call.
  13689. *
  13690. * By default Electron manages the devtools by creating an internal `WebContents`
  13691. * with native view, which developers have very limited control of. With the
  13692. * `setDevToolsWebContents` method, developers can use any `WebContents` to show
  13693. * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
  13694. * tag.
  13695. *
  13696. * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
  13697. * caller's responsibility to destroy `devToolsWebContents`.
  13698. *
  13699. * An example of showing devtools in a `<webview>` tag:
  13700. *
  13701. * An example of showing devtools in a `BrowserWindow`:
  13702. */
  13703. setDevToolsWebContents(devToolsWebContents: WebContents): void;
  13704. /**
  13705. * If _offscreen rendering_ is enabled sets the frame rate to the specified number.
  13706. * Only values between 1 and 240 are accepted.
  13707. */
  13708. setFrameRate(fps: number): void;
  13709. /**
  13710. * Ignore application menu shortcuts while this web contents is focused.
  13711. */
  13712. setIgnoreMenuShortcuts(ignore: boolean): void;
  13713. /**
  13714. * Sets the image animation policy for this webContents. The policy only affects
  13715. * _new_ images, existing images that are currently being animated are unaffected.
  13716. * This is a known limitation in Chromium, you can force image animation to be
  13717. * recalculated with `img.src = img.src` which will result in no network traffic
  13718. * but will update the animation policy.
  13719. *
  13720. * This corresponds to the animationPolicy accessibility feature in Chromium.
  13721. */
  13722. setImageAnimationPolicy(policy: 'animate' | 'animateOnce' | 'noAnimation'): void;
  13723. /**
  13724. * Overrides the user agent for this web page.
  13725. */
  13726. setUserAgent(userAgent: string): void;
  13727. /**
  13728. * Sets the maximum and minimum pinch-to-zoom level.
  13729. *
  13730. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  13731. * call:
  13732. */
  13733. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  13734. /**
  13735. * Setting the WebRTC IP handling policy allows you to control which IPs are
  13736. * exposed via WebRTC. See BrowserLeaks for more details.
  13737. */
  13738. setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
  13739. /**
  13740. * Setting the WebRTC UDP Port Range allows you to restrict the udp port range used
  13741. * by WebRTC. By default the port range is unrestricted. **Note:** To reset to an
  13742. * unrestricted port range this value should be set to `{ min: 0, max: 0 }`.
  13743. */
  13744. setWebRTCUDPPortRange(udpPortRange: UdpPortRange): void;
  13745. /**
  13746. * Called before creating a window a new window is requested by the renderer, e.g.
  13747. * by `window.open()`, a link with `target="_blank"`, shift+clicking on a link, or
  13748. * submitting a form with `<form target="_blank">`. See `window.open()` for more
  13749. * details and how to use this in conjunction with `did-create-window`.
  13750. */
  13751. setWindowOpenHandler(handler: (details: HandlerDetails) => ({action: 'deny'}) | ({action: 'allow', outlivesOpener?: boolean, overrideBrowserWindowOptions?: BrowserWindowConstructorOptions})): void;
  13752. /**
  13753. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  13754. * divided by 100, so 300% = 3.0.
  13755. *
  13756. * The factor must be greater than 0.0.
  13757. */
  13758. setZoomFactor(factor: number): void;
  13759. /**
  13760. * Changes the zoom level to the specified level. The original size is 0 and each
  13761. * increment above or below represents zooming 20% larger or smaller to default
  13762. * limits of 300% and 50% of original size, respectively. The formula for this is
  13763. * `scale := 1.2 ^ level`.
  13764. *
  13765. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  13766. * the zoom level for a specific domain propagates across all instances of windows
  13767. * with the same domain. Differentiating the window URLs will make zoom work
  13768. * per-window.
  13769. */
  13770. setZoomLevel(level: number): void;
  13771. /**
  13772. * Shows pop-up dictionary that searches the selected word on the page.
  13773. *
  13774. * @platform darwin
  13775. */
  13776. showDefinitionForSelection(): void;
  13777. /**
  13778. * Sets the `item` as dragging item for current drag-drop operation, `file` is the
  13779. * absolute path of the file to be dragged, and `icon` is the image showing under
  13780. * the cursor when dragging.
  13781. */
  13782. startDrag(item: Item): void;
  13783. /**
  13784. * If _offscreen rendering_ is enabled and not painting, start painting.
  13785. */
  13786. startPainting(): void;
  13787. /**
  13788. * Stops any pending navigation.
  13789. */
  13790. stop(): void;
  13791. /**
  13792. * Stops any `findInPage` request for the `webContents` with the provided `action`.
  13793. */
  13794. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  13795. /**
  13796. * If _offscreen rendering_ is enabled and painting, stop painting.
  13797. */
  13798. stopPainting(): void;
  13799. /**
  13800. * Indicates whether the snapshot has been created successfully.
  13801. *
  13802. * Takes a V8 heap snapshot and saves it to `filePath`.
  13803. */
  13804. takeHeapSnapshot(filePath: string): Promise<void>;
  13805. /**
  13806. * Toggles the developer tools.
  13807. */
  13808. toggleDevTools(): void;
  13809. /**
  13810. * Executes the editing command `undo` in web page.
  13811. */
  13812. undo(): void;
  13813. /**
  13814. * Executes the editing command `unselect` in web page.
  13815. */
  13816. unselect(): void;
  13817. /**
  13818. * A `boolean` property that determines whether this page is muted.
  13819. */
  13820. audioMuted: boolean;
  13821. /**
  13822. * A `boolean` property that determines whether or not this WebContents will
  13823. * throttle animations and timers when the page becomes backgrounded. This also
  13824. * affects the Page Visibility API.
  13825. */
  13826. backgroundThrottling: boolean;
  13827. /**
  13828. * A `Debugger` instance for this webContents.
  13829. *
  13830. */
  13831. readonly debugger: Debugger;
  13832. /**
  13833. * A `WebContents | null` property that represents the of DevTools `WebContents`
  13834. * associated with a given `WebContents`.
  13835. *
  13836. * **Note:** Users should never store this object because it may become `null` when
  13837. * the DevTools has been closed.
  13838. *
  13839. */
  13840. readonly devToolsWebContents: (WebContents) | (null);
  13841. /**
  13842. * An `Integer` property that sets the frame rate of the web contents to the
  13843. * specified number. Only values between 1 and 240 are accepted.
  13844. *
  13845. * Only applicable if _offscreen rendering_ is enabled.
  13846. */
  13847. frameRate: number;
  13848. /**
  13849. * A `WebContents` instance that might own this `WebContents`.
  13850. *
  13851. */
  13852. readonly hostWebContents: WebContents;
  13853. /**
  13854. * A `Integer` representing the unique ID of this WebContents. Each ID is unique
  13855. * among all `WebContents` instances of the entire Electron application.
  13856. *
  13857. */
  13858. readonly id: number;
  13859. /**
  13860. * An `IpcMain` scoped to just IPC messages sent from this WebContents.
  13861. *
  13862. * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
  13863. * `ipcRenderer.postMessage` will be delivered in the following order:
  13864. *
  13865. * * `contents.on('ipc-message')`
  13866. * * `contents.mainFrame.on(channel)`
  13867. * * `contents.ipc.on(channel)`
  13868. * * `ipcMain.on(channel)`
  13869. *
  13870. * Handlers registered with `invoke` will be checked in the following order. The
  13871. * first one that is defined will be called, the rest will be ignored.
  13872. *
  13873. * * `contents.mainFrame.handle(channel)`
  13874. * * `contents.handle(channel)`
  13875. * * `ipcMain.handle(channel)`
  13876. *
  13877. * A handler or event listener registered on the WebContents will receive IPC
  13878. * messages sent from any frame, including child frames. In most cases, only the
  13879. * main frame can send IPC messages. However, if the `nodeIntegrationInSubFrames`
  13880. * option is enabled, it is possible for child frames to send IPC messages also. In
  13881. * that case, handlers should check the `senderFrame` property of the IPC event to
  13882. * ensure that the message is coming from the expected frame. Alternatively,
  13883. * register handlers on the appropriate frame directly using the `WebFrameMain.ipc`
  13884. * interface.
  13885. *
  13886. */
  13887. readonly ipc: IpcMain;
  13888. /**
  13889. * A `WebFrameMain` property that represents the top frame of the page's frame
  13890. * hierarchy.
  13891. *
  13892. */
  13893. readonly mainFrame: WebFrameMain;
  13894. /**
  13895. * A `WebFrameMain` property that represents the frame that opened this
  13896. * WebContents, either with open(), or by navigating a link with a target
  13897. * attribute.
  13898. *
  13899. */
  13900. readonly opener: WebFrameMain;
  13901. /**
  13902. * A `Session` used by this webContents.
  13903. *
  13904. */
  13905. readonly session: Session;
  13906. /**
  13907. * A `string` property that determines the user agent for this web page.
  13908. */
  13909. userAgent: string;
  13910. /**
  13911. * A `number` property that determines the zoom factor for this web contents.
  13912. *
  13913. * The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
  13914. */
  13915. zoomFactor: number;
  13916. /**
  13917. * A `number` property that determines the zoom level for this web contents.
  13918. *
  13919. * The original size is 0 and each increment above or below represents zooming 20%
  13920. * larger or smaller to default limits of 300% and 50% of original size,
  13921. * respectively. The formula for this is `scale := 1.2 ^ level`.
  13922. */
  13923. zoomLevel: number;
  13924. }
  13925. interface WebFrame {
  13926. // Docs: https://electronjs.org/docs/api/web-frame
  13927. /**
  13928. * Attempts to free memory that is no longer being used (like images from a
  13929. * previous navigation).
  13930. *
  13931. * Note that blindly calling this method probably makes Electron slower since it
  13932. * will have to refill these emptied caches, you should only call it if an event in
  13933. * your app has occurred that makes you think your page is actually using less
  13934. * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
  13935. * and intend to stay there).
  13936. */
  13937. clearCache(): void;
  13938. /**
  13939. * A promise that resolves with the result of the executed code or is rejected if
  13940. * execution throws or results in a rejected promise.
  13941. *
  13942. * Evaluates `code` in page.
  13943. *
  13944. * In the browser window some HTML APIs like `requestFullScreen` can only be
  13945. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  13946. * this limitation.
  13947. */
  13948. executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  13949. /**
  13950. * A promise that resolves with the result of the executed code or is rejected if
  13951. * execution could not start.
  13952. *
  13953. * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  13954. *
  13955. * Note that when the execution of script fails, the returned promise will not
  13956. * reject and the `result` would be `undefined`. This is because Chromium does not
  13957. * dispatch errors of isolated worlds to foreign worlds.
  13958. */
  13959. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  13960. /**
  13961. * A child of `webFrame` with the supplied `name`, `null` would be returned if
  13962. * there's no such frame or if the frame is not in the current renderer process.
  13963. */
  13964. findFrameByName(name: string): WebFrame;
  13965. /**
  13966. * that has the supplied `routingId`, `null` if not found.
  13967. */
  13968. findFrameByRoutingId(routingId: number): WebFrame;
  13969. /**
  13970. * The frame element in `webFrame's` document selected by `selector`, `null` would
  13971. * be returned if `selector` does not select a frame or if the frame is not in the
  13972. * current renderer process.
  13973. */
  13974. getFrameForSelector(selector: string): WebFrame;
  13975. /**
  13976. * * `images` MemoryUsageDetails
  13977. * * `scripts` MemoryUsageDetails
  13978. * * `cssStyleSheets` MemoryUsageDetails
  13979. * * `xslStyleSheets` MemoryUsageDetails
  13980. * * `fonts` MemoryUsageDetails
  13981. * * `other` MemoryUsageDetails
  13982. *
  13983. * Returns an object describing usage information of Blink's internal memory
  13984. * caches.
  13985. *
  13986. * This will generate:
  13987. */
  13988. getResourceUsage(): ResourceUsage;
  13989. /**
  13990. * A list of suggested words for a given word. If the word is spelled correctly,
  13991. * the result will be empty.
  13992. */
  13993. getWordSuggestions(word: string): string[];
  13994. /**
  13995. * The current zoom factor.
  13996. */
  13997. getZoomFactor(): number;
  13998. /**
  13999. * The current zoom level.
  14000. */
  14001. getZoomLevel(): number;
  14002. /**
  14003. * A key for the inserted CSS that can later be used to remove the CSS via
  14004. * `webFrame.removeInsertedCSS(key)`.
  14005. *
  14006. * Injects CSS into the current web page and returns a unique key for the inserted
  14007. * stylesheet.
  14008. */
  14009. insertCSS(css: string, options?: InsertCSSOptions): string;
  14010. /**
  14011. * Inserts `text` to the focused element.
  14012. */
  14013. insertText(text: string): void;
  14014. /**
  14015. * True if the word is misspelled according to the built in spellchecker, false
  14016. * otherwise. If no dictionary is loaded, always return false.
  14017. */
  14018. isWordMisspelled(word: string): boolean;
  14019. /**
  14020. * Removes the inserted CSS from the current web page. The stylesheet is identified
  14021. * by its key, which is returned from `webFrame.insertCSS(css)`.
  14022. */
  14023. removeInsertedCSS(key: string): void;
  14024. /**
  14025. * Set the security origin, content security policy and name of the isolated world.
  14026. * Note: If the `csp` is specified, then the `securityOrigin` also has to be
  14027. * specified.
  14028. */
  14029. setIsolatedWorldInfo(worldId: number, info: Info): void;
  14030. /**
  14031. * Sets a provider for spell checking in input fields and text areas.
  14032. *
  14033. * If you want to use this method you must disable the builtin spellchecker when
  14034. * you construct the window.
  14035. *
  14036. * The `provider` must be an object that has a `spellCheck` method that accepts an
  14037. * array of individual words for spellchecking. The `spellCheck` function runs
  14038. * asynchronously and calls the `callback` function with an array of misspelt words
  14039. * when complete.
  14040. *
  14041. * An example of using node-spellchecker as provider:
  14042. */
  14043. setSpellCheckProvider(language: string, provider: Provider): void;
  14044. /**
  14045. * Sets the maximum and minimum pinch-to-zoom level.
  14046. *
  14047. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  14048. * call:
  14049. *
  14050. * > **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom
  14051. * shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem
  14052. * roles in the application Menu. To disable shortcuts, manually define the Menu
  14053. * and omit zoom roles from the definition.
  14054. */
  14055. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
  14056. /**
  14057. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  14058. * divided by 100, so 300% = 3.0.
  14059. *
  14060. * The factor must be greater than 0.0.
  14061. */
  14062. setZoomFactor(factor: number): void;
  14063. /**
  14064. * Changes the zoom level to the specified level. The original size is 0 and each
  14065. * increment above or below represents zooming 20% larger or smaller to default
  14066. * limits of 300% and 50% of original size, respectively.
  14067. *
  14068. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  14069. * the zoom level for a specific domain propagates across all instances of windows
  14070. * with the same domain. Differentiating the window URLs will make zoom work
  14071. * per-window.
  14072. */
  14073. setZoomLevel(level: number): void;
  14074. /**
  14075. * A `WebFrame | null` representing the first child frame of `webFrame`, the
  14076. * property would be `null` if `webFrame` has no children or if first child is not
  14077. * in the current renderer process.
  14078. *
  14079. */
  14080. readonly firstChild: (WebFrame) | (null);
  14081. /**
  14082. * A `WebFrame | null` representing next sibling frame, the property would be
  14083. * `null` if `webFrame` is the last frame in its parent or if the next sibling is
  14084. * not in the current renderer process.
  14085. *
  14086. */
  14087. readonly nextSibling: (WebFrame) | (null);
  14088. /**
  14089. * A `WebFrame | null` representing the frame which opened `webFrame`, the property
  14090. * would be `null` if there's no opener or opener is not in the current renderer
  14091. * process.
  14092. *
  14093. */
  14094. readonly opener: (WebFrame) | (null);
  14095. /**
  14096. * A `WebFrame | null` representing parent frame of `webFrame`, the property would
  14097. * be `null` if `webFrame` is top or parent is not in the current renderer process.
  14098. *
  14099. */
  14100. readonly parent: (WebFrame) | (null);
  14101. /**
  14102. * An `Integer` representing the unique frame id in the current renderer process.
  14103. * Distinct WebFrame instances that refer to the same underlying frame will have
  14104. * the same `routingId`.
  14105. *
  14106. */
  14107. readonly routingId: number;
  14108. /**
  14109. * A `WebFrame | null` representing top frame in frame hierarchy to which
  14110. * `webFrame` belongs, the property would be `null` if top frame is not in the
  14111. * current renderer process.
  14112. *
  14113. */
  14114. readonly top: (WebFrame) | (null);
  14115. }
  14116. class WebFrameMain extends NodeEventEmitter {
  14117. // Docs: https://electronjs.org/docs/api/web-frame-main
  14118. /**
  14119. * A frame with the given process and routing IDs, or `undefined` if there is no
  14120. * WebFrameMain associated with the given IDs.
  14121. */
  14122. static fromId(processId: number, routingId: number): (WebFrameMain) | (undefined);
  14123. /**
  14124. * Emitted when the document is loaded.
  14125. */
  14126. on(event: 'dom-ready', listener: Function): this;
  14127. off(event: 'dom-ready', listener: Function): this;
  14128. once(event: 'dom-ready', listener: Function): this;
  14129. addListener(event: 'dom-ready', listener: Function): this;
  14130. removeListener(event: 'dom-ready', listener: Function): this;
  14131. /**
  14132. * A promise that resolves with the result of the executed code or is rejected if
  14133. * execution throws or results in a rejected promise.
  14134. *
  14135. * Evaluates `code` in page.
  14136. *
  14137. * In the browser window some HTML APIs like `requestFullScreen` can only be
  14138. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  14139. * this limitation.
  14140. */
  14141. executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>;
  14142. /**
  14143. * Send a message to the renderer process, optionally transferring ownership of
  14144. * zero or more `MessagePortMain` objects.
  14145. *
  14146. * The transferred `MessagePortMain` objects will be available in the renderer
  14147. * process by accessing the `ports` property of the emitted event. When they arrive
  14148. * in the renderer, they will be native DOM `MessagePort` objects.
  14149. *
  14150. * For example:
  14151. */
  14152. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  14153. /**
  14154. * Whether the reload was initiated successfully. Only results in `false` when the
  14155. * frame has no history.
  14156. */
  14157. reload(): boolean;
  14158. /**
  14159. * Send an asynchronous message to the renderer process via `channel`, along with
  14160. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  14161. * just like `postMessage`, so prototype chains will not be included. Sending
  14162. * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
  14163. *
  14164. * The renderer process can handle the message by listening to `channel` with the
  14165. * `ipcRenderer` module.
  14166. */
  14167. send(channel: string, ...args: any[]): void;
  14168. /**
  14169. * A `WebFrameMain[]` collection containing the direct descendents of `frame`.
  14170. *
  14171. */
  14172. readonly frames: WebFrameMain[];
  14173. /**
  14174. * A `WebFrameMain[]` collection containing every frame in the subtree of `frame`,
  14175. * including itself. This can be useful when traversing through all frames.
  14176. *
  14177. */
  14178. readonly framesInSubtree: WebFrameMain[];
  14179. /**
  14180. * An `Integer` representing the id of the frame's internal FrameTreeNode instance.
  14181. * This id is browser-global and uniquely identifies a frame that hosts content.
  14182. * The identifier is fixed at the creation of the frame and stays constant for the
  14183. * lifetime of the frame. When the frame is removed, the id is not used again.
  14184. *
  14185. */
  14186. readonly frameTreeNodeId: number;
  14187. /**
  14188. * An `IpcMain` instance scoped to the frame.
  14189. *
  14190. * IPC messages sent with `ipcRenderer.send`, `ipcRenderer.sendSync` or
  14191. * `ipcRenderer.postMessage` will be delivered in the following order:
  14192. *
  14193. * * `contents.on('ipc-message')`
  14194. * * `contents.mainFrame.on(channel)`
  14195. * * `contents.ipc.on(channel)`
  14196. * * `ipcMain.on(channel)`
  14197. *
  14198. * Handlers registered with `invoke` will be checked in the following order. The
  14199. * first one that is defined will be called, the rest will be ignored.
  14200. *
  14201. * * `contents.mainFrame.handle(channel)`
  14202. * * `contents.handle(channel)`
  14203. * * `ipcMain.handle(channel)`
  14204. *
  14205. * In most cases, only the main frame of a WebContents can send or receive IPC
  14206. * messages. However, if the `nodeIntegrationInSubFrames` option is enabled, it is
  14207. * possible for child frames to send and receive IPC messages also. The
  14208. * `WebContents.ipc` interface may be more convenient when
  14209. * `nodeIntegrationInSubFrames` is not enabled.
  14210. *
  14211. */
  14212. readonly ipc: IpcMain;
  14213. /**
  14214. * A `string` representing the frame name.
  14215. *
  14216. */
  14217. readonly name: string;
  14218. /**
  14219. * A `string` representing the current origin of the frame, serialized according to
  14220. * RFC 6454. This may be different from the URL. For instance, if the frame is a
  14221. * child window opened to `about:blank`, then `frame.origin` will return the parent
  14222. * frame's origin, while `frame.url` will return the empty string. Pages without a
  14223. * scheme/host/port triple origin will have the serialized origin of `"null"` (that
  14224. * is, the string containing the letters n, u, l, l).
  14225. *
  14226. */
  14227. readonly origin: string;
  14228. /**
  14229. * An `Integer` representing the operating system `pid` of the process which owns
  14230. * this frame.
  14231. *
  14232. */
  14233. readonly osProcessId: number;
  14234. /**
  14235. * A `WebFrameMain | null` representing parent frame of `frame`, the property would
  14236. * be `null` if `frame` is the top frame in the frame hierarchy.
  14237. *
  14238. */
  14239. readonly parent: (WebFrameMain) | (null);
  14240. /**
  14241. * An `Integer` representing the Chromium internal `pid` of the process which owns
  14242. * this frame. This is not the same as the OS process ID; to read that use
  14243. * `frame.osProcessId`.
  14244. *
  14245. */
  14246. readonly processId: number;
  14247. /**
  14248. * An `Integer` representing the unique frame id in the current renderer process.
  14249. * Distinct `WebFrameMain` instances that refer to the same underlying frame will
  14250. * have the same `routingId`.
  14251. *
  14252. */
  14253. readonly routingId: number;
  14254. /**
  14255. * A `WebFrameMain | null` representing top frame in the frame hierarchy to which
  14256. * `frame` belongs.
  14257. *
  14258. */
  14259. readonly top: (WebFrameMain) | (null);
  14260. /**
  14261. * A `string` representing the current URL of the frame.
  14262. *
  14263. */
  14264. readonly url: string;
  14265. /**
  14266. * A `string` representing the visibility state of the frame.
  14267. *
  14268. * See also how the Page Visibility API is affected by other Electron APIs.
  14269. *
  14270. */
  14271. readonly visibilityState: string;
  14272. }
  14273. interface WebPreferences {
  14274. // Docs: https://electronjs.org/docs/api/structures/web-preferences
  14275. /**
  14276. * An alternative title string provided only to accessibility tools such as screen
  14277. * readers. This string is not directly visible to users.
  14278. */
  14279. accessibleTitle?: string;
  14280. /**
  14281. * A list of strings that will be appended to `process.argv` in the renderer
  14282. * process of this app. Useful for passing small bits of data down to renderer
  14283. * process preload scripts.
  14284. */
  14285. additionalArguments?: string[];
  14286. /**
  14287. * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
  14288. * `false`.
  14289. */
  14290. allowRunningInsecureContent?: boolean;
  14291. /**
  14292. * Autoplay policy to apply to content in the window, can be
  14293. * `no-user-gesture-required`, `user-gesture-required`,
  14294. * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
  14295. */
  14296. autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
  14297. /**
  14298. * Whether to throttle animations and timers when the page becomes background. This
  14299. * also affects the Page Visibility API. When at least one webContents displayed in
  14300. * a single browserWindow has disabled `backgroundThrottling` then frames will be
  14301. * drawn and swapped for the whole window and other webContents displayed by it.
  14302. * Defaults to `true`.
  14303. */
  14304. backgroundThrottling?: boolean;
  14305. /**
  14306. * Whether to run Electron APIs and the specified `preload` script in a separate
  14307. * JavaScript context. Defaults to `true`. The context that the `preload` script
  14308. * runs in will only have access to its own dedicated `document` and `window`
  14309. * globals, as well as its own set of JavaScript builtins (`Array`, `Object`,
  14310. * `JSON`, etc.), which are all invisible to the loaded content. The Electron API
  14311. * will only be available in the `preload` script and not the loaded page. This
  14312. * option should be used when loading potentially untrusted remote content to
  14313. * ensure the loaded content cannot tamper with the `preload` script and any
  14314. * Electron APIs being used. This option uses the same technique used by Chrome
  14315. * Content Scripts. You can access this context in the dev tools by selecting the
  14316. * 'Electron Isolated Context' entry in the combo box at the top of the Console
  14317. * tab.
  14318. */
  14319. contextIsolation?: boolean;
  14320. /**
  14321. * Defaults to `ISO-8859-1`.
  14322. */
  14323. defaultEncoding?: string;
  14324. /**
  14325. * Sets the default font for the font-family.
  14326. */
  14327. defaultFontFamily?: DefaultFontFamily;
  14328. /**
  14329. * Defaults to `16`.
  14330. */
  14331. defaultFontSize?: number;
  14332. /**
  14333. * Defaults to `13`.
  14334. */
  14335. defaultMonospaceFontSize?: number;
  14336. /**
  14337. * Whether to enable DevTools. If it is set to `false`, can not use
  14338. * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
  14339. */
  14340. devTools?: boolean;
  14341. /**
  14342. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  14343. * to disable. The full list of supported feature strings can be found in the
  14344. * RuntimeEnabledFeatures.json5 file.
  14345. */
  14346. disableBlinkFeatures?: string;
  14347. /**
  14348. * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
  14349. * `false`.
  14350. */
  14351. disableDialogs?: boolean;
  14352. /**
  14353. * Whether to prevent the window from resizing when entering HTML Fullscreen.
  14354. * Default is `false`.
  14355. */
  14356. disableHtmlFullscreenWindowResize?: boolean;
  14357. /**
  14358. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  14359. * to enable. The full list of supported feature strings can be found in the
  14360. * RuntimeEnabledFeatures.json5 file.
  14361. */
  14362. enableBlinkFeatures?: string;
  14363. /**
  14364. * Whether to enable preferred size mode. The preferred size is the minimum size
  14365. * needed to contain the layout of the document—without requiring scrolling.
  14366. * Enabling this will cause the `preferred-size-changed` event to be emitted on the
  14367. * `WebContents` when the preferred size changes. Default is `false`.
  14368. */
  14369. enablePreferredSizeMode?: boolean;
  14370. /**
  14371. * Whether to enable the WebSQL api. Default is `true`.
  14372. */
  14373. enableWebSQL?: boolean;
  14374. /**
  14375. * Enables Chromium's experimental features. Default is `false`.
  14376. */
  14377. experimentalFeatures?: boolean;
  14378. /**
  14379. * Specifies how to run image animations (E.g. GIFs). Can be `animate`,
  14380. * `animateOnce` or `noAnimation`. Default is `animate`.
  14381. */
  14382. imageAnimationPolicy?: ('animate' | 'animateOnce' | 'noAnimation');
  14383. /**
  14384. * Enables image support. Default is `true`.
  14385. */
  14386. images?: boolean;
  14387. /**
  14388. * Enables JavaScript support. Default is `true`.
  14389. */
  14390. javascript?: boolean;
  14391. /**
  14392. * Defaults to `0`.
  14393. */
  14394. minimumFontSize?: number;
  14395. /**
  14396. * Whether dragging and dropping a file or link onto the page causes a navigation.
  14397. * Default is `false`.
  14398. */
  14399. navigateOnDragDrop?: boolean;
  14400. /**
  14401. * Whether node integration is enabled. Default is `false`.
  14402. */
  14403. nodeIntegration?: boolean;
  14404. /**
  14405. * Experimental option for enabling Node.js support in sub-frames such as iframes
  14406. * and child windows. All your preloads will load for every iframe, you can use
  14407. * `process.isMainFrame` to determine if you are in the main frame or not.
  14408. */
  14409. nodeIntegrationInSubFrames?: boolean;
  14410. /**
  14411. * Whether node integration is enabled in web workers. Default is `false`. More
  14412. * about this can be found in Multithreading.
  14413. */
  14414. nodeIntegrationInWorker?: boolean;
  14415. /**
  14416. * Whether to enable offscreen rendering for the browser window. Defaults to
  14417. * `false`. See the offscreen rendering tutorial for more details.
  14418. */
  14419. offscreen?: boolean;
  14420. /**
  14421. * Sets the session used by the page according to the session's partition string.
  14422. * If `partition` starts with `persist:`, the page will use a persistent session
  14423. * available to all pages in the app with the same `partition`. If there is no
  14424. * `persist:` prefix, the page will use an in-memory session. By assigning the same
  14425. * `partition`, multiple pages can share the same session. Default is the default
  14426. * session.
  14427. */
  14428. partition?: string;
  14429. /**
  14430. * Whether plugins should be enabled. Default is `false`.
  14431. */
  14432. plugins?: boolean;
  14433. /**
  14434. * Specifies a script that will be loaded before other scripts run in the page.
  14435. * This script will always have access to node APIs no matter whether node
  14436. * integration is turned on or off. The value should be the absolute file path to
  14437. * the script. When node integration is turned off, the preload script can
  14438. * reintroduce Node global symbols back to the global scope. See example here.
  14439. */
  14440. preload?: string;
  14441. /**
  14442. * Whether to enable browser style consecutive dialog protection. Default is
  14443. * `false`.
  14444. */
  14445. safeDialogs?: boolean;
  14446. /**
  14447. * The message to display when consecutive dialog protection is triggered. If not
  14448. * defined the default message would be used, note that currently the default
  14449. * message is in English and not localized.
  14450. */
  14451. safeDialogsMessage?: string;
  14452. /**
  14453. * If set, this will sandbox the renderer associated with the window, making it
  14454. * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
  14455. * This is not the same as the `nodeIntegration` option and the APIs available to
  14456. * the preload script are more limited. Read more about the option here.
  14457. */
  14458. sandbox?: boolean;
  14459. /**
  14460. * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
  14461. *
  14462. * @platform darwin
  14463. */
  14464. scrollBounce?: boolean;
  14465. /**
  14466. * Sets the session used by the page. Instead of passing the Session object
  14467. * directly, you can also choose to use the `partition` option instead, which
  14468. * accepts a partition string. When both `session` and `partition` are provided,
  14469. * `session` will be preferred. Default is the default session.
  14470. */
  14471. session?: Session;
  14472. /**
  14473. * Whether to enable the builtin spellchecker. Default is `true`.
  14474. */
  14475. spellcheck?: boolean;
  14476. /**
  14477. * Make TextArea elements resizable. Default is `true`.
  14478. */
  14479. textAreasAreResizable?: boolean;
  14480. /**
  14481. * Enforces the v8 code caching policy used by blink. Accepted values are
  14482. */
  14483. v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
  14484. /**
  14485. * Enables WebGL support. Default is `true`.
  14486. */
  14487. webgl?: boolean;
  14488. /**
  14489. * When `false`, it will disable the same-origin policy (usually using testing
  14490. * websites by people), and set `allowRunningInsecureContent` to `true` if this
  14491. * options has not been set by user. Default is `true`.
  14492. */
  14493. webSecurity?: boolean;
  14494. /**
  14495. * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
  14496. * `preload` script configured for the `<webview>` will have node integration
  14497. * enabled when it is executed so you should ensure remote/untrusted content is not
  14498. * able to create a `<webview>` tag with a possibly malicious `preload` script. You
  14499. * can use the `will-attach-webview` event on webContents to strip away the
  14500. * `preload` script and to validate or alter the `<webview>`'s initial settings.
  14501. */
  14502. webviewTag?: boolean;
  14503. /**
  14504. * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
  14505. */
  14506. zoomFactor?: number;
  14507. }
  14508. class WebRequest {
  14509. // Docs: https://electronjs.org/docs/api/web-request
  14510. /**
  14511. * The `listener` will be called with `listener(details)` when a server initiated
  14512. * redirect is about to occur.
  14513. */
  14514. onBeforeRedirect(filter: WebRequestFilter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  14515. /**
  14516. * The `listener` will be called with `listener(details)` when a server initiated
  14517. * redirect is about to occur.
  14518. */
  14519. onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  14520. /**
  14521. * The `listener` will be called with `listener(details, callback)` when a request
  14522. * is about to occur.
  14523. *
  14524. * The `uploadData` is an array of `UploadData` objects.
  14525. *
  14526. * The `callback` has to be called with an `response` object.
  14527. *
  14528. * Some examples of valid `urls`:
  14529. */
  14530. onBeforeRequest(filter: WebRequestFilter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
  14531. /**
  14532. * The `listener` will be called with `listener(details, callback)` when a request
  14533. * is about to occur.
  14534. *
  14535. * The `uploadData` is an array of `UploadData` objects.
  14536. *
  14537. * The `callback` has to be called with an `response` object.
  14538. *
  14539. * Some examples of valid `urls`:
  14540. */
  14541. onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) => void) => void) | (null)): void;
  14542. /**
  14543. * The `listener` will be called with `listener(details, callback)` before sending
  14544. * an HTTP request, once the request headers are available. This may occur after a
  14545. * TCP connection is made to the server, but before any http data is sent.
  14546. *
  14547. * The `callback` has to be called with a `response` object.
  14548. */
  14549. onBeforeSendHeaders(filter: WebRequestFilter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  14550. /**
  14551. * The `listener` will be called with `listener(details, callback)` before sending
  14552. * an HTTP request, once the request headers are available. This may occur after a
  14553. * TCP connection is made to the server, but before any http data is sent.
  14554. *
  14555. * The `callback` has to be called with a `response` object.
  14556. */
  14557. onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  14558. /**
  14559. * The `listener` will be called with `listener(details)` when a request is
  14560. * completed.
  14561. */
  14562. onCompleted(filter: WebRequestFilter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  14563. /**
  14564. * The `listener` will be called with `listener(details)` when a request is
  14565. * completed.
  14566. */
  14567. onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  14568. /**
  14569. * The `listener` will be called with `listener(details)` when an error occurs.
  14570. */
  14571. onErrorOccurred(filter: WebRequestFilter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  14572. /**
  14573. * The `listener` will be called with `listener(details)` when an error occurs.
  14574. */
  14575. onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  14576. /**
  14577. * The `listener` will be called with `listener(details, callback)` when HTTP
  14578. * response headers of a request have been received.
  14579. *
  14580. * The `callback` has to be called with a `response` object.
  14581. */
  14582. onHeadersReceived(filter: WebRequestFilter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  14583. /**
  14584. * The `listener` will be called with `listener(details, callback)` when HTTP
  14585. * response headers of a request have been received.
  14586. *
  14587. * The `callback` has to be called with a `response` object.
  14588. */
  14589. onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  14590. /**
  14591. * The `listener` will be called with `listener(details)` when first byte of the
  14592. * response body is received. For HTTP requests, this means that the status line
  14593. * and response headers are available.
  14594. */
  14595. onResponseStarted(filter: WebRequestFilter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  14596. /**
  14597. * The `listener` will be called with `listener(details)` when first byte of the
  14598. * response body is received. For HTTP requests, this means that the status line
  14599. * and response headers are available.
  14600. */
  14601. onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  14602. /**
  14603. * The `listener` will be called with `listener(details)` just before a request is
  14604. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  14605. * response are visible by the time this listener is fired.
  14606. */
  14607. onSendHeaders(filter: WebRequestFilter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  14608. /**
  14609. * The `listener` will be called with `listener(details)` just before a request is
  14610. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  14611. * response are visible by the time this listener is fired.
  14612. */
  14613. onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  14614. }
  14615. interface WebRequestFilter {
  14616. // Docs: https://electronjs.org/docs/api/structures/web-request-filter
  14617. /**
  14618. * Array of types that will be used to filter out the requests that do not match
  14619. * the types. When not specified, all types will be matched. Can be `mainFrame`,
  14620. * `subFrame`, `stylesheet`, `script`, `image`, `font`, `object`, `xhr`, `ping`,
  14621. * `cspReport`, `media` or `webSocket`.
  14622. */
  14623. types?: Array<'mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket'>;
  14624. /**
  14625. * Array of URL patterns that will be used to filter out the requests that do not
  14626. * match the URL patterns.
  14627. */
  14628. urls: string[];
  14629. }
  14630. interface WebSource {
  14631. // Docs: https://electronjs.org/docs/api/structures/web-source
  14632. code: string;
  14633. url?: string;
  14634. }
  14635. interface WebviewTag extends HTMLElement {
  14636. // Docs: https://electronjs.org/docs/api/webview-tag
  14637. /**
  14638. * Fired when a load has committed. This includes navigation within the current
  14639. * document as well as subframe document-level loads, but does not include
  14640. * asynchronous resource loads.
  14641. */
  14642. addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
  14643. removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
  14644. /**
  14645. * Fired when the navigation is done, i.e. the spinner of the tab will stop
  14646. * spinning, and the `onload` event is dispatched.
  14647. */
  14648. addEventListener(event: 'did-finish-load', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14649. removeEventListener(event: 'did-finish-load', listener: (event: DOMEvent) => void): this;
  14650. /**
  14651. * This event is like `did-finish-load`, but fired when the load failed or was
  14652. * cancelled, e.g. `window.stop()` is invoked.
  14653. */
  14654. addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
  14655. removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
  14656. /**
  14657. * Fired when a frame has done navigation.
  14658. */
  14659. addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
  14660. removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
  14661. /**
  14662. * Corresponds to the points in time when the spinner of the tab starts spinning.
  14663. */
  14664. addEventListener(event: 'did-start-loading', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14665. removeEventListener(event: 'did-start-loading', listener: (event: DOMEvent) => void): this;
  14666. /**
  14667. * Corresponds to the points in time when the spinner of the tab stops spinning.
  14668. */
  14669. addEventListener(event: 'did-stop-loading', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14670. removeEventListener(event: 'did-stop-loading', listener: (event: DOMEvent) => void): this;
  14671. /**
  14672. * Fired when attached to the embedder web contents.
  14673. */
  14674. addEventListener(event: 'did-attach', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14675. removeEventListener(event: 'did-attach', listener: (event: DOMEvent) => void): this;
  14676. /**
  14677. * Fired when document in the given frame is loaded.
  14678. */
  14679. addEventListener(event: 'dom-ready', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14680. removeEventListener(event: 'dom-ready', listener: (event: DOMEvent) => void): this;
  14681. /**
  14682. * Fired when page title is set during navigation. `explicitSet` is false when
  14683. * title is synthesized from file url.
  14684. */
  14685. addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
  14686. removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
  14687. /**
  14688. * Fired when page receives favicon urls.
  14689. */
  14690. addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
  14691. removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
  14692. /**
  14693. * Fired when page enters fullscreen triggered by HTML API.
  14694. */
  14695. addEventListener(event: 'enter-html-full-screen', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14696. removeEventListener(event: 'enter-html-full-screen', listener: (event: DOMEvent) => void): this;
  14697. /**
  14698. * Fired when page leaves fullscreen triggered by HTML API.
  14699. */
  14700. addEventListener(event: 'leave-html-full-screen', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14701. removeEventListener(event: 'leave-html-full-screen', listener: (event: DOMEvent) => void): this;
  14702. /**
  14703. * Fired when the guest window logs a console message.
  14704. *
  14705. * The following example code forwards all log messages to the embedder's console
  14706. * without regard for log level or other properties.
  14707. */
  14708. addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
  14709. removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
  14710. /**
  14711. * Fired when a result is available for `webview.findInPage` request.
  14712. */
  14713. addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
  14714. removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
  14715. /**
  14716. * Emitted when a user or the page wants to start navigation. It can happen when
  14717. * the `window.location` object is changed or a user clicks a link in the page.
  14718. *
  14719. * This event will not emit when the navigation is started programmatically with
  14720. * APIs like `<webview>.loadURL` and `<webview>.back`.
  14721. *
  14722. * It is also not emitted during in-page navigation, such as clicking anchor links
  14723. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  14724. * this purpose.
  14725. *
  14726. * Calling `event.preventDefault()` does **NOT** have any effect.
  14727. */
  14728. addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
  14729. removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
  14730. /**
  14731. * Emitted when a user or the page wants to start navigation anywhere in the
  14732. * `<webview>` or any frames embedded within. It can happen when the
  14733. * `window.location` object is changed or a user clicks a link in the page.
  14734. *
  14735. * This event will not emit when the navigation is started programmatically with
  14736. * APIs like `<webview>.loadURL` and `<webview>.back`.
  14737. *
  14738. * It is also not emitted during in-page navigation, such as clicking anchor links
  14739. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  14740. * this purpose.
  14741. *
  14742. * Calling `event.preventDefault()` does **NOT** have any effect.
  14743. */
  14744. addEventListener(event: 'will-frame-navigate', listener: (event: WillFrameNavigateEvent) => void, useCapture?: boolean): this;
  14745. removeEventListener(event: 'will-frame-navigate', listener: (event: WillFrameNavigateEvent) => void): this;
  14746. /**
  14747. * Emitted when any frame (including main) starts navigating. `isInPlace` will be
  14748. * `true` for in-page navigations.
  14749. */
  14750. addEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void, useCapture?: boolean): this;
  14751. removeEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void): this;
  14752. /**
  14753. * Emitted after a server side redirect occurs during navigation. For example a 302
  14754. * redirect.
  14755. */
  14756. addEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void, useCapture?: boolean): this;
  14757. removeEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void): this;
  14758. /**
  14759. * Emitted when a navigation is done.
  14760. *
  14761. * This event is not emitted for in-page navigations, such as clicking anchor links
  14762. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  14763. * this purpose.
  14764. */
  14765. addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
  14766. removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
  14767. /**
  14768. * Emitted when any frame navigation is done.
  14769. *
  14770. * This event is not emitted for in-page navigations, such as clicking anchor links
  14771. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  14772. * this purpose.
  14773. */
  14774. addEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void, useCapture?: boolean): this;
  14775. removeEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void): this;
  14776. /**
  14777. * Emitted when an in-page navigation happened.
  14778. *
  14779. * When in-page navigation happens, the page URL changes but does not cause
  14780. * navigation outside of the page. Examples of this occurring are when anchor links
  14781. * are clicked or when the DOM `hashchange` event is triggered.
  14782. */
  14783. addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
  14784. removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
  14785. /**
  14786. * Fired when the guest page attempts to close itself.
  14787. *
  14788. * The following example code navigates the `webview` to `about:blank` when the
  14789. * guest attempts to close itself.
  14790. */
  14791. addEventListener(event: 'close', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14792. removeEventListener(event: 'close', listener: (event: DOMEvent) => void): this;
  14793. /**
  14794. * Fired when the guest page has sent an asynchronous message to embedder page.
  14795. *
  14796. * With `sendToHost` method and `ipc-message` event you can communicate between
  14797. * guest page and embedder page:
  14798. */
  14799. addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
  14800. removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
  14801. /**
  14802. * Fired when the renderer process crashes or is killed.
  14803. *
  14804. * **Deprecated:** This event is superceded by the `render-process-gone` event
  14805. * which contains more information about why the render process disappeared. It
  14806. * isn't always because it crashed.
  14807. *
  14808. * @deprecated
  14809. */
  14810. addEventListener(event: 'crashed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14811. /**
  14812. * @deprecated
  14813. */
  14814. removeEventListener(event: 'crashed', listener: (event: DOMEvent) => void): this;
  14815. /**
  14816. * Fired when the renderer process unexpectedly disappears. This is normally
  14817. * because it was crashed or killed.
  14818. */
  14819. addEventListener(event: 'render-process-gone', listener: (event: RenderProcessGoneEvent) => void, useCapture?: boolean): this;
  14820. removeEventListener(event: 'render-process-gone', listener: (event: RenderProcessGoneEvent) => void): this;
  14821. /**
  14822. * Fired when a plugin process is crashed.
  14823. */
  14824. addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
  14825. removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
  14826. /**
  14827. * Fired when the WebContents is destroyed.
  14828. */
  14829. addEventListener(event: 'destroyed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14830. removeEventListener(event: 'destroyed', listener: (event: DOMEvent) => void): this;
  14831. /**
  14832. * Emitted when media starts playing.
  14833. */
  14834. addEventListener(event: 'media-started-playing', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14835. removeEventListener(event: 'media-started-playing', listener: (event: DOMEvent) => void): this;
  14836. /**
  14837. * Emitted when media is paused or done playing.
  14838. */
  14839. addEventListener(event: 'media-paused', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14840. removeEventListener(event: 'media-paused', listener: (event: DOMEvent) => void): this;
  14841. /**
  14842. * Emitted when a page's theme color changes. This is usually due to encountering a
  14843. * meta tag:
  14844. */
  14845. addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
  14846. removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
  14847. /**
  14848. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  14849. */
  14850. addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
  14851. removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
  14852. /**
  14853. * Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for
  14854. * a link in its context menu.
  14855. */
  14856. addEventListener(event: 'devtools-open-url', listener: (event: DevtoolsOpenUrlEvent) => void, useCapture?: boolean): this;
  14857. removeEventListener(event: 'devtools-open-url', listener: (event: DevtoolsOpenUrlEvent) => void): this;
  14858. /**
  14859. * Emitted when DevTools is opened.
  14860. */
  14861. addEventListener(event: 'devtools-opened', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14862. removeEventListener(event: 'devtools-opened', listener: (event: DOMEvent) => void): this;
  14863. /**
  14864. * Emitted when DevTools is closed.
  14865. */
  14866. addEventListener(event: 'devtools-closed', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14867. removeEventListener(event: 'devtools-closed', listener: (event: DOMEvent) => void): this;
  14868. /**
  14869. * Emitted when DevTools is focused / opened.
  14870. */
  14871. addEventListener(event: 'devtools-focused', listener: (event: DOMEvent) => void, useCapture?: boolean): this;
  14872. removeEventListener(event: 'devtools-focused', listener: (event: DOMEvent) => void): this;
  14873. /**
  14874. * Emitted when there is a new context menu that needs to be handled.
  14875. */
  14876. addEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void, useCapture?: boolean): this;
  14877. removeEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void): this;
  14878. addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  14879. addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  14880. removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  14881. removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  14882. /**
  14883. * Adjusts the current text selection starting and ending points in the focused
  14884. * frame by the given amounts. A negative amount moves the selection towards the
  14885. * beginning of the document, and a positive amount moves the selection towards the
  14886. * end of the document.
  14887. *
  14888. * See `webContents.adjustSelection` for examples.
  14889. */
  14890. adjustSelection(options: AdjustSelectionOptions): void;
  14891. /**
  14892. * Whether the guest page can go back.
  14893. */
  14894. canGoBack(): boolean;
  14895. /**
  14896. * Whether the guest page can go forward.
  14897. */
  14898. canGoForward(): boolean;
  14899. /**
  14900. * Whether the guest page can go to `offset`.
  14901. */
  14902. canGoToOffset(offset: number): boolean;
  14903. /**
  14904. * Resolves with a NativeImage
  14905. *
  14906. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  14907. * whole visible page.
  14908. */
  14909. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  14910. /**
  14911. * Centers the current text selection in page.
  14912. */
  14913. centerSelection(): void;
  14914. /**
  14915. * Clears the navigation history.
  14916. */
  14917. clearHistory(): void;
  14918. /**
  14919. * Closes the DevTools window of guest page.
  14920. */
  14921. closeDevTools(): void;
  14922. /**
  14923. * Executes editing command `copy` in page.
  14924. */
  14925. copy(): void;
  14926. /**
  14927. * Executes editing command `cut` in page.
  14928. */
  14929. cut(): void;
  14930. /**
  14931. * Executes editing command `delete` in page.
  14932. */
  14933. delete(): void;
  14934. /**
  14935. * Initiates a download of the resource at `url` without navigating.
  14936. */
  14937. downloadURL(url: string, options?: DownloadURLOptions): void;
  14938. /**
  14939. * A promise that resolves with the result of the executed code or is rejected if
  14940. * the result of the code is a rejected promise.
  14941. *
  14942. * Evaluates `code` in page. If `userGesture` is set, it will create the user
  14943. * gesture context in the page. HTML APIs like `requestFullScreen`, which require
  14944. * user action, can take advantage of this option for automation.
  14945. */
  14946. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  14947. /**
  14948. * The request id used for the request.
  14949. *
  14950. * Starts a request to find all matches for the `text` in the web page. The result
  14951. * of the request can be obtained by subscribing to `found-in-page` event.
  14952. */
  14953. findInPage(text: string, options?: FindInPageOptions): number;
  14954. /**
  14955. * The title of guest page.
  14956. */
  14957. getTitle(): string;
  14958. /**
  14959. * The URL of guest page.
  14960. */
  14961. getURL(): string;
  14962. /**
  14963. * The user agent for guest page.
  14964. */
  14965. getUserAgent(): string;
  14966. /**
  14967. * The WebContents ID of this `webview`.
  14968. */
  14969. getWebContentsId(): number;
  14970. /**
  14971. * the current zoom factor.
  14972. */
  14973. getZoomFactor(): number;
  14974. /**
  14975. * the current zoom level.
  14976. */
  14977. getZoomLevel(): number;
  14978. /**
  14979. * Makes the guest page go back.
  14980. */
  14981. goBack(): void;
  14982. /**
  14983. * Makes the guest page go forward.
  14984. */
  14985. goForward(): void;
  14986. /**
  14987. * Navigates to the specified absolute index.
  14988. */
  14989. goToIndex(index: number): void;
  14990. /**
  14991. * Navigates to the specified offset from the "current entry".
  14992. */
  14993. goToOffset(offset: number): void;
  14994. /**
  14995. * A promise that resolves with a key for the inserted CSS that can later be used
  14996. * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
  14997. *
  14998. * Injects CSS into the current web page and returns a unique key for the inserted
  14999. * stylesheet.
  15000. */
  15001. insertCSS(css: string): Promise<string>;
  15002. /**
  15003. * Inserts `text` to the focused element.
  15004. */
  15005. insertText(text: string): Promise<void>;
  15006. /**
  15007. * Starts inspecting element at position (`x`, `y`) of guest page.
  15008. */
  15009. inspectElement(x: number, y: number): void;
  15010. /**
  15011. * Opens the DevTools for the service worker context present in the guest page.
  15012. */
  15013. inspectServiceWorker(): void;
  15014. /**
  15015. * Opens the DevTools for the shared worker context present in the guest page.
  15016. */
  15017. inspectSharedWorker(): void;
  15018. /**
  15019. * Whether guest page has been muted.
  15020. */
  15021. isAudioMuted(): boolean;
  15022. /**
  15023. * Whether the renderer process has crashed.
  15024. */
  15025. isCrashed(): boolean;
  15026. /**
  15027. * Whether audio is currently playing.
  15028. */
  15029. isCurrentlyAudible(): boolean;
  15030. /**
  15031. * Whether DevTools window of guest page is focused.
  15032. */
  15033. isDevToolsFocused(): boolean;
  15034. /**
  15035. * Whether guest page has a DevTools window attached.
  15036. */
  15037. isDevToolsOpened(): boolean;
  15038. /**
  15039. * Whether guest page is still loading resources.
  15040. */
  15041. isLoading(): boolean;
  15042. /**
  15043. * Whether the main frame (and not just iframes or frames within it) is still
  15044. * loading.
  15045. */
  15046. isLoadingMainFrame(): boolean;
  15047. /**
  15048. * Whether the guest page is waiting for a first-response for the main resource of
  15049. * the page.
  15050. */
  15051. isWaitingForResponse(): boolean;
  15052. /**
  15053. * The promise will resolve when the page has finished loading (see
  15054. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  15055. *
  15056. * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
  15057. * the `http://` or `file://`.
  15058. */
  15059. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  15060. /**
  15061. * Opens a DevTools window for guest page.
  15062. */
  15063. openDevTools(): void;
  15064. /**
  15065. * Executes editing command `paste` in page.
  15066. */
  15067. paste(): void;
  15068. /**
  15069. * Executes editing command `pasteAndMatchStyle` in page.
  15070. */
  15071. pasteAndMatchStyle(): void;
  15072. /**
  15073. * Prints `webview`'s web page. Same as `webContents.print([options])`.
  15074. */
  15075. print(options?: WebviewTagPrintOptions): Promise<void>;
  15076. /**
  15077. * Resolves with the generated PDF data.
  15078. *
  15079. * Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
  15080. */
  15081. printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
  15082. /**
  15083. * Executes editing command `redo` in page.
  15084. */
  15085. redo(): void;
  15086. /**
  15087. * Reloads the guest page.
  15088. */
  15089. reload(): void;
  15090. /**
  15091. * Reloads the guest page and ignores cache.
  15092. */
  15093. reloadIgnoringCache(): void;
  15094. /**
  15095. * Resolves if the removal was successful.
  15096. *
  15097. * Removes the inserted CSS from the current web page. The stylesheet is identified
  15098. * by its key, which is returned from `<webview>.insertCSS(css)`.
  15099. */
  15100. removeInsertedCSS(key: string): Promise<void>;
  15101. /**
  15102. * Executes editing command `replace` in page.
  15103. */
  15104. replace(text: string): void;
  15105. /**
  15106. * Executes editing command `replaceMisspelling` in page.
  15107. */
  15108. replaceMisspelling(text: string): void;
  15109. /**
  15110. * Scrolls to the bottom of the current `<webview>`.
  15111. */
  15112. scrollToBottom(): void;
  15113. /**
  15114. * Scrolls to the top of the current `<webview>`.
  15115. */
  15116. scrollToTop(): void;
  15117. /**
  15118. * Executes editing command `selectAll` in page.
  15119. */
  15120. selectAll(): void;
  15121. /**
  15122. * Send an asynchronous message to renderer process via `channel`, you can also
  15123. * send arbitrary arguments. The renderer process can handle the message by
  15124. * listening to the `channel` event with the `ipcRenderer` module.
  15125. *
  15126. * See webContents.send for examples.
  15127. */
  15128. send(channel: string, ...args: any[]): Promise<void>;
  15129. /**
  15130. * Sends an input `event` to the page.
  15131. *
  15132. * See webContents.sendInputEvent for detailed description of `event` object.
  15133. */
  15134. sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
  15135. /**
  15136. * Send an asynchronous message to renderer process via `channel`, you can also
  15137. * send arbitrary arguments. The renderer process can handle the message by
  15138. * listening to the `channel` event with the `ipcRenderer` module.
  15139. *
  15140. * See webContents.sendToFrame for examples.
  15141. */
  15142. sendToFrame(frameId: [number, number], channel: string, ...args: any[]): Promise<void>;
  15143. /**
  15144. * Set guest page muted.
  15145. */
  15146. setAudioMuted(muted: boolean): void;
  15147. /**
  15148. * Overrides the user agent for the guest page.
  15149. */
  15150. setUserAgent(userAgent: string): void;
  15151. /**
  15152. * Sets the maximum and minimum pinch-to-zoom level.
  15153. */
  15154. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  15155. /**
  15156. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  15157. * divided by 100, so 300% = 3.0.
  15158. */
  15159. setZoomFactor(factor: number): void;
  15160. /**
  15161. * Changes the zoom level to the specified level. The original size is 0 and each
  15162. * increment above or below represents zooming 20% larger or smaller to default
  15163. * limits of 300% and 50% of original size, respectively. The formula for this is
  15164. * `scale := 1.2 ^ level`.
  15165. *
  15166. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  15167. * the zoom level for a specific domain propagates across all instances of windows
  15168. * with the same domain. Differentiating the window URLs will make zoom work
  15169. * per-window.
  15170. */
  15171. setZoomLevel(level: number): void;
  15172. /**
  15173. * Shows pop-up dictionary that searches the selected word on the page.
  15174. *
  15175. * @platform darwin
  15176. */
  15177. showDefinitionForSelection(): void;
  15178. /**
  15179. * Stops any pending navigation.
  15180. */
  15181. stop(): void;
  15182. /**
  15183. * Stops any `findInPage` request for the `webview` with the provided `action`.
  15184. */
  15185. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  15186. /**
  15187. * Executes editing command `undo` in page.
  15188. */
  15189. undo(): void;
  15190. /**
  15191. * Executes editing command `unselect` in page.
  15192. */
  15193. unselect(): void;
  15194. /**
  15195. * A `boolean`. When this attribute is present the guest page will be allowed to
  15196. * open new windows. Popups are disabled by default.
  15197. */
  15198. allowpopups: boolean;
  15199. /**
  15200. * A `string` which is a list of strings which specifies the blink features to be
  15201. * disabled separated by `,`. The full list of supported feature strings can be
  15202. * found in the RuntimeEnabledFeatures.json5 file.
  15203. */
  15204. disableblinkfeatures: string;
  15205. /**
  15206. * A `boolean`. When this attribute is present the guest page will have web
  15207. * security disabled. Web security is enabled by default.
  15208. *
  15209. * This value can only be modified before the first navigation.
  15210. */
  15211. disablewebsecurity: boolean;
  15212. /**
  15213. * A `string` which is a list of strings which specifies the blink features to be
  15214. * enabled separated by `,`. The full list of supported feature strings can be
  15215. * found in the RuntimeEnabledFeatures.json5 file.
  15216. */
  15217. enableblinkfeatures: string;
  15218. /**
  15219. * A `string` that sets the referrer URL for the guest page.
  15220. */
  15221. httpreferrer: string;
  15222. /**
  15223. * A `boolean`. When this attribute is present the guest page in `webview` will
  15224. * have node integration and can use node APIs like `require` and `process` to
  15225. * access low level system resources. Node integration is disabled by default in
  15226. * the guest page.
  15227. */
  15228. nodeintegration: boolean;
  15229. /**
  15230. * A `boolean` for the experimental option for enabling NodeJS support in
  15231. * sub-frames such as iframes inside the `webview`. All your preloads will load for
  15232. * every iframe, you can use `process.isMainFrame` to determine if you are in the
  15233. * main frame or not. This option is disabled by default in the guest page.
  15234. */
  15235. nodeintegrationinsubframes: boolean;
  15236. /**
  15237. * A `string` that sets the session used by the page. If `partition` starts with
  15238. * `persist:`, the page will use a persistent session available to all pages in the
  15239. * app with the same `partition`. if there is no `persist:` prefix, the page will
  15240. * use an in-memory session. By assigning the same `partition`, multiple pages can
  15241. * share the same session. If the `partition` is unset then default session of the
  15242. * app will be used.
  15243. *
  15244. * This value can only be modified before the first navigation, since the session
  15245. * of an active renderer process cannot change. Subsequent attempts to modify the
  15246. * value will fail with a DOM exception.
  15247. */
  15248. partition: string;
  15249. /**
  15250. * A `boolean`. When this attribute is present the guest page in `webview` will be
  15251. * able to use browser plugins. Plugins are disabled by default.
  15252. */
  15253. plugins: boolean;
  15254. /**
  15255. * A `string` that specifies a script that will be loaded before other scripts run
  15256. * in the guest page. The protocol of script's URL must be `file:` (even when using
  15257. * `asar:` archives) because it will be loaded by Node's `require` under the hood,
  15258. * which treats `asar:` archives as virtual directories.
  15259. *
  15260. * When the guest page doesn't have node integration this script will still have
  15261. * access to all Node APIs, but global objects injected by Node will be deleted
  15262. * after this script has finished executing.
  15263. */
  15264. preload: string;
  15265. /**
  15266. * A `string` representing the visible URL. Writing to this attribute initiates
  15267. * top-level navigation.
  15268. *
  15269. * Assigning `src` its own value will reload the current page.
  15270. *
  15271. * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
  15272. * world!`.
  15273. */
  15274. src: string;
  15275. /**
  15276. * A `string` that sets the user agent for the guest page before the page is
  15277. * navigated to. Once the page is loaded, use the `setUserAgent` method to change
  15278. * the user agent.
  15279. */
  15280. useragent: string;
  15281. /**
  15282. * A `string` which is a comma separated list of strings which specifies the web
  15283. * preferences to be set on the webview. The full list of supported preference
  15284. * strings can be found in BrowserWindow.
  15285. *
  15286. * The string follows the same format as the features string in `window.open`. A
  15287. * name by itself is given a `true` boolean value. A preference can be set to
  15288. * another value by including an `=`, followed by the value. Special values `yes`
  15289. * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
  15290. * `false`.
  15291. */
  15292. webpreferences: string;
  15293. }
  15294. interface AboutPanelOptionsOptions {
  15295. /**
  15296. * The app's name.
  15297. */
  15298. applicationName?: string;
  15299. /**
  15300. * The app's version.
  15301. */
  15302. applicationVersion?: string;
  15303. /**
  15304. * Copyright information.
  15305. */
  15306. copyright?: string;
  15307. /**
  15308. * The app's build version number.
  15309. *
  15310. * @platform darwin
  15311. */
  15312. version?: string;
  15313. /**
  15314. * Credit information.
  15315. *
  15316. * @platform darwin,win32
  15317. */
  15318. credits?: string;
  15319. /**
  15320. * List of app authors.
  15321. *
  15322. * @platform linux
  15323. */
  15324. authors?: string[];
  15325. /**
  15326. * The app's website.
  15327. *
  15328. * @platform linux
  15329. */
  15330. website?: string;
  15331. /**
  15332. * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
  15333. * 64x64 pixels while retaining aspect ratio.
  15334. *
  15335. * @platform linux,win32
  15336. */
  15337. iconPath?: string;
  15338. }
  15339. interface AddRepresentationOptions {
  15340. /**
  15341. * The scale factor to add the image representation for.
  15342. */
  15343. scaleFactor?: number;
  15344. /**
  15345. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  15346. */
  15347. width?: number;
  15348. /**
  15349. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  15350. */
  15351. height?: number;
  15352. /**
  15353. * The buffer containing the raw image data.
  15354. */
  15355. buffer?: Buffer;
  15356. /**
  15357. * The data URL containing either a base 64 encoded PNG or JPEG image.
  15358. */
  15359. dataURL?: string;
  15360. }
  15361. interface AdjustSelectionOptions {
  15362. /**
  15363. * Amount to shift the start index of the current selection.
  15364. */
  15365. start?: number;
  15366. /**
  15367. * Amount to shift the end index of the current selection.
  15368. */
  15369. end?: number;
  15370. }
  15371. interface AnimationSettings {
  15372. /**
  15373. * Returns true if rich animations should be rendered. Looks at session type (e.g.
  15374. * remote desktop) and accessibility settings to give guidance for heavy
  15375. * animations.
  15376. */
  15377. shouldRenderRichAnimation: boolean;
  15378. /**
  15379. * Determines on a per-platform basis whether scroll animations (e.g. produced by
  15380. * home/end key) should be enabled.
  15381. */
  15382. scrollAnimationsEnabledBySystem: boolean;
  15383. /**
  15384. * Determines whether the user desires reduced motion based on platform APIs.
  15385. */
  15386. prefersReducedMotion: boolean;
  15387. }
  15388. interface AppDetailsOptions {
  15389. /**
  15390. * Window's App User Model ID. It has to be set, otherwise the other options will
  15391. * have no effect.
  15392. */
  15393. appId?: string;
  15394. /**
  15395. * Window's Relaunch Icon.
  15396. */
  15397. appIconPath?: string;
  15398. /**
  15399. * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
  15400. * Default is `0`.
  15401. */
  15402. appIconIndex?: number;
  15403. /**
  15404. * Window's Relaunch Command.
  15405. */
  15406. relaunchCommand?: string;
  15407. /**
  15408. * Window's Relaunch Display Name.
  15409. */
  15410. relaunchDisplayName?: string;
  15411. }
  15412. interface ApplicationInfoForProtocolReturnValue {
  15413. /**
  15414. * the display icon of the app handling the protocol.
  15415. */
  15416. icon: NativeImage;
  15417. /**
  15418. * installation path of the app handling the protocol.
  15419. */
  15420. path: string;
  15421. /**
  15422. * display name of the app handling the protocol.
  15423. */
  15424. name: string;
  15425. }
  15426. interface AuthenticationResponseDetails {
  15427. url: string;
  15428. }
  15429. interface AuthInfo {
  15430. isProxy: boolean;
  15431. scheme: string;
  15432. host: string;
  15433. port: number;
  15434. realm: string;
  15435. }
  15436. interface AutoResizeOptions {
  15437. /**
  15438. * If `true`, the view's width will grow and shrink together with the window.
  15439. * `false` by default.
  15440. */
  15441. width?: boolean;
  15442. /**
  15443. * If `true`, the view's height will grow and shrink together with the window.
  15444. * `false` by default.
  15445. */
  15446. height?: boolean;
  15447. /**
  15448. * If `true`, the view's x position and width will grow and shrink proportionally
  15449. * with the window. `false` by default.
  15450. */
  15451. horizontal?: boolean;
  15452. /**
  15453. * If `true`, the view's y position and height will grow and shrink proportionally
  15454. * with the window. `false` by default.
  15455. */
  15456. vertical?: boolean;
  15457. }
  15458. interface BeforeSendResponse {
  15459. cancel?: boolean;
  15460. /**
  15461. * When provided, request will be made with these headers.
  15462. */
  15463. requestHeaders?: Record<string, (string) | (string[])>;
  15464. }
  15465. interface BitmapOptions {
  15466. /**
  15467. * Defaults to 1.0.
  15468. */
  15469. scaleFactor?: number;
  15470. }
  15471. interface BlinkMemoryInfo {
  15472. /**
  15473. * Size of all allocated objects in Kilobytes.
  15474. */
  15475. allocated: number;
  15476. /**
  15477. * Total allocated space in Kilobytes.
  15478. */
  15479. total: number;
  15480. }
  15481. interface BluetoothPairingHandlerHandlerDetails {
  15482. deviceId: string;
  15483. /**
  15484. * The type of pairing prompt being requested. One of the following values:
  15485. */
  15486. pairingKind: ('confirm' | 'confirmPin' | 'providePin');
  15487. frame: WebFrameMain;
  15488. /**
  15489. * The pin value to verify if `pairingKind` is `confirmPin`.
  15490. */
  15491. pin?: string;
  15492. }
  15493. interface BrowserViewConstructorOptions {
  15494. /**
  15495. * Settings of web page's features.
  15496. */
  15497. webPreferences?: WebPreferences;
  15498. }
  15499. interface CallbackResponse {
  15500. cancel?: boolean;
  15501. /**
  15502. * The original request is prevented from being sent or completed and is instead
  15503. * redirected to the given URL.
  15504. */
  15505. redirectURL?: string;
  15506. }
  15507. interface CertificateTrustDialogOptions {
  15508. /**
  15509. * The certificate to trust/import.
  15510. */
  15511. certificate: Certificate;
  15512. /**
  15513. * The message to display to the user.
  15514. */
  15515. message: string;
  15516. }
  15517. interface ClearCodeCachesOptions {
  15518. /**
  15519. * An array of url corresponding to the resource whose generated code cache needs
  15520. * to be removed. If the list is empty then all entries in the cache directory will
  15521. * be removed.
  15522. */
  15523. urls?: string[];
  15524. }
  15525. interface ClearStorageDataOptions {
  15526. /**
  15527. * Should follow `window.location.origin`’s representation `scheme://host:port`.
  15528. */
  15529. origin?: string;
  15530. /**
  15531. * The types of storages to clear, can be `cookies`, `filesystem`, `indexdb`,
  15532. * `localstorage`, `shadercache`, `websql`, `serviceworkers`, `cachestorage`. If
  15533. * not specified, clear all storage types.
  15534. */
  15535. storages?: Array<'cookies' | 'filesystem' | 'indexdb' | 'localstorage' | 'shadercache' | 'websql' | 'serviceworkers' | 'cachestorage'>;
  15536. /**
  15537. * The types of quotas to clear, can be `temporary`, `syncable`. If not specified,
  15538. * clear all quotas.
  15539. */
  15540. quotas?: Array<'temporary' | 'syncable'>;
  15541. }
  15542. interface ClientRequestConstructorOptions {
  15543. /**
  15544. * The HTTP request method. Defaults to the GET method.
  15545. */
  15546. method?: string;
  15547. /**
  15548. * The request URL. Must be provided in the absolute form with the protocol scheme
  15549. * specified as http or https.
  15550. */
  15551. url?: string;
  15552. /**
  15553. * Headers to be sent with the request.
  15554. */
  15555. headers?: Record<string, (string) | (string[])>;
  15556. /**
  15557. * The `Session` instance with which the request is associated.
  15558. */
  15559. session?: Session;
  15560. /**
  15561. * The name of the `partition` with which the request is associated. Defaults to
  15562. * the empty string. The `session` option supersedes `partition`. Thus if a
  15563. * `session` is explicitly specified, `partition` is ignored.
  15564. */
  15565. partition?: string;
  15566. /**
  15567. * Can be `include`, `omit` or `same-origin`. Whether to send credentials with this
  15568. * request. If set to `include`, credentials from the session associated with the
  15569. * request will be used. If set to `omit`, credentials will not be sent with the
  15570. * request (and the `'login'` event will not be triggered in the event of a 401).
  15571. * If set to `same-origin`, `origin` must also be specified. This matches the
  15572. * behavior of the fetch option of the same name. If this option is not specified,
  15573. * authentication data from the session will be sent, and cookies will not be sent
  15574. * (unless `useSessionCookies` is set).
  15575. */
  15576. credentials?: ('include' | 'omit' | 'same-origin');
  15577. /**
  15578. * Whether to send cookies with this request from the provided session. If
  15579. * `credentials` is specified, this option has no effect. Default is `false`.
  15580. */
  15581. useSessionCookies?: boolean;
  15582. /**
  15583. * Can be `http:` or `https:`. The protocol scheme in the form 'scheme:'. Defaults
  15584. * to 'http:'.
  15585. */
  15586. protocol?: ('http:' | 'https:');
  15587. /**
  15588. * The server host provided as a concatenation of the hostname and the port number
  15589. * 'hostname:port'.
  15590. */
  15591. host?: string;
  15592. /**
  15593. * The server host name.
  15594. */
  15595. hostname?: string;
  15596. /**
  15597. * The server's listening port number.
  15598. */
  15599. port?: number;
  15600. /**
  15601. * The path part of the request URL.
  15602. */
  15603. path?: string;
  15604. /**
  15605. * Can be `follow`, `error` or `manual`. The redirect mode for this request. When
  15606. * mode is `error`, any redirection will be aborted. When mode is `manual` the
  15607. * redirection will be cancelled unless `request.followRedirect` is invoked
  15608. * synchronously during the `redirect` event. Defaults to `follow`.
  15609. */
  15610. redirect?: ('follow' | 'error' | 'manual');
  15611. /**
  15612. * The origin URL of the request.
  15613. */
  15614. origin?: string;
  15615. /**
  15616. * can be `""`, `no-referrer`, `no-referrer-when-downgrade`, `origin`,
  15617. * `origin-when-cross-origin`, `unsafe-url`, `same-origin`, `strict-origin`, or
  15618. * `strict-origin-when-cross-origin`. Defaults to
  15619. * `strict-origin-when-cross-origin`.
  15620. */
  15621. referrerPolicy?: string;
  15622. /**
  15623. * can be `default`, `no-store`, `reload`, `no-cache`, `force-cache` or
  15624. * `only-if-cached`.
  15625. */
  15626. cache?: ('default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached');
  15627. }
  15628. interface CloseOpts {
  15629. /**
  15630. * if true, fire the `beforeunload` event before closing the page. If the page
  15631. * prevents the unload, the WebContents will not be closed. The
  15632. * `will-prevent-unload` will be fired if the page requests prevention of unload.
  15633. */
  15634. waitForBeforeUnload: boolean;
  15635. }
  15636. interface Config {
  15637. /**
  15638. * Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. The minimum SSL version to allow
  15639. * when connecting to remote servers. Defaults to `tls1`.
  15640. */
  15641. minVersion?: ('tls1' | 'tls1.1' | 'tls1.2' | 'tls1.3');
  15642. /**
  15643. * Can be `tls1.2` or `tls1.3`. The maximum SSL version to allow when connecting to
  15644. * remote servers. Defaults to `tls1.3`.
  15645. */
  15646. maxVersion?: ('tls1.2' | 'tls1.3');
  15647. /**
  15648. * List of cipher suites which should be explicitly prevented from being used in
  15649. * addition to those disabled by the net built-in policy. Supported literal forms:
  15650. * 0xAABB, where AA is `cipher_suite[0]` and BB is `cipher_suite[1]`, as defined in
  15651. * RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form
  15652. * will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify
  15653. * 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note
  15654. * that TLSv1.3 ciphers cannot be disabled using this mechanism.
  15655. */
  15656. disabledCipherSuites?: number[];
  15657. }
  15658. interface ConfigureHostResolverOptions {
  15659. /**
  15660. * Whether the built-in host resolver is used in preference to getaddrinfo. When
  15661. * enabled, the built-in resolver will attempt to use the system's DNS settings to
  15662. * do DNS lookups itself. Enabled by default on macOS, disabled by default on
  15663. * Windows and Linux.
  15664. */
  15665. enableBuiltInResolver?: boolean;
  15666. /**
  15667. * Can be 'off', 'automatic' or 'secure'. Configures the DNS-over-HTTP mode. When
  15668. * 'off', no DoH lookups will be performed. When 'automatic', DoH lookups will be
  15669. * performed first if DoH is available, and insecure DNS lookups will be performed
  15670. * as a fallback. When 'secure', only DoH lookups will be performed. Defaults to
  15671. * 'automatic'.
  15672. */
  15673. secureDnsMode?: ('off' | 'automatic' | 'secure');
  15674. /**
  15675. * A list of DNS-over-HTTP server templates. See RFC8484 § 3 for details on the
  15676. * template format. Most servers support the POST method; the template for such
  15677. * servers is simply a URI. Note that for some DNS providers, the resolver will
  15678. * automatically upgrade to DoH unless DoH is explicitly disabled, even if there
  15679. * are no DoH servers provided in this list.
  15680. */
  15681. secureDnsServers?: string[];
  15682. /**
  15683. * Controls whether additional DNS query types, e.g. HTTPS (DNS type 65) will be
  15684. * allowed besides the traditional A and AAAA queries when a request is being made
  15685. * via insecure DNS. Has no effect on Secure DNS which always allows additional
  15686. * types. Defaults to true.
  15687. */
  15688. enableAdditionalDnsQueryTypes?: boolean;
  15689. }
  15690. interface ConsoleMessageEvent extends DOMEvent {
  15691. /**
  15692. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  15693. * `error`.
  15694. */
  15695. level: number;
  15696. /**
  15697. * The actual console message
  15698. */
  15699. message: string;
  15700. /**
  15701. * The line number of the source that triggered this console message
  15702. */
  15703. line: number;
  15704. sourceId: string;
  15705. }
  15706. interface ContextMenuEvent extends DOMEvent {
  15707. params: Params;
  15708. }
  15709. interface ContextMenuParams {
  15710. /**
  15711. * x coordinate.
  15712. */
  15713. x: number;
  15714. /**
  15715. * y coordinate.
  15716. */
  15717. y: number;
  15718. /**
  15719. * Frame from which the context menu was invoked.
  15720. */
  15721. frame: WebFrameMain;
  15722. /**
  15723. * URL of the link that encloses the node the context menu was invoked on.
  15724. */
  15725. linkURL: string;
  15726. /**
  15727. * Text associated with the link. May be an empty string if the contents of the
  15728. * link are an image.
  15729. */
  15730. linkText: string;
  15731. /**
  15732. * URL of the top level page that the context menu was invoked on.
  15733. */
  15734. pageURL: string;
  15735. /**
  15736. * URL of the subframe that the context menu was invoked on.
  15737. */
  15738. frameURL: string;
  15739. /**
  15740. * Source URL for the element that the context menu was invoked on. Elements with
  15741. * source URLs are images, audio and video.
  15742. */
  15743. srcURL: string;
  15744. /**
  15745. * Type of the node the context menu was invoked on. Can be `none`, `image`,
  15746. * `audio`, `video`, `canvas`, `file` or `plugin`.
  15747. */
  15748. mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
  15749. /**
  15750. * Whether the context menu was invoked on an image which has non-empty contents.
  15751. */
  15752. hasImageContents: boolean;
  15753. /**
  15754. * Whether the context is editable.
  15755. */
  15756. isEditable: boolean;
  15757. /**
  15758. * Text of the selection that the context menu was invoked on.
  15759. */
  15760. selectionText: string;
  15761. /**
  15762. * Title text of the selection that the context menu was invoked on.
  15763. */
  15764. titleText: string;
  15765. /**
  15766. * Alt text of the selection that the context menu was invoked on.
  15767. */
  15768. altText: string;
  15769. /**
  15770. * Suggested filename to be used when saving file through 'Save Link As' option of
  15771. * context menu.
  15772. */
  15773. suggestedFilename: string;
  15774. /**
  15775. * Rect representing the coordinates in the document space of the selection.
  15776. */
  15777. selectionRect: Rectangle;
  15778. /**
  15779. * Start position of the selection text.
  15780. */
  15781. selectionStartOffset: number;
  15782. /**
  15783. * The referrer policy of the frame on which the menu is invoked.
  15784. */
  15785. referrerPolicy: Referrer;
  15786. /**
  15787. * The misspelled word under the cursor, if any.
  15788. */
  15789. misspelledWord: string;
  15790. /**
  15791. * An array of suggested words to show the user to replace the `misspelledWord`.
  15792. * Only available if there is a misspelled word and spellchecker is enabled.
  15793. */
  15794. dictionarySuggestions: string[];
  15795. /**
  15796. * The character encoding of the frame on which the menu was invoked.
  15797. */
  15798. frameCharset: string;
  15799. /**
  15800. * The source that the context menu was invoked on. Possible values include `none`,
  15801. * `button-button`, `field-set`, `input-button`, `input-checkbox`, `input-color`,
  15802. * `input-date`, `input-datetime-local`, `input-email`, `input-file`,
  15803. * `input-hidden`, `input-image`, `input-month`, `input-number`, `input-password`,
  15804. * `input-radio`, `input-range`, `input-reset`, `input-search`, `input-submit`,
  15805. * `input-telephone`, `input-text`, `input-time`, `input-url`, `input-week`,
  15806. * `output`, `reset-button`, `select-list`, `select-list`, `select-multiple`,
  15807. * `select-one`, `submit-button`, and `text-area`,
  15808. */
  15809. formControlType: ('none' | 'button-button' | 'field-set' | 'input-button' | 'input-checkbox' | 'input-color' | 'input-date' | 'input-datetime-local' | 'input-email' | 'input-file' | 'input-hidden' | 'input-image' | 'input-month' | 'input-number' | 'input-password' | 'input-radio' | 'input-range' | 'input-reset' | 'input-search' | 'input-submit' | 'input-telephone' | 'input-text' | 'input-time' | 'input-url' | 'input-week' | 'output' | 'reset-button' | 'select-list' | 'select-list' | 'select-multiple' | 'select-one' | 'submit-button' | 'text-area');
  15810. /**
  15811. * If the context menu was invoked on an input field, the type of that field.
  15812. * Possible values include `none`, `plainText`, `password`, `other`.
  15813. *
  15814. * @deprecated
  15815. */
  15816. inputFieldType: ('none' | 'plainText' | 'password' | 'other');
  15817. /**
  15818. * If the context is editable, whether or not spellchecking is enabled.
  15819. */
  15820. spellcheckEnabled: boolean;
  15821. /**
  15822. * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
  15823. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  15824. * `adjustSelection`, or `adjustSelectionReset`.
  15825. */
  15826. menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  15827. /**
  15828. * The flags for the media element the context menu was invoked on.
  15829. */
  15830. mediaFlags: MediaFlags;
  15831. /**
  15832. * These flags indicate whether the renderer believes it is able to perform the
  15833. * corresponding action.
  15834. */
  15835. editFlags: EditFlags;
  15836. }
  15837. interface ContinueActivityDetails {
  15838. /**
  15839. * A string identifying the URL of the webpage accessed by the activity on another
  15840. * device, if available.
  15841. */
  15842. webpageURL?: string;
  15843. }
  15844. interface CookiesGetFilter {
  15845. /**
  15846. * Retrieves cookies which are associated with `url`. Empty implies retrieving
  15847. * cookies of all URLs.
  15848. */
  15849. url?: string;
  15850. /**
  15851. * Filters cookies by name.
  15852. */
  15853. name?: string;
  15854. /**
  15855. * Retrieves cookies whose domains match or are subdomains of `domains`.
  15856. */
  15857. domain?: string;
  15858. /**
  15859. * Retrieves cookies whose path matches `path`.
  15860. */
  15861. path?: string;
  15862. /**
  15863. * Filters cookies by their Secure property.
  15864. */
  15865. secure?: boolean;
  15866. /**
  15867. * Filters out session or persistent cookies.
  15868. */
  15869. session?: boolean;
  15870. /**
  15871. * Filters cookies by httpOnly.
  15872. */
  15873. httpOnly?: boolean;
  15874. }
  15875. interface CookiesSetDetails {
  15876. /**
  15877. * The URL to associate the cookie with. The promise will be rejected if the URL is
  15878. * invalid.
  15879. */
  15880. url: string;
  15881. /**
  15882. * The name of the cookie. Empty by default if omitted.
  15883. */
  15884. name?: string;
  15885. /**
  15886. * The value of the cookie. Empty by default if omitted.
  15887. */
  15888. value?: string;
  15889. /**
  15890. * The domain of the cookie; this will be normalized with a preceding dot so that
  15891. * it's also valid for subdomains. Empty by default if omitted.
  15892. */
  15893. domain?: string;
  15894. /**
  15895. * The path of the cookie. Empty by default if omitted.
  15896. */
  15897. path?: string;
  15898. /**
  15899. * Whether the cookie should be marked as Secure. Defaults to false unless Same
  15900. * Site=None attribute is used.
  15901. */
  15902. secure?: boolean;
  15903. /**
  15904. * Whether the cookie should be marked as HTTP only. Defaults to false.
  15905. */
  15906. httpOnly?: boolean;
  15907. /**
  15908. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  15909. * If omitted then the cookie becomes a session cookie and will not be retained
  15910. * between sessions.
  15911. */
  15912. expirationDate?: number;
  15913. /**
  15914. * The Same Site policy to apply to this cookie. Can be `unspecified`,
  15915. * `no_restriction`, `lax` or `strict`. Default is `lax`.
  15916. */
  15917. sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  15918. }
  15919. interface CrashReporterStartOptions {
  15920. /**
  15921. * URL that crash reports will be sent to as POST. Required unless `uploadToServer`
  15922. * is `false`.
  15923. */
  15924. submitURL?: string;
  15925. /**
  15926. * Defaults to `app.name`.
  15927. */
  15928. productName?: string;
  15929. /**
  15930. * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
  15931. *
  15932. * @deprecated
  15933. */
  15934. companyName?: string;
  15935. /**
  15936. * Whether crash reports should be sent to the server. If false, crash reports will
  15937. * be collected and stored in the crashes directory, but not uploaded. Default is
  15938. * `true`.
  15939. */
  15940. uploadToServer?: boolean;
  15941. /**
  15942. * If true, crashes generated in the main process will not be forwarded to the
  15943. * system crash handler. Default is `false`.
  15944. */
  15945. ignoreSystemCrashHandler?: boolean;
  15946. /**
  15947. * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
  15948. *
  15949. * @platform darwin,win32
  15950. */
  15951. rateLimit?: boolean;
  15952. /**
  15953. * If true, crash reports will be compressed and uploaded with `Content-Encoding:
  15954. * gzip`. Default is `true`.
  15955. */
  15956. compress?: boolean;
  15957. /**
  15958. * Extra string key/value annotations that will be sent along with crash reports
  15959. * that are generated in the main process. Only string values are supported.
  15960. * Crashes generated in child processes will not contain these extra parameters to
  15961. * crash reports generated from child processes, call `addExtraParameter` from the
  15962. * child process.
  15963. */
  15964. extra?: Record<string, string>;
  15965. /**
  15966. * Extra string key/value annotations that will be sent along with any crash
  15967. * reports generated in any process. These annotations cannot be changed once the
  15968. * crash reporter has been started. If a key is present in both the global extra
  15969. * parameters and the process-specific extra parameters, then the global one will
  15970. * take precedence. By default, `productName` and the app version are included, as
  15971. * well as the Electron version.
  15972. */
  15973. globalExtra?: Record<string, string>;
  15974. }
  15975. interface CreateFromBitmapOptions {
  15976. width: number;
  15977. height: number;
  15978. /**
  15979. * Defaults to 1.0.
  15980. */
  15981. scaleFactor?: number;
  15982. }
  15983. interface CreateFromBufferOptions {
  15984. /**
  15985. * Required for bitmap buffers.
  15986. */
  15987. width?: number;
  15988. /**
  15989. * Required for bitmap buffers.
  15990. */
  15991. height?: number;
  15992. /**
  15993. * Defaults to 1.0.
  15994. */
  15995. scaleFactor?: number;
  15996. }
  15997. interface CreateInterruptedDownloadOptions {
  15998. /**
  15999. * Absolute path of the download.
  16000. */
  16001. path: string;
  16002. /**
  16003. * Complete URL chain for the download.
  16004. */
  16005. urlChain: string[];
  16006. mimeType?: string;
  16007. /**
  16008. * Start range for the download.
  16009. */
  16010. offset: number;
  16011. /**
  16012. * Total length of the download.
  16013. */
  16014. length: number;
  16015. /**
  16016. * Last-Modified header value.
  16017. */
  16018. lastModified?: string;
  16019. /**
  16020. * ETag header value.
  16021. */
  16022. eTag?: string;
  16023. /**
  16024. * Time when download was started in number of seconds since UNIX epoch.
  16025. */
  16026. startTime?: number;
  16027. }
  16028. interface Data {
  16029. text?: string;
  16030. html?: string;
  16031. image?: NativeImage;
  16032. rtf?: string;
  16033. /**
  16034. * The title of the URL at `text`.
  16035. */
  16036. bookmark?: string;
  16037. }
  16038. interface DefaultFontFamily {
  16039. /**
  16040. * Defaults to `Times New Roman`.
  16041. */
  16042. standard?: string;
  16043. /**
  16044. * Defaults to `Times New Roman`.
  16045. */
  16046. serif?: string;
  16047. /**
  16048. * Defaults to `Arial`.
  16049. */
  16050. sansSerif?: string;
  16051. /**
  16052. * Defaults to `Courier New`.
  16053. */
  16054. monospace?: string;
  16055. /**
  16056. * Defaults to `Script`.
  16057. */
  16058. cursive?: string;
  16059. /**
  16060. * Defaults to `Impact`.
  16061. */
  16062. fantasy?: string;
  16063. /**
  16064. * Defaults to `Latin Modern Math`.
  16065. */
  16066. math?: string;
  16067. }
  16068. interface Details {
  16069. /**
  16070. * Process type. One of the following values:
  16071. */
  16072. type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  16073. /**
  16074. * The reason the child process is gone. Possible values:
  16075. */
  16076. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  16077. /**
  16078. * The exit code for the process (e.g. status from waitpid if on posix, from
  16079. * GetExitCodeProcess on Windows).
  16080. */
  16081. exitCode: number;
  16082. /**
  16083. * The non-localized name of the process.
  16084. */
  16085. serviceName?: string;
  16086. /**
  16087. * The name of the process. Examples for utility: `Audio Service`, `Content
  16088. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  16089. */
  16090. name?: string;
  16091. }
  16092. interface DevicePermissionHandlerHandlerDetails {
  16093. /**
  16094. * The type of device that permission is being requested on, can be `hid`,
  16095. * `serial`, or `usb`.
  16096. */
  16097. deviceType: ('hid' | 'serial' | 'usb');
  16098. /**
  16099. * The origin URL of the device permission check.
  16100. */
  16101. origin: string;
  16102. /**
  16103. * the device that permission is being requested for.
  16104. */
  16105. device: (HIDDevice) | (SerialPort) | (USBDevice);
  16106. }
  16107. interface DevtoolsOpenUrlEvent extends DOMEvent {
  16108. /**
  16109. * URL of the link that was clicked or selected.
  16110. */
  16111. url: string;
  16112. }
  16113. interface DidChangeThemeColorEvent extends DOMEvent {
  16114. themeColor: string;
  16115. }
  16116. interface DidCreateWindowDetails {
  16117. /**
  16118. * URL for the created window.
  16119. */
  16120. url: string;
  16121. /**
  16122. * Name given to the created window in the `window.open()` call.
  16123. */
  16124. frameName: string;
  16125. /**
  16126. * The options used to create the BrowserWindow. They are merged in increasing
  16127. * precedence: parsed options from the `features` string from `window.open()`,
  16128. * security-related webPreferences inherited from the parent, and options given by
  16129. * `webContents.setWindowOpenHandler`. Unrecognized options are not filtered out.
  16130. */
  16131. options: BrowserWindowConstructorOptions;
  16132. /**
  16133. * The referrer that will be passed to the new window. May or may not result in the
  16134. * `Referer` header being sent, depending on the referrer policy.
  16135. */
  16136. referrer: Referrer;
  16137. /**
  16138. * The post data that will be sent to the new window, along with the appropriate
  16139. * headers that will be set. If no post data is to be sent, the value will be
  16140. * `null`. Only defined when the window is being created by a form that set
  16141. * `target=_blank`.
  16142. */
  16143. postBody?: PostBody;
  16144. /**
  16145. * Can be `default`, `foreground-tab`, `background-tab`, `new-window` or `other`.
  16146. */
  16147. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other');
  16148. }
  16149. interface DidFailLoadEvent extends DOMEvent {
  16150. errorCode: number;
  16151. errorDescription: string;
  16152. validatedURL: string;
  16153. isMainFrame: boolean;
  16154. }
  16155. interface DidFrameFinishLoadEvent extends DOMEvent {
  16156. isMainFrame: boolean;
  16157. }
  16158. interface DidFrameNavigateEvent extends DOMEvent {
  16159. url: string;
  16160. /**
  16161. * -1 for non HTTP navigations
  16162. */
  16163. httpResponseCode: number;
  16164. /**
  16165. * empty for non HTTP navigations,
  16166. */
  16167. httpStatusText: string;
  16168. isMainFrame: boolean;
  16169. frameProcessId: number;
  16170. frameRoutingId: number;
  16171. }
  16172. interface DidNavigateEvent extends DOMEvent {
  16173. url: string;
  16174. }
  16175. interface DidNavigateInPageEvent extends DOMEvent {
  16176. isMainFrame: boolean;
  16177. url: string;
  16178. }
  16179. interface DidRedirectNavigationEvent extends DOMEvent {
  16180. url: string;
  16181. isInPlace: boolean;
  16182. isMainFrame: boolean;
  16183. frameProcessId: number;
  16184. frameRoutingId: number;
  16185. }
  16186. interface DidStartNavigationEvent extends DOMEvent {
  16187. url: string;
  16188. isInPlace: boolean;
  16189. isMainFrame: boolean;
  16190. frameProcessId: number;
  16191. frameRoutingId: number;
  16192. }
  16193. interface DisplayBalloonOptions {
  16194. /**
  16195. * Icon to use when `iconType` is `custom`.
  16196. */
  16197. icon?: (NativeImage) | (string);
  16198. /**
  16199. * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
  16200. */
  16201. iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
  16202. title: string;
  16203. content: string;
  16204. /**
  16205. * The large version of the icon should be used. Default is `true`. Maps to
  16206. * `NIIF_LARGE_ICON`.
  16207. */
  16208. largeIcon?: boolean;
  16209. /**
  16210. * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
  16211. */
  16212. noSound?: boolean;
  16213. /**
  16214. * Do not display the balloon notification if the current user is in "quiet time".
  16215. * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
  16216. */
  16217. respectQuietTime?: boolean;
  16218. }
  16219. interface DisplayMediaRequestHandlerHandlerRequest {
  16220. /**
  16221. * Frame that is requesting access to media.
  16222. */
  16223. frame: WebFrameMain;
  16224. /**
  16225. * Origin of the page making the request.
  16226. */
  16227. securityOrigin: string;
  16228. /**
  16229. * true if the web content requested a video stream.
  16230. */
  16231. videoRequested: boolean;
  16232. /**
  16233. * true if the web content requested an audio stream.
  16234. */
  16235. audioRequested: boolean;
  16236. /**
  16237. * Whether a user gesture was active when this request was triggered.
  16238. */
  16239. userGesture: boolean;
  16240. }
  16241. interface DownloadURLOptions {
  16242. /**
  16243. * HTTP request headers.
  16244. */
  16245. headers?: Record<string, string>;
  16246. }
  16247. interface EnableNetworkEmulationOptions {
  16248. /**
  16249. * Whether to emulate network outage. Defaults to false.
  16250. */
  16251. offline?: boolean;
  16252. /**
  16253. * RTT in ms. Defaults to 0 which will disable latency throttling.
  16254. */
  16255. latency?: number;
  16256. /**
  16257. * Download rate in Bps. Defaults to 0 which will disable download throttling.
  16258. */
  16259. downloadThroughput?: number;
  16260. /**
  16261. * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
  16262. */
  16263. uploadThroughput?: number;
  16264. }
  16265. interface FeedURLOptions {
  16266. url: string;
  16267. /**
  16268. * HTTP request headers.
  16269. *
  16270. * @platform darwin
  16271. */
  16272. headers?: Record<string, string>;
  16273. /**
  16274. * Can be `json` or `default`, see the Squirrel.Mac README for more information.
  16275. *
  16276. * @platform darwin
  16277. */
  16278. serverType?: ('json' | 'default');
  16279. }
  16280. interface FileIconOptions {
  16281. size: ('small' | 'normal' | 'large');
  16282. }
  16283. interface FindInPageOptions {
  16284. /**
  16285. * Whether to search forward or backward, defaults to `true`.
  16286. */
  16287. forward?: boolean;
  16288. /**
  16289. * Whether to begin a new text finding session with this request. Should be `true`
  16290. * for initial requests, and `false` for follow-up requests. Defaults to `false`.
  16291. */
  16292. findNext?: boolean;
  16293. /**
  16294. * Whether search should be case-sensitive, defaults to `false`.
  16295. */
  16296. matchCase?: boolean;
  16297. }
  16298. interface FocusOptions {
  16299. /**
  16300. * Make the receiver the active app even if another app is currently active.
  16301. *
  16302. * @platform darwin
  16303. */
  16304. steal: boolean;
  16305. }
  16306. interface ForkOptions {
  16307. /**
  16308. * Environment key-value pairs. Default is `process.env`.
  16309. */
  16310. env?: Env;
  16311. /**
  16312. * List of string arguments passed to the executable.
  16313. */
  16314. execArgv?: string[];
  16315. /**
  16316. * Current working directory of the child process.
  16317. */
  16318. cwd?: string;
  16319. /**
  16320. * Allows configuring the mode for `stdout` and `stderr` of the child process.
  16321. * Default is `inherit`. String value can be one of `pipe`, `ignore`, `inherit`,
  16322. * for more details on these values you can refer to stdio documentation from
  16323. * Node.js. Currently this option only supports configuring `stdout` and `stderr`
  16324. * to either `pipe`, `inherit` or `ignore`. Configuring `stdin` is not supported;
  16325. * `stdin` will always be ignored. For example, the supported values will be
  16326. * processed as following:
  16327. */
  16328. stdio?: (Array<'pipe' | 'ignore' | 'inherit'>) | (string);
  16329. /**
  16330. * Name of the process that will appear in `name` property of `ProcessMetric`
  16331. * returned by `app.getAppMetrics` and `child-process-gone` event of `app`. Default
  16332. * is `Node Utility Process`.
  16333. */
  16334. serviceName?: string;
  16335. /**
  16336. * With this flag, the utility process will be launched via the `Electron Helper
  16337. * (Plugin).app` helper executable on macOS, which can be codesigned with
  16338. * `com.apple.security.cs.disable-library-validation` and
  16339. * `com.apple.security.cs.allow-unsigned-executable-memory` entitlements. This will
  16340. * allow the utility process to load unsigned libraries. Unless you specifically
  16341. * need this capability, it is best to leave this disabled. Default is `false`.
  16342. *
  16343. * @platform darwin
  16344. */
  16345. allowLoadingUnsignedLibraries?: boolean;
  16346. }
  16347. interface FoundInPageEvent extends DOMEvent {
  16348. result: FoundInPageResult;
  16349. }
  16350. interface FrameCreatedDetails {
  16351. frame: WebFrameMain;
  16352. }
  16353. interface FromPartitionOptions {
  16354. /**
  16355. * Whether to enable cache.
  16356. */
  16357. cache: boolean;
  16358. }
  16359. interface FromPathOptions {
  16360. /**
  16361. * Whether to enable cache.
  16362. */
  16363. cache: boolean;
  16364. }
  16365. interface HandlerDetails {
  16366. /**
  16367. * The _resolved_ version of the URL passed to `window.open()`. e.g. opening a
  16368. * window with `window.open('foo')` will yield something like
  16369. * `https://the-origin/the/current/path/foo`.
  16370. */
  16371. url: string;
  16372. /**
  16373. * Name of the window provided in `window.open()`
  16374. */
  16375. frameName: string;
  16376. /**
  16377. * Comma separated list of window features provided to `window.open()`.
  16378. */
  16379. features: string;
  16380. /**
  16381. * Can be `default`, `foreground-tab`, `background-tab`, `new-window` or `other`.
  16382. */
  16383. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other');
  16384. /**
  16385. * The referrer that will be passed to the new window. May or may not result in the
  16386. * `Referer` header being sent, depending on the referrer policy.
  16387. */
  16388. referrer: Referrer;
  16389. /**
  16390. * The post data that will be sent to the new window, along with the appropriate
  16391. * headers that will be set. If no post data is to be sent, the value will be
  16392. * `null`. Only defined when the window is being created by a form that set
  16393. * `target=_blank`.
  16394. */
  16395. postBody?: PostBody;
  16396. }
  16397. interface HeadersReceivedResponse {
  16398. cancel?: boolean;
  16399. /**
  16400. * When provided, the server is assumed to have responded with these headers.
  16401. */
  16402. responseHeaders?: Record<string, (string) | (string[])>;
  16403. /**
  16404. * Should be provided when overriding `responseHeaders` to change header status
  16405. * otherwise original response header's status will be used.
  16406. */
  16407. statusLine?: string;
  16408. }
  16409. interface HeapStatistics {
  16410. totalHeapSize: number;
  16411. totalHeapSizeExecutable: number;
  16412. totalPhysicalSize: number;
  16413. totalAvailableSize: number;
  16414. usedHeapSize: number;
  16415. heapSizeLimit: number;
  16416. mallocedMemory: number;
  16417. peakMallocedMemory: number;
  16418. doesZapGarbage: boolean;
  16419. }
  16420. interface HidDeviceAddedDetails {
  16421. device: HIDDevice;
  16422. frame: WebFrameMain;
  16423. }
  16424. interface HidDeviceRemovedDetails {
  16425. device: HIDDevice;
  16426. frame: WebFrameMain;
  16427. }
  16428. interface HidDeviceRevokedDetails {
  16429. device: HIDDevice;
  16430. /**
  16431. * The origin that the device has been revoked from.
  16432. */
  16433. origin?: string;
  16434. }
  16435. interface IgnoreMouseEventsOptions {
  16436. /**
  16437. * If true, forwards mouse move messages to Chromium, enabling mouse related events
  16438. * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
  16439. * forwarding is always disabled regardless of this value.
  16440. *
  16441. * @platform darwin,win32
  16442. */
  16443. forward?: boolean;
  16444. }
  16445. interface ImportCertificateOptions {
  16446. /**
  16447. * Path for the pkcs12 file.
  16448. */
  16449. certificate: string;
  16450. /**
  16451. * Passphrase for the certificate.
  16452. */
  16453. password: string;
  16454. }
  16455. interface Info {
  16456. /**
  16457. * Security origin for the isolated world.
  16458. */
  16459. securityOrigin?: string;
  16460. /**
  16461. * Content Security Policy for the isolated world.
  16462. */
  16463. csp?: string;
  16464. /**
  16465. * Name for isolated world. Useful in devtools.
  16466. */
  16467. name?: string;
  16468. }
  16469. interface Input {
  16470. /**
  16471. * Either `keyUp` or `keyDown`.
  16472. */
  16473. type: string;
  16474. /**
  16475. * Equivalent to KeyboardEvent.key.
  16476. */
  16477. key: string;
  16478. /**
  16479. * Equivalent to KeyboardEvent.code.
  16480. */
  16481. code: string;
  16482. /**
  16483. * Equivalent to KeyboardEvent.repeat.
  16484. */
  16485. isAutoRepeat: boolean;
  16486. /**
  16487. * Equivalent to KeyboardEvent.isComposing.
  16488. */
  16489. isComposing: boolean;
  16490. /**
  16491. * Equivalent to KeyboardEvent.shiftKey.
  16492. */
  16493. shift: boolean;
  16494. /**
  16495. * Equivalent to KeyboardEvent.controlKey.
  16496. */
  16497. control: boolean;
  16498. /**
  16499. * Equivalent to KeyboardEvent.altKey.
  16500. */
  16501. alt: boolean;
  16502. /**
  16503. * Equivalent to KeyboardEvent.metaKey.
  16504. */
  16505. meta: boolean;
  16506. /**
  16507. * Equivalent to KeyboardEvent.location.
  16508. */
  16509. location: number;
  16510. /**
  16511. * See InputEvent.modifiers.
  16512. */
  16513. modifiers: string[];
  16514. }
  16515. interface InsertCSSOptions {
  16516. /**
  16517. * Can be 'user' or 'author'. Sets the cascade origin of the inserted stylesheet.
  16518. * Default is 'author'.
  16519. */
  16520. cssOrigin?: ('user' | 'author');
  16521. }
  16522. interface IpcMessageEvent extends DOMEvent {
  16523. /**
  16524. * pair of `[processId, frameId]`.
  16525. */
  16526. frameId: [number, number];
  16527. channel: string;
  16528. args: any[];
  16529. }
  16530. interface Item {
  16531. /**
  16532. * The path to the file being dragged.
  16533. */
  16534. file: string;
  16535. /**
  16536. * The paths to the files being dragged. (`files` will override `file` field)
  16537. */
  16538. files?: string[];
  16539. /**
  16540. * The image must be non-empty on macOS.
  16541. */
  16542. icon: (NativeImage) | (string);
  16543. }
  16544. interface JumpListSettings {
  16545. /**
  16546. * The minimum number of items that will be shown in the Jump List (for a more
  16547. * detailed description of this value see the MSDN docs).
  16548. */
  16549. minItems: number;
  16550. /**
  16551. * Array of `JumpListItem` objects that correspond to items that the user has
  16552. * explicitly removed from custom categories in the Jump List. These items must not
  16553. * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
  16554. * Windows will not display any custom category that contains any of the removed
  16555. * items.
  16556. */
  16557. removedItems: JumpListItem[];
  16558. }
  16559. interface LoadCommitEvent extends DOMEvent {
  16560. url: string;
  16561. isMainFrame: boolean;
  16562. }
  16563. interface LoadExtensionOptions {
  16564. /**
  16565. * Whether to allow the extension to read local files over `file://` protocol and
  16566. * inject content scripts into `file://` pages. This is required e.g. for loading
  16567. * devtools extensions on `file://` URLs. Defaults to false.
  16568. */
  16569. allowFileAccess: boolean;
  16570. }
  16571. interface LoadFileOptions {
  16572. /**
  16573. * Passed to `url.format()`.
  16574. */
  16575. query?: Record<string, string>;
  16576. /**
  16577. * Passed to `url.format()`.
  16578. */
  16579. search?: string;
  16580. /**
  16581. * Passed to `url.format()`.
  16582. */
  16583. hash?: string;
  16584. }
  16585. interface LoadURLOptions {
  16586. /**
  16587. * An HTTP Referrer url.
  16588. */
  16589. httpReferrer?: (string) | (Referrer);
  16590. /**
  16591. * A user agent originating the request.
  16592. */
  16593. userAgent?: string;
  16594. /**
  16595. * Extra headers separated by "\n"
  16596. */
  16597. extraHeaders?: string;
  16598. postData?: Array<(UploadRawData) | (UploadFile)>;
  16599. /**
  16600. * Base url (with trailing path separator) for files to be loaded by the data url.
  16601. * This is needed only if the specified `url` is a data url and needs to load other
  16602. * files.
  16603. */
  16604. baseURLForDataURL?: string;
  16605. }
  16606. interface LoginItemSettings {
  16607. /**
  16608. * `true` if the app is set to open at login.
  16609. */
  16610. openAtLogin: boolean;
  16611. /**
  16612. * `true` if the app is set to open as hidden at login. This setting is not
  16613. * available on MAS builds.
  16614. *
  16615. * @platform darwin
  16616. */
  16617. openAsHidden: boolean;
  16618. /**
  16619. * `true` if the app was opened at login automatically. This setting is not
  16620. * available on MAS builds.
  16621. *
  16622. * @platform darwin
  16623. */
  16624. wasOpenedAtLogin: boolean;
  16625. /**
  16626. * `true` if the app was opened as a hidden login item. This indicates that the app
  16627. * should not open any windows at startup. This setting is not available on MAS
  16628. * builds.
  16629. *
  16630. * @platform darwin
  16631. */
  16632. wasOpenedAsHidden: boolean;
  16633. /**
  16634. * `true` if the app was opened as a login item that should restore the state from
  16635. * the previous session. This indicates that the app should restore the windows
  16636. * that were open the last time the app was closed. This setting is not available
  16637. * on MAS builds.
  16638. *
  16639. * @platform darwin
  16640. */
  16641. restoreState: boolean;
  16642. /**
  16643. * `true` if app is set to open at login and its run key is not deactivated. This
  16644. * differs from `openAtLogin` as it ignores the `args` option, this property will
  16645. * be true if the given executable would be launched at login with **any**
  16646. * arguments.
  16647. *
  16648. * @platform win32
  16649. */
  16650. executableWillLaunchAtLogin: boolean;
  16651. launchItems: LaunchItems[];
  16652. }
  16653. interface LoginItemSettingsOptions {
  16654. /**
  16655. * The executable path to compare against. Defaults to `process.execPath`.
  16656. *
  16657. * @platform win32
  16658. */
  16659. path?: string;
  16660. /**
  16661. * The command-line arguments to compare against. Defaults to an empty array.
  16662. *
  16663. * @platform win32
  16664. */
  16665. args?: string[];
  16666. }
  16667. interface MenuItemConstructorOptions {
  16668. /**
  16669. * Will be called with `click(menuItem, browserWindow, event)` when the menu item
  16670. * is clicked.
  16671. */
  16672. click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
  16673. /**
  16674. * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
  16675. * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
  16676. * `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`,
  16677. * `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`,
  16678. * `showSubstitutions`, `toggleSmartQuotes`, `toggleSmartDashes`,
  16679. * `toggleTextReplacement`, `startSpeaking`, `stopSpeaking`, `zoom`, `front`,
  16680. * `appMenu`, `fileMenu`, `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`,
  16681. * `toggleTabBar`, `selectNextTab`, `selectPreviousTab`, `showAllTabs`,
  16682. * `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
  16683. * - Define the action of the menu item, when specified the `click` property will
  16684. * be ignored. See roles.
  16685. */
  16686. role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'toggleSpellChecker' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'showSubstitutions' | 'toggleSmartQuotes' | 'toggleSmartDashes' | 'toggleTextReplacement' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'shareMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'showAllTabs' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  16687. /**
  16688. * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
  16689. */
  16690. type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  16691. label?: string;
  16692. sublabel?: string;
  16693. /**
  16694. * Hover text for this menu item.
  16695. *
  16696. * @platform darwin
  16697. */
  16698. toolTip?: string;
  16699. accelerator?: Accelerator;
  16700. icon?: (NativeImage) | (string);
  16701. /**
  16702. * If false, the menu item will be greyed out and unclickable.
  16703. */
  16704. enabled?: boolean;
  16705. /**
  16706. * default is `true`, and when `false` will prevent the accelerator from triggering
  16707. * the item if the item is not visible.
  16708. *
  16709. * @platform darwin
  16710. */
  16711. acceleratorWorksWhenHidden?: boolean;
  16712. /**
  16713. * If false, the menu item will be entirely hidden.
  16714. */
  16715. visible?: boolean;
  16716. /**
  16717. * Should only be specified for `checkbox` or `radio` type menu items.
  16718. */
  16719. checked?: boolean;
  16720. /**
  16721. * If false, the accelerator won't be registered with the system, but it will still
  16722. * be displayed. Defaults to true.
  16723. *
  16724. * @platform linux,win32
  16725. */
  16726. registerAccelerator?: boolean;
  16727. /**
  16728. * The item to share when the `role` is `shareMenu`.
  16729. *
  16730. * @platform darwin
  16731. */
  16732. sharingItem?: SharingItem;
  16733. /**
  16734. * Should be specified for `submenu` type menu items. If `submenu` is specified,
  16735. * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
  16736. * be automatically converted to one using `Menu.buildFromTemplate`.
  16737. */
  16738. submenu?: (MenuItemConstructorOptions[]) | (Menu);
  16739. /**
  16740. * Unique within a single menu. If defined then it can be used as a reference to
  16741. * this item by the position attribute.
  16742. */
  16743. id?: string;
  16744. /**
  16745. * Inserts this item before the item with the specified label. If the referenced
  16746. * item doesn't exist the item will be inserted at the end of the menu. Also
  16747. * implies that the menu item in question should be placed in the same “group” as
  16748. * the item.
  16749. */
  16750. before?: string[];
  16751. /**
  16752. * Inserts this item after the item with the specified label. If the referenced
  16753. * item doesn't exist the item will be inserted at the end of the menu.
  16754. */
  16755. after?: string[];
  16756. /**
  16757. * Provides a means for a single context menu to declare the placement of their
  16758. * containing group before the containing group of the item with the specified
  16759. * label.
  16760. */
  16761. beforeGroupContaining?: string[];
  16762. /**
  16763. * Provides a means for a single context menu to declare the placement of their
  16764. * containing group after the containing group of the item with the specified
  16765. * label.
  16766. */
  16767. afterGroupContaining?: string[];
  16768. }
  16769. interface MessageBoxOptions {
  16770. /**
  16771. * Content of the message box.
  16772. */
  16773. message: string;
  16774. /**
  16775. * Can be `none`, `info`, `error`, `question` or `warning`. On Windows, `question`
  16776. * displays the same icon as `info`, unless you set an icon using the `icon`
  16777. * option. On macOS, both `warning` and `error` display the same warning icon.
  16778. */
  16779. type?: ('none' | 'info' | 'error' | 'question' | 'warning');
  16780. /**
  16781. * Array of texts for buttons. On Windows, an empty array will result in one button
  16782. * labeled "OK".
  16783. */
  16784. buttons?: string[];
  16785. /**
  16786. * Index of the button in the buttons array which will be selected by default when
  16787. * the message box opens.
  16788. */
  16789. defaultId?: number;
  16790. /**
  16791. * Pass an instance of AbortSignal to optionally close the message box, the message
  16792. * box will behave as if it was cancelled by the user. On macOS, `signal` does not
  16793. * work with message boxes that do not have a parent window, since those message
  16794. * boxes run synchronously due to platform limitations.
  16795. */
  16796. signal?: AbortSignal;
  16797. /**
  16798. * Title of the message box, some platforms will not show it.
  16799. */
  16800. title?: string;
  16801. /**
  16802. * Extra information of the message.
  16803. */
  16804. detail?: string;
  16805. /**
  16806. * If provided, the message box will include a checkbox with the given label.
  16807. */
  16808. checkboxLabel?: string;
  16809. /**
  16810. * Initial checked state of the checkbox. `false` by default.
  16811. */
  16812. checkboxChecked?: boolean;
  16813. icon?: (NativeImage) | (string);
  16814. /**
  16815. * Custom width of the text in the message box.
  16816. *
  16817. * @platform darwin
  16818. */
  16819. textWidth?: number;
  16820. /**
  16821. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  16822. * default this is assigned to the first button with "cancel" or "no" as the label.
  16823. * If no such labeled buttons exist and this option is not set, `0` will be used as
  16824. * the return value.
  16825. */
  16826. cancelId?: number;
  16827. /**
  16828. * On Windows Electron will try to figure out which one of the `buttons` are common
  16829. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  16830. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  16831. * you don't like this behavior, you can set `noLink` to `true`.
  16832. */
  16833. noLink?: boolean;
  16834. /**
  16835. * Normalize the keyboard access keys across platforms. Default is `false`.
  16836. * Enabling this assumes `&` is used in the button labels for the placement of the
  16837. * keyboard shortcut access key and labels will be converted so they work correctly
  16838. * on each platform, `&` characters are removed on macOS, converted to `_` on
  16839. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  16840. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  16841. * via `Alt-W` on Windows and Linux.
  16842. */
  16843. normalizeAccessKeys?: boolean;
  16844. }
  16845. interface MessageBoxReturnValue {
  16846. /**
  16847. * The index of the clicked button.
  16848. */
  16849. response: number;
  16850. /**
  16851. * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
  16852. */
  16853. checkboxChecked: boolean;
  16854. }
  16855. interface MessageBoxSyncOptions {
  16856. /**
  16857. * Content of the message box.
  16858. */
  16859. message: string;
  16860. /**
  16861. * Can be `none`, `info`, `error`, `question` or `warning`. On Windows, `question`
  16862. * displays the same icon as `info`, unless you set an icon using the `icon`
  16863. * option. On macOS, both `warning` and `error` display the same warning icon.
  16864. */
  16865. type?: ('none' | 'info' | 'error' | 'question' | 'warning');
  16866. /**
  16867. * Array of texts for buttons. On Windows, an empty array will result in one button
  16868. * labeled "OK".
  16869. */
  16870. buttons?: string[];
  16871. /**
  16872. * Index of the button in the buttons array which will be selected by default when
  16873. * the message box opens.
  16874. */
  16875. defaultId?: number;
  16876. /**
  16877. * Title of the message box, some platforms will not show it.
  16878. */
  16879. title?: string;
  16880. /**
  16881. * Extra information of the message.
  16882. */
  16883. detail?: string;
  16884. icon?: (NativeImage) | (string);
  16885. /**
  16886. * Custom width of the text in the message box.
  16887. *
  16888. * @platform darwin
  16889. */
  16890. textWidth?: number;
  16891. /**
  16892. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  16893. * default this is assigned to the first button with "cancel" or "no" as the label.
  16894. * If no such labeled buttons exist and this option is not set, `0` will be used as
  16895. * the return value.
  16896. */
  16897. cancelId?: number;
  16898. /**
  16899. * On Windows Electron will try to figure out which one of the `buttons` are common
  16900. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  16901. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  16902. * you don't like this behavior, you can set `noLink` to `true`.
  16903. */
  16904. noLink?: boolean;
  16905. /**
  16906. * Normalize the keyboard access keys across platforms. Default is `false`.
  16907. * Enabling this assumes `&` is used in the button labels for the placement of the
  16908. * keyboard shortcut access key and labels will be converted so they work correctly
  16909. * on each platform, `&` characters are removed on macOS, converted to `_` on
  16910. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  16911. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  16912. * via `Alt-W` on Windows and Linux.
  16913. */
  16914. normalizeAccessKeys?: boolean;
  16915. }
  16916. interface MessageDetails {
  16917. /**
  16918. * The actual console message
  16919. */
  16920. message: string;
  16921. /**
  16922. * The version ID of the service worker that sent the log message
  16923. */
  16924. versionId: number;
  16925. /**
  16926. * The type of source for this message. Can be `javascript`, `xml`, `network`,
  16927. * `console-api`, `storage`, `rendering`, `security`, `deprecation`, `worker`,
  16928. * `violation`, `intervention`, `recommendation` or `other`.
  16929. */
  16930. source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
  16931. /**
  16932. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  16933. * `error`.
  16934. */
  16935. level: number;
  16936. /**
  16937. * The URL the message came from
  16938. */
  16939. sourceUrl: string;
  16940. /**
  16941. * The line number of the source that triggered this console message
  16942. */
  16943. lineNumber: number;
  16944. }
  16945. interface MessageEvent {
  16946. data: any;
  16947. ports: MessagePortMain[];
  16948. }
  16949. interface MoveToApplicationsFolderOptions {
  16950. /**
  16951. * A handler for potential conflict in move failure.
  16952. */
  16953. conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
  16954. }
  16955. interface NotificationConstructorOptions {
  16956. /**
  16957. * A title for the notification, which will be displayed at the top of the
  16958. * notification window when it is shown.
  16959. */
  16960. title?: string;
  16961. /**
  16962. * A subtitle for the notification, which will be displayed below the title.
  16963. *
  16964. * @platform darwin
  16965. */
  16966. subtitle?: string;
  16967. /**
  16968. * The body text of the notification, which will be displayed below the title or
  16969. * subtitle.
  16970. */
  16971. body?: string;
  16972. /**
  16973. * Whether or not to suppress the OS notification noise when showing the
  16974. * notification.
  16975. */
  16976. silent?: boolean;
  16977. /**
  16978. * An icon to use in the notification.
  16979. */
  16980. icon?: (string) | (NativeImage);
  16981. /**
  16982. * Whether or not to add an inline reply option to the notification.
  16983. *
  16984. * @platform darwin
  16985. */
  16986. hasReply?: boolean;
  16987. /**
  16988. * The timeout duration of the notification. Can be 'default' or 'never'.
  16989. *
  16990. * @platform linux,win32
  16991. */
  16992. timeoutType?: ('default' | 'never');
  16993. /**
  16994. * The placeholder to write in the inline reply input field.
  16995. *
  16996. * @platform darwin
  16997. */
  16998. replyPlaceholder?: string;
  16999. /**
  17000. * The name of the sound file to play when the notification is shown.
  17001. *
  17002. * @platform darwin
  17003. */
  17004. sound?: string;
  17005. /**
  17006. * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
  17007. *
  17008. * @platform linux
  17009. */
  17010. urgency?: ('normal' | 'critical' | 'low');
  17011. /**
  17012. * Actions to add to the notification. Please read the available actions and
  17013. * limitations in the `NotificationAction` documentation.
  17014. *
  17015. * @platform darwin
  17016. */
  17017. actions?: NotificationAction[];
  17018. /**
  17019. * A custom title for the close button of an alert. An empty string will cause the
  17020. * default localized text to be used.
  17021. *
  17022. * @platform darwin
  17023. */
  17024. closeButtonText?: string;
  17025. /**
  17026. * A custom description of the Notification on Windows superseding all properties
  17027. * above. Provides full customization of design and behavior of the notification.
  17028. *
  17029. * @platform win32
  17030. */
  17031. toastXml?: string;
  17032. }
  17033. interface OnBeforeRedirectListenerDetails {
  17034. id: number;
  17035. url: string;
  17036. method: string;
  17037. webContentsId?: number;
  17038. webContents?: WebContents;
  17039. frame?: WebFrameMain;
  17040. /**
  17041. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  17042. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  17043. */
  17044. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  17045. referrer: string;
  17046. timestamp: number;
  17047. redirectURL: string;
  17048. statusCode: number;
  17049. statusLine: string;
  17050. /**
  17051. * The server IP address that the request was actually sent to.
  17052. */
  17053. ip?: string;
  17054. fromCache: boolean;
  17055. responseHeaders?: Record<string, string[]>;
  17056. }
  17057. interface OnBeforeRequestListenerDetails {
  17058. id: number;
  17059. url: string;
  17060. method: string;
  17061. webContentsId?: number;
  17062. webContents?: WebContents;
  17063. frame?: WebFrameMain;
  17064. /**
  17065. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  17066. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  17067. */
  17068. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  17069. referrer: string;
  17070. timestamp: number;
  17071. uploadData: UploadData[];
  17072. }
  17073. interface OnBeforeSendHeadersListenerDetails {
  17074. id: number;
  17075. url: string;
  17076. method: string;
  17077. webContentsId?: number;
  17078. webContents?: WebContents;
  17079. frame?: WebFrameMain;
  17080. /**
  17081. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  17082. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  17083. */
  17084. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  17085. referrer: string;
  17086. timestamp: number;
  17087. uploadData?: UploadData[];
  17088. requestHeaders: Record<string, string>;
  17089. }
  17090. interface OnCompletedListenerDetails {
  17091. id: number;
  17092. url: string;
  17093. method: string;
  17094. webContentsId?: number;
  17095. webContents?: WebContents;
  17096. frame?: WebFrameMain;
  17097. /**
  17098. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  17099. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  17100. */
  17101. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  17102. referrer: string;
  17103. timestamp: number;
  17104. responseHeaders?: Record<string, string[]>;
  17105. fromCache: boolean;
  17106. statusCode: number;
  17107. statusLine: string;
  17108. error: string;
  17109. }
  17110. interface OnErrorOccurredListenerDetails {
  17111. id: number;
  17112. url: string;
  17113. method: string;
  17114. webContentsId?: number;
  17115. webContents?: WebContents;
  17116. frame?: WebFrameMain;
  17117. /**
  17118. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  17119. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  17120. */
  17121. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  17122. referrer: string;
  17123. timestamp: number;
  17124. fromCache: boolean;
  17125. /**
  17126. * The error description.
  17127. */
  17128. error: string;
  17129. }
  17130. interface OnHeadersReceivedListenerDetails {
  17131. id: number;
  17132. url: string;
  17133. method: string;
  17134. webContentsId?: number;
  17135. webContents?: WebContents;
  17136. frame?: WebFrameMain;
  17137. /**
  17138. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  17139. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  17140. */
  17141. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  17142. referrer: string;
  17143. timestamp: number;
  17144. statusLine: string;
  17145. statusCode: number;
  17146. responseHeaders?: Record<string, string[]>;
  17147. }
  17148. interface OnResponseStartedListenerDetails {
  17149. id: number;
  17150. url: string;
  17151. method: string;
  17152. webContentsId?: number;
  17153. webContents?: WebContents;
  17154. frame?: WebFrameMain;
  17155. /**
  17156. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  17157. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  17158. */
  17159. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  17160. referrer: string;
  17161. timestamp: number;
  17162. responseHeaders?: Record<string, string[]>;
  17163. /**
  17164. * Indicates whether the response was fetched from disk cache.
  17165. */
  17166. fromCache: boolean;
  17167. statusCode: number;
  17168. statusLine: string;
  17169. }
  17170. interface OnSendHeadersListenerDetails {
  17171. id: number;
  17172. url: string;
  17173. method: string;
  17174. webContentsId?: number;
  17175. webContents?: WebContents;
  17176. frame?: WebFrameMain;
  17177. /**
  17178. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  17179. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  17180. */
  17181. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  17182. referrer: string;
  17183. timestamp: number;
  17184. requestHeaders: Record<string, string>;
  17185. }
  17186. interface OpenDevToolsOptions {
  17187. /**
  17188. * Opens the devtools with specified dock state, can be `left`, `right`, `bottom`,
  17189. * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
  17190. * possible to dock back. In `detach` mode it's not.
  17191. */
  17192. mode: ('left' | 'right' | 'bottom' | 'undocked' | 'detach');
  17193. /**
  17194. * Whether to bring the opened devtools window to the foreground. The default is
  17195. * `true`.
  17196. */
  17197. activate?: boolean;
  17198. /**
  17199. * A title for the DevTools window (only in `undocked` or `detach` mode).
  17200. */
  17201. title?: string;
  17202. }
  17203. interface OpenDialogOptions {
  17204. title?: string;
  17205. defaultPath?: string;
  17206. /**
  17207. * Custom label for the confirmation button, when left empty the default label will
  17208. * be used.
  17209. */
  17210. buttonLabel?: string;
  17211. filters?: FileFilter[];
  17212. /**
  17213. * Contains which features the dialog should use. The following values are
  17214. * supported:
  17215. */
  17216. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  17217. /**
  17218. * Message to display above input boxes.
  17219. *
  17220. * @platform darwin
  17221. */
  17222. message?: string;
  17223. /**
  17224. * Create security scoped bookmarks when packaged for the Mac App Store.
  17225. *
  17226. * @platform darwin,mas
  17227. */
  17228. securityScopedBookmarks?: boolean;
  17229. }
  17230. interface OpenDialogReturnValue {
  17231. /**
  17232. * whether or not the dialog was canceled.
  17233. */
  17234. canceled: boolean;
  17235. /**
  17236. * An array of file paths chosen by the user. If the dialog is cancelled this will
  17237. * be an empty array.
  17238. */
  17239. filePaths: string[];
  17240. /**
  17241. * An array matching the `filePaths` array of base64 encoded strings which contains
  17242. * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
  17243. * this to be populated. (For return values, see table here.)
  17244. *
  17245. * @platform darwin,mas
  17246. */
  17247. bookmarks?: string[];
  17248. }
  17249. interface OpenDialogSyncOptions {
  17250. title?: string;
  17251. defaultPath?: string;
  17252. /**
  17253. * Custom label for the confirmation button, when left empty the default label will
  17254. * be used.
  17255. */
  17256. buttonLabel?: string;
  17257. filters?: FileFilter[];
  17258. /**
  17259. * Contains which features the dialog should use. The following values are
  17260. * supported:
  17261. */
  17262. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  17263. /**
  17264. * Message to display above input boxes.
  17265. *
  17266. * @platform darwin
  17267. */
  17268. message?: string;
  17269. /**
  17270. * Create security scoped bookmarks when packaged for the Mac App Store.
  17271. *
  17272. * @platform darwin,mas
  17273. */
  17274. securityScopedBookmarks?: boolean;
  17275. }
  17276. interface OpenExternalOptions {
  17277. /**
  17278. * `true` to bring the opened application to the foreground. The default is `true`.
  17279. *
  17280. * @platform darwin
  17281. */
  17282. activate?: boolean;
  17283. /**
  17284. * The working directory.
  17285. *
  17286. * @platform win32
  17287. */
  17288. workingDirectory?: string;
  17289. /**
  17290. * Indicates a user initiated launch that enables tracking of frequently used
  17291. * programs and other behaviors. The default is `false`.
  17292. *
  17293. * @platform win32
  17294. */
  17295. logUsage?: boolean;
  17296. }
  17297. interface Options {
  17298. }
  17299. interface Opts {
  17300. /**
  17301. * Keep the page hidden instead of visible. Default is `false`.
  17302. */
  17303. stayHidden?: boolean;
  17304. /**
  17305. * Keep the system awake instead of allowing it to sleep. Default is `false`.
  17306. */
  17307. stayAwake?: boolean;
  17308. }
  17309. interface PageFaviconUpdatedEvent extends DOMEvent {
  17310. /**
  17311. * Array of URLs.
  17312. */
  17313. favicons: string[];
  17314. }
  17315. interface PageTitleUpdatedEvent extends DOMEvent {
  17316. title: string;
  17317. explicitSet: boolean;
  17318. }
  17319. interface Parameters {
  17320. /**
  17321. * Specify the screen type to emulate (default: `desktop`):
  17322. */
  17323. screenPosition: ('desktop' | 'mobile');
  17324. /**
  17325. * Set the emulated screen size (screenPosition == mobile).
  17326. */
  17327. screenSize: Size;
  17328. /**
  17329. * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
  17330. * 0 }`).
  17331. */
  17332. viewPosition: Point;
  17333. /**
  17334. * Set the device scale factor (if zero defaults to original device scale factor)
  17335. * (default: `0`).
  17336. */
  17337. deviceScaleFactor: number;
  17338. /**
  17339. * Set the emulated view size (empty means no override)
  17340. */
  17341. viewSize: Size;
  17342. /**
  17343. * Scale of emulated view inside available space (not in fit to view mode)
  17344. * (default: `1`).
  17345. */
  17346. scale: number;
  17347. }
  17348. interface Payment {
  17349. /**
  17350. * The identifier of the purchased product.
  17351. */
  17352. productIdentifier: string;
  17353. /**
  17354. * The quantity purchased.
  17355. */
  17356. quantity: number;
  17357. /**
  17358. * An opaque identifier for the user’s account on your system.
  17359. */
  17360. applicationUsername: string;
  17361. /**
  17362. * The details of the discount offer to apply to the payment.
  17363. */
  17364. paymentDiscount?: PaymentDiscount;
  17365. }
  17366. interface PermissionCheckHandlerHandlerDetails {
  17367. /**
  17368. * The origin of the frame embedding the frame that made the permission check.
  17369. * Only set for cross-origin sub frames making permission checks.
  17370. */
  17371. embeddingOrigin?: string;
  17372. /**
  17373. * The security origin of the `media` check.
  17374. */
  17375. securityOrigin?: string;
  17376. /**
  17377. * The type of media access being requested, can be `video`, `audio` or `unknown`
  17378. */
  17379. mediaType?: ('video' | 'audio' | 'unknown');
  17380. /**
  17381. * The last URL the requesting frame loaded. This is not provided for cross-origin
  17382. * sub frames making permission checks.
  17383. */
  17384. requestingUrl?: string;
  17385. /**
  17386. * Whether the frame making the request is the main frame
  17387. */
  17388. isMainFrame: boolean;
  17389. }
  17390. interface PermissionRequestHandlerHandlerDetails {
  17391. /**
  17392. * The url of the `openExternal` request.
  17393. */
  17394. externalURL?: string;
  17395. /**
  17396. * The security origin of the `media` request.
  17397. */
  17398. securityOrigin?: string;
  17399. /**
  17400. * The types of media access being requested, elements can be `video` or `audio`
  17401. */
  17402. mediaTypes?: Array<'video' | 'audio'>;
  17403. /**
  17404. * The last URL the requesting frame loaded
  17405. */
  17406. requestingUrl: string;
  17407. /**
  17408. * Whether the frame making the request is the main frame
  17409. */
  17410. isMainFrame: boolean;
  17411. }
  17412. interface PluginCrashedEvent extends DOMEvent {
  17413. name: string;
  17414. version: string;
  17415. }
  17416. interface PopupOptions {
  17417. /**
  17418. * Default is the focused window.
  17419. */
  17420. window?: BrowserWindow;
  17421. /**
  17422. * Default is the current mouse cursor position. Must be declared if `y` is
  17423. * declared.
  17424. */
  17425. x?: number;
  17426. /**
  17427. * Default is the current mouse cursor position. Must be declared if `x` is
  17428. * declared.
  17429. */
  17430. y?: number;
  17431. /**
  17432. * The index of the menu item to be positioned under the mouse cursor at the
  17433. * specified coordinates. Default is -1.
  17434. *
  17435. * @platform darwin
  17436. */
  17437. positioningItem?: number;
  17438. /**
  17439. * This should map to the `menuSourceType` provided by the `context-menu` event. It
  17440. * is not recommended to set this value manually, only provide values you receive
  17441. * from other APIs or leave it `undefined`. Can be `none`, `mouse`, `keyboard`,
  17442. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  17443. * `adjustSelection`, or `adjustSelectionReset`.
  17444. *
  17445. * @platform win32,linux
  17446. */
  17447. sourceType?: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  17448. /**
  17449. * Called when menu is closed.
  17450. */
  17451. callback?: () => void;
  17452. }
  17453. interface PreconnectOptions {
  17454. /**
  17455. * URL for preconnect. Only the origin is relevant for opening the socket.
  17456. */
  17457. url: string;
  17458. /**
  17459. * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
  17460. */
  17461. numSockets?: number;
  17462. }
  17463. interface PrintToPDFOptions {
  17464. /**
  17465. * Paper orientation.`true` for landscape, `false` for portrait. Defaults to false.
  17466. */
  17467. landscape?: boolean;
  17468. /**
  17469. * Whether to display header and footer. Defaults to false.
  17470. */
  17471. displayHeaderFooter?: boolean;
  17472. /**
  17473. * Whether to print background graphics. Defaults to false.
  17474. */
  17475. printBackground?: boolean;
  17476. /**
  17477. * Scale of the webpage rendering. Defaults to 1.
  17478. */
  17479. scale?: number;
  17480. /**
  17481. * Specify page size of the generated PDF. Can be `A0`, `A1`, `A2`, `A3`, `A4`,
  17482. * `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing
  17483. * `height` and `width` in inches. Defaults to `Letter`.
  17484. */
  17485. pageSize?: (('A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid' | 'Ledger')) | (Size);
  17486. margins?: Margins;
  17487. /**
  17488. * Page ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which
  17489. * means print all pages.
  17490. */
  17491. pageRanges?: string;
  17492. /**
  17493. * HTML template for the print header. Should be valid HTML markup with following
  17494. * classes used to inject printing values into them: `date` (formatted print date),
  17495. * `title` (document title), `url` (document location), `pageNumber` (current page
  17496. * number) and `totalPages` (total pages in the document). For example, `<span
  17497. * class=title></span>` would generate span containing the title.
  17498. */
  17499. headerTemplate?: string;
  17500. /**
  17501. * HTML template for the print footer. Should use the same format as the
  17502. * `headerTemplate`.
  17503. */
  17504. footerTemplate?: string;
  17505. /**
  17506. * Whether or not to prefer page size as defined by css. Defaults to false, in
  17507. * which case the content will be scaled to fit the paper size.
  17508. */
  17509. preferCSSPageSize?: boolean;
  17510. /**
  17511. * Whether or not to generate a tagged (accessible) PDF. Defaults to false. As this
  17512. * property is experimental, the generated PDF may not adhere fully to PDF/UA and
  17513. * WCAG standards.
  17514. *
  17515. * @experimental
  17516. */
  17517. generateTaggedPDF?: boolean;
  17518. }
  17519. interface Privileges {
  17520. /**
  17521. * Default false.
  17522. */
  17523. standard?: boolean;
  17524. /**
  17525. * Default false.
  17526. */
  17527. secure?: boolean;
  17528. /**
  17529. * Default false.
  17530. */
  17531. bypassCSP?: boolean;
  17532. /**
  17533. * Default false.
  17534. */
  17535. allowServiceWorkers?: boolean;
  17536. /**
  17537. * Default false.
  17538. */
  17539. supportFetchAPI?: boolean;
  17540. /**
  17541. * Default false.
  17542. */
  17543. corsEnabled?: boolean;
  17544. /**
  17545. * Default false.
  17546. */
  17547. stream?: boolean;
  17548. /**
  17549. * Enable V8 code cache for the scheme, only works when `standard` is also set to
  17550. * true. Default false.
  17551. */
  17552. codeCache?: boolean;
  17553. }
  17554. interface ProgressBarOptions {
  17555. /**
  17556. * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
  17557. * `paused`.
  17558. *
  17559. * @platform win32
  17560. */
  17561. mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
  17562. }
  17563. interface Provider {
  17564. spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
  17565. }
  17566. interface PurchaseProductOpts {
  17567. /**
  17568. * The number of items the user wants to purchase.
  17569. */
  17570. quantity?: number;
  17571. /**
  17572. * The string that associates the transaction with a user account on your service
  17573. * (applicationUsername).
  17574. */
  17575. username?: string;
  17576. }
  17577. interface ReadBookmark {
  17578. title: string;
  17579. url: string;
  17580. }
  17581. interface RegistrationCompletedDetails {
  17582. /**
  17583. * The base URL that a service worker is registered for
  17584. */
  17585. scope: string;
  17586. }
  17587. interface RelaunchOptions {
  17588. args?: string[];
  17589. execPath?: string;
  17590. }
  17591. interface RenderProcessGoneEvent extends DOMEvent {
  17592. details: RenderProcessGoneDetails;
  17593. }
  17594. interface Request {
  17595. hostname: string;
  17596. certificate: Certificate;
  17597. validatedCertificate: Certificate;
  17598. /**
  17599. * `true` if Chromium recognises the root CA as a standard root. If it isn't then
  17600. * it's probably the case that this certificate was generated by a MITM proxy whose
  17601. * root has been installed locally (for example, by a corporate proxy). This should
  17602. * not be trusted if the `verificationResult` is not `OK`.
  17603. */
  17604. isIssuedByKnownRoot: boolean;
  17605. /**
  17606. * `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`.
  17607. */
  17608. verificationResult: string;
  17609. /**
  17610. * Error code.
  17611. */
  17612. errorCode: number;
  17613. }
  17614. interface ResizeOptions {
  17615. /**
  17616. * Defaults to the image's width.
  17617. */
  17618. width?: number;
  17619. /**
  17620. * Defaults to the image's height.
  17621. */
  17622. height?: number;
  17623. /**
  17624. * The desired quality of the resize image. Possible values include `good`,
  17625. * `better`, or `best`. The default is `best`. These values express a desired
  17626. * quality/speed tradeoff. They are translated into an algorithm-specific method
  17627. * that depends on the capabilities (CPU, GPU) of the underlying platform. It is
  17628. * possible for all three methods to be mapped to the same algorithm on a given
  17629. * platform.
  17630. */
  17631. quality?: ('good' | 'better' | 'best');
  17632. }
  17633. interface ResolveHostOptions {
  17634. /**
  17635. * Requested DNS query type. If unspecified, resolver will pick A or AAAA (or both)
  17636. * based on IPv4/IPv6 settings:
  17637. */
  17638. queryType?: ('A' | 'AAAA');
  17639. /**
  17640. * The source to use for resolved addresses. Default allows the resolver to pick an
  17641. * appropriate source. Only affects use of big external sources (e.g. calling the
  17642. * system for resolution or using DNS). Even if a source is specified, results can
  17643. * still come from cache, resolving "localhost" or IP literals, etc. One of the
  17644. * following values:
  17645. */
  17646. source?: ('any' | 'system' | 'dns' | 'mdns' | 'localOnly');
  17647. /**
  17648. * Indicates what DNS cache entries, if any, can be used to provide a response. One
  17649. * of the following values:
  17650. */
  17651. cacheUsage?: ('allowed' | 'staleAllowed' | 'disallowed');
  17652. /**
  17653. * Controls the resolver's Secure DNS behavior for this request. One of the
  17654. * following values:
  17655. */
  17656. secureDnsPolicy?: ('allow' | 'disable');
  17657. }
  17658. interface ResourceUsage {
  17659. images: MemoryUsageDetails;
  17660. scripts: MemoryUsageDetails;
  17661. cssStyleSheets: MemoryUsageDetails;
  17662. xslStyleSheets: MemoryUsageDetails;
  17663. fonts: MemoryUsageDetails;
  17664. other: MemoryUsageDetails;
  17665. }
  17666. interface Response {
  17667. /**
  17668. * `false` should be passed in if the dialog is canceled. If the `pairingKind` is
  17669. * `confirm` or `confirmPin`, this value should indicate if the pairing is
  17670. * confirmed. If the `pairingKind` is `providePin` the value should be `true` when
  17671. * a value is provided.
  17672. */
  17673. confirmed: boolean;
  17674. /**
  17675. * When the `pairingKind` is `providePin` this value should be the required pin for
  17676. * the Bluetooth device.
  17677. */
  17678. pin?: (string) | (null);
  17679. }
  17680. interface Result {
  17681. requestId: number;
  17682. /**
  17683. * Position of the active match.
  17684. */
  17685. activeMatchOrdinal: number;
  17686. /**
  17687. * Number of Matches.
  17688. */
  17689. matches: number;
  17690. /**
  17691. * Coordinates of first match region.
  17692. */
  17693. selectionArea: Rectangle;
  17694. finalUpdate: boolean;
  17695. }
  17696. interface SaveDialogOptions {
  17697. /**
  17698. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  17699. */
  17700. title?: string;
  17701. /**
  17702. * Absolute directory path, absolute file path, or file name to use by default.
  17703. */
  17704. defaultPath?: string;
  17705. /**
  17706. * Custom label for the confirmation button, when left empty the default label will
  17707. * be used.
  17708. */
  17709. buttonLabel?: string;
  17710. filters?: FileFilter[];
  17711. /**
  17712. * Message to display above text fields.
  17713. *
  17714. * @platform darwin
  17715. */
  17716. message?: string;
  17717. /**
  17718. * Custom label for the text displayed in front of the filename text field.
  17719. *
  17720. * @platform darwin
  17721. */
  17722. nameFieldLabel?: string;
  17723. /**
  17724. * Show the tags input box, defaults to `true`.
  17725. *
  17726. * @platform darwin
  17727. */
  17728. showsTagField?: boolean;
  17729. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  17730. /**
  17731. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  17732. * option is enabled and the file doesn't already exist a blank file will be
  17733. * created at the chosen path.
  17734. *
  17735. * @platform darwin,mas
  17736. */
  17737. securityScopedBookmarks?: boolean;
  17738. }
  17739. interface SaveDialogReturnValue {
  17740. /**
  17741. * whether or not the dialog was canceled.
  17742. */
  17743. canceled: boolean;
  17744. /**
  17745. * If the dialog is canceled, this will be an empty string.
  17746. */
  17747. filePath: string;
  17748. /**
  17749. * Base64 encoded string which contains the security scoped bookmark data for the
  17750. * saved file. `securityScopedBookmarks` must be enabled for this to be present.
  17751. * (For return values, see table here.)
  17752. *
  17753. * @platform darwin,mas
  17754. */
  17755. bookmark?: string;
  17756. }
  17757. interface SaveDialogSyncOptions {
  17758. /**
  17759. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  17760. */
  17761. title?: string;
  17762. /**
  17763. * Absolute directory path, absolute file path, or file name to use by default.
  17764. */
  17765. defaultPath?: string;
  17766. /**
  17767. * Custom label for the confirmation button, when left empty the default label will
  17768. * be used.
  17769. */
  17770. buttonLabel?: string;
  17771. filters?: FileFilter[];
  17772. /**
  17773. * Message to display above text fields.
  17774. *
  17775. * @platform darwin
  17776. */
  17777. message?: string;
  17778. /**
  17779. * Custom label for the text displayed in front of the filename text field.
  17780. *
  17781. * @platform darwin
  17782. */
  17783. nameFieldLabel?: string;
  17784. /**
  17785. * Show the tags input box, defaults to `true`.
  17786. *
  17787. * @platform darwin
  17788. */
  17789. showsTagField?: boolean;
  17790. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  17791. /**
  17792. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  17793. * option is enabled and the file doesn't already exist a blank file will be
  17794. * created at the chosen path.
  17795. *
  17796. * @platform darwin,mas
  17797. */
  17798. securityScopedBookmarks?: boolean;
  17799. }
  17800. interface SelectHidDeviceDetails {
  17801. deviceList: HIDDevice[];
  17802. frame: WebFrameMain;
  17803. }
  17804. interface SelectUsbDeviceDetails {
  17805. deviceList: USBDevice[];
  17806. frame: WebFrameMain;
  17807. }
  17808. interface SerialPortRevokedDetails {
  17809. port: SerialPort;
  17810. frame: WebFrameMain;
  17811. /**
  17812. * The origin that the device has been revoked from.
  17813. */
  17814. origin: string;
  17815. }
  17816. interface Settings {
  17817. /**
  17818. * `true` to open the app at login, `false` to remove the app as a login item.
  17819. * Defaults to `false`.
  17820. */
  17821. openAtLogin?: boolean;
  17822. /**
  17823. * `true` to open the app as hidden. Defaults to `false`. The user can edit this
  17824. * setting from the System Preferences so
  17825. * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
  17826. * opened to know the current value. This setting is not available on MAS builds.
  17827. *
  17828. * @platform darwin
  17829. */
  17830. openAsHidden?: boolean;
  17831. /**
  17832. * The executable to launch at login. Defaults to `process.execPath`.
  17833. *
  17834. * @platform win32
  17835. */
  17836. path?: string;
  17837. /**
  17838. * The command-line arguments to pass to the executable. Defaults to an empty
  17839. * array. Take care to wrap paths in quotes.
  17840. *
  17841. * @platform win32
  17842. */
  17843. args?: string[];
  17844. /**
  17845. * `true` will change the startup approved registry key and `enable / disable` the
  17846. * App in Task Manager and Windows Settings. Defaults to `true`.
  17847. *
  17848. * @platform win32
  17849. */
  17850. enabled?: boolean;
  17851. /**
  17852. * value name to write into registry. Defaults to the app's AppUserModelId(). Set
  17853. * the app's login item settings.
  17854. *
  17855. * @platform win32
  17856. */
  17857. name?: string;
  17858. }
  17859. interface SourcesOptions {
  17860. /**
  17861. * An array of strings that lists the types of desktop sources to be captured,
  17862. * available types can be `screen` and `window`.
  17863. */
  17864. types: Array<'screen' | 'window'>;
  17865. /**
  17866. * The size that the media source thumbnail should be scaled to. Default is `150` x
  17867. * `150`. Set width or height to 0 when you do not need the thumbnails. This will
  17868. * save the processing time required for capturing the content of each window and
  17869. * screen.
  17870. */
  17871. thumbnailSize?: Size;
  17872. /**
  17873. * Set to true to enable fetching window icons. The default value is false. When
  17874. * false the appIcon property of the sources return null. Same if a source has the
  17875. * type screen.
  17876. */
  17877. fetchWindowIcons?: boolean;
  17878. }
  17879. interface StartLoggingOptions {
  17880. /**
  17881. * What kinds of data should be captured. By default, only metadata about requests
  17882. * will be captured. Setting this to `includeSensitive` will include cookies and
  17883. * authentication data. Setting it to `everything` will include all bytes
  17884. * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
  17885. */
  17886. captureMode?: ('default' | 'includeSensitive' | 'everything');
  17887. /**
  17888. * When the log grows beyond this size, logging will automatically stop. Defaults
  17889. * to unlimited.
  17890. */
  17891. maxFileSize?: number;
  17892. }
  17893. interface Streams {
  17894. video?: (Video) | (WebFrameMain);
  17895. /**
  17896. * If a string is specified, can be `loopback` or `loopbackWithMute`. Specifying a
  17897. * loopback device will capture system audio, and is currently only supported on
  17898. * Windows. If a WebFrameMain is specified, will capture audio from that frame.
  17899. */
  17900. audio?: (('loopback' | 'loopbackWithMute')) | (WebFrameMain);
  17901. /**
  17902. * If `audio` is a WebFrameMain and this is set to `true`, then local playback of
  17903. * audio will not be muted (e.g. using `MediaRecorder` to record `WebFrameMain`
  17904. * with this flag set to `true` will allow audio to pass through to the speakers
  17905. * while recording). Default is `false`.
  17906. */
  17907. enableLocalEcho?: boolean;
  17908. }
  17909. interface SystemMemoryInfo {
  17910. /**
  17911. * The total amount of physical memory in Kilobytes available to the system.
  17912. */
  17913. total: number;
  17914. /**
  17915. * The total amount of memory not being used by applications or disk cache.
  17916. */
  17917. free: number;
  17918. /**
  17919. * The total amount of swap memory in Kilobytes available to the system.
  17920. *
  17921. * @platform win32,linux
  17922. */
  17923. swapTotal: number;
  17924. /**
  17925. * The free amount of swap memory in Kilobytes available to the system.
  17926. *
  17927. * @platform win32,linux
  17928. */
  17929. swapFree: number;
  17930. }
  17931. interface TitleBarOverlay {
  17932. /**
  17933. * The CSS color of the Window Controls Overlay when enabled. Default is the system
  17934. * color.
  17935. *
  17936. * @platform win32
  17937. */
  17938. color?: string;
  17939. /**
  17940. * The CSS color of the symbols on the Window Controls Overlay when enabled.
  17941. * Default is the system color.
  17942. *
  17943. * @platform win32
  17944. */
  17945. symbolColor?: string;
  17946. /**
  17947. * The height of the title bar and Window Controls Overlay in pixels. Default is
  17948. * system height.
  17949. *
  17950. * @platform darwin,win32
  17951. */
  17952. height?: number;
  17953. }
  17954. interface TitleOptions {
  17955. /**
  17956. * The font family variant to display, can be `monospaced` or `monospacedDigit`.
  17957. * `monospaced` is available in macOS 10.15+ When left blank, the title uses the
  17958. * default system font.
  17959. */
  17960. fontType?: ('monospaced' | 'monospacedDigit');
  17961. }
  17962. interface ToBitmapOptions {
  17963. /**
  17964. * Defaults to 1.0.
  17965. */
  17966. scaleFactor?: number;
  17967. }
  17968. interface ToDataURLOptions {
  17969. /**
  17970. * Defaults to 1.0.
  17971. */
  17972. scaleFactor?: number;
  17973. }
  17974. interface ToPNGOptions {
  17975. /**
  17976. * Defaults to 1.0.
  17977. */
  17978. scaleFactor?: number;
  17979. }
  17980. interface TouchBarButtonConstructorOptions {
  17981. /**
  17982. * Button text.
  17983. */
  17984. label?: string;
  17985. /**
  17986. * A short description of the button for use by screenreaders like VoiceOver.
  17987. */
  17988. accessibilityLabel?: string;
  17989. /**
  17990. * Button background color in hex format, i.e `#ABCDEF`.
  17991. */
  17992. backgroundColor?: string;
  17993. /**
  17994. * Button icon.
  17995. */
  17996. icon?: (NativeImage) | (string);
  17997. /**
  17998. * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
  17999. */
  18000. iconPosition?: ('left' | 'right' | 'overlay');
  18001. /**
  18002. * Function to call when the button is clicked.
  18003. */
  18004. click?: () => void;
  18005. /**
  18006. * Whether the button is in an enabled state. Default is `true`.
  18007. */
  18008. enabled?: boolean;
  18009. }
  18010. interface TouchBarColorPickerConstructorOptions {
  18011. /**
  18012. * Array of hex color strings to appear as possible colors to select.
  18013. */
  18014. availableColors?: string[];
  18015. /**
  18016. * The selected hex color in the picker, i.e `#ABCDEF`.
  18017. */
  18018. selectedColor?: string;
  18019. /**
  18020. * Function to call when a color is selected.
  18021. */
  18022. change?: (color: string) => void;
  18023. }
  18024. interface TouchBarConstructorOptions {
  18025. items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
  18026. escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
  18027. }
  18028. interface TouchBarGroupConstructorOptions {
  18029. /**
  18030. * Items to display as a group.
  18031. */
  18032. items: TouchBar;
  18033. }
  18034. interface TouchBarLabelConstructorOptions {
  18035. /**
  18036. * Text to display.
  18037. */
  18038. label?: string;
  18039. /**
  18040. * A short description of the button for use by screenreaders like VoiceOver.
  18041. */
  18042. accessibilityLabel?: string;
  18043. /**
  18044. * Hex color of text, i.e `#ABCDEF`.
  18045. */
  18046. textColor?: string;
  18047. }
  18048. interface TouchBarPopoverConstructorOptions {
  18049. /**
  18050. * Popover button text.
  18051. */
  18052. label?: string;
  18053. /**
  18054. * Popover button icon.
  18055. */
  18056. icon?: NativeImage;
  18057. /**
  18058. * Items to display in the popover.
  18059. */
  18060. items: TouchBar;
  18061. /**
  18062. * `true` to display a close button on the left of the popover, `false` to not show
  18063. * it. Default is `true`.
  18064. */
  18065. showCloseButton?: boolean;
  18066. }
  18067. interface TouchBarScrubberConstructorOptions {
  18068. /**
  18069. * An array of items to place in this scrubber.
  18070. */
  18071. items: ScrubberItem[];
  18072. /**
  18073. * Called when the user taps an item that was not the last tapped item.
  18074. */
  18075. select?: (selectedIndex: number) => void;
  18076. /**
  18077. * Called when the user taps any item.
  18078. */
  18079. highlight?: (highlightedIndex: number) => void;
  18080. /**
  18081. * Selected item style. Can be `background`, `outline` or `none`. Defaults to
  18082. * `none`.
  18083. */
  18084. selectedStyle?: ('background' | 'outline' | 'none');
  18085. /**
  18086. * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
  18087. * to `none`.
  18088. */
  18089. overlayStyle?: ('background' | 'outline' | 'none');
  18090. /**
  18091. * Whether to show arrow buttons. Defaults to `false` and is only shown if `items`
  18092. * is non-empty.
  18093. */
  18094. showArrowButtons?: boolean;
  18095. /**
  18096. * Can be `fixed` or `free`. The default is `free`.
  18097. */
  18098. mode?: ('fixed' | 'free');
  18099. /**
  18100. * Defaults to `true`.
  18101. */
  18102. continuous?: boolean;
  18103. }
  18104. interface TouchBarSegmentedControlConstructorOptions {
  18105. /**
  18106. * Style of the segments:
  18107. */
  18108. segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
  18109. /**
  18110. * The selection mode of the control:
  18111. */
  18112. mode?: ('single' | 'multiple' | 'buttons');
  18113. /**
  18114. * An array of segments to place in this control.
  18115. */
  18116. segments: SegmentedControlSegment[];
  18117. /**
  18118. * The index of the currently selected segment, will update automatically with user
  18119. * interaction. When the mode is `multiple` it will be the last selected item.
  18120. */
  18121. selectedIndex?: number;
  18122. /**
  18123. * Called when the user selects a new segment.
  18124. */
  18125. change?: (selectedIndex: number, isSelected: boolean) => void;
  18126. }
  18127. interface TouchBarSliderConstructorOptions {
  18128. /**
  18129. * Label text.
  18130. */
  18131. label?: string;
  18132. /**
  18133. * Selected value.
  18134. */
  18135. value?: number;
  18136. /**
  18137. * Minimum value.
  18138. */
  18139. minValue?: number;
  18140. /**
  18141. * Maximum value.
  18142. */
  18143. maxValue?: number;
  18144. /**
  18145. * Function to call when the slider is changed.
  18146. */
  18147. change?: (newValue: number) => void;
  18148. }
  18149. interface TouchBarSpacerConstructorOptions {
  18150. /**
  18151. * Size of spacer, possible values are:
  18152. */
  18153. size?: ('small' | 'large' | 'flexible');
  18154. }
  18155. interface TraceBufferUsageReturnValue {
  18156. value: number;
  18157. percentage: number;
  18158. }
  18159. interface UdpPortRange {
  18160. /**
  18161. * The minimum UDP port number that WebRTC should use.
  18162. */
  18163. min: number;
  18164. /**
  18165. * The maximum UDP port number that WebRTC should use.
  18166. */
  18167. max: number;
  18168. }
  18169. interface UpdateTargetUrlEvent extends DOMEvent {
  18170. url: string;
  18171. }
  18172. interface UploadProgress {
  18173. /**
  18174. * Whether the request is currently active. If this is false no other properties
  18175. * will be set
  18176. */
  18177. active: boolean;
  18178. /**
  18179. * Whether the upload has started. If this is false both `current` and `total` will
  18180. * be set to 0.
  18181. */
  18182. started: boolean;
  18183. /**
  18184. * The number of bytes that have been uploaded so far
  18185. */
  18186. current: number;
  18187. /**
  18188. * The number of bytes that will be uploaded this request
  18189. */
  18190. total: number;
  18191. }
  18192. interface UsbDeviceRevokedDetails {
  18193. device: USBDevice;
  18194. /**
  18195. * The origin that the device has been revoked from.
  18196. */
  18197. origin?: string;
  18198. }
  18199. interface USBProtectedClassesHandlerHandlerDetails {
  18200. /**
  18201. * The current list of protected USB classes. Possible class values include:
  18202. */
  18203. protectedClasses: Array<'audio' | 'audio-video' | 'hid' | 'mass-storage' | 'smart-card' | 'video' | 'wireless'>;
  18204. }
  18205. interface VisibleOnAllWorkspacesOptions {
  18206. /**
  18207. * Sets whether the window should be visible above fullscreen windows.
  18208. *
  18209. * @platform darwin
  18210. */
  18211. visibleOnFullScreen?: boolean;
  18212. /**
  18213. * Calling setVisibleOnAllWorkspaces will by default transform the process type
  18214. * between UIElementApplication and ForegroundApplication to ensure the correct
  18215. * behavior. However, this will hide the window and dock for a short time every
  18216. * time it is called. If your window is already of type UIElementApplication, you
  18217. * can bypass this transformation by passing true to skipTransformProcessType.
  18218. *
  18219. * @platform darwin
  18220. */
  18221. skipTransformProcessType?: boolean;
  18222. }
  18223. interface WebContentsAudioStateChangedEventParams {
  18224. /**
  18225. * True if one or more frames or child `webContents` are emitting audio.
  18226. */
  18227. audible: boolean;
  18228. }
  18229. interface WebContentsDidRedirectNavigationEventParams {
  18230. /**
  18231. * The URL the frame is navigating to.
  18232. */
  18233. url: string;
  18234. /**
  18235. * Whether the navigation happened without changing document. Examples of same
  18236. * document navigations are reference fragment navigations, pushState/replaceState,
  18237. * and same page history navigation.
  18238. */
  18239. isSameDocument: boolean;
  18240. /**
  18241. * True if the navigation is taking place in a main frame.
  18242. */
  18243. isMainFrame: boolean;
  18244. /**
  18245. * The frame to be navigated.
  18246. */
  18247. frame: WebFrameMain;
  18248. /**
  18249. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  18250. * `window.open` with a frame's name), or null if the navigation was not initiated
  18251. * by a frame. This can also be null if the initiating frame was deleted before the
  18252. * event was emitted.
  18253. */
  18254. initiator?: WebFrameMain;
  18255. }
  18256. interface WebContentsDidStartNavigationEventParams {
  18257. /**
  18258. * The URL the frame is navigating to.
  18259. */
  18260. url: string;
  18261. /**
  18262. * Whether the navigation happened without changing document. Examples of same
  18263. * document navigations are reference fragment navigations, pushState/replaceState,
  18264. * and same page history navigation.
  18265. */
  18266. isSameDocument: boolean;
  18267. /**
  18268. * True if the navigation is taking place in a main frame.
  18269. */
  18270. isMainFrame: boolean;
  18271. /**
  18272. * The frame to be navigated.
  18273. */
  18274. frame: WebFrameMain;
  18275. /**
  18276. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  18277. * `window.open` with a frame's name), or null if the navigation was not initiated
  18278. * by a frame. This can also be null if the initiating frame was deleted before the
  18279. * event was emitted.
  18280. */
  18281. initiator?: WebFrameMain;
  18282. }
  18283. interface WebContentsPrintOptions {
  18284. /**
  18285. * Don't ask user for print settings. Default is `false`.
  18286. */
  18287. silent?: boolean;
  18288. /**
  18289. * Prints the background color and image of the web page. Default is `false`.
  18290. */
  18291. printBackground?: boolean;
  18292. /**
  18293. * Set the printer device name to use. Must be the system-defined name and not the
  18294. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  18295. */
  18296. deviceName?: string;
  18297. /**
  18298. * Set whether the printed web page will be in color or grayscale. Default is
  18299. * `true`.
  18300. */
  18301. color?: boolean;
  18302. margins?: Margins;
  18303. /**
  18304. * Whether the web page should be printed in landscape mode. Default is `false`.
  18305. */
  18306. landscape?: boolean;
  18307. /**
  18308. * The scale factor of the web page.
  18309. */
  18310. scaleFactor?: number;
  18311. /**
  18312. * The number of pages to print per page sheet.
  18313. */
  18314. pagesPerSheet?: number;
  18315. /**
  18316. * Whether the web page should be collated.
  18317. */
  18318. collate?: boolean;
  18319. /**
  18320. * The number of copies of the web page to print.
  18321. */
  18322. copies?: number;
  18323. /**
  18324. * The page range to print. On macOS, only one range is honored.
  18325. */
  18326. pageRanges?: PageRanges[];
  18327. /**
  18328. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  18329. * `longEdge`.
  18330. */
  18331. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  18332. dpi?: Record<string, number>;
  18333. /**
  18334. * string to be printed as page header.
  18335. */
  18336. header?: string;
  18337. /**
  18338. * string to be printed as page footer.
  18339. */
  18340. footer?: string;
  18341. /**
  18342. * Specify page size of the printed document. Can be `A0`, `A1`, `A2`, `A3`, `A4`,
  18343. * `A5`, `A6`, `Legal`, `Letter`, `Tabloid` or an Object containing `height` and
  18344. * `width`.
  18345. */
  18346. pageSize?: (('A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid')) | (Size);
  18347. }
  18348. interface WebContentsWillFrameNavigateEventParams {
  18349. /**
  18350. * The URL the frame is navigating to.
  18351. */
  18352. url: string;
  18353. /**
  18354. * This event does not fire for same document navigations using window.history api
  18355. * and reference fragment navigations. This property is always set to `false` for
  18356. * this event.
  18357. */
  18358. isSameDocument: boolean;
  18359. /**
  18360. * True if the navigation is taking place in a main frame.
  18361. */
  18362. isMainFrame: boolean;
  18363. /**
  18364. * The frame to be navigated.
  18365. */
  18366. frame: WebFrameMain;
  18367. /**
  18368. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  18369. * `window.open` with a frame's name), or null if the navigation was not initiated
  18370. * by a frame. This can also be null if the initiating frame was deleted before the
  18371. * event was emitted.
  18372. */
  18373. initiator?: WebFrameMain;
  18374. }
  18375. interface WebContentsWillNavigateEventParams {
  18376. /**
  18377. * The URL the frame is navigating to.
  18378. */
  18379. url: string;
  18380. /**
  18381. * This event does not fire for same document navigations using window.history api
  18382. * and reference fragment navigations. This property is always set to `false` for
  18383. * this event.
  18384. */
  18385. isSameDocument: boolean;
  18386. /**
  18387. * True if the navigation is taking place in a main frame.
  18388. */
  18389. isMainFrame: boolean;
  18390. /**
  18391. * The frame to be navigated.
  18392. */
  18393. frame: WebFrameMain;
  18394. /**
  18395. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  18396. * `window.open` with a frame's name), or null if the navigation was not initiated
  18397. * by a frame. This can also be null if the initiating frame was deleted before the
  18398. * event was emitted.
  18399. */
  18400. initiator?: WebFrameMain;
  18401. }
  18402. interface WebContentsWillRedirectEventParams {
  18403. /**
  18404. * The URL the frame is navigating to.
  18405. */
  18406. url: string;
  18407. /**
  18408. * Whether the navigation happened without changing document. Examples of same
  18409. * document navigations are reference fragment navigations, pushState/replaceState,
  18410. * and same page history navigation.
  18411. */
  18412. isSameDocument: boolean;
  18413. /**
  18414. * True if the navigation is taking place in a main frame.
  18415. */
  18416. isMainFrame: boolean;
  18417. /**
  18418. * The frame to be navigated.
  18419. */
  18420. frame: WebFrameMain;
  18421. /**
  18422. * The frame which initiated the navigation, which can be a parent frame (e.g. via
  18423. * `window.open` with a frame's name), or null if the navigation was not initiated
  18424. * by a frame. This can also be null if the initiating frame was deleted before the
  18425. * event was emitted.
  18426. */
  18427. initiator?: WebFrameMain;
  18428. }
  18429. interface WebRTCUDPPortRange {
  18430. /**
  18431. * The minimum UDP port number that WebRTC should use.
  18432. */
  18433. min: number;
  18434. /**
  18435. * The maximum UDP port number that WebRTC should use.
  18436. */
  18437. max: number;
  18438. }
  18439. interface WebviewTagPrintOptions {
  18440. /**
  18441. * Don't ask user for print settings. Default is `false`.
  18442. */
  18443. silent?: boolean;
  18444. /**
  18445. * Prints the background color and image of the web page. Default is `false`.
  18446. */
  18447. printBackground?: boolean;
  18448. /**
  18449. * Set the printer device name to use. Must be the system-defined name and not the
  18450. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  18451. */
  18452. deviceName?: string;
  18453. /**
  18454. * Set whether the printed web page will be in color or grayscale. Default is
  18455. * `true`.
  18456. */
  18457. color?: boolean;
  18458. margins?: Margins;
  18459. /**
  18460. * Whether the web page should be printed in landscape mode. Default is `false`.
  18461. */
  18462. landscape?: boolean;
  18463. /**
  18464. * The scale factor of the web page.
  18465. */
  18466. scaleFactor?: number;
  18467. /**
  18468. * The number of pages to print per page sheet.
  18469. */
  18470. pagesPerSheet?: number;
  18471. /**
  18472. * Whether the web page should be collated.
  18473. */
  18474. collate?: boolean;
  18475. /**
  18476. * The number of copies of the web page to print.
  18477. */
  18478. copies?: number;
  18479. /**
  18480. * The page range to print.
  18481. */
  18482. pageRanges?: PageRanges[];
  18483. /**
  18484. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  18485. * `longEdge`.
  18486. */
  18487. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  18488. dpi?: Record<string, number>;
  18489. /**
  18490. * string to be printed as page header.
  18491. */
  18492. header?: string;
  18493. /**
  18494. * string to be printed as page footer.
  18495. */
  18496. footer?: string;
  18497. /**
  18498. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  18499. * `Letter`, `Tabloid` or an Object containing `height` in microns.
  18500. */
  18501. pageSize?: (('A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid')) | (Size);
  18502. }
  18503. interface WillFrameNavigateEvent extends DOMEvent {
  18504. url: string;
  18505. isMainFrame: boolean;
  18506. frameProcessId: number;
  18507. frameRoutingId: number;
  18508. }
  18509. interface WillNavigateEvent extends DOMEvent {
  18510. url: string;
  18511. }
  18512. interface WillResizeDetails {
  18513. /**
  18514. * The edge of the window being dragged for resizing. Can be `bottom`, `left`,
  18515. * `right`, `top-left`, `top-right`, `bottom-left` or `bottom-right`.
  18516. */
  18517. edge: ('bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right');
  18518. }
  18519. interface EditFlags {
  18520. /**
  18521. * Whether the renderer believes it can undo.
  18522. */
  18523. canUndo: boolean;
  18524. /**
  18525. * Whether the renderer believes it can redo.
  18526. */
  18527. canRedo: boolean;
  18528. /**
  18529. * Whether the renderer believes it can cut.
  18530. */
  18531. canCut: boolean;
  18532. /**
  18533. * Whether the renderer believes it can copy.
  18534. */
  18535. canCopy: boolean;
  18536. /**
  18537. * Whether the renderer believes it can paste.
  18538. */
  18539. canPaste: boolean;
  18540. /**
  18541. * Whether the renderer believes it can delete.
  18542. */
  18543. canDelete: boolean;
  18544. /**
  18545. * Whether the renderer believes it can select all.
  18546. */
  18547. canSelectAll: boolean;
  18548. /**
  18549. * Whether the renderer believes it can edit text richly.
  18550. */
  18551. canEditRichly: boolean;
  18552. }
  18553. interface Env {
  18554. }
  18555. interface FoundInPageResult {
  18556. requestId: number;
  18557. /**
  18558. * Position of the active match.
  18559. */
  18560. activeMatchOrdinal: number;
  18561. /**
  18562. * Number of Matches.
  18563. */
  18564. matches: number;
  18565. /**
  18566. * Coordinates of first match region.
  18567. */
  18568. selectionArea: Rectangle;
  18569. finalUpdate: boolean;
  18570. }
  18571. interface LaunchItems {
  18572. /**
  18573. * name value of a registry entry.
  18574. *
  18575. * @platform win32
  18576. */
  18577. name: string;
  18578. /**
  18579. * The executable to an app that corresponds to a registry entry.
  18580. *
  18581. * @platform win32
  18582. */
  18583. path: string;
  18584. /**
  18585. * the command-line arguments to pass to the executable.
  18586. *
  18587. * @platform win32
  18588. */
  18589. args: string[];
  18590. /**
  18591. * one of `user` or `machine`. Indicates whether the registry entry is under
  18592. * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  18593. *
  18594. * @platform win32
  18595. */
  18596. scope: string;
  18597. /**
  18598. * `true` if the app registry key is startup approved and therefore shows as
  18599. * `enabled` in Task Manager and Windows settings.
  18600. *
  18601. * @platform win32
  18602. */
  18603. enabled: boolean;
  18604. }
  18605. interface Margins {
  18606. /**
  18607. * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
  18608. * you will also need to specify `top`, `bottom`, `left`, and `right`.
  18609. */
  18610. marginType?: ('default' | 'none' | 'printableArea' | 'custom');
  18611. /**
  18612. * The top margin of the printed web page, in pixels.
  18613. */
  18614. top?: number;
  18615. /**
  18616. * The bottom margin of the printed web page, in pixels.
  18617. */
  18618. bottom?: number;
  18619. /**
  18620. * The left margin of the printed web page, in pixels.
  18621. */
  18622. left?: number;
  18623. /**
  18624. * The right margin of the printed web page, in pixels.
  18625. */
  18626. right?: number;
  18627. }
  18628. interface MediaFlags {
  18629. /**
  18630. * Whether the media element has crashed.
  18631. */
  18632. inError: boolean;
  18633. /**
  18634. * Whether the media element is paused.
  18635. */
  18636. isPaused: boolean;
  18637. /**
  18638. * Whether the media element is muted.
  18639. */
  18640. isMuted: boolean;
  18641. /**
  18642. * Whether the media element has audio.
  18643. */
  18644. hasAudio: boolean;
  18645. /**
  18646. * Whether the media element is looping.
  18647. */
  18648. isLooping: boolean;
  18649. /**
  18650. * Whether the media element's controls are visible.
  18651. */
  18652. isControlsVisible: boolean;
  18653. /**
  18654. * Whether the media element's controls are toggleable.
  18655. */
  18656. canToggleControls: boolean;
  18657. /**
  18658. * Whether the media element can be printed.
  18659. */
  18660. canPrint: boolean;
  18661. /**
  18662. * Whether or not the media element can be downloaded.
  18663. */
  18664. canSave: boolean;
  18665. /**
  18666. * Whether the media element can show picture-in-picture.
  18667. */
  18668. canShowPictureInPicture: boolean;
  18669. /**
  18670. * Whether the media element is currently showing picture-in-picture.
  18671. */
  18672. isShowingPictureInPicture: boolean;
  18673. /**
  18674. * Whether the media element can be rotated.
  18675. */
  18676. canRotate: boolean;
  18677. /**
  18678. * Whether the media element can be looped.
  18679. */
  18680. canLoop: boolean;
  18681. }
  18682. interface PageRanges {
  18683. /**
  18684. * Index of the first page to print (0-based).
  18685. */
  18686. from: number;
  18687. /**
  18688. * Index of the last page to print (inclusive) (0-based).
  18689. */
  18690. to: number;
  18691. }
  18692. interface Params {
  18693. /**
  18694. * x coordinate.
  18695. */
  18696. x: number;
  18697. /**
  18698. * y coordinate.
  18699. */
  18700. y: number;
  18701. /**
  18702. * URL of the link that encloses the node the context menu was invoked on.
  18703. */
  18704. linkURL: string;
  18705. /**
  18706. * Text associated with the link. May be an empty string if the contents of the
  18707. * link are an image.
  18708. */
  18709. linkText: string;
  18710. /**
  18711. * URL of the top level page that the context menu was invoked on.
  18712. */
  18713. pageURL: string;
  18714. /**
  18715. * URL of the subframe that the context menu was invoked on.
  18716. */
  18717. frameURL: string;
  18718. /**
  18719. * Source URL for the element that the context menu was invoked on. Elements with
  18720. * source URLs are images, audio and video.
  18721. */
  18722. srcURL: string;
  18723. /**
  18724. * Type of the node the context menu was invoked on. Can be `none`, `image`,
  18725. * `audio`, `video`, `canvas`, `file` or `plugin`.
  18726. */
  18727. mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
  18728. /**
  18729. * Whether the context menu was invoked on an image which has non-empty contents.
  18730. */
  18731. hasImageContents: boolean;
  18732. /**
  18733. * Whether the context is editable.
  18734. */
  18735. isEditable: boolean;
  18736. /**
  18737. * Text of the selection that the context menu was invoked on.
  18738. */
  18739. selectionText: string;
  18740. /**
  18741. * Title text of the selection that the context menu was invoked on.
  18742. */
  18743. titleText: string;
  18744. /**
  18745. * Alt text of the selection that the context menu was invoked on.
  18746. */
  18747. altText: string;
  18748. /**
  18749. * Suggested filename to be used when saving file through 'Save Link As' option of
  18750. * context menu.
  18751. */
  18752. suggestedFilename: string;
  18753. /**
  18754. * Rect representing the coordinates in the document space of the selection.
  18755. */
  18756. selectionRect: Rectangle;
  18757. /**
  18758. * Start position of the selection text.
  18759. */
  18760. selectionStartOffset: number;
  18761. /**
  18762. * The referrer policy of the frame on which the menu is invoked.
  18763. */
  18764. referrerPolicy: Referrer;
  18765. /**
  18766. * The misspelled word under the cursor, if any.
  18767. */
  18768. misspelledWord: string;
  18769. /**
  18770. * An array of suggested words to show the user to replace the `misspelledWord`.
  18771. * Only available if there is a misspelled word and spellchecker is enabled.
  18772. */
  18773. dictionarySuggestions: string[];
  18774. /**
  18775. * The character encoding of the frame on which the menu was invoked.
  18776. */
  18777. frameCharset: string;
  18778. /**
  18779. * The source that the context menu was invoked on. Possible values include `none`,
  18780. * `button-button`, `field-set`, `input-button`, `input-checkbox`, `input-color`,
  18781. * `input-date`, `input-datetime-local`, `input-email`, `input-file`,
  18782. * `input-hidden`, `input-image`, `input-month`, `input-number`, `input-password`,
  18783. * `input-radio`, `input-range`, `input-reset`, `input-search`, `input-submit`,
  18784. * `input-telephone`, `input-text`, `input-time`, `input-url`, `input-week`,
  18785. * `output`, `reset-button`, `select-list`, `select-list`, `select-multiple`,
  18786. * `select-one`, `submit-button`, and `text-area`,
  18787. */
  18788. formControlType: ('none' | 'button-button' | 'field-set' | 'input-button' | 'input-checkbox' | 'input-color' | 'input-date' | 'input-datetime-local' | 'input-email' | 'input-file' | 'input-hidden' | 'input-image' | 'input-month' | 'input-number' | 'input-password' | 'input-radio' | 'input-range' | 'input-reset' | 'input-search' | 'input-submit' | 'input-telephone' | 'input-text' | 'input-time' | 'input-url' | 'input-week' | 'output' | 'reset-button' | 'select-list' | 'select-list' | 'select-multiple' | 'select-one' | 'submit-button' | 'text-area');
  18789. /**
  18790. * If the context menu was invoked on an input field, the type of that field.
  18791. * Possible values include `none`, `plainText`, `password`, `other`.
  18792. *
  18793. * @deprecated
  18794. */
  18795. inputFieldType: ('none' | 'plainText' | 'password' | 'other');
  18796. /**
  18797. * If the context is editable, whether or not spellchecking is enabled.
  18798. */
  18799. spellcheckEnabled: boolean;
  18800. /**
  18801. * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
  18802. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  18803. * `adjustSelection`, or `adjustSelectionReset`.
  18804. */
  18805. menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  18806. /**
  18807. * The flags for the media element the context menu was invoked on.
  18808. */
  18809. mediaFlags: MediaFlags;
  18810. /**
  18811. * These flags indicate whether the renderer believes it is able to perform the
  18812. * corresponding action.
  18813. */
  18814. editFlags: EditFlags;
  18815. }
  18816. interface Video {
  18817. /**
  18818. * The id of the stream being granted. This will usually come from a
  18819. * DesktopCapturerSource object.
  18820. */
  18821. id: string;
  18822. /**
  18823. * The name of the stream being granted. This will usually come from a
  18824. * DesktopCapturerSource object.
  18825. */
  18826. name: string;
  18827. }
  18828. namespace Common {
  18829. type Event<Params extends object = {}> = Electron.Event<Params>;
  18830. const clipboard: Clipboard;
  18831. type Clipboard = Electron.Clipboard;
  18832. const crashReporter: CrashReporter;
  18833. type CrashReporter = Electron.CrashReporter;
  18834. const nativeImage: typeof NativeImage;
  18835. type NativeImage = Electron.NativeImage;
  18836. const shell: Shell;
  18837. type Shell = Electron.Shell;
  18838. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  18839. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  18840. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  18841. type AnimationSettings = Electron.AnimationSettings;
  18842. type AppDetailsOptions = Electron.AppDetailsOptions;
  18843. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  18844. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  18845. type AuthInfo = Electron.AuthInfo;
  18846. type AutoResizeOptions = Electron.AutoResizeOptions;
  18847. type BeforeSendResponse = Electron.BeforeSendResponse;
  18848. type BitmapOptions = Electron.BitmapOptions;
  18849. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  18850. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  18851. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  18852. type CallbackResponse = Electron.CallbackResponse;
  18853. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  18854. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  18855. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  18856. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  18857. type CloseOpts = Electron.CloseOpts;
  18858. type Config = Electron.Config;
  18859. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  18860. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  18861. type ContextMenuEvent = Electron.ContextMenuEvent;
  18862. type ContextMenuParams = Electron.ContextMenuParams;
  18863. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  18864. type CookiesGetFilter = Electron.CookiesGetFilter;
  18865. type CookiesSetDetails = Electron.CookiesSetDetails;
  18866. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  18867. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  18868. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  18869. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  18870. type Data = Electron.Data;
  18871. type DefaultFontFamily = Electron.DefaultFontFamily;
  18872. type Details = Electron.Details;
  18873. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  18874. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  18875. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  18876. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  18877. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  18878. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  18879. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  18880. type DidNavigateEvent = Electron.DidNavigateEvent;
  18881. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  18882. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  18883. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  18884. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  18885. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  18886. type DownloadURLOptions = Electron.DownloadURLOptions;
  18887. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  18888. type FeedURLOptions = Electron.FeedURLOptions;
  18889. type FileIconOptions = Electron.FileIconOptions;
  18890. type FindInPageOptions = Electron.FindInPageOptions;
  18891. type FocusOptions = Electron.FocusOptions;
  18892. type ForkOptions = Electron.ForkOptions;
  18893. type FoundInPageEvent = Electron.FoundInPageEvent;
  18894. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  18895. type FromPartitionOptions = Electron.FromPartitionOptions;
  18896. type FromPathOptions = Electron.FromPathOptions;
  18897. type HandlerDetails = Electron.HandlerDetails;
  18898. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  18899. type HeapStatistics = Electron.HeapStatistics;
  18900. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  18901. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  18902. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  18903. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  18904. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  18905. type Info = Electron.Info;
  18906. type Input = Electron.Input;
  18907. type InsertCSSOptions = Electron.InsertCSSOptions;
  18908. type IpcMessageEvent = Electron.IpcMessageEvent;
  18909. type Item = Electron.Item;
  18910. type JumpListSettings = Electron.JumpListSettings;
  18911. type LoadCommitEvent = Electron.LoadCommitEvent;
  18912. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  18913. type LoadFileOptions = Electron.LoadFileOptions;
  18914. type LoadURLOptions = Electron.LoadURLOptions;
  18915. type LoginItemSettings = Electron.LoginItemSettings;
  18916. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  18917. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  18918. type MessageBoxOptions = Electron.MessageBoxOptions;
  18919. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  18920. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  18921. type MessageDetails = Electron.MessageDetails;
  18922. type MessageEvent = Electron.MessageEvent;
  18923. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  18924. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  18925. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  18926. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  18927. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  18928. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  18929. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  18930. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  18931. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  18932. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  18933. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  18934. type OpenDialogOptions = Electron.OpenDialogOptions;
  18935. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  18936. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  18937. type OpenExternalOptions = Electron.OpenExternalOptions;
  18938. type Options = Electron.Options;
  18939. type Opts = Electron.Opts;
  18940. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  18941. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  18942. type Parameters = Electron.Parameters;
  18943. type Payment = Electron.Payment;
  18944. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  18945. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  18946. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  18947. type PopupOptions = Electron.PopupOptions;
  18948. type PreconnectOptions = Electron.PreconnectOptions;
  18949. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  18950. type Privileges = Electron.Privileges;
  18951. type ProgressBarOptions = Electron.ProgressBarOptions;
  18952. type Provider = Electron.Provider;
  18953. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  18954. type ReadBookmark = Electron.ReadBookmark;
  18955. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  18956. type RelaunchOptions = Electron.RelaunchOptions;
  18957. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  18958. type Request = Electron.Request;
  18959. type ResizeOptions = Electron.ResizeOptions;
  18960. type ResolveHostOptions = Electron.ResolveHostOptions;
  18961. type ResourceUsage = Electron.ResourceUsage;
  18962. type Response = Electron.Response;
  18963. type Result = Electron.Result;
  18964. type SaveDialogOptions = Electron.SaveDialogOptions;
  18965. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  18966. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  18967. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  18968. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  18969. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  18970. type Settings = Electron.Settings;
  18971. type SourcesOptions = Electron.SourcesOptions;
  18972. type StartLoggingOptions = Electron.StartLoggingOptions;
  18973. type Streams = Electron.Streams;
  18974. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  18975. type TitleBarOverlay = Electron.TitleBarOverlay;
  18976. type TitleOptions = Electron.TitleOptions;
  18977. type ToBitmapOptions = Electron.ToBitmapOptions;
  18978. type ToDataURLOptions = Electron.ToDataURLOptions;
  18979. type ToPNGOptions = Electron.ToPNGOptions;
  18980. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  18981. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  18982. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  18983. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  18984. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  18985. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  18986. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  18987. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  18988. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  18989. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  18990. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  18991. type UdpPortRange = Electron.UdpPortRange;
  18992. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  18993. type UploadProgress = Electron.UploadProgress;
  18994. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  18995. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  18996. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  18997. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  18998. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  18999. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  19000. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  19001. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  19002. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  19003. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  19004. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  19005. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  19006. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  19007. type WillNavigateEvent = Electron.WillNavigateEvent;
  19008. type WillResizeDetails = Electron.WillResizeDetails;
  19009. type EditFlags = Electron.EditFlags;
  19010. type Env = Electron.Env;
  19011. type FoundInPageResult = Electron.FoundInPageResult;
  19012. type LaunchItems = Electron.LaunchItems;
  19013. type Margins = Electron.Margins;
  19014. type MediaFlags = Electron.MediaFlags;
  19015. type PageRanges = Electron.PageRanges;
  19016. type Params = Electron.Params;
  19017. type Video = Electron.Video;
  19018. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  19019. type BluetoothDevice = Electron.BluetoothDevice;
  19020. type Certificate = Electron.Certificate;
  19021. type CertificatePrincipal = Electron.CertificatePrincipal;
  19022. type Cookie = Electron.Cookie;
  19023. type CPUUsage = Electron.CPUUsage;
  19024. type CrashReport = Electron.CrashReport;
  19025. type CustomScheme = Electron.CustomScheme;
  19026. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  19027. type Display = Electron.Display;
  19028. type Extension = Electron.Extension;
  19029. type ExtensionInfo = Electron.ExtensionInfo;
  19030. type FileFilter = Electron.FileFilter;
  19031. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  19032. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  19033. type HIDDevice = Electron.HIDDevice;
  19034. type InputEvent = Electron.InputEvent;
  19035. type IOCounters = Electron.IOCounters;
  19036. type IpcMainEvent = Electron.IpcMainEvent;
  19037. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  19038. type IpcRendererEvent = Electron.IpcRendererEvent;
  19039. type JumpListCategory = Electron.JumpListCategory;
  19040. type JumpListItem = Electron.JumpListItem;
  19041. type KeyboardEvent = Electron.KeyboardEvent;
  19042. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  19043. type MemoryInfo = Electron.MemoryInfo;
  19044. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  19045. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  19046. type MouseInputEvent = Electron.MouseInputEvent;
  19047. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  19048. type NotificationAction = Electron.NotificationAction;
  19049. type NotificationResponse = Electron.NotificationResponse;
  19050. type PaymentDiscount = Electron.PaymentDiscount;
  19051. type Point = Electron.Point;
  19052. type PostBody = Electron.PostBody;
  19053. type PrinterInfo = Electron.PrinterInfo;
  19054. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  19055. type ProcessMetric = Electron.ProcessMetric;
  19056. type Product = Electron.Product;
  19057. type ProductDiscount = Electron.ProductDiscount;
  19058. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  19059. type ProtocolRequest = Electron.ProtocolRequest;
  19060. type ProtocolResponse = Electron.ProtocolResponse;
  19061. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  19062. type ProxyConfig = Electron.ProxyConfig;
  19063. type Rectangle = Electron.Rectangle;
  19064. type Referrer = Electron.Referrer;
  19065. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  19066. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  19067. type ResolvedHost = Electron.ResolvedHost;
  19068. type ScrubberItem = Electron.ScrubberItem;
  19069. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  19070. type SerialPort = Electron.SerialPort;
  19071. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  19072. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  19073. type SharingItem = Electron.SharingItem;
  19074. type ShortcutDetails = Electron.ShortcutDetails;
  19075. type Size = Electron.Size;
  19076. type Task = Electron.Task;
  19077. type ThumbarButton = Electron.ThumbarButton;
  19078. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  19079. type TraceConfig = Electron.TraceConfig;
  19080. type Transaction = Electron.Transaction;
  19081. type UploadData = Electron.UploadData;
  19082. type UploadFile = Electron.UploadFile;
  19083. type UploadRawData = Electron.UploadRawData;
  19084. type USBDevice = Electron.USBDevice;
  19085. type UserDefaultTypes = Electron.UserDefaultTypes;
  19086. type WebPreferences = Electron.WebPreferences;
  19087. type WebRequestFilter = Electron.WebRequestFilter;
  19088. type WebSource = Electron.WebSource;
  19089. }
  19090. namespace Main {
  19091. type Event<Params extends object = {}> = Electron.Event<Params>;
  19092. const app: App;
  19093. type App = Electron.App;
  19094. const autoUpdater: AutoUpdater;
  19095. type AutoUpdater = Electron.AutoUpdater;
  19096. class BrowserView extends Electron.BrowserView {}
  19097. class BrowserWindow extends Electron.BrowserWindow {}
  19098. type ClientRequest = Electron.ClientRequest;
  19099. type CommandLine = Electron.CommandLine;
  19100. const contentTracing: ContentTracing;
  19101. type ContentTracing = Electron.ContentTracing;
  19102. type Cookies = Electron.Cookies;
  19103. type Debugger = Electron.Debugger;
  19104. const desktopCapturer: DesktopCapturer;
  19105. type DesktopCapturer = Electron.DesktopCapturer;
  19106. const dialog: Dialog;
  19107. type Dialog = Electron.Dialog;
  19108. type Dock = Electron.Dock;
  19109. type DownloadItem = Electron.DownloadItem;
  19110. const globalShortcut: GlobalShortcut;
  19111. type GlobalShortcut = Electron.GlobalShortcut;
  19112. const inAppPurchase: InAppPurchase;
  19113. type InAppPurchase = Electron.InAppPurchase;
  19114. type IncomingMessage = Electron.IncomingMessage;
  19115. const ipcMain: IpcMain;
  19116. type IpcMain = Electron.IpcMain;
  19117. class Menu extends Electron.Menu {}
  19118. class MenuItem extends Electron.MenuItem {}
  19119. class MessageChannelMain extends Electron.MessageChannelMain {}
  19120. type MessagePortMain = Electron.MessagePortMain;
  19121. const nativeTheme: NativeTheme;
  19122. type NativeTheme = Electron.NativeTheme;
  19123. const net: Net;
  19124. type Net = Electron.Net;
  19125. const netLog: NetLog;
  19126. type NetLog = Electron.NetLog;
  19127. class Notification extends Electron.Notification {}
  19128. const powerMonitor: PowerMonitor;
  19129. type PowerMonitor = Electron.PowerMonitor;
  19130. const powerSaveBlocker: PowerSaveBlocker;
  19131. type PowerSaveBlocker = Electron.PowerSaveBlocker;
  19132. const protocol: Protocol;
  19133. type Protocol = Electron.Protocol;
  19134. const pushNotifications: PushNotifications;
  19135. type PushNotifications = Electron.PushNotifications;
  19136. const safeStorage: SafeStorage;
  19137. type SafeStorage = Electron.SafeStorage;
  19138. const screen: Screen;
  19139. type Screen = Electron.Screen;
  19140. type ServiceWorkers = Electron.ServiceWorkers;
  19141. const session: typeof Session;
  19142. type Session = Electron.Session;
  19143. class ShareMenu extends Electron.ShareMenu {}
  19144. const systemPreferences: SystemPreferences;
  19145. type SystemPreferences = Electron.SystemPreferences;
  19146. class TouchBar extends Electron.TouchBar {}
  19147. type TouchBarButton = Electron.TouchBarButton;
  19148. type TouchBarColorPicker = Electron.TouchBarColorPicker;
  19149. type TouchBarGroup = Electron.TouchBarGroup;
  19150. type TouchBarLabel = Electron.TouchBarLabel;
  19151. type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
  19152. type TouchBarPopover = Electron.TouchBarPopover;
  19153. type TouchBarScrubber = Electron.TouchBarScrubber;
  19154. type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
  19155. type TouchBarSlider = Electron.TouchBarSlider;
  19156. type TouchBarSpacer = Electron.TouchBarSpacer;
  19157. class Tray extends Electron.Tray {}
  19158. const utilityProcess: typeof UtilityProcess;
  19159. type UtilityProcess = Electron.UtilityProcess;
  19160. const webContents: typeof WebContents;
  19161. type WebContents = Electron.WebContents;
  19162. const webFrameMain: typeof WebFrameMain;
  19163. type WebFrameMain = Electron.WebFrameMain;
  19164. type WebRequest = Electron.WebRequest;
  19165. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  19166. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  19167. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  19168. type AnimationSettings = Electron.AnimationSettings;
  19169. type AppDetailsOptions = Electron.AppDetailsOptions;
  19170. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  19171. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  19172. type AuthInfo = Electron.AuthInfo;
  19173. type AutoResizeOptions = Electron.AutoResizeOptions;
  19174. type BeforeSendResponse = Electron.BeforeSendResponse;
  19175. type BitmapOptions = Electron.BitmapOptions;
  19176. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  19177. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  19178. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  19179. type CallbackResponse = Electron.CallbackResponse;
  19180. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  19181. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  19182. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  19183. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  19184. type CloseOpts = Electron.CloseOpts;
  19185. type Config = Electron.Config;
  19186. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  19187. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  19188. type ContextMenuEvent = Electron.ContextMenuEvent;
  19189. type ContextMenuParams = Electron.ContextMenuParams;
  19190. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  19191. type CookiesGetFilter = Electron.CookiesGetFilter;
  19192. type CookiesSetDetails = Electron.CookiesSetDetails;
  19193. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  19194. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  19195. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  19196. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  19197. type Data = Electron.Data;
  19198. type DefaultFontFamily = Electron.DefaultFontFamily;
  19199. type Details = Electron.Details;
  19200. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  19201. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  19202. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  19203. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  19204. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  19205. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  19206. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  19207. type DidNavigateEvent = Electron.DidNavigateEvent;
  19208. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  19209. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  19210. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  19211. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  19212. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  19213. type DownloadURLOptions = Electron.DownloadURLOptions;
  19214. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  19215. type FeedURLOptions = Electron.FeedURLOptions;
  19216. type FileIconOptions = Electron.FileIconOptions;
  19217. type FindInPageOptions = Electron.FindInPageOptions;
  19218. type FocusOptions = Electron.FocusOptions;
  19219. type ForkOptions = Electron.ForkOptions;
  19220. type FoundInPageEvent = Electron.FoundInPageEvent;
  19221. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  19222. type FromPartitionOptions = Electron.FromPartitionOptions;
  19223. type FromPathOptions = Electron.FromPathOptions;
  19224. type HandlerDetails = Electron.HandlerDetails;
  19225. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  19226. type HeapStatistics = Electron.HeapStatistics;
  19227. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  19228. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  19229. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  19230. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  19231. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  19232. type Info = Electron.Info;
  19233. type Input = Electron.Input;
  19234. type InsertCSSOptions = Electron.InsertCSSOptions;
  19235. type IpcMessageEvent = Electron.IpcMessageEvent;
  19236. type Item = Electron.Item;
  19237. type JumpListSettings = Electron.JumpListSettings;
  19238. type LoadCommitEvent = Electron.LoadCommitEvent;
  19239. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  19240. type LoadFileOptions = Electron.LoadFileOptions;
  19241. type LoadURLOptions = Electron.LoadURLOptions;
  19242. type LoginItemSettings = Electron.LoginItemSettings;
  19243. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  19244. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  19245. type MessageBoxOptions = Electron.MessageBoxOptions;
  19246. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  19247. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  19248. type MessageDetails = Electron.MessageDetails;
  19249. type MessageEvent = Electron.MessageEvent;
  19250. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  19251. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  19252. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  19253. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  19254. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  19255. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  19256. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  19257. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  19258. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  19259. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  19260. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  19261. type OpenDialogOptions = Electron.OpenDialogOptions;
  19262. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  19263. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  19264. type OpenExternalOptions = Electron.OpenExternalOptions;
  19265. type Options = Electron.Options;
  19266. type Opts = Electron.Opts;
  19267. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  19268. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  19269. type Parameters = Electron.Parameters;
  19270. type Payment = Electron.Payment;
  19271. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  19272. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  19273. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  19274. type PopupOptions = Electron.PopupOptions;
  19275. type PreconnectOptions = Electron.PreconnectOptions;
  19276. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  19277. type Privileges = Electron.Privileges;
  19278. type ProgressBarOptions = Electron.ProgressBarOptions;
  19279. type Provider = Electron.Provider;
  19280. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  19281. type ReadBookmark = Electron.ReadBookmark;
  19282. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  19283. type RelaunchOptions = Electron.RelaunchOptions;
  19284. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  19285. type Request = Electron.Request;
  19286. type ResizeOptions = Electron.ResizeOptions;
  19287. type ResolveHostOptions = Electron.ResolveHostOptions;
  19288. type ResourceUsage = Electron.ResourceUsage;
  19289. type Response = Electron.Response;
  19290. type Result = Electron.Result;
  19291. type SaveDialogOptions = Electron.SaveDialogOptions;
  19292. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  19293. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  19294. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  19295. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  19296. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  19297. type Settings = Electron.Settings;
  19298. type SourcesOptions = Electron.SourcesOptions;
  19299. type StartLoggingOptions = Electron.StartLoggingOptions;
  19300. type Streams = Electron.Streams;
  19301. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  19302. type TitleBarOverlay = Electron.TitleBarOverlay;
  19303. type TitleOptions = Electron.TitleOptions;
  19304. type ToBitmapOptions = Electron.ToBitmapOptions;
  19305. type ToDataURLOptions = Electron.ToDataURLOptions;
  19306. type ToPNGOptions = Electron.ToPNGOptions;
  19307. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  19308. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  19309. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  19310. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  19311. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  19312. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  19313. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  19314. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  19315. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  19316. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  19317. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  19318. type UdpPortRange = Electron.UdpPortRange;
  19319. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  19320. type UploadProgress = Electron.UploadProgress;
  19321. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  19322. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  19323. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  19324. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  19325. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  19326. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  19327. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  19328. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  19329. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  19330. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  19331. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  19332. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  19333. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  19334. type WillNavigateEvent = Electron.WillNavigateEvent;
  19335. type WillResizeDetails = Electron.WillResizeDetails;
  19336. type EditFlags = Electron.EditFlags;
  19337. type Env = Electron.Env;
  19338. type FoundInPageResult = Electron.FoundInPageResult;
  19339. type LaunchItems = Electron.LaunchItems;
  19340. type Margins = Electron.Margins;
  19341. type MediaFlags = Electron.MediaFlags;
  19342. type PageRanges = Electron.PageRanges;
  19343. type Params = Electron.Params;
  19344. type Video = Electron.Video;
  19345. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  19346. type BluetoothDevice = Electron.BluetoothDevice;
  19347. type Certificate = Electron.Certificate;
  19348. type CertificatePrincipal = Electron.CertificatePrincipal;
  19349. type Cookie = Electron.Cookie;
  19350. type CPUUsage = Electron.CPUUsage;
  19351. type CrashReport = Electron.CrashReport;
  19352. type CustomScheme = Electron.CustomScheme;
  19353. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  19354. type Display = Electron.Display;
  19355. type Extension = Electron.Extension;
  19356. type ExtensionInfo = Electron.ExtensionInfo;
  19357. type FileFilter = Electron.FileFilter;
  19358. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  19359. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  19360. type HIDDevice = Electron.HIDDevice;
  19361. type InputEvent = Electron.InputEvent;
  19362. type IOCounters = Electron.IOCounters;
  19363. type IpcMainEvent = Electron.IpcMainEvent;
  19364. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  19365. type IpcRendererEvent = Electron.IpcRendererEvent;
  19366. type JumpListCategory = Electron.JumpListCategory;
  19367. type JumpListItem = Electron.JumpListItem;
  19368. type KeyboardEvent = Electron.KeyboardEvent;
  19369. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  19370. type MemoryInfo = Electron.MemoryInfo;
  19371. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  19372. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  19373. type MouseInputEvent = Electron.MouseInputEvent;
  19374. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  19375. type NotificationAction = Electron.NotificationAction;
  19376. type NotificationResponse = Electron.NotificationResponse;
  19377. type PaymentDiscount = Electron.PaymentDiscount;
  19378. type Point = Electron.Point;
  19379. type PostBody = Electron.PostBody;
  19380. type PrinterInfo = Electron.PrinterInfo;
  19381. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  19382. type ProcessMetric = Electron.ProcessMetric;
  19383. type Product = Electron.Product;
  19384. type ProductDiscount = Electron.ProductDiscount;
  19385. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  19386. type ProtocolRequest = Electron.ProtocolRequest;
  19387. type ProtocolResponse = Electron.ProtocolResponse;
  19388. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  19389. type ProxyConfig = Electron.ProxyConfig;
  19390. type Rectangle = Electron.Rectangle;
  19391. type Referrer = Electron.Referrer;
  19392. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  19393. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  19394. type ResolvedHost = Electron.ResolvedHost;
  19395. type ScrubberItem = Electron.ScrubberItem;
  19396. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  19397. type SerialPort = Electron.SerialPort;
  19398. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  19399. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  19400. type SharingItem = Electron.SharingItem;
  19401. type ShortcutDetails = Electron.ShortcutDetails;
  19402. type Size = Electron.Size;
  19403. type Task = Electron.Task;
  19404. type ThumbarButton = Electron.ThumbarButton;
  19405. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  19406. type TraceConfig = Electron.TraceConfig;
  19407. type Transaction = Electron.Transaction;
  19408. type UploadData = Electron.UploadData;
  19409. type UploadFile = Electron.UploadFile;
  19410. type UploadRawData = Electron.UploadRawData;
  19411. type USBDevice = Electron.USBDevice;
  19412. type UserDefaultTypes = Electron.UserDefaultTypes;
  19413. type WebPreferences = Electron.WebPreferences;
  19414. type WebRequestFilter = Electron.WebRequestFilter;
  19415. type WebSource = Electron.WebSource;
  19416. }
  19417. namespace Renderer {
  19418. type Event<Params extends object = {}> = Electron.Event<Params>;
  19419. const contextBridge: ContextBridge;
  19420. type ContextBridge = Electron.ContextBridge;
  19421. const ipcRenderer: IpcRenderer;
  19422. type IpcRenderer = Electron.IpcRenderer;
  19423. const webFrame: WebFrame;
  19424. type WebFrame = Electron.WebFrame;
  19425. type WebviewTag = Electron.WebviewTag;
  19426. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  19427. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  19428. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  19429. type AnimationSettings = Electron.AnimationSettings;
  19430. type AppDetailsOptions = Electron.AppDetailsOptions;
  19431. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  19432. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  19433. type AuthInfo = Electron.AuthInfo;
  19434. type AutoResizeOptions = Electron.AutoResizeOptions;
  19435. type BeforeSendResponse = Electron.BeforeSendResponse;
  19436. type BitmapOptions = Electron.BitmapOptions;
  19437. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  19438. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  19439. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  19440. type CallbackResponse = Electron.CallbackResponse;
  19441. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  19442. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  19443. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  19444. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  19445. type CloseOpts = Electron.CloseOpts;
  19446. type Config = Electron.Config;
  19447. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  19448. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  19449. type ContextMenuEvent = Electron.ContextMenuEvent;
  19450. type ContextMenuParams = Electron.ContextMenuParams;
  19451. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  19452. type CookiesGetFilter = Electron.CookiesGetFilter;
  19453. type CookiesSetDetails = Electron.CookiesSetDetails;
  19454. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  19455. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  19456. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  19457. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  19458. type Data = Electron.Data;
  19459. type DefaultFontFamily = Electron.DefaultFontFamily;
  19460. type Details = Electron.Details;
  19461. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  19462. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  19463. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  19464. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  19465. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  19466. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  19467. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  19468. type DidNavigateEvent = Electron.DidNavigateEvent;
  19469. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  19470. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  19471. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  19472. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  19473. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  19474. type DownloadURLOptions = Electron.DownloadURLOptions;
  19475. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  19476. type FeedURLOptions = Electron.FeedURLOptions;
  19477. type FileIconOptions = Electron.FileIconOptions;
  19478. type FindInPageOptions = Electron.FindInPageOptions;
  19479. type FocusOptions = Electron.FocusOptions;
  19480. type ForkOptions = Electron.ForkOptions;
  19481. type FoundInPageEvent = Electron.FoundInPageEvent;
  19482. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  19483. type FromPartitionOptions = Electron.FromPartitionOptions;
  19484. type FromPathOptions = Electron.FromPathOptions;
  19485. type HandlerDetails = Electron.HandlerDetails;
  19486. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  19487. type HeapStatistics = Electron.HeapStatistics;
  19488. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  19489. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  19490. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  19491. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  19492. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  19493. type Info = Electron.Info;
  19494. type Input = Electron.Input;
  19495. type InsertCSSOptions = Electron.InsertCSSOptions;
  19496. type IpcMessageEvent = Electron.IpcMessageEvent;
  19497. type Item = Electron.Item;
  19498. type JumpListSettings = Electron.JumpListSettings;
  19499. type LoadCommitEvent = Electron.LoadCommitEvent;
  19500. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  19501. type LoadFileOptions = Electron.LoadFileOptions;
  19502. type LoadURLOptions = Electron.LoadURLOptions;
  19503. type LoginItemSettings = Electron.LoginItemSettings;
  19504. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  19505. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  19506. type MessageBoxOptions = Electron.MessageBoxOptions;
  19507. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  19508. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  19509. type MessageDetails = Electron.MessageDetails;
  19510. type MessageEvent = Electron.MessageEvent;
  19511. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  19512. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  19513. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  19514. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  19515. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  19516. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  19517. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  19518. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  19519. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  19520. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  19521. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  19522. type OpenDialogOptions = Electron.OpenDialogOptions;
  19523. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  19524. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  19525. type OpenExternalOptions = Electron.OpenExternalOptions;
  19526. type Options = Electron.Options;
  19527. type Opts = Electron.Opts;
  19528. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  19529. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  19530. type Parameters = Electron.Parameters;
  19531. type Payment = Electron.Payment;
  19532. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  19533. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  19534. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  19535. type PopupOptions = Electron.PopupOptions;
  19536. type PreconnectOptions = Electron.PreconnectOptions;
  19537. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  19538. type Privileges = Electron.Privileges;
  19539. type ProgressBarOptions = Electron.ProgressBarOptions;
  19540. type Provider = Electron.Provider;
  19541. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  19542. type ReadBookmark = Electron.ReadBookmark;
  19543. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  19544. type RelaunchOptions = Electron.RelaunchOptions;
  19545. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  19546. type Request = Electron.Request;
  19547. type ResizeOptions = Electron.ResizeOptions;
  19548. type ResolveHostOptions = Electron.ResolveHostOptions;
  19549. type ResourceUsage = Electron.ResourceUsage;
  19550. type Response = Electron.Response;
  19551. type Result = Electron.Result;
  19552. type SaveDialogOptions = Electron.SaveDialogOptions;
  19553. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  19554. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  19555. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  19556. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  19557. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  19558. type Settings = Electron.Settings;
  19559. type SourcesOptions = Electron.SourcesOptions;
  19560. type StartLoggingOptions = Electron.StartLoggingOptions;
  19561. type Streams = Electron.Streams;
  19562. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  19563. type TitleBarOverlay = Electron.TitleBarOverlay;
  19564. type TitleOptions = Electron.TitleOptions;
  19565. type ToBitmapOptions = Electron.ToBitmapOptions;
  19566. type ToDataURLOptions = Electron.ToDataURLOptions;
  19567. type ToPNGOptions = Electron.ToPNGOptions;
  19568. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  19569. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  19570. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  19571. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  19572. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  19573. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  19574. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  19575. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  19576. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  19577. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  19578. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  19579. type UdpPortRange = Electron.UdpPortRange;
  19580. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  19581. type UploadProgress = Electron.UploadProgress;
  19582. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  19583. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  19584. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  19585. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  19586. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  19587. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  19588. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  19589. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  19590. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  19591. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  19592. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  19593. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  19594. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  19595. type WillNavigateEvent = Electron.WillNavigateEvent;
  19596. type WillResizeDetails = Electron.WillResizeDetails;
  19597. type EditFlags = Electron.EditFlags;
  19598. type Env = Electron.Env;
  19599. type FoundInPageResult = Electron.FoundInPageResult;
  19600. type LaunchItems = Electron.LaunchItems;
  19601. type Margins = Electron.Margins;
  19602. type MediaFlags = Electron.MediaFlags;
  19603. type PageRanges = Electron.PageRanges;
  19604. type Params = Electron.Params;
  19605. type Video = Electron.Video;
  19606. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  19607. type BluetoothDevice = Electron.BluetoothDevice;
  19608. type Certificate = Electron.Certificate;
  19609. type CertificatePrincipal = Electron.CertificatePrincipal;
  19610. type Cookie = Electron.Cookie;
  19611. type CPUUsage = Electron.CPUUsage;
  19612. type CrashReport = Electron.CrashReport;
  19613. type CustomScheme = Electron.CustomScheme;
  19614. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  19615. type Display = Electron.Display;
  19616. type Extension = Electron.Extension;
  19617. type ExtensionInfo = Electron.ExtensionInfo;
  19618. type FileFilter = Electron.FileFilter;
  19619. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  19620. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  19621. type HIDDevice = Electron.HIDDevice;
  19622. type InputEvent = Electron.InputEvent;
  19623. type IOCounters = Electron.IOCounters;
  19624. type IpcMainEvent = Electron.IpcMainEvent;
  19625. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  19626. type IpcRendererEvent = Electron.IpcRendererEvent;
  19627. type JumpListCategory = Electron.JumpListCategory;
  19628. type JumpListItem = Electron.JumpListItem;
  19629. type KeyboardEvent = Electron.KeyboardEvent;
  19630. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  19631. type MemoryInfo = Electron.MemoryInfo;
  19632. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  19633. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  19634. type MouseInputEvent = Electron.MouseInputEvent;
  19635. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  19636. type NotificationAction = Electron.NotificationAction;
  19637. type NotificationResponse = Electron.NotificationResponse;
  19638. type PaymentDiscount = Electron.PaymentDiscount;
  19639. type Point = Electron.Point;
  19640. type PostBody = Electron.PostBody;
  19641. type PrinterInfo = Electron.PrinterInfo;
  19642. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  19643. type ProcessMetric = Electron.ProcessMetric;
  19644. type Product = Electron.Product;
  19645. type ProductDiscount = Electron.ProductDiscount;
  19646. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  19647. type ProtocolRequest = Electron.ProtocolRequest;
  19648. type ProtocolResponse = Electron.ProtocolResponse;
  19649. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  19650. type ProxyConfig = Electron.ProxyConfig;
  19651. type Rectangle = Electron.Rectangle;
  19652. type Referrer = Electron.Referrer;
  19653. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  19654. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  19655. type ResolvedHost = Electron.ResolvedHost;
  19656. type ScrubberItem = Electron.ScrubberItem;
  19657. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  19658. type SerialPort = Electron.SerialPort;
  19659. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  19660. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  19661. type SharingItem = Electron.SharingItem;
  19662. type ShortcutDetails = Electron.ShortcutDetails;
  19663. type Size = Electron.Size;
  19664. type Task = Electron.Task;
  19665. type ThumbarButton = Electron.ThumbarButton;
  19666. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  19667. type TraceConfig = Electron.TraceConfig;
  19668. type Transaction = Electron.Transaction;
  19669. type UploadData = Electron.UploadData;
  19670. type UploadFile = Electron.UploadFile;
  19671. type UploadRawData = Electron.UploadRawData;
  19672. type USBDevice = Electron.USBDevice;
  19673. type UserDefaultTypes = Electron.UserDefaultTypes;
  19674. type WebPreferences = Electron.WebPreferences;
  19675. type WebRequestFilter = Electron.WebRequestFilter;
  19676. type WebSource = Electron.WebSource;
  19677. }
  19678. namespace Utility {
  19679. type Event<Params extends object = {}> = Electron.Event<Params>;
  19680. type ClientRequest = Electron.ClientRequest;
  19681. type IncomingMessage = Electron.IncomingMessage;
  19682. const net: Net;
  19683. type Net = Electron.Net;
  19684. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  19685. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  19686. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  19687. type AnimationSettings = Electron.AnimationSettings;
  19688. type AppDetailsOptions = Electron.AppDetailsOptions;
  19689. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  19690. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  19691. type AuthInfo = Electron.AuthInfo;
  19692. type AutoResizeOptions = Electron.AutoResizeOptions;
  19693. type BeforeSendResponse = Electron.BeforeSendResponse;
  19694. type BitmapOptions = Electron.BitmapOptions;
  19695. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  19696. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  19697. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  19698. type CallbackResponse = Electron.CallbackResponse;
  19699. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  19700. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  19701. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  19702. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  19703. type CloseOpts = Electron.CloseOpts;
  19704. type Config = Electron.Config;
  19705. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  19706. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  19707. type ContextMenuEvent = Electron.ContextMenuEvent;
  19708. type ContextMenuParams = Electron.ContextMenuParams;
  19709. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  19710. type CookiesGetFilter = Electron.CookiesGetFilter;
  19711. type CookiesSetDetails = Electron.CookiesSetDetails;
  19712. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  19713. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  19714. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  19715. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  19716. type Data = Electron.Data;
  19717. type DefaultFontFamily = Electron.DefaultFontFamily;
  19718. type Details = Electron.Details;
  19719. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  19720. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  19721. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  19722. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  19723. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  19724. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  19725. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  19726. type DidNavigateEvent = Electron.DidNavigateEvent;
  19727. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  19728. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  19729. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  19730. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  19731. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  19732. type DownloadURLOptions = Electron.DownloadURLOptions;
  19733. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  19734. type FeedURLOptions = Electron.FeedURLOptions;
  19735. type FileIconOptions = Electron.FileIconOptions;
  19736. type FindInPageOptions = Electron.FindInPageOptions;
  19737. type FocusOptions = Electron.FocusOptions;
  19738. type ForkOptions = Electron.ForkOptions;
  19739. type FoundInPageEvent = Electron.FoundInPageEvent;
  19740. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  19741. type FromPartitionOptions = Electron.FromPartitionOptions;
  19742. type FromPathOptions = Electron.FromPathOptions;
  19743. type HandlerDetails = Electron.HandlerDetails;
  19744. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  19745. type HeapStatistics = Electron.HeapStatistics;
  19746. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  19747. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  19748. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  19749. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  19750. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  19751. type Info = Electron.Info;
  19752. type Input = Electron.Input;
  19753. type InsertCSSOptions = Electron.InsertCSSOptions;
  19754. type IpcMessageEvent = Electron.IpcMessageEvent;
  19755. type Item = Electron.Item;
  19756. type JumpListSettings = Electron.JumpListSettings;
  19757. type LoadCommitEvent = Electron.LoadCommitEvent;
  19758. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  19759. type LoadFileOptions = Electron.LoadFileOptions;
  19760. type LoadURLOptions = Electron.LoadURLOptions;
  19761. type LoginItemSettings = Electron.LoginItemSettings;
  19762. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  19763. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  19764. type MessageBoxOptions = Electron.MessageBoxOptions;
  19765. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  19766. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  19767. type MessageDetails = Electron.MessageDetails;
  19768. type MessageEvent = Electron.MessageEvent;
  19769. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  19770. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  19771. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  19772. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  19773. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  19774. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  19775. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  19776. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  19777. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  19778. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  19779. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  19780. type OpenDialogOptions = Electron.OpenDialogOptions;
  19781. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  19782. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  19783. type OpenExternalOptions = Electron.OpenExternalOptions;
  19784. type Options = Electron.Options;
  19785. type Opts = Electron.Opts;
  19786. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  19787. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  19788. type Parameters = Electron.Parameters;
  19789. type Payment = Electron.Payment;
  19790. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  19791. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  19792. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  19793. type PopupOptions = Electron.PopupOptions;
  19794. type PreconnectOptions = Electron.PreconnectOptions;
  19795. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  19796. type Privileges = Electron.Privileges;
  19797. type ProgressBarOptions = Electron.ProgressBarOptions;
  19798. type Provider = Electron.Provider;
  19799. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  19800. type ReadBookmark = Electron.ReadBookmark;
  19801. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  19802. type RelaunchOptions = Electron.RelaunchOptions;
  19803. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  19804. type Request = Electron.Request;
  19805. type ResizeOptions = Electron.ResizeOptions;
  19806. type ResolveHostOptions = Electron.ResolveHostOptions;
  19807. type ResourceUsage = Electron.ResourceUsage;
  19808. type Response = Electron.Response;
  19809. type Result = Electron.Result;
  19810. type SaveDialogOptions = Electron.SaveDialogOptions;
  19811. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  19812. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  19813. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  19814. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  19815. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  19816. type Settings = Electron.Settings;
  19817. type SourcesOptions = Electron.SourcesOptions;
  19818. type StartLoggingOptions = Electron.StartLoggingOptions;
  19819. type Streams = Electron.Streams;
  19820. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  19821. type TitleBarOverlay = Electron.TitleBarOverlay;
  19822. type TitleOptions = Electron.TitleOptions;
  19823. type ToBitmapOptions = Electron.ToBitmapOptions;
  19824. type ToDataURLOptions = Electron.ToDataURLOptions;
  19825. type ToPNGOptions = Electron.ToPNGOptions;
  19826. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  19827. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  19828. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  19829. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  19830. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  19831. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  19832. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  19833. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  19834. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  19835. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  19836. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  19837. type UdpPortRange = Electron.UdpPortRange;
  19838. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  19839. type UploadProgress = Electron.UploadProgress;
  19840. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  19841. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  19842. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  19843. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  19844. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  19845. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  19846. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  19847. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  19848. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  19849. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  19850. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  19851. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  19852. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  19853. type WillNavigateEvent = Electron.WillNavigateEvent;
  19854. type WillResizeDetails = Electron.WillResizeDetails;
  19855. type EditFlags = Electron.EditFlags;
  19856. type Env = Electron.Env;
  19857. type FoundInPageResult = Electron.FoundInPageResult;
  19858. type LaunchItems = Electron.LaunchItems;
  19859. type Margins = Electron.Margins;
  19860. type MediaFlags = Electron.MediaFlags;
  19861. type PageRanges = Electron.PageRanges;
  19862. type Params = Electron.Params;
  19863. type Video = Electron.Video;
  19864. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  19865. type BluetoothDevice = Electron.BluetoothDevice;
  19866. type Certificate = Electron.Certificate;
  19867. type CertificatePrincipal = Electron.CertificatePrincipal;
  19868. type Cookie = Electron.Cookie;
  19869. type CPUUsage = Electron.CPUUsage;
  19870. type CrashReport = Electron.CrashReport;
  19871. type CustomScheme = Electron.CustomScheme;
  19872. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  19873. type Display = Electron.Display;
  19874. type Extension = Electron.Extension;
  19875. type ExtensionInfo = Electron.ExtensionInfo;
  19876. type FileFilter = Electron.FileFilter;
  19877. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  19878. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  19879. type HIDDevice = Electron.HIDDevice;
  19880. type InputEvent = Electron.InputEvent;
  19881. type IOCounters = Electron.IOCounters;
  19882. type IpcMainEvent = Electron.IpcMainEvent;
  19883. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  19884. type IpcRendererEvent = Electron.IpcRendererEvent;
  19885. type JumpListCategory = Electron.JumpListCategory;
  19886. type JumpListItem = Electron.JumpListItem;
  19887. type KeyboardEvent = Electron.KeyboardEvent;
  19888. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  19889. type MemoryInfo = Electron.MemoryInfo;
  19890. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  19891. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  19892. type MouseInputEvent = Electron.MouseInputEvent;
  19893. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  19894. type NotificationAction = Electron.NotificationAction;
  19895. type NotificationResponse = Electron.NotificationResponse;
  19896. type PaymentDiscount = Electron.PaymentDiscount;
  19897. type Point = Electron.Point;
  19898. type PostBody = Electron.PostBody;
  19899. type PrinterInfo = Electron.PrinterInfo;
  19900. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  19901. type ProcessMetric = Electron.ProcessMetric;
  19902. type Product = Electron.Product;
  19903. type ProductDiscount = Electron.ProductDiscount;
  19904. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  19905. type ProtocolRequest = Electron.ProtocolRequest;
  19906. type ProtocolResponse = Electron.ProtocolResponse;
  19907. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  19908. type ProxyConfig = Electron.ProxyConfig;
  19909. type Rectangle = Electron.Rectangle;
  19910. type Referrer = Electron.Referrer;
  19911. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  19912. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  19913. type ResolvedHost = Electron.ResolvedHost;
  19914. type ScrubberItem = Electron.ScrubberItem;
  19915. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  19916. type SerialPort = Electron.SerialPort;
  19917. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  19918. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  19919. type SharingItem = Electron.SharingItem;
  19920. type ShortcutDetails = Electron.ShortcutDetails;
  19921. type Size = Electron.Size;
  19922. type Task = Electron.Task;
  19923. type ThumbarButton = Electron.ThumbarButton;
  19924. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  19925. type TraceConfig = Electron.TraceConfig;
  19926. type Transaction = Electron.Transaction;
  19927. type UploadData = Electron.UploadData;
  19928. type UploadFile = Electron.UploadFile;
  19929. type UploadRawData = Electron.UploadRawData;
  19930. type USBDevice = Electron.USBDevice;
  19931. type UserDefaultTypes = Electron.UserDefaultTypes;
  19932. type WebPreferences = Electron.WebPreferences;
  19933. type WebRequestFilter = Electron.WebRequestFilter;
  19934. type WebSource = Electron.WebSource;
  19935. }
  19936. namespace CrossProcessExports {
  19937. type Event<Params extends object = {}> = Electron.Event<Params>;
  19938. const app: App;
  19939. type App = Electron.App;
  19940. const autoUpdater: AutoUpdater;
  19941. type AutoUpdater = Electron.AutoUpdater;
  19942. class BrowserView extends Electron.BrowserView {}
  19943. class BrowserWindow extends Electron.BrowserWindow {}
  19944. type ClientRequest = Electron.ClientRequest;
  19945. const clipboard: Clipboard;
  19946. type Clipboard = Electron.Clipboard;
  19947. type CommandLine = Electron.CommandLine;
  19948. const contentTracing: ContentTracing;
  19949. type ContentTracing = Electron.ContentTracing;
  19950. const contextBridge: ContextBridge;
  19951. type ContextBridge = Electron.ContextBridge;
  19952. type Cookies = Electron.Cookies;
  19953. const crashReporter: CrashReporter;
  19954. type CrashReporter = Electron.CrashReporter;
  19955. type Debugger = Electron.Debugger;
  19956. const desktopCapturer: DesktopCapturer;
  19957. type DesktopCapturer = Electron.DesktopCapturer;
  19958. const dialog: Dialog;
  19959. type Dialog = Electron.Dialog;
  19960. type Dock = Electron.Dock;
  19961. type DownloadItem = Electron.DownloadItem;
  19962. const globalShortcut: GlobalShortcut;
  19963. type GlobalShortcut = Electron.GlobalShortcut;
  19964. const inAppPurchase: InAppPurchase;
  19965. type InAppPurchase = Electron.InAppPurchase;
  19966. type IncomingMessage = Electron.IncomingMessage;
  19967. const ipcMain: IpcMain;
  19968. type IpcMain = Electron.IpcMain;
  19969. const ipcRenderer: IpcRenderer;
  19970. type IpcRenderer = Electron.IpcRenderer;
  19971. class Menu extends Electron.Menu {}
  19972. class MenuItem extends Electron.MenuItem {}
  19973. class MessageChannelMain extends Electron.MessageChannelMain {}
  19974. type MessagePortMain = Electron.MessagePortMain;
  19975. const nativeImage: typeof NativeImage;
  19976. type NativeImage = Electron.NativeImage;
  19977. const nativeTheme: NativeTheme;
  19978. type NativeTheme = Electron.NativeTheme;
  19979. const net: Net;
  19980. type Net = Electron.Net;
  19981. const netLog: NetLog;
  19982. type NetLog = Electron.NetLog;
  19983. class Notification extends Electron.Notification {}
  19984. const powerMonitor: PowerMonitor;
  19985. type PowerMonitor = Electron.PowerMonitor;
  19986. const powerSaveBlocker: PowerSaveBlocker;
  19987. type PowerSaveBlocker = Electron.PowerSaveBlocker;
  19988. const protocol: Protocol;
  19989. type Protocol = Electron.Protocol;
  19990. const pushNotifications: PushNotifications;
  19991. type PushNotifications = Electron.PushNotifications;
  19992. const safeStorage: SafeStorage;
  19993. type SafeStorage = Electron.SafeStorage;
  19994. const screen: Screen;
  19995. type Screen = Electron.Screen;
  19996. type ServiceWorkers = Electron.ServiceWorkers;
  19997. const session: typeof Session;
  19998. type Session = Electron.Session;
  19999. class ShareMenu extends Electron.ShareMenu {}
  20000. const shell: Shell;
  20001. type Shell = Electron.Shell;
  20002. const systemPreferences: SystemPreferences;
  20003. type SystemPreferences = Electron.SystemPreferences;
  20004. class TouchBar extends Electron.TouchBar {}
  20005. type TouchBarButton = Electron.TouchBarButton;
  20006. type TouchBarColorPicker = Electron.TouchBarColorPicker;
  20007. type TouchBarGroup = Electron.TouchBarGroup;
  20008. type TouchBarLabel = Electron.TouchBarLabel;
  20009. type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
  20010. type TouchBarPopover = Electron.TouchBarPopover;
  20011. type TouchBarScrubber = Electron.TouchBarScrubber;
  20012. type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
  20013. type TouchBarSlider = Electron.TouchBarSlider;
  20014. type TouchBarSpacer = Electron.TouchBarSpacer;
  20015. class Tray extends Electron.Tray {}
  20016. const utilityProcess: typeof UtilityProcess;
  20017. type UtilityProcess = Electron.UtilityProcess;
  20018. const webContents: typeof WebContents;
  20019. type WebContents = Electron.WebContents;
  20020. const webFrame: WebFrame;
  20021. type WebFrame = Electron.WebFrame;
  20022. const webFrameMain: typeof WebFrameMain;
  20023. type WebFrameMain = Electron.WebFrameMain;
  20024. type WebRequest = Electron.WebRequest;
  20025. type WebviewTag = Electron.WebviewTag;
  20026. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  20027. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  20028. type AdjustSelectionOptions = Electron.AdjustSelectionOptions;
  20029. type AnimationSettings = Electron.AnimationSettings;
  20030. type AppDetailsOptions = Electron.AppDetailsOptions;
  20031. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  20032. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  20033. type AuthInfo = Electron.AuthInfo;
  20034. type AutoResizeOptions = Electron.AutoResizeOptions;
  20035. type BeforeSendResponse = Electron.BeforeSendResponse;
  20036. type BitmapOptions = Electron.BitmapOptions;
  20037. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  20038. type BluetoothPairingHandlerHandlerDetails = Electron.BluetoothPairingHandlerHandlerDetails;
  20039. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  20040. type CallbackResponse = Electron.CallbackResponse;
  20041. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  20042. type ClearCodeCachesOptions = Electron.ClearCodeCachesOptions;
  20043. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  20044. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  20045. type CloseOpts = Electron.CloseOpts;
  20046. type Config = Electron.Config;
  20047. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  20048. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  20049. type ContextMenuEvent = Electron.ContextMenuEvent;
  20050. type ContextMenuParams = Electron.ContextMenuParams;
  20051. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  20052. type CookiesGetFilter = Electron.CookiesGetFilter;
  20053. type CookiesSetDetails = Electron.CookiesSetDetails;
  20054. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  20055. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  20056. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  20057. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  20058. type Data = Electron.Data;
  20059. type DefaultFontFamily = Electron.DefaultFontFamily;
  20060. type Details = Electron.Details;
  20061. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  20062. type DevtoolsOpenUrlEvent = Electron.DevtoolsOpenUrlEvent;
  20063. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  20064. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  20065. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  20066. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  20067. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  20068. type DidNavigateEvent = Electron.DidNavigateEvent;
  20069. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  20070. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  20071. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  20072. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  20073. type DisplayMediaRequestHandlerHandlerRequest = Electron.DisplayMediaRequestHandlerHandlerRequest;
  20074. type DownloadURLOptions = Electron.DownloadURLOptions;
  20075. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  20076. type FeedURLOptions = Electron.FeedURLOptions;
  20077. type FileIconOptions = Electron.FileIconOptions;
  20078. type FindInPageOptions = Electron.FindInPageOptions;
  20079. type FocusOptions = Electron.FocusOptions;
  20080. type ForkOptions = Electron.ForkOptions;
  20081. type FoundInPageEvent = Electron.FoundInPageEvent;
  20082. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  20083. type FromPartitionOptions = Electron.FromPartitionOptions;
  20084. type FromPathOptions = Electron.FromPathOptions;
  20085. type HandlerDetails = Electron.HandlerDetails;
  20086. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  20087. type HeapStatistics = Electron.HeapStatistics;
  20088. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  20089. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  20090. type HidDeviceRevokedDetails = Electron.HidDeviceRevokedDetails;
  20091. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  20092. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  20093. type Info = Electron.Info;
  20094. type Input = Electron.Input;
  20095. type InsertCSSOptions = Electron.InsertCSSOptions;
  20096. type IpcMessageEvent = Electron.IpcMessageEvent;
  20097. type Item = Electron.Item;
  20098. type JumpListSettings = Electron.JumpListSettings;
  20099. type LoadCommitEvent = Electron.LoadCommitEvent;
  20100. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  20101. type LoadFileOptions = Electron.LoadFileOptions;
  20102. type LoadURLOptions = Electron.LoadURLOptions;
  20103. type LoginItemSettings = Electron.LoginItemSettings;
  20104. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  20105. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  20106. type MessageBoxOptions = Electron.MessageBoxOptions;
  20107. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  20108. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  20109. type MessageDetails = Electron.MessageDetails;
  20110. type MessageEvent = Electron.MessageEvent;
  20111. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  20112. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  20113. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  20114. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  20115. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  20116. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  20117. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  20118. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  20119. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  20120. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  20121. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  20122. type OpenDialogOptions = Electron.OpenDialogOptions;
  20123. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  20124. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  20125. type OpenExternalOptions = Electron.OpenExternalOptions;
  20126. type Options = Electron.Options;
  20127. type Opts = Electron.Opts;
  20128. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  20129. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  20130. type Parameters = Electron.Parameters;
  20131. type Payment = Electron.Payment;
  20132. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  20133. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  20134. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  20135. type PopupOptions = Electron.PopupOptions;
  20136. type PreconnectOptions = Electron.PreconnectOptions;
  20137. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  20138. type Privileges = Electron.Privileges;
  20139. type ProgressBarOptions = Electron.ProgressBarOptions;
  20140. type Provider = Electron.Provider;
  20141. type PurchaseProductOpts = Electron.PurchaseProductOpts;
  20142. type ReadBookmark = Electron.ReadBookmark;
  20143. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  20144. type RelaunchOptions = Electron.RelaunchOptions;
  20145. type RenderProcessGoneEvent = Electron.RenderProcessGoneEvent;
  20146. type Request = Electron.Request;
  20147. type ResizeOptions = Electron.ResizeOptions;
  20148. type ResolveHostOptions = Electron.ResolveHostOptions;
  20149. type ResourceUsage = Electron.ResourceUsage;
  20150. type Response = Electron.Response;
  20151. type Result = Electron.Result;
  20152. type SaveDialogOptions = Electron.SaveDialogOptions;
  20153. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  20154. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  20155. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  20156. type SelectUsbDeviceDetails = Electron.SelectUsbDeviceDetails;
  20157. type SerialPortRevokedDetails = Electron.SerialPortRevokedDetails;
  20158. type Settings = Electron.Settings;
  20159. type SourcesOptions = Electron.SourcesOptions;
  20160. type StartLoggingOptions = Electron.StartLoggingOptions;
  20161. type Streams = Electron.Streams;
  20162. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  20163. type TitleBarOverlay = Electron.TitleBarOverlay;
  20164. type TitleOptions = Electron.TitleOptions;
  20165. type ToBitmapOptions = Electron.ToBitmapOptions;
  20166. type ToDataURLOptions = Electron.ToDataURLOptions;
  20167. type ToPNGOptions = Electron.ToPNGOptions;
  20168. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  20169. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  20170. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  20171. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  20172. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  20173. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  20174. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  20175. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  20176. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  20177. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  20178. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  20179. type UdpPortRange = Electron.UdpPortRange;
  20180. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  20181. type UploadProgress = Electron.UploadProgress;
  20182. type UsbDeviceRevokedDetails = Electron.UsbDeviceRevokedDetails;
  20183. type USBProtectedClassesHandlerHandlerDetails = Electron.USBProtectedClassesHandlerHandlerDetails;
  20184. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  20185. type WebContentsAudioStateChangedEventParams = Electron.WebContentsAudioStateChangedEventParams;
  20186. type WebContentsDidRedirectNavigationEventParams = Electron.WebContentsDidRedirectNavigationEventParams;
  20187. type WebContentsDidStartNavigationEventParams = Electron.WebContentsDidStartNavigationEventParams;
  20188. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  20189. type WebContentsWillFrameNavigateEventParams = Electron.WebContentsWillFrameNavigateEventParams;
  20190. type WebContentsWillNavigateEventParams = Electron.WebContentsWillNavigateEventParams;
  20191. type WebContentsWillRedirectEventParams = Electron.WebContentsWillRedirectEventParams;
  20192. type WebRTCUDPPortRange = Electron.WebRTCUDPPortRange;
  20193. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  20194. type WillFrameNavigateEvent = Electron.WillFrameNavigateEvent;
  20195. type WillNavigateEvent = Electron.WillNavigateEvent;
  20196. type WillResizeDetails = Electron.WillResizeDetails;
  20197. type EditFlags = Electron.EditFlags;
  20198. type Env = Electron.Env;
  20199. type FoundInPageResult = Electron.FoundInPageResult;
  20200. type LaunchItems = Electron.LaunchItems;
  20201. type Margins = Electron.Margins;
  20202. type MediaFlags = Electron.MediaFlags;
  20203. type PageRanges = Electron.PageRanges;
  20204. type Params = Electron.Params;
  20205. type Video = Electron.Video;
  20206. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  20207. type BluetoothDevice = Electron.BluetoothDevice;
  20208. type Certificate = Electron.Certificate;
  20209. type CertificatePrincipal = Electron.CertificatePrincipal;
  20210. type Cookie = Electron.Cookie;
  20211. type CPUUsage = Electron.CPUUsage;
  20212. type CrashReport = Electron.CrashReport;
  20213. type CustomScheme = Electron.CustomScheme;
  20214. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  20215. type Display = Electron.Display;
  20216. type Extension = Electron.Extension;
  20217. type ExtensionInfo = Electron.ExtensionInfo;
  20218. type FileFilter = Electron.FileFilter;
  20219. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  20220. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  20221. type HIDDevice = Electron.HIDDevice;
  20222. type InputEvent = Electron.InputEvent;
  20223. type IOCounters = Electron.IOCounters;
  20224. type IpcMainEvent = Electron.IpcMainEvent;
  20225. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  20226. type IpcRendererEvent = Electron.IpcRendererEvent;
  20227. type JumpListCategory = Electron.JumpListCategory;
  20228. type JumpListItem = Electron.JumpListItem;
  20229. type KeyboardEvent = Electron.KeyboardEvent;
  20230. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  20231. type MemoryInfo = Electron.MemoryInfo;
  20232. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  20233. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  20234. type MouseInputEvent = Electron.MouseInputEvent;
  20235. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  20236. type NotificationAction = Electron.NotificationAction;
  20237. type NotificationResponse = Electron.NotificationResponse;
  20238. type PaymentDiscount = Electron.PaymentDiscount;
  20239. type Point = Electron.Point;
  20240. type PostBody = Electron.PostBody;
  20241. type PrinterInfo = Electron.PrinterInfo;
  20242. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  20243. type ProcessMetric = Electron.ProcessMetric;
  20244. type Product = Electron.Product;
  20245. type ProductDiscount = Electron.ProductDiscount;
  20246. type ProductSubscriptionPeriod = Electron.ProductSubscriptionPeriod;
  20247. type ProtocolRequest = Electron.ProtocolRequest;
  20248. type ProtocolResponse = Electron.ProtocolResponse;
  20249. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  20250. type ProxyConfig = Electron.ProxyConfig;
  20251. type Rectangle = Electron.Rectangle;
  20252. type Referrer = Electron.Referrer;
  20253. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  20254. type ResolvedEndpoint = Electron.ResolvedEndpoint;
  20255. type ResolvedHost = Electron.ResolvedHost;
  20256. type ScrubberItem = Electron.ScrubberItem;
  20257. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  20258. type SerialPort = Electron.SerialPort;
  20259. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  20260. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  20261. type SharingItem = Electron.SharingItem;
  20262. type ShortcutDetails = Electron.ShortcutDetails;
  20263. type Size = Electron.Size;
  20264. type Task = Electron.Task;
  20265. type ThumbarButton = Electron.ThumbarButton;
  20266. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  20267. type TraceConfig = Electron.TraceConfig;
  20268. type Transaction = Electron.Transaction;
  20269. type UploadData = Electron.UploadData;
  20270. type UploadFile = Electron.UploadFile;
  20271. type UploadRawData = Electron.UploadRawData;
  20272. type USBDevice = Electron.USBDevice;
  20273. type UserDefaultTypes = Electron.UserDefaultTypes;
  20274. type WebPreferences = Electron.WebPreferences;
  20275. type WebRequestFilter = Electron.WebRequestFilter;
  20276. type WebSource = Electron.WebSource;
  20277. }
  20278. const app: App;
  20279. const autoUpdater: AutoUpdater;
  20280. const clipboard: Clipboard;
  20281. const contentTracing: ContentTracing;
  20282. const contextBridge: ContextBridge;
  20283. const crashReporter: CrashReporter;
  20284. const desktopCapturer: DesktopCapturer;
  20285. const dialog: Dialog;
  20286. const globalShortcut: GlobalShortcut;
  20287. const inAppPurchase: InAppPurchase;
  20288. const ipcMain: IpcMain;
  20289. const ipcRenderer: IpcRenderer;
  20290. const nativeImage: typeof NativeImage;
  20291. const nativeTheme: NativeTheme;
  20292. const net: Net;
  20293. const netLog: NetLog;
  20294. const parentPort: ParentPort;
  20295. const powerMonitor: PowerMonitor;
  20296. const powerSaveBlocker: PowerSaveBlocker;
  20297. const protocol: Protocol;
  20298. const pushNotifications: PushNotifications;
  20299. const safeStorage: SafeStorage;
  20300. const screen: Screen;
  20301. const session: typeof Session;
  20302. const shell: Shell;
  20303. const systemPreferences: SystemPreferences;
  20304. const utilityProcess: typeof UtilityProcess;
  20305. const webContents: typeof WebContents;
  20306. const webFrame: WebFrame;
  20307. const webFrameMain: typeof WebFrameMain;
  20308. }
  20309. declare module 'electron' {
  20310. export = Electron.CrossProcessExports;
  20311. }
  20312. declare module 'electron/main' {
  20313. export = Electron.Main;
  20314. }
  20315. declare module 'electron/common' {
  20316. export = Electron.Common;
  20317. }
  20318. declare module 'electron/renderer' {
  20319. export = Electron.Renderer;
  20320. }
  20321. declare module 'electron/utility' {
  20322. export = Electron.Utility;
  20323. }
  20324. interface NodeRequireFunction {
  20325. (moduleName: 'electron'): typeof Electron.CrossProcessExports;
  20326. (moduleName: 'electron/main'): typeof Electron.Main;
  20327. (moduleName: 'electron/common'): typeof Electron.Common;
  20328. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  20329. (moduleName: 'electron/utility'): typeof Electron.Utility;
  20330. }
  20331. interface NodeRequire {
  20332. (moduleName: 'electron'): typeof Electron.CrossProcessExports;
  20333. (moduleName: 'electron/main'): typeof Electron.Main;
  20334. (moduleName: 'electron/common'): typeof Electron.Common;
  20335. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  20336. (moduleName: 'electron/utility'): typeof Electron.Utility;
  20337. }
  20338. interface File {
  20339. /**
  20340. * The real path to the file on the users filesystem
  20341. */
  20342. path: string;
  20343. }
  20344. declare module 'original-fs' {
  20345. import * as fs from 'fs';
  20346. export = fs;
  20347. }
  20348. declare module 'node:original-fs' {
  20349. import * as fs from 'fs';
  20350. export = fs;
  20351. }
  20352. interface Document {
  20353. createElement(tagName: 'webview'): Electron.WebviewTag;
  20354. }
  20355. declare namespace NodeJS {
  20356. interface Process extends NodeJS.EventEmitter {
  20357. // Docs: https://electronjs.org/docs/api/process
  20358. /**
  20359. * Emitted when Electron has loaded its internal initialization script and is
  20360. * beginning to load the web page or the main script.
  20361. */
  20362. on(event: 'loaded', listener: Function): this;
  20363. off(event: 'loaded', listener: Function): this;
  20364. once(event: 'loaded', listener: Function): this;
  20365. addListener(event: 'loaded', listener: Function): this;
  20366. removeListener(event: 'loaded', listener: Function): this;
  20367. /**
  20368. * Causes the main thread of the current process crash.
  20369. */
  20370. crash(): void;
  20371. /**
  20372. * * `allocated` Integer - Size of all allocated objects in Kilobytes.
  20373. * * `total` Integer - Total allocated space in Kilobytes.
  20374. *
  20375. * Returns an object with Blink memory information. It can be useful for debugging
  20376. * rendering / DOM related memory issues. Note that all values are reported in
  20377. * Kilobytes.
  20378. */
  20379. getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
  20380. getCPUUsage(): Electron.CPUUsage;
  20381. /**
  20382. * The number of milliseconds since epoch, or `null` if the information is
  20383. * unavailable
  20384. *
  20385. * Indicates the creation time of the application. The time is represented as
  20386. * number of milliseconds since epoch. It returns null if it is unable to get the
  20387. * process creation time.
  20388. */
  20389. getCreationTime(): (number) | (null);
  20390. /**
  20391. * * `totalHeapSize` Integer
  20392. * * `totalHeapSizeExecutable` Integer
  20393. * * `totalPhysicalSize` Integer
  20394. * * `totalAvailableSize` Integer
  20395. * * `usedHeapSize` Integer
  20396. * * `heapSizeLimit` Integer
  20397. * * `mallocedMemory` Integer
  20398. * * `peakMallocedMemory` Integer
  20399. * * `doesZapGarbage` boolean
  20400. *
  20401. * Returns an object with V8 heap statistics. Note that all statistics are reported
  20402. * in Kilobytes.
  20403. */
  20404. getHeapStatistics(): Electron.HeapStatistics;
  20405. /**
  20406. * @platform win32,linux
  20407. */
  20408. getIOCounters(): Electron.IOCounters;
  20409. /**
  20410. * Resolves with a ProcessMemoryInfo
  20411. *
  20412. * Returns an object giving memory usage statistics about the current process. Note
  20413. * that all statistics are reported in Kilobytes. This api should be called after
  20414. * app ready.
  20415. *
  20416. * Chromium does not provide `residentSet` value for macOS. This is because macOS
  20417. * performs in-memory compression of pages that haven't been recently used. As a
  20418. * result the resident set size value is not what one would expect. `private`
  20419. * memory is more representative of the actual pre-compression memory usage of the
  20420. * process on macOS.
  20421. */
  20422. getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
  20423. /**
  20424. * * `total` Integer - The total amount of physical memory in Kilobytes available
  20425. * to the system.
  20426. * * `free` Integer - The total amount of memory not being used by applications or
  20427. * disk cache.
  20428. * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
  20429. * Kilobytes available to the system.
  20430. * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
  20431. * Kilobytes available to the system.
  20432. *
  20433. * Returns an object giving memory usage statistics about the entire system. Note
  20434. * that all statistics are reported in Kilobytes.
  20435. */
  20436. getSystemMemoryInfo(): Electron.SystemMemoryInfo;
  20437. /**
  20438. * The version of the host operating system.
  20439. *
  20440. * Example:
  20441. *
  20442. * **Note:** It returns the actual operating system version instead of kernel
  20443. * version on macOS unlike `os.release()`.
  20444. */
  20445. getSystemVersion(): string;
  20446. /**
  20447. * Causes the main thread of the current process hang.
  20448. */
  20449. hang(): void;
  20450. /**
  20451. * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
  20452. * whichever is lower for the current process.
  20453. *
  20454. * @platform darwin,linux
  20455. */
  20456. setFdLimit(maxDescriptors: number): void;
  20457. /**
  20458. * Indicates whether the snapshot has been created successfully.
  20459. *
  20460. * Takes a V8 heap snapshot and saves it to `filePath`.
  20461. */
  20462. takeHeapSnapshot(filePath: string): boolean;
  20463. /**
  20464. * A `string` representing Chrome's version string.
  20465. *
  20466. */
  20467. readonly chrome: string;
  20468. /**
  20469. * A `string` (optional) representing a globally unique ID of the current
  20470. * JavaScript context. Each frame has its own JavaScript context. When
  20471. * contextIsolation is enabled, the isolated world also has a separate JavaScript
  20472. * context. This property is only available in the renderer process.
  20473. *
  20474. */
  20475. readonly contextId?: string;
  20476. /**
  20477. * A `boolean` that indicates whether the current renderer context has
  20478. * `contextIsolation` enabled. It is `undefined` in the main process.
  20479. *
  20480. */
  20481. readonly contextIsolated: boolean;
  20482. /**
  20483. * A `boolean`. When the app is started by being passed as parameter to the default
  20484. * Electron executable, this property is `true` in the main process, otherwise it
  20485. * is `undefined`. For example when running the app with `electron .`, it is
  20486. * `true`, even if the app is packaged (`isPackaged`) is `true`. This can be useful
  20487. * to determine how many arguments will need to be sliced off from `process.argv`.
  20488. *
  20489. */
  20490. readonly defaultApp: boolean;
  20491. /**
  20492. * A `string` representing Electron's version string.
  20493. *
  20494. */
  20495. readonly electron: string;
  20496. /**
  20497. * A `boolean`, `true` when the current renderer context is the "main" renderer
  20498. * frame. If you want the ID of the current frame you should use
  20499. * `webFrame.routingId`.
  20500. *
  20501. */
  20502. readonly isMainFrame: boolean;
  20503. /**
  20504. * A `boolean`. For Mac App Store build, this property is `true`, for other builds
  20505. * it is `undefined`.
  20506. *
  20507. */
  20508. readonly mas: boolean;
  20509. /**
  20510. * A `boolean` that controls ASAR support inside your application. Setting this to
  20511. * `true` will disable the support for `asar` archives in Node's built-in modules.
  20512. */
  20513. noAsar: boolean;
  20514. /**
  20515. * A `boolean` that controls whether or not deprecation warnings are printed to
  20516. * `stderr`. Setting this to `true` will silence deprecation warnings. This
  20517. * property is used instead of the `--no-deprecation` command line flag.
  20518. */
  20519. noDeprecation: boolean;
  20520. /**
  20521. * A `Electron.ParentPort` property if this is a `UtilityProcess` (or `null`
  20522. * otherwise) allowing communication with the parent process.
  20523. */
  20524. parentPort: Electron.ParentPort;
  20525. /**
  20526. * A `string` representing the path to the resources directory.
  20527. *
  20528. */
  20529. readonly resourcesPath: string;
  20530. /**
  20531. * A `boolean`. When the renderer process is sandboxed, this property is `true`,
  20532. * otherwise it is `undefined`.
  20533. *
  20534. */
  20535. readonly sandboxed: boolean;
  20536. /**
  20537. * A `boolean` that controls whether or not deprecation warnings will be thrown as
  20538. * exceptions. Setting this to `true` will throw errors for deprecations. This
  20539. * property is used instead of the `--throw-deprecation` command line flag.
  20540. */
  20541. throwDeprecation: boolean;
  20542. /**
  20543. * A `boolean` that controls whether or not deprecations printed to `stderr`
  20544. * include their stack trace. Setting this to `true` will print stack traces for
  20545. * deprecations. This property is instead of the `--trace-deprecation` command line
  20546. * flag.
  20547. */
  20548. traceDeprecation: boolean;
  20549. /**
  20550. * A `boolean` that controls whether or not process warnings printed to `stderr`
  20551. * include their stack trace. Setting this to `true` will print stack traces for
  20552. * process warnings (including deprecations). This property is instead of the
  20553. * `--trace-warnings` command line flag.
  20554. */
  20555. traceProcessWarnings: boolean;
  20556. /**
  20557. * A `string` representing the current process's type, can be:
  20558. *
  20559. * * `browser` - The main process
  20560. * * `renderer` - A renderer process
  20561. * * `worker` - In a web worker
  20562. * * `utility` - In a node process launched as a service
  20563. *
  20564. */
  20565. readonly type: ('browser' | 'renderer' | 'worker' | 'utility');
  20566. /**
  20567. * A `boolean`. If the app is running as a Windows Store app (appx), this property
  20568. * is `true`, for otherwise it is `undefined`.
  20569. *
  20570. */
  20571. readonly windowsStore: boolean;
  20572. }
  20573. interface ProcessVersions {
  20574. readonly electron: string;
  20575. readonly chrome: string;
  20576. }
  20577. }