electron.d.ts 706 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503
  1. // Type definitions for Electron 16.0.2
  2. // Project: http://electronjs.org/
  3. // Definitions by: The Electron Team <https://github.com/electron/electron>
  4. // Definitions: https://github.com/electron/electron-typescript-definitions
  5. /// <reference types="node" />
  6. type GlobalEvent = Event & { returnValue: any };
  7. declare namespace Electron {
  8. const NodeEventEmitter: typeof import('events').EventEmitter;
  9. class Accelerator extends String {
  10. }
  11. interface App extends NodeJS.EventEmitter {
  12. // Docs: https://electronjs.org/docs/api/app
  13. /**
  14. * Emitted when Chrome's accessibility support changes. This event fires when
  15. * assistive technologies, such as screen readers, are enabled or disabled. See
  16. * https://www.chromium.org/developers/design-documents/accessibility for more
  17. * details.
  18. *
  19. * @platform darwin,win32
  20. */
  21. on(event: 'accessibility-support-changed', listener: (event: Event,
  22. /**
  23. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  24. */
  25. accessibilitySupportEnabled: boolean) => void): this;
  26. once(event: 'accessibility-support-changed', listener: (event: Event,
  27. /**
  28. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  29. */
  30. accessibilitySupportEnabled: boolean) => void): this;
  31. addListener(event: 'accessibility-support-changed', listener: (event: Event,
  32. /**
  33. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  34. */
  35. accessibilitySupportEnabled: boolean) => void): this;
  36. removeListener(event: 'accessibility-support-changed', listener: (event: Event,
  37. /**
  38. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  39. */
  40. accessibilitySupportEnabled: boolean) => void): this;
  41. /**
  42. * Emitted when the application is activated. Various actions can trigger this
  43. * event, such as launching the application for the first time, attempting to
  44. * re-launch the application when it's already running, or clicking on the
  45. * application's dock or taskbar icon.
  46. *
  47. * @platform darwin
  48. */
  49. on(event: 'activate', listener: (event: Event,
  50. hasVisibleWindows: boolean) => void): this;
  51. once(event: 'activate', listener: (event: Event,
  52. hasVisibleWindows: boolean) => void): this;
  53. addListener(event: 'activate', listener: (event: Event,
  54. hasVisibleWindows: boolean) => void): this;
  55. removeListener(event: 'activate', listener: (event: Event,
  56. hasVisibleWindows: boolean) => void): this;
  57. /**
  58. * Emitted during Handoff after an activity from this device was successfully
  59. * resumed on another one.
  60. *
  61. * @platform darwin
  62. */
  63. on(event: 'activity-was-continued', listener: (event: Event,
  64. /**
  65. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  66. */
  67. type: string,
  68. /**
  69. * Contains app-specific state stored by the activity.
  70. */
  71. userInfo: unknown) => void): this;
  72. once(event: 'activity-was-continued', listener: (event: Event,
  73. /**
  74. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  75. */
  76. type: string,
  77. /**
  78. * Contains app-specific state stored by the activity.
  79. */
  80. userInfo: unknown) => void): this;
  81. addListener(event: 'activity-was-continued', listener: (event: Event,
  82. /**
  83. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  84. */
  85. type: string,
  86. /**
  87. * Contains app-specific state stored by the activity.
  88. */
  89. userInfo: unknown) => void): this;
  90. removeListener(event: 'activity-was-continued', listener: (event: Event,
  91. /**
  92. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  93. */
  94. type: string,
  95. /**
  96. * Contains app-specific state stored by the activity.
  97. */
  98. userInfo: unknown) => void): this;
  99. /**
  100. * Emitted before the application starts closing its windows. Calling
  101. * `event.preventDefault()` will prevent the default behavior, which is terminating
  102. * the application.
  103. *
  104. * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
  105. * then `before-quit` is emitted *after* emitting `close` event on all windows and
  106. * closing them.
  107. *
  108. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  109. * a shutdown/restart of the system or a user logout.
  110. */
  111. on(event: 'before-quit', listener: (event: Event) => void): this;
  112. once(event: 'before-quit', listener: (event: Event) => void): this;
  113. addListener(event: 'before-quit', listener: (event: Event) => void): this;
  114. removeListener(event: 'before-quit', listener: (event: Event) => void): this;
  115. /**
  116. * Emitted when a browserWindow gets blurred.
  117. */
  118. on(event: 'browser-window-blur', listener: (event: Event,
  119. window: BrowserWindow) => void): this;
  120. once(event: 'browser-window-blur', listener: (event: Event,
  121. window: BrowserWindow) => void): this;
  122. addListener(event: 'browser-window-blur', listener: (event: Event,
  123. window: BrowserWindow) => void): this;
  124. removeListener(event: 'browser-window-blur', listener: (event: Event,
  125. window: BrowserWindow) => void): this;
  126. /**
  127. * Emitted when a new browserWindow is created.
  128. */
  129. on(event: 'browser-window-created', listener: (event: Event,
  130. window: BrowserWindow) => void): this;
  131. once(event: 'browser-window-created', listener: (event: Event,
  132. window: BrowserWindow) => void): this;
  133. addListener(event: 'browser-window-created', listener: (event: Event,
  134. window: BrowserWindow) => void): this;
  135. removeListener(event: 'browser-window-created', listener: (event: Event,
  136. window: BrowserWindow) => void): this;
  137. /**
  138. * Emitted when a browserWindow gets focused.
  139. */
  140. on(event: 'browser-window-focus', listener: (event: Event,
  141. window: BrowserWindow) => void): this;
  142. once(event: 'browser-window-focus', listener: (event: Event,
  143. window: BrowserWindow) => void): this;
  144. addListener(event: 'browser-window-focus', listener: (event: Event,
  145. window: BrowserWindow) => void): this;
  146. removeListener(event: 'browser-window-focus', listener: (event: Event,
  147. window: BrowserWindow) => void): this;
  148. /**
  149. * Emitted when failed to verify the `certificate` for `url`, to trust the
  150. * certificate you should prevent the default behavior with
  151. * `event.preventDefault()` and call `callback(true)`.
  152. */
  153. on(event: 'certificate-error', listener: (event: Event,
  154. webContents: WebContents,
  155. url: string,
  156. /**
  157. * The error code
  158. */
  159. error: string,
  160. certificate: Certificate,
  161. callback: (isTrusted: boolean) => void,
  162. isMainFrame: boolean) => void): this;
  163. once(event: 'certificate-error', listener: (event: Event,
  164. webContents: WebContents,
  165. url: string,
  166. /**
  167. * The error code
  168. */
  169. error: string,
  170. certificate: Certificate,
  171. callback: (isTrusted: boolean) => void,
  172. isMainFrame: boolean) => void): this;
  173. addListener(event: 'certificate-error', listener: (event: Event,
  174. webContents: WebContents,
  175. url: string,
  176. /**
  177. * The error code
  178. */
  179. error: string,
  180. certificate: Certificate,
  181. callback: (isTrusted: boolean) => void,
  182. isMainFrame: boolean) => void): this;
  183. removeListener(event: 'certificate-error', listener: (event: Event,
  184. webContents: WebContents,
  185. url: string,
  186. /**
  187. * The error code
  188. */
  189. error: string,
  190. certificate: Certificate,
  191. callback: (isTrusted: boolean) => void,
  192. isMainFrame: boolean) => void): this;
  193. /**
  194. * Emitted when the child process unexpectedly disappears. This is normally because
  195. * it was crashed or killed. It does not include renderer processes.
  196. */
  197. on(event: 'child-process-gone', listener: (event: Event,
  198. details: Details) => void): this;
  199. once(event: 'child-process-gone', listener: (event: Event,
  200. details: Details) => void): this;
  201. addListener(event: 'child-process-gone', listener: (event: Event,
  202. details: Details) => void): this;
  203. removeListener(event: 'child-process-gone', listener: (event: Event,
  204. details: Details) => void): this;
  205. /**
  206. * Emitted during Handoff when an activity from a different device wants to be
  207. * resumed. You should call `event.preventDefault()` if you want to handle this
  208. * event.
  209. *
  210. * A user activity can be continued only in an app that has the same developer Team
  211. * ID as the activity's source app and that supports the activity's type. Supported
  212. * activity types are specified in the app's `Info.plist` under the
  213. * `NSUserActivityTypes` key.
  214. *
  215. * @platform darwin
  216. */
  217. on(event: 'continue-activity', listener: (event: Event,
  218. /**
  219. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  220. */
  221. type: string,
  222. /**
  223. * Contains app-specific state stored by the activity on another device.
  224. */
  225. userInfo: unknown,
  226. details: ContinueActivityDetails) => void): this;
  227. once(event: 'continue-activity', listener: (event: Event,
  228. /**
  229. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  230. */
  231. type: string,
  232. /**
  233. * Contains app-specific state stored by the activity on another device.
  234. */
  235. userInfo: unknown,
  236. details: ContinueActivityDetails) => void): this;
  237. addListener(event: 'continue-activity', listener: (event: Event,
  238. /**
  239. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  240. */
  241. type: string,
  242. /**
  243. * Contains app-specific state stored by the activity on another device.
  244. */
  245. userInfo: unknown,
  246. details: ContinueActivityDetails) => void): this;
  247. removeListener(event: 'continue-activity', listener: (event: Event,
  248. /**
  249. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  250. */
  251. type: string,
  252. /**
  253. * Contains app-specific state stored by the activity on another device.
  254. */
  255. userInfo: unknown,
  256. details: ContinueActivityDetails) => void): this;
  257. /**
  258. * Emitted during Handoff when an activity from a different device fails to be
  259. * resumed.
  260. *
  261. * @platform darwin
  262. */
  263. on(event: 'continue-activity-error', listener: (event: Event,
  264. /**
  265. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  266. */
  267. type: string,
  268. /**
  269. * A string with the error's localized description.
  270. */
  271. error: string) => void): this;
  272. once(event: 'continue-activity-error', listener: (event: Event,
  273. /**
  274. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  275. */
  276. type: string,
  277. /**
  278. * A string with the error's localized description.
  279. */
  280. error: string) => void): this;
  281. addListener(event: 'continue-activity-error', listener: (event: Event,
  282. /**
  283. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  284. */
  285. type: string,
  286. /**
  287. * A string with the error's localized description.
  288. */
  289. error: string) => void): this;
  290. removeListener(event: 'continue-activity-error', listener: (event: Event,
  291. /**
  292. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  293. */
  294. type: string,
  295. /**
  296. * A string with the error's localized description.
  297. */
  298. error: string) => void): this;
  299. /**
  300. * Emitted when `desktopCapturer.getSources()` is called in the renderer process of
  301. * `webContents`. Calling `event.preventDefault()` will make it return empty
  302. * sources.
  303. */
  304. on(event: 'desktop-capturer-get-sources', listener: (event: Event,
  305. webContents: WebContents) => void): this;
  306. once(event: 'desktop-capturer-get-sources', listener: (event: Event,
  307. webContents: WebContents) => void): this;
  308. addListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
  309. webContents: WebContents) => void): this;
  310. removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
  311. webContents: WebContents) => void): this;
  312. /**
  313. * Emitted when mac application become active. Difference from `activate` event is
  314. * that `did-become-active` is emitted every time the app becomes active, not only
  315. * when Dock icon is clicked or application is re-launched.
  316. *
  317. * @platform darwin
  318. */
  319. on(event: 'did-become-active', listener: (event: Event) => void): this;
  320. once(event: 'did-become-active', listener: (event: Event) => void): this;
  321. addListener(event: 'did-become-active', listener: (event: Event) => void): this;
  322. removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
  323. /**
  324. * Emitted whenever there is a GPU info update.
  325. */
  326. on(event: 'gpu-info-update', listener: Function): this;
  327. once(event: 'gpu-info-update', listener: Function): this;
  328. addListener(event: 'gpu-info-update', listener: Function): this;
  329. removeListener(event: 'gpu-info-update', listener: Function): this;
  330. /**
  331. * Emitted when the GPU process crashes or is killed.
  332. *
  333. * **Deprecated:** This event is superceded by the `child-process-gone` event which
  334. * contains more information about why the child process disappeared. It isn't
  335. * always because it crashed. The `killed` boolean can be replaced by checking
  336. * `reason === 'killed'` when you switch to that event.
  337. *
  338. * @deprecated
  339. */
  340. on(event: 'gpu-process-crashed', listener: (event: Event,
  341. killed: boolean) => void): this;
  342. once(event: 'gpu-process-crashed', listener: (event: Event,
  343. killed: boolean) => void): this;
  344. addListener(event: 'gpu-process-crashed', listener: (event: Event,
  345. killed: boolean) => void): this;
  346. removeListener(event: 'gpu-process-crashed', listener: (event: Event,
  347. killed: boolean) => void): this;
  348. /**
  349. * Emitted when `webContents` wants to do basic auth.
  350. *
  351. * The default behavior is to cancel all authentications. To override this you
  352. * should prevent the default behavior with `event.preventDefault()` and call
  353. * `callback(username, password)` with the credentials.
  354. *
  355. * If `callback` is called without a username or password, the authentication
  356. * request will be cancelled and the authentication error will be returned to the
  357. * page.
  358. */
  359. on(event: 'login', listener: (event: Event,
  360. webContents: WebContents,
  361. authenticationResponseDetails: AuthenticationResponseDetails,
  362. authInfo: AuthInfo,
  363. callback: (username?: string, password?: string) => void) => void): this;
  364. once(event: 'login', listener: (event: Event,
  365. webContents: WebContents,
  366. authenticationResponseDetails: AuthenticationResponseDetails,
  367. authInfo: AuthInfo,
  368. callback: (username?: string, password?: string) => void) => void): this;
  369. addListener(event: 'login', listener: (event: Event,
  370. webContents: WebContents,
  371. authenticationResponseDetails: AuthenticationResponseDetails,
  372. authInfo: AuthInfo,
  373. callback: (username?: string, password?: string) => void) => void): this;
  374. removeListener(event: 'login', listener: (event: Event,
  375. webContents: WebContents,
  376. authenticationResponseDetails: AuthenticationResponseDetails,
  377. authInfo: AuthInfo,
  378. callback: (username?: string, password?: string) => void) => void): this;
  379. /**
  380. * Emitted when the user clicks the native macOS new tab button. The new tab button
  381. * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
  382. *
  383. * @platform darwin
  384. */
  385. on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  386. once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  387. addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  388. removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  389. /**
  390. * Emitted when the user wants to open a file with the application. The `open-file`
  391. * event is usually emitted when the application is already open and the OS wants
  392. * to reuse the application to open the file. `open-file` is also emitted when a
  393. * file is dropped onto the dock and the application is not yet running. Make sure
  394. * to listen for the `open-file` event very early in your application startup to
  395. * handle this case (even before the `ready` event is emitted).
  396. *
  397. * You should call `event.preventDefault()` if you want to handle this event.
  398. *
  399. * On Windows, you have to parse `process.argv` (in the main process) to get the
  400. * filepath.
  401. *
  402. * @platform darwin
  403. */
  404. on(event: 'open-file', listener: (event: Event,
  405. path: string) => void): this;
  406. once(event: 'open-file', listener: (event: Event,
  407. path: string) => void): this;
  408. addListener(event: 'open-file', listener: (event: Event,
  409. path: string) => void): this;
  410. removeListener(event: 'open-file', listener: (event: Event,
  411. path: string) => void): this;
  412. /**
  413. * Emitted when the user wants to open a URL with the application. Your
  414. * application's `Info.plist` file must define the URL scheme within the
  415. * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
  416. *
  417. * You should call `event.preventDefault()` if you want to handle this event.
  418. *
  419. * @platform darwin
  420. */
  421. on(event: 'open-url', listener: (event: Event,
  422. url: string) => void): this;
  423. once(event: 'open-url', listener: (event: Event,
  424. url: string) => void): this;
  425. addListener(event: 'open-url', listener: (event: Event,
  426. url: string) => void): this;
  427. removeListener(event: 'open-url', listener: (event: Event,
  428. url: string) => void): this;
  429. /**
  430. * Emitted when the application is quitting.
  431. *
  432. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  433. * a shutdown/restart of the system or a user logout.
  434. */
  435. on(event: 'quit', listener: (event: Event,
  436. exitCode: number) => void): this;
  437. once(event: 'quit', listener: (event: Event,
  438. exitCode: number) => void): this;
  439. addListener(event: 'quit', listener: (event: Event,
  440. exitCode: number) => void): this;
  441. removeListener(event: 'quit', listener: (event: Event,
  442. exitCode: number) => void): this;
  443. /**
  444. * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
  445. * holds the `userInfo` of the `NSUserNotification` or information from
  446. * `UNNotificationResponse` that was used to open the application, if it was
  447. * launched from Notification Center. You can also call `app.isReady()` to check if
  448. * this event has already fired and `app.whenReady()` to get a Promise that is
  449. * fulfilled when Electron is initialized.
  450. */
  451. on(event: 'ready', listener: (event: Event,
  452. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  453. once(event: 'ready', listener: (event: Event,
  454. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  455. addListener(event: 'ready', listener: (event: Event,
  456. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  457. removeListener(event: 'ready', listener: (event: Event,
  458. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  459. /**
  460. * Emitted when the renderer process unexpectedly disappears. This is normally
  461. * because it was crashed or killed.
  462. */
  463. on(event: 'render-process-gone', listener: (event: Event,
  464. webContents: WebContents,
  465. details: RenderProcessGoneDetails) => void): this;
  466. once(event: 'render-process-gone', listener: (event: Event,
  467. webContents: WebContents,
  468. details: RenderProcessGoneDetails) => void): this;
  469. addListener(event: 'render-process-gone', listener: (event: Event,
  470. webContents: WebContents,
  471. details: RenderProcessGoneDetails) => void): this;
  472. removeListener(event: 'render-process-gone', listener: (event: Event,
  473. webContents: WebContents,
  474. details: RenderProcessGoneDetails) => void): this;
  475. /**
  476. * Emitted when the renderer process of `webContents` crashes or is killed.
  477. *
  478. * **Deprecated:** This event is superceded by the `render-process-gone` event
  479. * which contains more information about why the render process disappeared. It
  480. * isn't always because it crashed. The `killed` boolean can be replaced by
  481. * checking `reason === 'killed'` when you switch to that event.
  482. *
  483. * @deprecated
  484. */
  485. on(event: 'renderer-process-crashed', listener: (event: Event,
  486. webContents: WebContents,
  487. killed: boolean) => void): this;
  488. once(event: 'renderer-process-crashed', listener: (event: Event,
  489. webContents: WebContents,
  490. killed: boolean) => void): this;
  491. addListener(event: 'renderer-process-crashed', listener: (event: Event,
  492. webContents: WebContents,
  493. killed: boolean) => void): this;
  494. removeListener(event: 'renderer-process-crashed', listener: (event: Event,
  495. webContents: WebContents,
  496. killed: boolean) => void): this;
  497. /**
  498. * This event will be emitted inside the primary instance of your application when
  499. * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
  500. *
  501. * `argv` is an Array of the second instance's command line arguments, and
  502. * `workingDirectory` is its current working directory. Usually applications
  503. * respond to this by making their primary window focused and non-minimized.
  504. *
  505. * **Note:** If the second instance is started by a different user than the first,
  506. * the `argv` array will not include the arguments.
  507. *
  508. * This event is guaranteed to be emitted after the `ready` event of `app` gets
  509. * emitted.
  510. *
  511. * **Note:** Extra command line arguments might be added by Chromium, such as
  512. * `--original-process-start-time`.
  513. */
  514. on(event: 'second-instance', listener: (event: Event,
  515. /**
  516. * An array of the second instance's command line arguments
  517. */
  518. argv: string[],
  519. /**
  520. * The second instance's working directory
  521. */
  522. workingDirectory: string,
  523. /**
  524. * A JSON object of additional data passed from the second instance
  525. */
  526. additionalData: unknown) => void): this;
  527. once(event: 'second-instance', listener: (event: Event,
  528. /**
  529. * An array of the second instance's command line arguments
  530. */
  531. argv: string[],
  532. /**
  533. * The second instance's working directory
  534. */
  535. workingDirectory: string,
  536. /**
  537. * A JSON object of additional data passed from the second instance
  538. */
  539. additionalData: unknown) => void): this;
  540. addListener(event: 'second-instance', listener: (event: Event,
  541. /**
  542. * An array of the second instance's command line arguments
  543. */
  544. argv: string[],
  545. /**
  546. * The second instance's working directory
  547. */
  548. workingDirectory: string,
  549. /**
  550. * A JSON object of additional data passed from the second instance
  551. */
  552. additionalData: unknown) => void): this;
  553. removeListener(event: 'second-instance', listener: (event: Event,
  554. /**
  555. * An array of the second instance's command line arguments
  556. */
  557. argv: string[],
  558. /**
  559. * The second instance's working directory
  560. */
  561. workingDirectory: string,
  562. /**
  563. * A JSON object of additional data passed from the second instance
  564. */
  565. additionalData: unknown) => void): this;
  566. /**
  567. * Emitted when a client certificate is requested.
  568. *
  569. * The `url` corresponds to the navigation entry requesting the client certificate
  570. * and `callback` can be called with an entry filtered from the list. Using
  571. * `event.preventDefault()` prevents the application from using the first
  572. * certificate from the store.
  573. */
  574. on(event: 'select-client-certificate', listener: (event: Event,
  575. webContents: WebContents,
  576. url: string,
  577. certificateList: Certificate[],
  578. callback: (certificate?: Certificate) => void) => void): this;
  579. once(event: 'select-client-certificate', listener: (event: Event,
  580. webContents: WebContents,
  581. url: string,
  582. certificateList: Certificate[],
  583. callback: (certificate?: Certificate) => void) => void): this;
  584. addListener(event: 'select-client-certificate', listener: (event: Event,
  585. webContents: WebContents,
  586. url: string,
  587. certificateList: Certificate[],
  588. callback: (certificate?: Certificate) => void) => void): this;
  589. removeListener(event: 'select-client-certificate', listener: (event: Event,
  590. webContents: WebContents,
  591. url: string,
  592. certificateList: Certificate[],
  593. callback: (certificate?: Certificate) => void) => void): this;
  594. /**
  595. * Emitted when Electron has created a new `session`.
  596. */
  597. on(event: 'session-created', listener: (session: Session) => void): this;
  598. once(event: 'session-created', listener: (session: Session) => void): this;
  599. addListener(event: 'session-created', listener: (session: Session) => void): this;
  600. removeListener(event: 'session-created', listener: (session: Session) => void): this;
  601. /**
  602. * Emitted when Handoff is about to be resumed on another device. If you need to
  603. * update the state to be transferred, you should call `event.preventDefault()`
  604. * immediately, construct a new `userInfo` dictionary and call
  605. * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
  606. * fail and `continue-activity-error` will be called.
  607. *
  608. * @platform darwin
  609. */
  610. on(event: 'update-activity-state', listener: (event: Event,
  611. /**
  612. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  613. */
  614. type: string,
  615. /**
  616. * Contains app-specific state stored by the activity.
  617. */
  618. userInfo: unknown) => void): this;
  619. once(event: 'update-activity-state', listener: (event: Event,
  620. /**
  621. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  622. */
  623. type: string,
  624. /**
  625. * Contains app-specific state stored by the activity.
  626. */
  627. userInfo: unknown) => void): this;
  628. addListener(event: 'update-activity-state', listener: (event: Event,
  629. /**
  630. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  631. */
  632. type: string,
  633. /**
  634. * Contains app-specific state stored by the activity.
  635. */
  636. userInfo: unknown) => void): this;
  637. removeListener(event: 'update-activity-state', listener: (event: Event,
  638. /**
  639. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  640. */
  641. type: string,
  642. /**
  643. * Contains app-specific state stored by the activity.
  644. */
  645. userInfo: unknown) => void): this;
  646. /**
  647. * Emitted when a new webContents is created.
  648. */
  649. on(event: 'web-contents-created', listener: (event: Event,
  650. webContents: WebContents) => void): this;
  651. once(event: 'web-contents-created', listener: (event: Event,
  652. webContents: WebContents) => void): this;
  653. addListener(event: 'web-contents-created', listener: (event: Event,
  654. webContents: WebContents) => void): this;
  655. removeListener(event: 'web-contents-created', listener: (event: Event,
  656. webContents: WebContents) => void): this;
  657. /**
  658. * Emitted during Handoff before an activity from a different device wants to be
  659. * resumed. You should call `event.preventDefault()` if you want to handle this
  660. * event.
  661. *
  662. * @platform darwin
  663. */
  664. on(event: 'will-continue-activity', listener: (event: Event,
  665. /**
  666. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  667. */
  668. type: string) => void): this;
  669. once(event: 'will-continue-activity', listener: (event: Event,
  670. /**
  671. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  672. */
  673. type: string) => void): this;
  674. addListener(event: 'will-continue-activity', listener: (event: Event,
  675. /**
  676. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  677. */
  678. type: string) => void): this;
  679. removeListener(event: 'will-continue-activity', listener: (event: Event,
  680. /**
  681. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  682. */
  683. type: string) => void): this;
  684. /**
  685. * Emitted when the application has finished basic startup. On Windows and Linux,
  686. * the `will-finish-launching` event is the same as the `ready` event; on macOS,
  687. * this event represents the `applicationWillFinishLaunching` notification of
  688. * `NSApplication`. You would usually set up listeners for the `open-file` and
  689. * `open-url` events here, and start the crash reporter and auto updater.
  690. *
  691. * In most cases, you should do everything in the `ready` event handler.
  692. */
  693. on(event: 'will-finish-launching', listener: Function): this;
  694. once(event: 'will-finish-launching', listener: Function): this;
  695. addListener(event: 'will-finish-launching', listener: Function): this;
  696. removeListener(event: 'will-finish-launching', listener: Function): this;
  697. /**
  698. * Emitted when all windows have been closed and the application will quit. Calling
  699. * `event.preventDefault()` will prevent the default behavior, which is terminating
  700. * the application.
  701. *
  702. * See the description of the `window-all-closed` event for the differences between
  703. * the `will-quit` and `window-all-closed` events.
  704. *
  705. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  706. * a shutdown/restart of the system or a user logout.
  707. */
  708. on(event: 'will-quit', listener: (event: Event) => void): this;
  709. once(event: 'will-quit', listener: (event: Event) => void): this;
  710. addListener(event: 'will-quit', listener: (event: Event) => void): this;
  711. removeListener(event: 'will-quit', listener: (event: Event) => void): this;
  712. /**
  713. * Emitted when all windows have been closed.
  714. *
  715. * If you do not subscribe to this event and all windows are closed, the default
  716. * behavior is to quit the app; however, if you subscribe, you control whether the
  717. * app quits or not. If the user pressed `Cmd + Q`, or the developer called
  718. * `app.quit()`, Electron will first try to close all the windows and then emit the
  719. * `will-quit` event, and in this case the `window-all-closed` event would not be
  720. * emitted.
  721. */
  722. on(event: 'window-all-closed', listener: Function): this;
  723. once(event: 'window-all-closed', listener: Function): this;
  724. addListener(event: 'window-all-closed', listener: Function): this;
  725. removeListener(event: 'window-all-closed', listener: Function): this;
  726. /**
  727. * Adds `path` to the recent documents list.
  728. *
  729. * This list is managed by the OS. On Windows, you can visit the list from the task
  730. * bar, and on macOS, you can visit it from dock menu.
  731. *
  732. * @platform darwin,win32
  733. */
  734. addRecentDocument(path: string): void;
  735. /**
  736. * Clears the recent documents list.
  737. *
  738. * @platform darwin,win32
  739. */
  740. clearRecentDocuments(): void;
  741. /**
  742. * Configures host resolution (DNS and DNS-over-HTTPS). By default, the following
  743. * resolvers will be used, in order:
  744. *
  745. * * DNS-over-HTTPS, if the DNS provider supports it, then
  746. * * the built-in resolver (enabled on macOS only by default), then
  747. * * the system's resolver (e.g. `getaddrinfo`).
  748. *
  749. * This can be configured to either restrict usage of non-encrypted DNS
  750. * (`secureDnsMode: "secure"`), or disable DNS-over-HTTPS (`secureDnsMode: "off"`).
  751. * It is also possible to enable or disable the built-in resolver.
  752. *
  753. * To disable insecure DNS, you can specify a `secureDnsMode` of `"secure"`. If you
  754. * do so, you should make sure to provide a list of DNS-over-HTTPS servers to use,
  755. * in case the user's DNS configuration does not include a provider that supports
  756. * DoH.
  757. *
  758. * This API must be called after the `ready` event is emitted.
  759. */
  760. configureHostResolver(options: ConfigureHostResolverOptions): void;
  761. /**
  762. * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
  763. * basis if the GPU processes crashes too frequently. This function disables that
  764. * behavior.
  765. *
  766. * This method can only be called before app is ready.
  767. */
  768. disableDomainBlockingFor3DAPIs(): void;
  769. /**
  770. * Disables hardware acceleration for current app.
  771. *
  772. * This method can only be called before app is ready.
  773. */
  774. disableHardwareAcceleration(): void;
  775. /**
  776. * Enables full sandbox mode on the app. This means that all renderers will be
  777. * launched sandboxed, regardless of the value of the `sandbox` flag in
  778. * WebPreferences.
  779. *
  780. * This method can only be called before app is ready.
  781. */
  782. enableSandbox(): void;
  783. /**
  784. * Exits immediately with `exitCode`. `exitCode` defaults to 0.
  785. *
  786. * All windows will be closed immediately without asking the user, and the
  787. * `before-quit` and `will-quit` events will not be emitted.
  788. */
  789. exit(exitCode?: number): void;
  790. /**
  791. * On Linux, focuses on the first visible window. On macOS, makes the application
  792. * the active app. On Windows, focuses on the application's first window.
  793. *
  794. * You should seek to use the `steal` option as sparingly as possible.
  795. */
  796. focus(options?: FocusOptions): void;
  797. /**
  798. * Resolve with an object containing the following:
  799. *
  800. * * `icon` NativeImage - the display icon of the app handling the protocol.
  801. * * `path` String - installation path of the app handling the protocol.
  802. * * `name` String - display name of the app handling the protocol.
  803. *
  804. * This method returns a promise that contains the application name, icon and path
  805. * of the default handler for the protocol (aka URI scheme) of a URL.
  806. *
  807. * @platform darwin,win32
  808. */
  809. getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
  810. /**
  811. * Name of the application handling the protocol, or an empty string if there is no
  812. * handler. For instance, if Electron is the default handler of the URL, this could
  813. * be `Electron` on Windows and Mac. However, don't rely on the precise format
  814. * which is not guaranteed to remain unchanged. Expect a different format on Linux,
  815. * possibly with a `.desktop` suffix.
  816. *
  817. * This method returns the application name of the default handler for the protocol
  818. * (aka URI scheme) of a URL.
  819. */
  820. getApplicationNameForProtocol(url: string): string;
  821. /**
  822. * Array of `ProcessMetric` objects that correspond to memory and CPU usage
  823. * statistics of all the processes associated with the app.
  824. */
  825. getAppMetrics(): ProcessMetric[];
  826. /**
  827. * The current application directory.
  828. */
  829. getAppPath(): string;
  830. /**
  831. * The current value displayed in the counter badge.
  832. *
  833. * @platform linux,darwin
  834. */
  835. getBadgeCount(): number;
  836. /**
  837. * The type of the currently running activity.
  838. *
  839. * @platform darwin
  840. */
  841. getCurrentActivityType(): string;
  842. /**
  843. * fulfilled with the app's icon, which is a NativeImage.
  844. *
  845. * Fetches a path's associated icon.
  846. *
  847. * On _Windows_, there a 2 kinds of icons:
  848. *
  849. * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
  850. * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
  851. *
  852. * On _Linux_ and _macOS_, icons depend on the application associated with file
  853. * mime type.
  854. */
  855. getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
  856. /**
  857. * The Graphics Feature Status from `chrome://gpu/`.
  858. *
  859. * **Note:** This information is only usable after the `gpu-info-update` event is
  860. * emitted.
  861. */
  862. getGPUFeatureStatus(): GPUFeatureStatus;
  863. /**
  864. * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
  865. * containing all the GPU Information as in chromium's GPUInfo object. This
  866. * includes the version and driver information that's shown on `chrome://gpu` page.
  867. *
  868. * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
  869. * fewer attributes than when requested with `complete`. Here's an example of basic
  870. * response:
  871. *
  872. * Using `basic` should be preferred if only basic information like `vendorId` or
  873. * `driverId` is needed.
  874. */
  875. getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
  876. /**
  877. * * `minItems` Integer - The minimum number of items that will be shown in the
  878. * Jump List (for a more detailed description of this value see the MSDN docs).
  879. * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
  880. * correspond to items that the user has explicitly removed from custom categories
  881. * in the Jump List. These items must not be re-added to the Jump List in the
  882. * **next** call to `app.setJumpList()`, Windows will not display any custom
  883. * category that contains any of the removed items.
  884. *
  885. * @platform win32
  886. */
  887. getJumpListSettings(): JumpListSettings;
  888. /**
  889. * The current application locale, fetched using Chromium's `l10n_util` library.
  890. * Possible return values are documented here.
  891. *
  892. * To set the locale, you'll want to use a command line switch at app startup,
  893. * which may be found here.
  894. *
  895. * **Note:** When distributing your packaged app, you have to also ship the
  896. * `locales` folder.
  897. *
  898. * **Note:** On Windows, you have to call it after the `ready` events gets emitted.
  899. */
  900. getLocale(): string;
  901. /**
  902. * User operating system's locale two-letter ISO 3166 country code. The value is
  903. * taken from native OS APIs.
  904. *
  905. * **Note:** When unable to detect locale country code, it returns empty string.
  906. */
  907. getLocaleCountryCode(): string;
  908. /**
  909. * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
  910. * you need to pass the same arguments here for `openAtLogin` to be set correctly.
  911. *
  912. *
  913. * * `openAtLogin` Boolean - `true` if the app is set to open at login.
  914. * * `openAsHidden` Boolean _macOS_ - `true` if the app is set to open as hidden at
  915. * login. This setting is not available on MAS builds.
  916. * * `wasOpenedAtLogin` Boolean _macOS_ - `true` if the app was opened at login
  917. * automatically. This setting is not available on MAS builds.
  918. * * `wasOpenedAsHidden` Boolean _macOS_ - `true` if the app was opened as a hidden
  919. * login item. This indicates that the app should not open any windows at startup.
  920. * This setting is not available on MAS builds.
  921. * * `restoreState` Boolean _macOS_ - `true` if the app was opened as a login item
  922. * that should restore the state from the previous session. This indicates that the
  923. * app should restore the windows that were open the last time the app was closed.
  924. * This setting is not available on MAS builds.
  925. * * `executableWillLaunchAtLogin` Boolean _Windows_ - `true` if app is set to open
  926. * at login and its run key is not deactivated. This differs from `openAtLogin` as
  927. * it ignores the `args` option, this property will be true if the given executable
  928. * would be launched at login with **any** arguments.
  929. * * `launchItems` Object[] _Windows_
  930. * * `name` String _Windows_ - name value of a registry entry.
  931. * * `path` String _Windows_ - The executable to an app that corresponds to a
  932. * registry entry.
  933. * * `args` String[] _Windows_ - the command-line arguments to pass to the
  934. * executable.
  935. * * `scope` String _Windows_ - one of `user` or `machine`. Indicates whether the
  936. * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  937. * * `enabled` Boolean _Windows_ - `true` if the app registry key is startup
  938. * approved and therefore shows as `enabled` in Task Manager and Windows settings.
  939. *
  940. * @platform darwin,win32
  941. */
  942. getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
  943. /**
  944. * The current application's name, which is the name in the application's
  945. * `package.json` file.
  946. *
  947. * Usually the `name` field of `package.json` is a short lowercase name, according
  948. * to the npm modules spec. You should usually also specify a `productName` field,
  949. * which is your application's full capitalized name, and which will be preferred
  950. * over `name` by Electron.
  951. */
  952. getName(): string;
  953. /**
  954. * A path to a special directory or file associated with `name`. On failure, an
  955. * `Error` is thrown.
  956. *
  957. * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
  958. * called first, a default log directory will be created equivalent to calling
  959. * `app.setAppLogsPath()` without a `path` parameter.
  960. */
  961. getPath(name: 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps'): string;
  962. /**
  963. * The version of the loaded application. If no version is found in the
  964. * application's `package.json` file, the version of the current bundle or
  965. * executable is returned.
  966. */
  967. getVersion(): string;
  968. /**
  969. * This method returns whether or not this instance of your app is currently
  970. * holding the single instance lock. You can request the lock with
  971. * `app.requestSingleInstanceLock()` and release with
  972. * `app.releaseSingleInstanceLock()`
  973. */
  974. hasSingleInstanceLock(): boolean;
  975. /**
  976. * Hides all application windows without minimizing them.
  977. *
  978. * @platform darwin
  979. */
  980. hide(): void;
  981. /**
  982. * Imports the certificate in pkcs12 format into the platform certificate store.
  983. * `callback` is called with the `result` of import operation, a value of `0`
  984. * indicates success while any other value indicates failure according to Chromium
  985. * net_error_list.
  986. *
  987. * @platform linux
  988. */
  989. importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
  990. /**
  991. * Invalidates the current Handoff user activity.
  992. *
  993. * @platform darwin
  994. */
  995. invalidateCurrentActivity(): void;
  996. /**
  997. * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
  998. * will return `true` if the use of assistive technologies, such as screen readers,
  999. * has been detected. See
  1000. * https://www.chromium.org/developers/design-documents/accessibility for more
  1001. * details.
  1002. *
  1003. * @platform darwin,win32
  1004. */
  1005. isAccessibilitySupportEnabled(): boolean;
  1006. /**
  1007. * Whether the current executable is the default handler for a protocol (aka URI
  1008. * scheme).
  1009. *
  1010. * **Note:** On macOS, you can use this method to check if the app has been
  1011. * registered as the default protocol handler for a protocol. You can also verify
  1012. * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
  1013. * macOS machine. Please refer to Apple's documentation for details.
  1014. *
  1015. * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
  1016. * internally.
  1017. */
  1018. isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1019. /**
  1020. * whether or not the current OS version allows for native emoji pickers.
  1021. */
  1022. isEmojiPanelSupported(): boolean;
  1023. /**
  1024. * Whether the application is currently running from the systems Application
  1025. * folder. Use in combination with `app.moveToApplicationsFolder()`
  1026. *
  1027. * @platform darwin
  1028. */
  1029. isInApplicationsFolder(): boolean;
  1030. /**
  1031. * `true` if Electron has finished initializing, `false` otherwise. See also
  1032. * `app.whenReady()`.
  1033. */
  1034. isReady(): boolean;
  1035. /**
  1036. * whether `Secure Keyboard Entry` is enabled.
  1037. *
  1038. * By default this API will return `false`.
  1039. *
  1040. * @platform darwin
  1041. */
  1042. isSecureKeyboardEntryEnabled(): boolean;
  1043. /**
  1044. * Whether the current desktop environment is Unity launcher.
  1045. *
  1046. * @platform linux
  1047. */
  1048. isUnityRunning(): boolean;
  1049. /**
  1050. * Whether the move was successful. Please note that if the move is successful,
  1051. * your application will quit and relaunch.
  1052. *
  1053. * No confirmation dialog will be presented by default. If you wish to allow the
  1054. * user to confirm the operation, you may do so using the `dialog` API.
  1055. *
  1056. * **NOTE:** This method throws errors if anything other than the user causes the
  1057. * move to fail. For instance if the user cancels the authorization dialog, this
  1058. * method returns false. If we fail to perform the copy, then this method will
  1059. * throw an error. The message in the error should be informative and tell you
  1060. * exactly what went wrong.
  1061. *
  1062. * By default, if an app of the same name as the one being moved exists in the
  1063. * Applications directory and is _not_ running, the existing app will be trashed
  1064. * and the active app moved into its place. If it _is_ running, the pre-existing
  1065. * running app will assume focus and the previously active app will quit itself.
  1066. * This behavior can be changed by providing the optional conflict handler, where
  1067. * the boolean returned by the handler determines whether or not the move conflict
  1068. * is resolved with default behavior. i.e. returning `false` will ensure no
  1069. * further action is taken, returning `true` will result in the default behavior
  1070. * and the method continuing.
  1071. *
  1072. * For example:
  1073. *
  1074. * Would mean that if an app already exists in the user directory, if the user
  1075. * chooses to 'Continue Move' then the function would continue with its default
  1076. * behavior and the existing app will be trashed and the active app moved into its
  1077. * place.
  1078. *
  1079. * @platform darwin
  1080. */
  1081. moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
  1082. /**
  1083. * Try to close all windows. The `before-quit` event will be emitted first. If all
  1084. * windows are successfully closed, the `will-quit` event will be emitted and by
  1085. * default the application will terminate.
  1086. *
  1087. * This method guarantees that all `beforeunload` and `unload` event handlers are
  1088. * correctly executed. It is possible that a window cancels the quitting by
  1089. * returning `false` in the `beforeunload` event handler.
  1090. */
  1091. quit(): void;
  1092. /**
  1093. * Relaunches the app when current instance exits.
  1094. *
  1095. * By default, the new instance will use the same working directory and command
  1096. * line arguments with current instance. When `args` is specified, the `args` will
  1097. * be passed as command line arguments instead. When `execPath` is specified, the
  1098. * `execPath` will be executed for relaunch instead of current app.
  1099. *
  1100. * Note that this method does not quit the app when executed, you have to call
  1101. * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
  1102. *
  1103. * When `app.relaunch` is called for multiple times, multiple instances will be
  1104. * started after current instance exited.
  1105. *
  1106. * An example of restarting current instance immediately and adding a new command
  1107. * line argument to the new instance:
  1108. */
  1109. relaunch(options?: RelaunchOptions): void;
  1110. /**
  1111. * Releases all locks that were created by `requestSingleInstanceLock`. This will
  1112. * allow multiple instances of the application to once again run side by side.
  1113. */
  1114. releaseSingleInstanceLock(): void;
  1115. /**
  1116. * Whether the call succeeded.
  1117. *
  1118. * This method checks if the current executable as the default handler for a
  1119. * protocol (aka URI scheme). If so, it will remove the app as the default handler.
  1120. *
  1121. * @platform darwin,win32
  1122. */
  1123. removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1124. /**
  1125. * * `additionalData` unknown (optional) - A JSON object containing additional data
  1126. * to send to the first instance.
  1127. *
  1128. *
  1129. * The return value of this method indicates whether or not this instance of your
  1130. * application successfully obtained the lock. If it failed to obtain the lock,
  1131. * you can assume that another instance of your application is already running with
  1132. * the lock and exit immediately.
  1133. *
  1134. * I.e. This method returns `true` if your process is the primary instance of your
  1135. * application and your app should continue loading. It returns `false` if your
  1136. * process should immediately quit as it has sent its parameters to another
  1137. * instance that has already acquired the lock.
  1138. *
  1139. * On macOS, the system enforces single instance automatically when users try to
  1140. * open a second instance of your app in Finder, and the `open-file` and `open-url`
  1141. * events will be emitted for that. However when users start your app in command
  1142. * line, the system's single instance mechanism will be bypassed, and you have to
  1143. * use this method to ensure single instance.
  1144. *
  1145. * An example of activating the window of primary instance when a second instance
  1146. * starts:
  1147. */
  1148. requestSingleInstanceLock(): boolean;
  1149. /**
  1150. * Marks the current Handoff user activity as inactive without invalidating it.
  1151. *
  1152. * @platform darwin
  1153. */
  1154. resignCurrentActivity(): void;
  1155. /**
  1156. * Set the about panel options. This will override the values defined in the app's
  1157. * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
  1158. * must be set in order to be shown; there are no defaults.
  1159. *
  1160. * If you do not set `credits` but still wish to surface them in your app, AppKit
  1161. * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
  1162. * that order, in the bundle returned by the NSBundle class method main. The first
  1163. * file found is used, and if none is found, the info area is left blank. See Apple
  1164. * documentation for more information.
  1165. */
  1166. setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
  1167. /**
  1168. * Manually enables Chrome's accessibility support, allowing to expose
  1169. * accessibility switch to users in application settings. See Chromium's
  1170. * accessibility docs for more details. Disabled by default.
  1171. *
  1172. * This API must be called after the `ready` event is emitted.
  1173. *
  1174. * **Note:** Rendering accessibility tree can significantly affect the performance
  1175. * of your app. It should not be enabled by default.
  1176. *
  1177. * @platform darwin,win32
  1178. */
  1179. setAccessibilitySupportEnabled(enabled: boolean): void;
  1180. /**
  1181. * Sets the activation policy for a given app.
  1182. *
  1183. * Activation policy types:
  1184. *
  1185. * * 'regular' - The application is an ordinary app that appears in the Dock and
  1186. * may have a user interface.
  1187. * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
  1188. * menu bar, but it may be activated programmatically or by clicking on one of its
  1189. * windows.
  1190. * * 'prohibited' - The application doesn’t appear in the Dock and may not create
  1191. * windows or be activated.
  1192. *
  1193. * @platform darwin
  1194. */
  1195. setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
  1196. /**
  1197. * Sets or creates a directory your app's logs which can then be manipulated with
  1198. * `app.getPath()` or `app.setPath(pathName, newPath)`.
  1199. *
  1200. * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
  1201. * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
  1202. * `userData` directory on _Linux_ and _Windows_.
  1203. */
  1204. setAppLogsPath(path?: string): void;
  1205. /**
  1206. * Changes the Application User Model ID to `id`.
  1207. *
  1208. * @platform win32
  1209. */
  1210. setAppUserModelId(id: string): void;
  1211. /**
  1212. * Whether the call succeeded.
  1213. *
  1214. * Sets the current executable as the default handler for a protocol (aka URI
  1215. * scheme). It allows you to integrate your app deeper into the operating system.
  1216. * Once registered, all links with `your-protocol://` will be opened with the
  1217. * current executable. The whole link, including protocol, will be passed to your
  1218. * application as a parameter.
  1219. *
  1220. * **Note:** On macOS, you can only register protocols that have been added to your
  1221. * app's `info.plist`, which cannot be modified at runtime. However, you can change
  1222. * the file during build time via Electron Forge, Electron Packager, or by editing
  1223. * `info.plist` with a text editor. Please refer to Apple's documentation for
  1224. * details.
  1225. *
  1226. * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
  1227. * will return `true` for all calls but the registry key it sets won't be
  1228. * accessible by other applications. In order to register your Windows Store
  1229. * application as a default protocol handler you must declare the protocol in your
  1230. * manifest.
  1231. *
  1232. * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
  1233. * internally.
  1234. */
  1235. setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1236. /**
  1237. * Whether the call succeeded.
  1238. *
  1239. * Sets the counter badge for current app. Setting the count to `0` will hide the
  1240. * badge.
  1241. *
  1242. * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
  1243. *
  1244. * **Note:** Unity launcher requires a `.desktop` file to work. For more
  1245. * information, please read the Unity integration documentation.
  1246. *
  1247. * @platform linux,darwin
  1248. */
  1249. setBadgeCount(count?: number): boolean;
  1250. /**
  1251. * Sets or removes a custom Jump List for the application, and returns one of the
  1252. * following strings:
  1253. *
  1254. * * `ok` - Nothing went wrong.
  1255. * * `error` - One or more errors occurred, enable runtime logging to figure out
  1256. * the likely cause.
  1257. * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
  1258. * category in the Jump List. Separators are only allowed in the standard `Tasks`
  1259. * category.
  1260. * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
  1261. * Jump List for a file type the app isn't registered to handle.
  1262. * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
  1263. * Jump List due to user privacy or group policy settings.
  1264. *
  1265. * If `categories` is `null` the previously set custom Jump List (if any) will be
  1266. * replaced by the standard Jump List for the app (managed by Windows).
  1267. *
  1268. * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
  1269. * property set then its `type` is assumed to be `tasks`. If the `name` property is
  1270. * set but the `type` property is omitted then the `type` is assumed to be
  1271. * `custom`.
  1272. *
  1273. * **Note:** Users can remove items from custom categories, and Windows will not
  1274. * allow a removed item to be added back into a custom category until **after** the
  1275. * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
  1276. * removed item to a custom category earlier than that will result in the entire
  1277. * custom category being omitted from the Jump List. The list of removed items can
  1278. * be obtained using `app.getJumpListSettings()`.
  1279. *
  1280. * **Note:** The maximum length of a Jump List item's `description` property is 260
  1281. * characters. Beyond this limit, the item will not be added to the Jump List, nor
  1282. * will it be displayed.
  1283. *
  1284. * Here's a very simple example of creating a custom Jump List:
  1285. *
  1286. * @platform win32
  1287. */
  1288. setJumpList(categories: (JumpListCategory[]) | (null)): void;
  1289. /**
  1290. * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
  1291. * want to set the launch path to Update.exe, and pass arguments that specify your
  1292. * application name. For example:
  1293. *
  1294. * @platform darwin,win32
  1295. */
  1296. setLoginItemSettings(settings: Settings): void;
  1297. /**
  1298. * Overrides the current application's name.
  1299. *
  1300. * **Note:** This function overrides the name used internally by Electron; it does
  1301. * not affect the name that the OS uses.
  1302. */
  1303. setName(name: string): void;
  1304. /**
  1305. * Overrides the `path` to a special directory or file associated with `name`. If
  1306. * the path specifies a directory that does not exist, an `Error` is thrown. In
  1307. * that case, the directory should be created with `fs.mkdirSync` or similar.
  1308. *
  1309. * You can only override paths of a `name` defined in `app.getPath`.
  1310. *
  1311. * By default, web pages' cookies and caches will be stored under the `userData`
  1312. * directory. If you want to change this location, you have to override the
  1313. * `userData` path before the `ready` event of the `app` module is emitted.
  1314. */
  1315. setPath(name: string, path: string): void;
  1316. /**
  1317. * Set the `Secure Keyboard Entry` is enabled in your application.
  1318. *
  1319. * By using this API, important information such as password and other sensitive
  1320. * information can be prevented from being intercepted by other processes.
  1321. *
  1322. * See Apple's documentation for more details.
  1323. *
  1324. * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
  1325. * when it is no longer needed.
  1326. *
  1327. * @platform darwin
  1328. */
  1329. setSecureKeyboardEntryEnabled(enabled: boolean): void;
  1330. /**
  1331. * Creates an `NSUserActivity` and sets it as the current activity. The activity is
  1332. * eligible for Handoff to another device afterward.
  1333. *
  1334. * @platform darwin
  1335. */
  1336. setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
  1337. /**
  1338. * Adds `tasks` to the Tasks category of the Jump List on Windows.
  1339. *
  1340. * `tasks` is an array of `Task` objects.
  1341. *
  1342. * Whether the call succeeded.
  1343. *
  1344. * **Note:** If you'd like to customize the Jump List even more use
  1345. * `app.setJumpList(categories)` instead.
  1346. *
  1347. * @platform win32
  1348. */
  1349. setUserTasks(tasks: Task[]): boolean;
  1350. /**
  1351. * Shows application windows after they were hidden. Does not automatically focus
  1352. * them.
  1353. *
  1354. * @platform darwin
  1355. */
  1356. show(): void;
  1357. /**
  1358. * Show the app's about panel options. These options can be overridden with
  1359. * `app.setAboutPanelOptions(options)`.
  1360. */
  1361. showAboutPanel(): void;
  1362. /**
  1363. * Show the platform's native emoji picker.
  1364. *
  1365. * @platform darwin,win32
  1366. */
  1367. showEmojiPanel(): void;
  1368. /**
  1369. * This function **must** be called once you have finished accessing the security
  1370. * scoped file. If you do not remember to stop accessing the bookmark, kernel
  1371. * resources will be leaked and your app will lose its ability to reach outside the
  1372. * sandbox completely, until your app is restarted.
  1373. *
  1374. * Start accessing a security scoped resource. With this method Electron
  1375. * applications that are packaged for the Mac App Store may reach outside their
  1376. * sandbox to access files chosen by the user. See Apple's documentation for a
  1377. * description of how this system works.
  1378. *
  1379. * @platform mas
  1380. */
  1381. startAccessingSecurityScopedResource(bookmarkData: string): Function;
  1382. /**
  1383. * Updates the current activity if its type matches `type`, merging the entries
  1384. * from `userInfo` into its current `userInfo` dictionary.
  1385. *
  1386. * @platform darwin
  1387. */
  1388. updateCurrentActivity(type: string, userInfo: any): void;
  1389. /**
  1390. * fulfilled when Electron is initialized. May be used as a convenient alternative
  1391. * to checking `app.isReady()` and subscribing to the `ready` event if the app is
  1392. * not ready yet.
  1393. */
  1394. whenReady(): Promise<void>;
  1395. /**
  1396. * A `Boolean` property that's `true` if Chrome's accessibility support is enabled,
  1397. * `false` otherwise. This property will be `true` if the use of assistive
  1398. * technologies, such as screen readers, has been detected. Setting this property
  1399. * to `true` manually enables Chrome's accessibility support, allowing developers
  1400. * to expose accessibility switch to users in application settings.
  1401. *
  1402. * See Chromium's accessibility docs for more details. Disabled by default.
  1403. *
  1404. * This API must be called after the `ready` event is emitted.
  1405. *
  1406. * **Note:** Rendering accessibility tree can significantly affect the performance
  1407. * of your app. It should not be enabled by default.
  1408. *
  1409. * @platform darwin,win32
  1410. */
  1411. accessibilitySupportEnabled: boolean;
  1412. /**
  1413. * A `Menu | null` property that returns `Menu` if one has been set and `null`
  1414. * otherwise. Users can pass a Menu to set this property.
  1415. */
  1416. applicationMenu: (Menu) | (null);
  1417. /**
  1418. * An `Integer` property that returns the badge count for current app. Setting the
  1419. * count to `0` will hide the badge.
  1420. *
  1421. * On macOS, setting this with any nonzero integer shows on the dock icon. On
  1422. * Linux, this property only works for Unity launcher.
  1423. *
  1424. * **Note:** Unity launcher requires a `.desktop` file to work. For more
  1425. * information, please read the Unity integration documentation.
  1426. *
  1427. * **Note:** On macOS, you need to ensure that your application has the permission
  1428. * to display notifications for this property to take effect.
  1429. *
  1430. * @platform linux,darwin
  1431. */
  1432. badgeCount: number;
  1433. /**
  1434. * A `CommandLine` object that allows you to read and manipulate the command line
  1435. * arguments that Chromium uses.
  1436. *
  1437. */
  1438. readonly commandLine: CommandLine;
  1439. /**
  1440. * A `Dock` `| undefined` object that allows you to perform actions on your app
  1441. * icon in the user's dock on macOS.
  1442. *
  1443. * @platform darwin
  1444. */
  1445. readonly dock: Dock;
  1446. /**
  1447. * A `Boolean` property that returns `true` if the app is packaged, `false`
  1448. * otherwise. For many apps, this property can be used to distinguish development
  1449. * and production environments.
  1450. *
  1451. */
  1452. readonly isPackaged: boolean;
  1453. /**
  1454. * A `String` property that indicates the current application's name, which is the
  1455. * name in the application's `package.json` file.
  1456. *
  1457. * Usually the `name` field of `package.json` is a short lowercase name, according
  1458. * to the npm modules spec. You should usually also specify a `productName` field,
  1459. * which is your application's full capitalized name, and which will be preferred
  1460. * over `name` by Electron.
  1461. */
  1462. name: string;
  1463. /**
  1464. * A `Boolean` which when `true` indicates that the app is currently running under
  1465. * an ARM64 translator (like the macOS Rosetta Translator Environment or Windows
  1466. * WOW).
  1467. *
  1468. * You can use this property to prompt users to download the arm64 version of your
  1469. * application when they are running the x64 version under Rosetta incorrectly.
  1470. *
  1471. * @platform darwin,win32
  1472. */
  1473. readonly runningUnderARM64Translation: boolean;
  1474. /**
  1475. * A `Boolean` which when `true` indicates that the app is currently running under
  1476. * the Rosetta Translator Environment.
  1477. *
  1478. * You can use this property to prompt users to download the arm64 version of your
  1479. * application when they are running the x64 version under Rosetta incorrectly.
  1480. *
  1481. * **Deprecated:** This property is superceded by the
  1482. * `runningUnderARM64Translation` property which detects when the app is being
  1483. * translated to ARM64 in both macOS and Windows.
  1484. *
  1485. * @deprecated
  1486. * @platform darwin
  1487. */
  1488. readonly runningUnderRosettaTranslation: boolean;
  1489. /**
  1490. * A `String` which is the user agent string Electron will use as a global
  1491. * fallback.
  1492. *
  1493. * This is the user agent that will be used when no user agent is set at the
  1494. * `webContents` or `session` level. It is useful for ensuring that your entire
  1495. * app has the same user agent. Set to a custom value as early as possible in your
  1496. * app's initialization to ensure that your overridden value is used.
  1497. */
  1498. userAgentFallback: string;
  1499. }
  1500. interface AutoUpdater extends NodeJS.EventEmitter {
  1501. // Docs: https://electronjs.org/docs/api/auto-updater
  1502. /**
  1503. * This event is emitted after a user calls `quitAndInstall()`.
  1504. *
  1505. * When this API is called, the `before-quit` event is not emitted before all
  1506. * windows are closed. As a result you should listen to this event if you wish to
  1507. * perform actions before the windows are closed while a process is quitting, as
  1508. * well as listening to `before-quit`.
  1509. */
  1510. on(event: 'before-quit-for-update', listener: Function): this;
  1511. once(event: 'before-quit-for-update', listener: Function): this;
  1512. addListener(event: 'before-quit-for-update', listener: Function): this;
  1513. removeListener(event: 'before-quit-for-update', listener: Function): this;
  1514. /**
  1515. * Emitted when checking if an update has started.
  1516. */
  1517. on(event: 'checking-for-update', listener: Function): this;
  1518. once(event: 'checking-for-update', listener: Function): this;
  1519. addListener(event: 'checking-for-update', listener: Function): this;
  1520. removeListener(event: 'checking-for-update', listener: Function): this;
  1521. /**
  1522. * Emitted when there is an error while updating.
  1523. */
  1524. on(event: 'error', listener: (error: Error) => void): this;
  1525. once(event: 'error', listener: (error: Error) => void): this;
  1526. addListener(event: 'error', listener: (error: Error) => void): this;
  1527. removeListener(event: 'error', listener: (error: Error) => void): this;
  1528. /**
  1529. * Emitted when there is an available update. The update is downloaded
  1530. * automatically.
  1531. */
  1532. on(event: 'update-available', listener: Function): this;
  1533. once(event: 'update-available', listener: Function): this;
  1534. addListener(event: 'update-available', listener: Function): this;
  1535. removeListener(event: 'update-available', listener: Function): this;
  1536. /**
  1537. * Emitted when an update has been downloaded.
  1538. *
  1539. * On Windows only `releaseName` is available.
  1540. *
  1541. * **Note:** It is not strictly necessary to handle this event. A successfully
  1542. * downloaded update will still be applied the next time the application starts.
  1543. */
  1544. on(event: 'update-downloaded', listener: (event: Event,
  1545. releaseNotes: string,
  1546. releaseName: string,
  1547. releaseDate: Date,
  1548. updateURL: string) => void): this;
  1549. once(event: 'update-downloaded', listener: (event: Event,
  1550. releaseNotes: string,
  1551. releaseName: string,
  1552. releaseDate: Date,
  1553. updateURL: string) => void): this;
  1554. addListener(event: 'update-downloaded', listener: (event: Event,
  1555. releaseNotes: string,
  1556. releaseName: string,
  1557. releaseDate: Date,
  1558. updateURL: string) => void): this;
  1559. removeListener(event: 'update-downloaded', listener: (event: Event,
  1560. releaseNotes: string,
  1561. releaseName: string,
  1562. releaseDate: Date,
  1563. updateURL: string) => void): this;
  1564. /**
  1565. * Emitted when there is no available update.
  1566. */
  1567. on(event: 'update-not-available', listener: Function): this;
  1568. once(event: 'update-not-available', listener: Function): this;
  1569. addListener(event: 'update-not-available', listener: Function): this;
  1570. removeListener(event: 'update-not-available', listener: Function): this;
  1571. /**
  1572. * Asks the server whether there is an update. You must call `setFeedURL` before
  1573. * using this API.
  1574. *
  1575. * **Note:** If an update is available it will be downloaded automatically. Calling
  1576. * `autoUpdater.checkForUpdates()` twice will download the update two times.
  1577. */
  1578. checkForUpdates(): void;
  1579. /**
  1580. * The current update feed URL.
  1581. */
  1582. getFeedURL(): string;
  1583. /**
  1584. * Restarts the app and installs the update after it has been downloaded. It should
  1585. * only be called after `update-downloaded` has been emitted.
  1586. *
  1587. * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
  1588. * windows first, and automatically call `app.quit()` after all windows have been
  1589. * closed.
  1590. *
  1591. * **Note:** It is not strictly necessary to call this function to apply an update,
  1592. * as a successfully downloaded update will always be applied the next time the
  1593. * application starts.
  1594. */
  1595. quitAndInstall(): void;
  1596. /**
  1597. * Sets the `url` and initialize the auto updater.
  1598. */
  1599. setFeedURL(options: FeedURLOptions): void;
  1600. }
  1601. interface BluetoothDevice {
  1602. // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
  1603. deviceId: string;
  1604. deviceName: string;
  1605. }
  1606. class BrowserView {
  1607. // Docs: https://electronjs.org/docs/api/browser-view
  1608. /**
  1609. * BrowserView
  1610. */
  1611. constructor(options?: BrowserViewConstructorOptions);
  1612. /**
  1613. * The `bounds` of this BrowserView instance as `Object`.
  1614. *
  1615. * @experimental
  1616. */
  1617. getBounds(): Rectangle;
  1618. setAutoResize(options: AutoResizeOptions): void;
  1619. setBackgroundColor(color: string): void;
  1620. /**
  1621. * Resizes and moves the view to the supplied bounds relative to the window.
  1622. *
  1623. * @experimental
  1624. */
  1625. setBounds(bounds: Rectangle): void;
  1626. /**
  1627. * A `WebContents` object owned by this view.
  1628. *
  1629. * @experimental
  1630. */
  1631. webContents: WebContents;
  1632. }
  1633. class BrowserWindow extends NodeEventEmitter {
  1634. // Docs: https://electronjs.org/docs/api/browser-window
  1635. /**
  1636. * Emitted when the window is set or unset to show always on top of other windows.
  1637. */
  1638. on(event: 'always-on-top-changed', listener: (event: Event,
  1639. isAlwaysOnTop: boolean) => void): this;
  1640. once(event: 'always-on-top-changed', listener: (event: Event,
  1641. isAlwaysOnTop: boolean) => void): this;
  1642. addListener(event: 'always-on-top-changed', listener: (event: Event,
  1643. isAlwaysOnTop: boolean) => void): this;
  1644. removeListener(event: 'always-on-top-changed', listener: (event: Event,
  1645. isAlwaysOnTop: boolean) => void): this;
  1646. /**
  1647. * Emitted when an App Command is invoked. These are typically related to keyboard
  1648. * media keys or browser commands, as well as the "Back" button built into some
  1649. * mice on Windows.
  1650. *
  1651. * Commands are lowercased, underscores are replaced with hyphens, and the
  1652. * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
  1653. * emitted as `browser-backward`.
  1654. *
  1655. * The following app commands are explicitly supported on Linux:
  1656. *
  1657. * * `browser-backward`
  1658. * * `browser-forward`
  1659. *
  1660. * @platform win32,linux
  1661. */
  1662. on(event: 'app-command', listener: (event: Event,
  1663. command: string) => void): this;
  1664. once(event: 'app-command', listener: (event: Event,
  1665. command: string) => void): this;
  1666. addListener(event: 'app-command', listener: (event: Event,
  1667. command: string) => void): this;
  1668. removeListener(event: 'app-command', listener: (event: Event,
  1669. command: string) => void): this;
  1670. /**
  1671. * Emitted when the window loses focus.
  1672. */
  1673. on(event: 'blur', listener: Function): this;
  1674. once(event: 'blur', listener: Function): this;
  1675. addListener(event: 'blur', listener: Function): this;
  1676. removeListener(event: 'blur', listener: Function): this;
  1677. /**
  1678. * Emitted when the window is going to be closed. It's emitted before the
  1679. * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
  1680. * will cancel the close.
  1681. *
  1682. * Usually you would want to use the `beforeunload` handler to decide whether the
  1683. * window should be closed, which will also be called when the window is reloaded.
  1684. * In Electron, returning any value other than `undefined` would cancel the close.
  1685. * For example:
  1686. *
  1687. * _**Note**: There is a subtle difference between the behaviors of
  1688. * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
  1689. * handler)`. It is recommended to always set the `event.returnValue` explicitly,
  1690. * instead of only returning a value, as the former works more consistently within
  1691. * Electron._
  1692. */
  1693. on(event: 'close', listener: (event: Event) => void): this;
  1694. once(event: 'close', listener: (event: Event) => void): this;
  1695. addListener(event: 'close', listener: (event: Event) => void): this;
  1696. removeListener(event: 'close', listener: (event: Event) => void): this;
  1697. /**
  1698. * Emitted when the window is closed. After you have received this event you should
  1699. * remove the reference to the window and avoid using it any more.
  1700. */
  1701. on(event: 'closed', listener: Function): this;
  1702. once(event: 'closed', listener: Function): this;
  1703. addListener(event: 'closed', listener: Function): this;
  1704. removeListener(event: 'closed', listener: Function): this;
  1705. /**
  1706. * Emitted when the window enters a full-screen state.
  1707. */
  1708. on(event: 'enter-full-screen', listener: Function): this;
  1709. once(event: 'enter-full-screen', listener: Function): this;
  1710. addListener(event: 'enter-full-screen', listener: Function): this;
  1711. removeListener(event: 'enter-full-screen', listener: Function): this;
  1712. /**
  1713. * Emitted when the window enters a full-screen state triggered by HTML API.
  1714. */
  1715. on(event: 'enter-html-full-screen', listener: Function): this;
  1716. once(event: 'enter-html-full-screen', listener: Function): this;
  1717. addListener(event: 'enter-html-full-screen', listener: Function): this;
  1718. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  1719. /**
  1720. * Emitted when the window gains focus.
  1721. */
  1722. on(event: 'focus', listener: Function): this;
  1723. once(event: 'focus', listener: Function): this;
  1724. addListener(event: 'focus', listener: Function): this;
  1725. removeListener(event: 'focus', listener: Function): this;
  1726. /**
  1727. * Emitted when the window is hidden.
  1728. */
  1729. on(event: 'hide', listener: Function): this;
  1730. once(event: 'hide', listener: Function): this;
  1731. addListener(event: 'hide', listener: Function): this;
  1732. removeListener(event: 'hide', listener: Function): this;
  1733. /**
  1734. * Emitted when the window leaves a full-screen state.
  1735. */
  1736. on(event: 'leave-full-screen', listener: Function): this;
  1737. once(event: 'leave-full-screen', listener: Function): this;
  1738. addListener(event: 'leave-full-screen', listener: Function): this;
  1739. removeListener(event: 'leave-full-screen', listener: Function): this;
  1740. /**
  1741. * Emitted when the window leaves a full-screen state triggered by HTML API.
  1742. */
  1743. on(event: 'leave-html-full-screen', listener: Function): this;
  1744. once(event: 'leave-html-full-screen', listener: Function): this;
  1745. addListener(event: 'leave-html-full-screen', listener: Function): this;
  1746. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  1747. /**
  1748. * Emitted when window is maximized.
  1749. */
  1750. on(event: 'maximize', listener: Function): this;
  1751. once(event: 'maximize', listener: Function): this;
  1752. addListener(event: 'maximize', listener: Function): this;
  1753. removeListener(event: 'maximize', listener: Function): this;
  1754. /**
  1755. * Emitted when the window is minimized.
  1756. */
  1757. on(event: 'minimize', listener: Function): this;
  1758. once(event: 'minimize', listener: Function): this;
  1759. addListener(event: 'minimize', listener: Function): this;
  1760. removeListener(event: 'minimize', listener: Function): this;
  1761. /**
  1762. * Emitted when the window is being moved to a new position.
  1763. */
  1764. on(event: 'move', listener: Function): this;
  1765. once(event: 'move', listener: Function): this;
  1766. addListener(event: 'move', listener: Function): this;
  1767. removeListener(event: 'move', listener: Function): this;
  1768. /**
  1769. * Emitted once when the window is moved to a new position.
  1770. *
  1771. * __Note__: On macOS this event is an alias of `move`.
  1772. *
  1773. * @platform darwin,win32
  1774. */
  1775. on(event: 'moved', listener: Function): this;
  1776. once(event: 'moved', listener: Function): this;
  1777. addListener(event: 'moved', listener: Function): this;
  1778. removeListener(event: 'moved', listener: Function): this;
  1779. /**
  1780. * Emitted when the native new tab button is clicked.
  1781. *
  1782. * @platform darwin
  1783. */
  1784. on(event: 'new-window-for-tab', listener: Function): this;
  1785. once(event: 'new-window-for-tab', listener: Function): this;
  1786. addListener(event: 'new-window-for-tab', listener: Function): this;
  1787. removeListener(event: 'new-window-for-tab', listener: Function): this;
  1788. /**
  1789. * Emitted when the document changed its title, calling `event.preventDefault()`
  1790. * will prevent the native window's title from changing. `explicitSet` is false
  1791. * when title is synthesized from file URL.
  1792. */
  1793. on(event: 'page-title-updated', listener: (event: Event,
  1794. title: string,
  1795. explicitSet: boolean) => void): this;
  1796. once(event: 'page-title-updated', listener: (event: Event,
  1797. title: string,
  1798. explicitSet: boolean) => void): this;
  1799. addListener(event: 'page-title-updated', listener: (event: Event,
  1800. title: string,
  1801. explicitSet: boolean) => void): this;
  1802. removeListener(event: 'page-title-updated', listener: (event: Event,
  1803. title: string,
  1804. explicitSet: boolean) => void): this;
  1805. /**
  1806. * Emitted when the web page has been rendered (while not being shown) and window
  1807. * can be displayed without a visual flash.
  1808. *
  1809. * Please note that using this event implies that the renderer will be considered
  1810. * "visible" and paint even though `show` is false. This event will never fire if
  1811. * you use `paintWhenInitiallyHidden: false`
  1812. */
  1813. on(event: 'ready-to-show', listener: Function): this;
  1814. once(event: 'ready-to-show', listener: Function): this;
  1815. addListener(event: 'ready-to-show', listener: Function): this;
  1816. removeListener(event: 'ready-to-show', listener: Function): this;
  1817. /**
  1818. * Emitted after the window has been resized.
  1819. */
  1820. on(event: 'resize', listener: Function): this;
  1821. once(event: 'resize', listener: Function): this;
  1822. addListener(event: 'resize', listener: Function): this;
  1823. removeListener(event: 'resize', listener: Function): this;
  1824. /**
  1825. * Emitted once when the window has finished being resized.
  1826. *
  1827. * This is usually emitted when the window has been resized manually. On macOS,
  1828. * resizing the window with `setBounds`/`setSize` and setting the `animate`
  1829. * parameter to `true` will also emit this event once resizing has finished.
  1830. *
  1831. * @platform darwin,win32
  1832. */
  1833. on(event: 'resized', listener: Function): this;
  1834. once(event: 'resized', listener: Function): this;
  1835. addListener(event: 'resized', listener: Function): this;
  1836. removeListener(event: 'resized', listener: Function): this;
  1837. /**
  1838. * Emitted when the unresponsive web page becomes responsive again.
  1839. */
  1840. on(event: 'responsive', listener: Function): this;
  1841. once(event: 'responsive', listener: Function): this;
  1842. addListener(event: 'responsive', listener: Function): this;
  1843. removeListener(event: 'responsive', listener: Function): this;
  1844. /**
  1845. * Emitted when the window is restored from a minimized state.
  1846. */
  1847. on(event: 'restore', listener: Function): this;
  1848. once(event: 'restore', listener: Function): this;
  1849. addListener(event: 'restore', listener: Function): this;
  1850. removeListener(event: 'restore', listener: Function): this;
  1851. /**
  1852. * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
  1853. * is ended. The `rotation` value on each emission is the angle in degrees rotated
  1854. * since the last emission. The last emitted event upon a rotation gesture will
  1855. * always be of value `0`. Counter-clockwise rotation values are positive, while
  1856. * clockwise ones are negative.
  1857. *
  1858. * @platform darwin
  1859. */
  1860. on(event: 'rotate-gesture', listener: (event: Event,
  1861. rotation: number) => void): this;
  1862. once(event: 'rotate-gesture', listener: (event: Event,
  1863. rotation: number) => void): this;
  1864. addListener(event: 'rotate-gesture', listener: (event: Event,
  1865. rotation: number) => void): this;
  1866. removeListener(event: 'rotate-gesture', listener: (event: Event,
  1867. rotation: number) => void): this;
  1868. /**
  1869. * Emitted when scroll wheel event phase has begun.
  1870. *
  1871. * @platform darwin
  1872. */
  1873. on(event: 'scroll-touch-begin', listener: Function): this;
  1874. once(event: 'scroll-touch-begin', listener: Function): this;
  1875. addListener(event: 'scroll-touch-begin', listener: Function): this;
  1876. removeListener(event: 'scroll-touch-begin', listener: Function): this;
  1877. /**
  1878. * Emitted when scroll wheel event phase filed upon reaching the edge of element.
  1879. *
  1880. * @platform darwin
  1881. */
  1882. on(event: 'scroll-touch-edge', listener: Function): this;
  1883. once(event: 'scroll-touch-edge', listener: Function): this;
  1884. addListener(event: 'scroll-touch-edge', listener: Function): this;
  1885. removeListener(event: 'scroll-touch-edge', listener: Function): this;
  1886. /**
  1887. * Emitted when scroll wheel event phase has ended.
  1888. *
  1889. * @platform darwin
  1890. */
  1891. on(event: 'scroll-touch-end', listener: Function): this;
  1892. once(event: 'scroll-touch-end', listener: Function): this;
  1893. addListener(event: 'scroll-touch-end', listener: Function): this;
  1894. removeListener(event: 'scroll-touch-end', listener: Function): this;
  1895. /**
  1896. * Emitted when window session is going to end due to force shutdown or machine
  1897. * restart or session log off.
  1898. *
  1899. * @platform win32
  1900. */
  1901. on(event: 'session-end', listener: Function): this;
  1902. once(event: 'session-end', listener: Function): this;
  1903. addListener(event: 'session-end', listener: Function): this;
  1904. removeListener(event: 'session-end', listener: Function): this;
  1905. /**
  1906. * Emitted when the window opens a sheet.
  1907. *
  1908. * @platform darwin
  1909. */
  1910. on(event: 'sheet-begin', listener: Function): this;
  1911. once(event: 'sheet-begin', listener: Function): this;
  1912. addListener(event: 'sheet-begin', listener: Function): this;
  1913. removeListener(event: 'sheet-begin', listener: Function): this;
  1914. /**
  1915. * Emitted when the window has closed a sheet.
  1916. *
  1917. * @platform darwin
  1918. */
  1919. on(event: 'sheet-end', listener: Function): this;
  1920. once(event: 'sheet-end', listener: Function): this;
  1921. addListener(event: 'sheet-end', listener: Function): this;
  1922. removeListener(event: 'sheet-end', listener: Function): this;
  1923. /**
  1924. * Emitted when the window is shown.
  1925. */
  1926. on(event: 'show', listener: Function): this;
  1927. once(event: 'show', listener: Function): this;
  1928. addListener(event: 'show', listener: Function): this;
  1929. removeListener(event: 'show', listener: Function): this;
  1930. /**
  1931. * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
  1932. * `left`.
  1933. *
  1934. * The method underlying this event is built to handle older macOS-style trackpad
  1935. * swiping, where the content on the screen doesn't move with the swipe. Most macOS
  1936. * trackpads are not configured to allow this kind of swiping anymore, so in order
  1937. * for it to emit properly the 'Swipe between pages' preference in `System
  1938. * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
  1939. * fingers'.
  1940. *
  1941. * @platform darwin
  1942. */
  1943. on(event: 'swipe', listener: (event: Event,
  1944. direction: string) => void): this;
  1945. once(event: 'swipe', listener: (event: Event,
  1946. direction: string) => void): this;
  1947. addListener(event: 'swipe', listener: (event: Event,
  1948. direction: string) => void): this;
  1949. removeListener(event: 'swipe', listener: (event: Event,
  1950. direction: string) => void): this;
  1951. /**
  1952. * Emitted when the system context menu is triggered on the window, this is
  1953. * normally only triggered when the user right clicks on the non-client area of
  1954. * your window. This is the window titlebar or any area you have declared as
  1955. * `-webkit-app-region: drag` in a frameless window.
  1956. *
  1957. * Calling `event.preventDefault()` will prevent the menu from being displayed.
  1958. *
  1959. * @platform win32
  1960. */
  1961. on(event: 'system-context-menu', listener: (event: Event,
  1962. /**
  1963. * The screen coordinates the context menu was triggered at
  1964. */
  1965. point: Point) => void): this;
  1966. once(event: 'system-context-menu', listener: (event: Event,
  1967. /**
  1968. * The screen coordinates the context menu was triggered at
  1969. */
  1970. point: Point) => void): this;
  1971. addListener(event: 'system-context-menu', listener: (event: Event,
  1972. /**
  1973. * The screen coordinates the context menu was triggered at
  1974. */
  1975. point: Point) => void): this;
  1976. removeListener(event: 'system-context-menu', listener: (event: Event,
  1977. /**
  1978. * The screen coordinates the context menu was triggered at
  1979. */
  1980. point: Point) => void): this;
  1981. /**
  1982. * Emitted when the window exits from a maximized state.
  1983. */
  1984. on(event: 'unmaximize', listener: Function): this;
  1985. once(event: 'unmaximize', listener: Function): this;
  1986. addListener(event: 'unmaximize', listener: Function): this;
  1987. removeListener(event: 'unmaximize', listener: Function): this;
  1988. /**
  1989. * Emitted when the web page becomes unresponsive.
  1990. */
  1991. on(event: 'unresponsive', listener: Function): this;
  1992. once(event: 'unresponsive', listener: Function): this;
  1993. addListener(event: 'unresponsive', listener: Function): this;
  1994. removeListener(event: 'unresponsive', listener: Function): this;
  1995. /**
  1996. * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
  1997. * will prevent the window from being moved.
  1998. *
  1999. * Note that this is only emitted when the window is being resized manually.
  2000. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2001. *
  2002. * @platform darwin,win32
  2003. */
  2004. on(event: 'will-move', listener: (event: Event,
  2005. /**
  2006. * Location the window is being moved to.
  2007. */
  2008. newBounds: Rectangle) => void): this;
  2009. once(event: 'will-move', listener: (event: Event,
  2010. /**
  2011. * Location the window is being moved to.
  2012. */
  2013. newBounds: Rectangle) => void): this;
  2014. addListener(event: 'will-move', listener: (event: Event,
  2015. /**
  2016. * Location the window is being moved to.
  2017. */
  2018. newBounds: Rectangle) => void): this;
  2019. removeListener(event: 'will-move', listener: (event: Event,
  2020. /**
  2021. * Location the window is being moved to.
  2022. */
  2023. newBounds: Rectangle) => void): this;
  2024. /**
  2025. * Emitted before the window is resized. Calling `event.preventDefault()` will
  2026. * prevent the window from being resized.
  2027. *
  2028. * Note that this is only emitted when the window is being resized manually.
  2029. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2030. *
  2031. * The possible values and behaviors of the `edge` option are platform dependent.
  2032. * Possible values are:
  2033. *
  2034. * * On Windows, possible values are `bottom`, `top`, `left`, `right`, `top-left`,
  2035. * `top-right`, `bottom-left`, `bottom-right`.
  2036. * * On macOS, possible values are `bottom` and `right`.
  2037. * * The value `bottom` is used to denote vertical resizing.
  2038. * * The value `right` is used to denote horizontal resizing.
  2039. *
  2040. * @platform darwin,win32
  2041. */
  2042. on(event: 'will-resize', listener: (event: Event,
  2043. /**
  2044. * Size the window is being resized to.
  2045. */
  2046. newBounds: Rectangle,
  2047. details: WillResizeDetails) => void): this;
  2048. once(event: 'will-resize', listener: (event: Event,
  2049. /**
  2050. * Size the window is being resized to.
  2051. */
  2052. newBounds: Rectangle,
  2053. details: WillResizeDetails) => void): this;
  2054. addListener(event: 'will-resize', listener: (event: Event,
  2055. /**
  2056. * Size the window is being resized to.
  2057. */
  2058. newBounds: Rectangle,
  2059. details: WillResizeDetails) => void): this;
  2060. removeListener(event: 'will-resize', listener: (event: Event,
  2061. /**
  2062. * Size the window is being resized to.
  2063. */
  2064. newBounds: Rectangle,
  2065. details: WillResizeDetails) => void): this;
  2066. /**
  2067. * BrowserWindow
  2068. */
  2069. constructor(options?: BrowserWindowConstructorOptions);
  2070. /**
  2071. * The window that owns the given `browserView`. If the given view is not attached
  2072. * to any window, returns `null`.
  2073. */
  2074. static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
  2075. /**
  2076. * The window with the given `id`.
  2077. */
  2078. static fromId(id: number): (BrowserWindow) | (null);
  2079. /**
  2080. * The window that owns the given `webContents` or `null` if the contents are not
  2081. * owned by a window.
  2082. */
  2083. static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
  2084. /**
  2085. * An array of all opened browser windows.
  2086. */
  2087. static getAllWindows(): BrowserWindow[];
  2088. /**
  2089. * The window that is focused in this application, otherwise returns `null`.
  2090. */
  2091. static getFocusedWindow(): (BrowserWindow) | (null);
  2092. /**
  2093. * Replacement API for setBrowserView supporting work with multi browser views.
  2094. *
  2095. * @experimental
  2096. */
  2097. addBrowserView(browserView: BrowserView): void;
  2098. /**
  2099. * Adds a window as a tab on this window, after the tab for the window instance.
  2100. *
  2101. * @platform darwin
  2102. */
  2103. addTabbedWindow(browserWindow: BrowserWindow): void;
  2104. /**
  2105. * Removes focus from the window.
  2106. */
  2107. blur(): void;
  2108. blurWebView(): void;
  2109. /**
  2110. * Resolves with a NativeImage
  2111. *
  2112. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  2113. * whole visible page. If the page is not visible, `rect` may be empty.
  2114. */
  2115. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  2116. /**
  2117. * Moves window to the center of the screen.
  2118. */
  2119. center(): void;
  2120. /**
  2121. * Try to close the window. This has the same effect as a user manually clicking
  2122. * the close button of the window. The web page may cancel the close though. See
  2123. * the close event.
  2124. */
  2125. close(): void;
  2126. /**
  2127. * Closes the currently open Quick Look panel.
  2128. *
  2129. * @platform darwin
  2130. */
  2131. closeFilePreview(): void;
  2132. /**
  2133. * Force closing the window, the `unload` and `beforeunload` event won't be emitted
  2134. * for the web page, and `close` event will also not be emitted for this window,
  2135. * but it guarantees the `closed` event will be emitted.
  2136. */
  2137. destroy(): void;
  2138. /**
  2139. * Starts or stops flashing the window to attract user's attention.
  2140. */
  2141. flashFrame(flag: boolean): void;
  2142. /**
  2143. * Focuses on the window.
  2144. */
  2145. focus(): void;
  2146. focusOnWebView(): void;
  2147. /**
  2148. * Gets the background color of the window. See Setting `backgroundColor`.
  2149. */
  2150. getBackgroundColor(): string;
  2151. /**
  2152. * The `bounds` of the window as `Object`.
  2153. */
  2154. getBounds(): Rectangle;
  2155. /**
  2156. * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
  2157. * Throws an error if multiple `BrowserView`s are attached.
  2158. *
  2159. * @experimental
  2160. */
  2161. getBrowserView(): (BrowserView) | (null);
  2162. /**
  2163. * an array of all BrowserViews that have been attached with `addBrowserView` or
  2164. * `setBrowserView`.
  2165. *
  2166. * **Note:** The BrowserView API is currently experimental and may change or be
  2167. * removed in future Electron releases.
  2168. *
  2169. * @experimental
  2170. */
  2171. getBrowserViews(): BrowserView[];
  2172. /**
  2173. * All child windows.
  2174. */
  2175. getChildWindows(): BrowserWindow[];
  2176. /**
  2177. * The `bounds` of the window's client area as `Object`.
  2178. */
  2179. getContentBounds(): Rectangle;
  2180. /**
  2181. * Contains the window's client area's width and height.
  2182. */
  2183. getContentSize(): number[];
  2184. /**
  2185. * Contains the window's maximum width and height.
  2186. */
  2187. getMaximumSize(): number[];
  2188. /**
  2189. * Window id in the format of DesktopCapturerSource's id. For example
  2190. * "window:1324:0".
  2191. *
  2192. * More precisely the format is `window:id:other_id` where `id` is `HWND` on
  2193. * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
  2194. * Linux. `other_id` is used to identify web contents (tabs) so within the same top
  2195. * level window.
  2196. */
  2197. getMediaSourceId(): string;
  2198. /**
  2199. * Contains the window's minimum width and height.
  2200. */
  2201. getMinimumSize(): number[];
  2202. /**
  2203. * The platform-specific handle of the window.
  2204. *
  2205. * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
  2206. * `Window` (`unsigned long`) on Linux.
  2207. */
  2208. getNativeWindowHandle(): Buffer;
  2209. /**
  2210. * Contains the window bounds of the normal state
  2211. *
  2212. * **Note:** whatever the current state of the window : maximized, minimized or in
  2213. * fullscreen, this function always returns the position and size of the window in
  2214. * normal state. In normal state, getBounds and getNormalBounds returns the same
  2215. * `Rectangle`.
  2216. */
  2217. getNormalBounds(): Rectangle;
  2218. /**
  2219. * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
  2220. * 1.
  2221. */
  2222. getOpacity(): number;
  2223. /**
  2224. * The parent window or `null` if there is no parent.
  2225. */
  2226. getParentWindow(): (BrowserWindow) | (null);
  2227. /**
  2228. * Contains the window's current position.
  2229. */
  2230. getPosition(): number[];
  2231. /**
  2232. * The pathname of the file the window represents.
  2233. *
  2234. * @platform darwin
  2235. */
  2236. getRepresentedFilename(): string;
  2237. /**
  2238. * Contains the window's width and height.
  2239. */
  2240. getSize(): number[];
  2241. /**
  2242. * The title of the native window.
  2243. *
  2244. * **Note:** The title of the web page can be different from the title of the
  2245. * native window.
  2246. */
  2247. getTitle(): string;
  2248. /**
  2249. * The custom position for the traffic light buttons in frameless window.
  2250. *
  2251. * @platform darwin
  2252. */
  2253. getTrafficLightPosition(): Point;
  2254. /**
  2255. * Whether the window has a shadow.
  2256. */
  2257. hasShadow(): boolean;
  2258. /**
  2259. * Hides the window.
  2260. */
  2261. hide(): void;
  2262. /**
  2263. * Hooks a windows message. The `callback` is called when the message is received
  2264. * in the WndProc.
  2265. *
  2266. * @platform win32
  2267. */
  2268. hookWindowMessage(message: number, callback: (wParam: any, lParam: any) => void): void;
  2269. /**
  2270. * Whether the window is always on top of other windows.
  2271. */
  2272. isAlwaysOnTop(): boolean;
  2273. /**
  2274. * Whether the window can be manually closed by user.
  2275. *
  2276. * On Linux always returns `true`.
  2277. *
  2278. * @platform darwin,win32
  2279. */
  2280. isClosable(): boolean;
  2281. /**
  2282. * Whether the window is destroyed.
  2283. */
  2284. isDestroyed(): boolean;
  2285. /**
  2286. * Whether the window's document has been edited.
  2287. *
  2288. * @platform darwin
  2289. */
  2290. isDocumentEdited(): boolean;
  2291. /**
  2292. * whether the window is enabled.
  2293. */
  2294. isEnabled(): boolean;
  2295. /**
  2296. * Returns whether the window can be focused.
  2297. *
  2298. * @platform darwin,win32
  2299. */
  2300. isFocusable(): void;
  2301. /**
  2302. * Whether the window is focused.
  2303. */
  2304. isFocused(): boolean;
  2305. /**
  2306. * Whether the window is in fullscreen mode.
  2307. */
  2308. isFullScreen(): boolean;
  2309. /**
  2310. * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
  2311. * window.
  2312. */
  2313. isFullScreenable(): boolean;
  2314. /**
  2315. * Whether the window is in kiosk mode.
  2316. */
  2317. isKiosk(): boolean;
  2318. /**
  2319. * Whether the window can be manually maximized by user.
  2320. *
  2321. * On Linux always returns `true`.
  2322. *
  2323. * @platform darwin,win32
  2324. */
  2325. isMaximizable(): boolean;
  2326. /**
  2327. * Whether the window is maximized.
  2328. */
  2329. isMaximized(): boolean;
  2330. /**
  2331. * Whether menu bar automatically hides itself.
  2332. */
  2333. isMenuBarAutoHide(): boolean;
  2334. /**
  2335. * Whether the menu bar is visible.
  2336. */
  2337. isMenuBarVisible(): boolean;
  2338. /**
  2339. * Whether the window can be manually minimized by the user.
  2340. *
  2341. * On Linux always returns `true`.
  2342. *
  2343. * @platform darwin,win32
  2344. */
  2345. isMinimizable(): boolean;
  2346. /**
  2347. * Whether the window is minimized.
  2348. */
  2349. isMinimized(): boolean;
  2350. /**
  2351. * Whether current window is a modal window.
  2352. */
  2353. isModal(): boolean;
  2354. /**
  2355. * Whether the window can be moved by user.
  2356. *
  2357. * On Linux always returns `true`.
  2358. *
  2359. * @platform darwin,win32
  2360. */
  2361. isMovable(): boolean;
  2362. /**
  2363. * Whether the window is in normal state (not maximized, not minimized, not in
  2364. * fullscreen mode).
  2365. */
  2366. isNormal(): boolean;
  2367. /**
  2368. * Whether the window can be manually resized by the user.
  2369. */
  2370. isResizable(): boolean;
  2371. /**
  2372. * Whether the window is in simple (pre-Lion) fullscreen mode.
  2373. *
  2374. * @platform darwin
  2375. */
  2376. isSimpleFullScreen(): boolean;
  2377. /**
  2378. * Whether the window is in Windows 10 tablet mode.
  2379. *
  2380. * Since Windows 10 users can use their PC as tablet, under this mode apps can
  2381. * choose to optimize their UI for tablets, such as enlarging the titlebar and
  2382. * hiding titlebar buttons.
  2383. *
  2384. * This API returns whether the window is in tablet mode, and the `resize` event
  2385. * can be be used to listen to changes to tablet mode.
  2386. *
  2387. * @platform win32
  2388. */
  2389. isTabletMode(): boolean;
  2390. /**
  2391. * Whether the window is visible to the user.
  2392. */
  2393. isVisible(): boolean;
  2394. /**
  2395. * Whether the window is visible on all workspaces.
  2396. *
  2397. * **Note:** This API always returns false on Windows.
  2398. */
  2399. isVisibleOnAllWorkspaces(): boolean;
  2400. /**
  2401. * `true` or `false` depending on whether the message is hooked.
  2402. *
  2403. * @platform win32
  2404. */
  2405. isWindowMessageHooked(message: number): boolean;
  2406. /**
  2407. * the promise will resolve when the page has finished loading (see
  2408. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  2409. *
  2410. * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
  2411. * relative to the root of your application. See the `webContents` docs for more
  2412. * information.
  2413. */
  2414. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  2415. /**
  2416. * the promise will resolve when the page has finished loading (see
  2417. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  2418. *
  2419. * Same as `webContents.loadURL(url[, options])`.
  2420. *
  2421. * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
  2422. * file using the `file://` protocol.
  2423. *
  2424. * To ensure that file URLs are properly formatted, it is recommended to use Node's
  2425. * `url.format` method:
  2426. *
  2427. * You can load a URL using a `POST` request with URL-encoded data by doing the
  2428. * following:
  2429. */
  2430. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  2431. /**
  2432. * Maximizes the window. This will also show (but not focus) the window if it isn't
  2433. * being displayed already.
  2434. */
  2435. maximize(): void;
  2436. /**
  2437. * Merges all windows into one window with multiple tabs when native tabs are
  2438. * enabled and there is more than one open window.
  2439. *
  2440. * @platform darwin
  2441. */
  2442. mergeAllWindows(): void;
  2443. /**
  2444. * Minimizes the window. On some platforms the minimized window will be shown in
  2445. * the Dock.
  2446. */
  2447. minimize(): void;
  2448. /**
  2449. * Moves window above the source window in the sense of z-order. If the
  2450. * `mediaSourceId` is not of type window or if the window does not exist then this
  2451. * method throws an error.
  2452. */
  2453. moveAbove(mediaSourceId: string): void;
  2454. /**
  2455. * Moves the current tab into a new window if native tabs are enabled and there is
  2456. * more than one tab in the current window.
  2457. *
  2458. * @platform darwin
  2459. */
  2460. moveTabToNewWindow(): void;
  2461. /**
  2462. * Moves window to top(z-order) regardless of focus
  2463. */
  2464. moveTop(): void;
  2465. /**
  2466. * Uses Quick Look to preview a file at a given path.
  2467. *
  2468. * @platform darwin
  2469. */
  2470. previewFile(path: string, displayName?: string): void;
  2471. /**
  2472. * Same as `webContents.reload`.
  2473. */
  2474. reload(): void;
  2475. removeBrowserView(browserView: BrowserView): void;
  2476. /**
  2477. * Remove the window's menu bar.
  2478. *
  2479. * @platform linux,win32
  2480. */
  2481. removeMenu(): void;
  2482. /**
  2483. * Restores the window from minimized state to its previous state.
  2484. */
  2485. restore(): void;
  2486. /**
  2487. * Selects the next tab when native tabs are enabled and there are other tabs in
  2488. * the window.
  2489. *
  2490. * @platform darwin
  2491. */
  2492. selectNextTab(): void;
  2493. /**
  2494. * Selects the previous tab when native tabs are enabled and there are other tabs
  2495. * in the window.
  2496. *
  2497. * @platform darwin
  2498. */
  2499. selectPreviousTab(): void;
  2500. /**
  2501. * Sets whether the window should show always on top of other windows. After
  2502. * setting this, the window is still a normal window, not a toolbox window which
  2503. * can not be focused on.
  2504. */
  2505. setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
  2506. /**
  2507. * Sets the properties for the window's taskbar button.
  2508. *
  2509. * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
  2510. * together. If one of those properties is not set, then neither will be used.
  2511. *
  2512. * @platform win32
  2513. */
  2514. setAppDetails(options: AppDetailsOptions): void;
  2515. /**
  2516. * This will make a window maintain an aspect ratio. The extra size allows a
  2517. * developer to have space, specified in pixels, not included within the aspect
  2518. * ratio calculations. This API already takes into account the difference between a
  2519. * window's size and its content size.
  2520. *
  2521. * Consider a normal window with an HD video player and associated controls.
  2522. * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
  2523. * on the right edge and 50 pixels of controls below the player. In order to
  2524. * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
  2525. * the player itself we would call this function with arguments of 16/9 and {
  2526. * width: 40, height: 50 }. The second argument doesn't care where the extra width
  2527. * and height are within the content view--only that they exist. Sum any extra
  2528. * width and height areas you have within the overall content view.
  2529. *
  2530. * The aspect ratio is not respected when window is resized programmatically with
  2531. * APIs like `win.setSize`.
  2532. */
  2533. setAspectRatio(aspectRatio: number, extraSize?: Size): void;
  2534. /**
  2535. * Controls whether to hide cursor when typing.
  2536. *
  2537. * @platform darwin
  2538. */
  2539. setAutoHideCursor(autoHide: boolean): void;
  2540. /**
  2541. * Sets whether the window menu bar should hide itself automatically. Once set the
  2542. * menu bar will only show when users press the single `Alt` key.
  2543. *
  2544. * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
  2545. * hide it immediately.
  2546. */
  2547. setAutoHideMenuBar(hide: boolean): void;
  2548. /**
  2549. * Sets the background color of the window. See Setting `backgroundColor`.
  2550. */
  2551. setBackgroundColor(backgroundColor: string): void;
  2552. /**
  2553. * Resizes and moves the window to the supplied bounds. Any properties that are not
  2554. * supplied will default to their current values.
  2555. */
  2556. setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
  2557. setBrowserView(browserView: (BrowserView) | (null)): void;
  2558. /**
  2559. * Sets whether the window can be manually closed by user. On Linux does nothing.
  2560. *
  2561. * @platform darwin,win32
  2562. */
  2563. setClosable(closable: boolean): void;
  2564. /**
  2565. * Resizes and moves the window's client area (e.g. the web page) to the supplied
  2566. * bounds.
  2567. */
  2568. setContentBounds(bounds: Rectangle, animate?: boolean): void;
  2569. /**
  2570. * Prevents the window contents from being captured by other apps.
  2571. *
  2572. * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
  2573. * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
  2574. * version 2004 and up the window will be removed from capture entirely, older
  2575. * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
  2576. *
  2577. * @platform darwin,win32
  2578. */
  2579. setContentProtection(enable: boolean): void;
  2580. /**
  2581. * Resizes the window's client area (e.g. the web page) to `width` and `height`.
  2582. */
  2583. setContentSize(width: number, height: number, animate?: boolean): void;
  2584. /**
  2585. * Specifies whether the window’s document has been edited, and the icon in title
  2586. * bar will become gray when set to `true`.
  2587. *
  2588. * @platform darwin
  2589. */
  2590. setDocumentEdited(edited: boolean): void;
  2591. /**
  2592. * Disable or enable the window.
  2593. */
  2594. setEnabled(enable: boolean): void;
  2595. /**
  2596. * Changes whether the window can be focused.
  2597. *
  2598. * On macOS it does not remove the focus from the window.
  2599. *
  2600. * @platform darwin,win32
  2601. */
  2602. setFocusable(focusable: boolean): void;
  2603. /**
  2604. * Sets whether the window should be in fullscreen mode.
  2605. */
  2606. setFullScreen(flag: boolean): void;
  2607. /**
  2608. * Sets whether the maximize/zoom window button toggles fullscreen mode or
  2609. * maximizes the window.
  2610. */
  2611. setFullScreenable(fullscreenable: boolean): void;
  2612. /**
  2613. * Sets whether the window should have a shadow.
  2614. */
  2615. setHasShadow(hasShadow: boolean): void;
  2616. /**
  2617. * Changes window icon.
  2618. *
  2619. * @platform win32,linux
  2620. */
  2621. setIcon(icon: (NativeImage) | (string)): void;
  2622. /**
  2623. * Makes the window ignore all mouse events.
  2624. *
  2625. * All mouse events happened in this window will be passed to the window below this
  2626. * window, but if this window has focus, it will still receive keyboard events.
  2627. */
  2628. setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
  2629. /**
  2630. * Enters or leaves kiosk mode.
  2631. */
  2632. setKiosk(flag: boolean): void;
  2633. /**
  2634. * Sets whether the window can be manually maximized by user. On Linux does
  2635. * nothing.
  2636. *
  2637. * @platform darwin,win32
  2638. */
  2639. setMaximizable(maximizable: boolean): void;
  2640. /**
  2641. * Sets the maximum size of window to `width` and `height`.
  2642. */
  2643. setMaximumSize(width: number, height: number): void;
  2644. /**
  2645. * Sets the `menu` as the window's menu bar.
  2646. *
  2647. * @platform linux,win32
  2648. */
  2649. setMenu(menu: (Menu) | (null)): void;
  2650. /**
  2651. * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
  2652. * can still bring up the menu bar by pressing the single `Alt` key.
  2653. *
  2654. * @platform win32,linux
  2655. */
  2656. setMenuBarVisibility(visible: boolean): void;
  2657. /**
  2658. * Sets whether the window can be manually minimized by user. On Linux does
  2659. * nothing.
  2660. *
  2661. * @platform darwin,win32
  2662. */
  2663. setMinimizable(minimizable: boolean): void;
  2664. /**
  2665. * Sets the minimum size of window to `width` and `height`.
  2666. */
  2667. setMinimumSize(width: number, height: number): void;
  2668. /**
  2669. * Sets whether the window can be moved by user. On Linux does nothing.
  2670. *
  2671. * @platform darwin,win32
  2672. */
  2673. setMovable(movable: boolean): void;
  2674. /**
  2675. * Sets the opacity of the window. On Linux, does nothing. Out of bound number
  2676. * values are clamped to the [0, 1] range.
  2677. *
  2678. * @platform win32,darwin
  2679. */
  2680. setOpacity(opacity: number): void;
  2681. /**
  2682. * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
  2683. * convey some sort of application status or to passively notify the user.
  2684. *
  2685. * @platform win32
  2686. */
  2687. setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
  2688. /**
  2689. * Sets `parent` as current window's parent window, passing `null` will turn
  2690. * current window into a top-level window.
  2691. */
  2692. setParentWindow(parent: (BrowserWindow) | (null)): void;
  2693. /**
  2694. * Moves window to `x` and `y`.
  2695. */
  2696. setPosition(x: number, y: number, animate?: boolean): void;
  2697. /**
  2698. * Sets progress value in progress bar. Valid range is [0, 1.0].
  2699. *
  2700. * Remove progress bar when progress < 0; Change to indeterminate mode when
  2701. * progress > 1.
  2702. *
  2703. * On Linux platform, only supports Unity desktop environment, you need to specify
  2704. * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
  2705. * it will assume `{app.name}.desktop`.
  2706. *
  2707. * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
  2708. * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
  2709. * mode set (but with a value within the valid range), `normal` will be assumed.
  2710. */
  2711. setProgressBar(progress: number, options?: ProgressBarOptions): void;
  2712. /**
  2713. * Sets the pathname of the file the window represents, and the icon of the file
  2714. * will show in window's title bar.
  2715. *
  2716. * @platform darwin
  2717. */
  2718. setRepresentedFilename(filename: string): void;
  2719. /**
  2720. * Sets whether the window can be manually resized by the user.
  2721. */
  2722. setResizable(resizable: boolean): void;
  2723. /**
  2724. * Setting a window shape determines the area within the window where the system
  2725. * permits drawing and user interaction. Outside of the given region, no pixels
  2726. * will be drawn and no mouse events will be registered. Mouse events outside of
  2727. * the region will not be received by that window, but will fall through to
  2728. * whatever is behind the window.
  2729. *
  2730. * @experimental
  2731. * @platform win32,linux
  2732. */
  2733. setShape(rects: Rectangle[]): void;
  2734. /**
  2735. * Changes the attachment point for sheets on macOS. By default, sheets are
  2736. * attached just below the window frame, but you may want to display them beneath a
  2737. * HTML-rendered toolbar. For example:
  2738. *
  2739. * @platform darwin
  2740. */
  2741. setSheetOffset(offsetY: number, offsetX?: number): void;
  2742. /**
  2743. * Enters or leaves simple fullscreen mode.
  2744. *
  2745. * Simple fullscreen mode emulates the native fullscreen behavior found in versions
  2746. * of macOS prior to Lion (10.7).
  2747. *
  2748. * @platform darwin
  2749. */
  2750. setSimpleFullScreen(flag: boolean): void;
  2751. /**
  2752. * Resizes the window to `width` and `height`. If `width` or `height` are below any
  2753. * set minimum size constraints the window will snap to its minimum size.
  2754. */
  2755. setSize(width: number, height: number, animate?: boolean): void;
  2756. /**
  2757. * Makes the window not show in the taskbar.
  2758. */
  2759. setSkipTaskbar(skip: boolean): void;
  2760. /**
  2761. * Whether the buttons were added successfully
  2762. *
  2763. * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
  2764. * of a window in a taskbar button layout. Returns a `Boolean` object indicates
  2765. * whether the thumbnail has been added successfully.
  2766. *
  2767. * The number of buttons in thumbnail toolbar should be no greater than 7 due to
  2768. * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
  2769. * removed due to the platform's limitation. But you can call the API with an empty
  2770. * array to clean the buttons.
  2771. *
  2772. * The `buttons` is an array of `Button` objects:
  2773. *
  2774. * * `Button` Object
  2775. * * `icon` NativeImage - The icon showing in thumbnail toolbar.
  2776. * * `click` Function
  2777. * * `tooltip` String (optional) - The text of the button's tooltip.
  2778. * * `flags` String[] (optional) - Control specific states and behaviors of the
  2779. * button. By default, it is `['enabled']`.
  2780. *
  2781. * The `flags` is an array that can include following `String`s:
  2782. *
  2783. * * `enabled` - The button is active and available to the user.
  2784. * * `disabled` - The button is disabled. It is present, but has a visual state
  2785. * indicating it will not respond to user action.
  2786. * * `dismissonclick` - When the button is clicked, the thumbnail window closes
  2787. * immediately.
  2788. * * `nobackground` - Do not draw a button border, use only the image.
  2789. * * `hidden` - The button is not shown to the user.
  2790. * * `noninteractive` - The button is enabled but not interactive; no pressed
  2791. * button state is drawn. This value is intended for instances where the button is
  2792. * used in a notification.
  2793. *
  2794. * @platform win32
  2795. */
  2796. setThumbarButtons(buttons: ThumbarButton[]): boolean;
  2797. /**
  2798. * Sets the region of the window to show as the thumbnail image displayed when
  2799. * hovering over the window in the taskbar. You can reset the thumbnail to be the
  2800. * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
  2801. * }`.
  2802. *
  2803. * @platform win32
  2804. */
  2805. setThumbnailClip(region: Rectangle): void;
  2806. /**
  2807. * Sets the toolTip that is displayed when hovering over the window thumbnail in
  2808. * the taskbar.
  2809. *
  2810. * @platform win32
  2811. */
  2812. setThumbnailToolTip(toolTip: string): void;
  2813. /**
  2814. * Changes the title of native window to `title`.
  2815. */
  2816. setTitle(title: string): void;
  2817. /**
  2818. * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
  2819. * error if `browserView` is not attached to `win`.
  2820. *
  2821. * @experimental
  2822. */
  2823. setTopBrowserView(browserView: BrowserView): void;
  2824. /**
  2825. * Sets the touchBar layout for the current window. Specifying `null` or
  2826. * `undefined` clears the touch bar. This method only has an effect if the machine
  2827. * has a touch bar and is running on macOS 10.12.1+.
  2828. *
  2829. * **Note:** The TouchBar API is currently experimental and may change or be
  2830. * removed in future Electron releases.
  2831. *
  2832. * @platform darwin
  2833. */
  2834. setTouchBar(touchBar: (TouchBar) | (null)): void;
  2835. /**
  2836. * Set a custom position for the traffic light buttons in frameless window.
  2837. *
  2838. * @platform darwin
  2839. */
  2840. setTrafficLightPosition(position: Point): void;
  2841. /**
  2842. * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
  2843. * will remove the vibrancy effect on the window.
  2844. *
  2845. * Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
  2846. * have been deprecated and will be removed in an upcoming version of macOS.
  2847. *
  2848. * @platform darwin
  2849. */
  2850. setVibrancy(type: (('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
  2851. /**
  2852. * Sets whether the window should be visible on all workspaces.
  2853. *
  2854. * **Note:** This API does nothing on Windows.
  2855. */
  2856. setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
  2857. /**
  2858. * Sets whether the window traffic light buttons should be visible.
  2859. *
  2860. * @platform darwin
  2861. */
  2862. setWindowButtonVisibility(visible: boolean): void;
  2863. /**
  2864. * Shows and gives focus to the window.
  2865. */
  2866. show(): void;
  2867. /**
  2868. * Same as `webContents.showDefinitionForSelection()`.
  2869. *
  2870. * @platform darwin
  2871. */
  2872. showDefinitionForSelection(): void;
  2873. /**
  2874. * Shows the window but doesn't focus on it.
  2875. */
  2876. showInactive(): void;
  2877. /**
  2878. * Toggles the visibility of the tab bar if native tabs are enabled and there is
  2879. * only one tab in the current window.
  2880. *
  2881. * @platform darwin
  2882. */
  2883. toggleTabBar(): void;
  2884. /**
  2885. * Unhooks all of the window messages.
  2886. *
  2887. * @platform win32
  2888. */
  2889. unhookAllWindowMessages(): void;
  2890. /**
  2891. * Unhook the window message.
  2892. *
  2893. * @platform win32
  2894. */
  2895. unhookWindowMessage(message: number): void;
  2896. /**
  2897. * Unmaximizes the window.
  2898. */
  2899. unmaximize(): void;
  2900. /**
  2901. * A `String` property that defines an alternative title provided only to
  2902. * accessibility tools such as screen readers. This string is not directly visible
  2903. * to users.
  2904. */
  2905. accessibleTitle: string;
  2906. /**
  2907. * A `Boolean` property that determines whether the window menu bar should hide
  2908. * itself automatically. Once set, the menu bar will only show when users press the
  2909. * single `Alt` key.
  2910. *
  2911. * If the menu bar is already visible, setting this property to `true` won't hide
  2912. * it immediately.
  2913. */
  2914. autoHideMenuBar: boolean;
  2915. /**
  2916. * A `Boolean` property that determines whether the window can be manually closed
  2917. * by user.
  2918. *
  2919. * On Linux the setter is a no-op, although the getter returns `true`.
  2920. */
  2921. closable: boolean;
  2922. /**
  2923. * A `Boolean` property that specifies whether the window’s document has been
  2924. * edited.
  2925. *
  2926. * The icon in title bar will become gray when set to `true`.
  2927. *
  2928. * @platform darwin
  2929. */
  2930. documentEdited: boolean;
  2931. /**
  2932. * A `Boolean` property that determines whether the window is excluded from the
  2933. * application’s Windows menu. `false` by default.
  2934. *
  2935. * @platform darwin
  2936. */
  2937. excludedFromShownWindowsMenu: boolean;
  2938. /**
  2939. * A `Boolean` property that determines whether the window is focusable.
  2940. *
  2941. * @platform win32,darwin
  2942. */
  2943. focusable: boolean;
  2944. /**
  2945. * A `Boolean` property that determines whether the window is in fullscreen mode.
  2946. */
  2947. fullScreen: boolean;
  2948. /**
  2949. * A `Boolean` property that determines whether the maximize/zoom window button
  2950. * toggles fullscreen mode or maximizes the window.
  2951. */
  2952. fullScreenable: boolean;
  2953. /**
  2954. * A `Integer` property representing the unique ID of the window. Each ID is unique
  2955. * among all `BrowserWindow` instances of the entire Electron application.
  2956. *
  2957. */
  2958. readonly id: number;
  2959. /**
  2960. * A `Boolean` property that determines whether the window is in kiosk mode.
  2961. */
  2962. kiosk: boolean;
  2963. /**
  2964. * A `Boolean` property that determines whether the window can be manually
  2965. * maximized by user.
  2966. *
  2967. * On Linux the setter is a no-op, although the getter returns `true`.
  2968. */
  2969. maximizable: boolean;
  2970. /**
  2971. * A `Boolean` property that determines whether the menu bar should be visible.
  2972. *
  2973. * **Note:** If the menu bar is auto-hide, users can still bring up the menu bar by
  2974. * pressing the single `Alt` key.
  2975. *
  2976. * @platform win32,linux
  2977. */
  2978. menuBarVisible: boolean;
  2979. /**
  2980. * A `Boolean` property that determines whether the window can be manually
  2981. * minimized by user.
  2982. *
  2983. * On Linux the setter is a no-op, although the getter returns `true`.
  2984. */
  2985. minimizable: boolean;
  2986. /**
  2987. * A `Boolean` property that determines Whether the window can be moved by user.
  2988. *
  2989. * On Linux the setter is a no-op, although the getter returns `true`.
  2990. */
  2991. movable: boolean;
  2992. /**
  2993. * A `String` property that determines the pathname of the file the window
  2994. * represents, and the icon of the file will show in window's title bar.
  2995. *
  2996. * @platform darwin
  2997. */
  2998. representedFilename: string;
  2999. /**
  3000. * A `Boolean` property that determines whether the window can be manually resized
  3001. * by user.
  3002. */
  3003. resizable: boolean;
  3004. /**
  3005. * A `Boolean` property that determines whether the window has a shadow.
  3006. */
  3007. shadow: boolean;
  3008. /**
  3009. * A `Boolean` property that determines whether the window is in simple (pre-Lion)
  3010. * fullscreen mode.
  3011. */
  3012. simpleFullScreen: boolean;
  3013. /**
  3014. * A `String` property that determines the title of the native window.
  3015. *
  3016. * **Note:** The title of the web page can be different from the title of the
  3017. * native window.
  3018. */
  3019. title: string;
  3020. /**
  3021. * A `Boolean` property that determines whether the window is visible on all
  3022. * workspaces.
  3023. *
  3024. * **Note:** Always returns false on Windows.
  3025. */
  3026. visibleOnAllWorkspaces: boolean;
  3027. /**
  3028. * A `WebContents` object this window owns. All web page related events and
  3029. * operations will be done via it.
  3030. *
  3031. * See the `webContents` documentation for its methods and events.
  3032. *
  3033. */
  3034. readonly webContents: WebContents;
  3035. }
  3036. class BrowserWindowProxy {
  3037. // Docs: https://electronjs.org/docs/api/browser-window-proxy
  3038. /**
  3039. * Removes focus from the child window.
  3040. */
  3041. blur(): void;
  3042. /**
  3043. * Forcefully closes the child window without calling its unload event.
  3044. */
  3045. close(): void;
  3046. /**
  3047. * Evaluates the code in the child window.
  3048. */
  3049. eval(code: string): void;
  3050. /**
  3051. * Focuses the child window (brings the window to front).
  3052. */
  3053. focus(): void;
  3054. /**
  3055. * Sends a message to the child window with the specified origin or `*` for no
  3056. * origin preference.
  3057. *
  3058. * In addition to these methods, the child window implements `window.opener` object
  3059. * with no properties and a single method.
  3060. */
  3061. postMessage(message: any, targetOrigin: string): void;
  3062. /**
  3063. * Invokes the print dialog on the child window.
  3064. */
  3065. print(): void;
  3066. /**
  3067. * A `Boolean` that is set to true after the child window gets closed.
  3068. */
  3069. closed: boolean;
  3070. }
  3071. interface Certificate {
  3072. // Docs: https://electronjs.org/docs/api/structures/certificate
  3073. /**
  3074. * PEM encoded data
  3075. */
  3076. data: string;
  3077. /**
  3078. * Fingerprint of the certificate
  3079. */
  3080. fingerprint: string;
  3081. /**
  3082. * Issuer principal
  3083. */
  3084. issuer: CertificatePrincipal;
  3085. /**
  3086. * Issuer certificate (if not self-signed)
  3087. */
  3088. issuerCert: Certificate;
  3089. /**
  3090. * Issuer's Common Name
  3091. */
  3092. issuerName: string;
  3093. /**
  3094. * Hex value represented string
  3095. */
  3096. serialNumber: string;
  3097. /**
  3098. * Subject principal
  3099. */
  3100. subject: CertificatePrincipal;
  3101. /**
  3102. * Subject's Common Name
  3103. */
  3104. subjectName: string;
  3105. /**
  3106. * End date of the certificate being valid in seconds
  3107. */
  3108. validExpiry: number;
  3109. /**
  3110. * Start date of the certificate being valid in seconds
  3111. */
  3112. validStart: number;
  3113. }
  3114. interface CertificatePrincipal {
  3115. // Docs: https://electronjs.org/docs/api/structures/certificate-principal
  3116. /**
  3117. * Common Name.
  3118. */
  3119. commonName: string;
  3120. /**
  3121. * Country or region.
  3122. */
  3123. country: string;
  3124. /**
  3125. * Locality.
  3126. */
  3127. locality: string;
  3128. /**
  3129. * Organization names.
  3130. */
  3131. organizations: string[];
  3132. /**
  3133. * Organization Unit names.
  3134. */
  3135. organizationUnits: string[];
  3136. /**
  3137. * State or province.
  3138. */
  3139. state: string;
  3140. }
  3141. class ClientRequest extends NodeEventEmitter {
  3142. // Docs: https://electronjs.org/docs/api/client-request
  3143. /**
  3144. * Emitted when the `request` is aborted. The `abort` event will not be fired if
  3145. * the `request` is already closed.
  3146. */
  3147. on(event: 'abort', listener: Function): this;
  3148. once(event: 'abort', listener: Function): this;
  3149. addListener(event: 'abort', listener: Function): this;
  3150. removeListener(event: 'abort', listener: Function): this;
  3151. /**
  3152. * Emitted as the last event in the HTTP request-response transaction. The `close`
  3153. * event indicates that no more events will be emitted on either the `request` or
  3154. * `response` objects.
  3155. */
  3156. on(event: 'close', listener: Function): this;
  3157. once(event: 'close', listener: Function): this;
  3158. addListener(event: 'close', listener: Function): this;
  3159. removeListener(event: 'close', listener: Function): this;
  3160. /**
  3161. * Emitted when the `net` module fails to issue a network request. Typically when
  3162. * the `request` object emits an `error` event, a `close` event will subsequently
  3163. * follow and no response object will be provided.
  3164. */
  3165. on(event: 'error', listener: (
  3166. /**
  3167. * an error object providing some information about the failure.
  3168. */
  3169. error: Error) => void): this;
  3170. once(event: 'error', listener: (
  3171. /**
  3172. * an error object providing some information about the failure.
  3173. */
  3174. error: Error) => void): this;
  3175. addListener(event: 'error', listener: (
  3176. /**
  3177. * an error object providing some information about the failure.
  3178. */
  3179. error: Error) => void): this;
  3180. removeListener(event: 'error', listener: (
  3181. /**
  3182. * an error object providing some information about the failure.
  3183. */
  3184. error: Error) => void): this;
  3185. /**
  3186. * Emitted just after the last chunk of the `request`'s data has been written into
  3187. * the `request` object.
  3188. */
  3189. on(event: 'finish', listener: Function): this;
  3190. once(event: 'finish', listener: Function): this;
  3191. addListener(event: 'finish', listener: Function): this;
  3192. removeListener(event: 'finish', listener: Function): this;
  3193. /**
  3194. * Emitted when an authenticating proxy is asking for user credentials.
  3195. *
  3196. * The `callback` function is expected to be called back with user credentials:
  3197. *
  3198. * * `username` String
  3199. * * `password` String
  3200. *
  3201. * Providing empty credentials will cancel the request and report an authentication
  3202. * error on the response object:
  3203. */
  3204. on(event: 'login', listener: (authInfo: AuthInfo,
  3205. callback: (username?: string, password?: string) => void) => void): this;
  3206. once(event: 'login', listener: (authInfo: AuthInfo,
  3207. callback: (username?: string, password?: string) => void) => void): this;
  3208. addListener(event: 'login', listener: (authInfo: AuthInfo,
  3209. callback: (username?: string, password?: string) => void) => void): this;
  3210. removeListener(event: 'login', listener: (authInfo: AuthInfo,
  3211. callback: (username?: string, password?: string) => void) => void): this;
  3212. /**
  3213. * Emitted when the server returns a redirect response (e.g. 301 Moved
  3214. * Permanently). Calling `request.followRedirect` will continue with the
  3215. * redirection. If this event is handled, `request.followRedirect` must be called
  3216. * **synchronously**, otherwise the request will be cancelled.
  3217. */
  3218. on(event: 'redirect', listener: (statusCode: number,
  3219. method: string,
  3220. redirectUrl: string,
  3221. responseHeaders: Record<string, string[]>) => void): this;
  3222. once(event: 'redirect', listener: (statusCode: number,
  3223. method: string,
  3224. redirectUrl: string,
  3225. responseHeaders: Record<string, string[]>) => void): this;
  3226. addListener(event: 'redirect', listener: (statusCode: number,
  3227. method: string,
  3228. redirectUrl: string,
  3229. responseHeaders: Record<string, string[]>) => void): this;
  3230. removeListener(event: 'redirect', listener: (statusCode: number,
  3231. method: string,
  3232. redirectUrl: string,
  3233. responseHeaders: Record<string, string[]>) => void): this;
  3234. on(event: 'response', listener: (
  3235. /**
  3236. * An object representing the HTTP response message.
  3237. */
  3238. response: IncomingMessage) => void): this;
  3239. once(event: 'response', listener: (
  3240. /**
  3241. * An object representing the HTTP response message.
  3242. */
  3243. response: IncomingMessage) => void): this;
  3244. addListener(event: 'response', listener: (
  3245. /**
  3246. * An object representing the HTTP response message.
  3247. */
  3248. response: IncomingMessage) => void): this;
  3249. removeListener(event: 'response', listener: (
  3250. /**
  3251. * An object representing the HTTP response message.
  3252. */
  3253. response: IncomingMessage) => void): this;
  3254. /**
  3255. * ClientRequest
  3256. */
  3257. constructor(options: (ClientRequestConstructorOptions) | (string));
  3258. /**
  3259. * Cancels an ongoing HTTP transaction. If the request has already emitted the
  3260. * `close` event, the abort operation will have no effect. Otherwise an ongoing
  3261. * event will emit `abort` and `close` events. Additionally, if there is an ongoing
  3262. * response object,it will emit the `aborted` event.
  3263. */
  3264. abort(): void;
  3265. /**
  3266. * Sends the last chunk of the request data. Subsequent write or end operations
  3267. * will not be allowed. The `finish` event is emitted just after the end operation.
  3268. */
  3269. end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  3270. /**
  3271. * Continues any pending redirection. Can only be called during a `'redirect'`
  3272. * event.
  3273. */
  3274. followRedirect(): void;
  3275. /**
  3276. * The value of a previously set extra header name.
  3277. */
  3278. getHeader(name: string): string;
  3279. /**
  3280. * * `active` Boolean - Whether the request is currently active. If this is false
  3281. * no other properties will be set
  3282. * * `started` Boolean - Whether the upload has started. If this is false both
  3283. * `current` and `total` will be set to 0.
  3284. * * `current` Integer - The number of bytes that have been uploaded so far
  3285. * * `total` Integer - The number of bytes that will be uploaded this request
  3286. *
  3287. * You can use this method in conjunction with `POST` requests to get the progress
  3288. * of a file upload or other data transfer.
  3289. */
  3290. getUploadProgress(): UploadProgress;
  3291. /**
  3292. * Removes a previously set extra header name. This method can be called only
  3293. * before first write. Trying to call it after the first write will throw an error.
  3294. */
  3295. removeHeader(name: string): void;
  3296. /**
  3297. * Adds an extra HTTP header. The header name will be issued as-is without
  3298. * lowercasing. It can be called only before first write. Calling this method after
  3299. * the first write will throw an error. If the passed value is not a `String`, its
  3300. * `toString()` method will be called to obtain the final value.
  3301. *
  3302. * Certain headers are restricted from being set by apps. These headers are listed
  3303. * below. More information on restricted headers can be found in Chromium's header
  3304. * utils.
  3305. *
  3306. * * `Content-Length`
  3307. * * `Host`
  3308. * * `Trailer` or `Te`
  3309. * * `Upgrade`
  3310. * * `Cookie2`
  3311. * * `Keep-Alive`
  3312. * * `Transfer-Encoding`
  3313. *
  3314. * Additionally, setting the `Connection` header to the value `upgrade` is also
  3315. * disallowed.
  3316. */
  3317. setHeader(name: string, value: string): void;
  3318. /**
  3319. * `callback` is essentially a dummy function introduced in the purpose of keeping
  3320. * similarity with the Node.js API. It is called asynchronously in the next tick
  3321. * after `chunk` content have been delivered to the Chromium networking layer.
  3322. * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
  3323. * content have been flushed on the wire before `callback` is called.
  3324. *
  3325. * Adds a chunk of data to the request body. The first write operation may cause
  3326. * the request headers to be issued on the wire. After the first write operation,
  3327. * it is not allowed to add or remove a custom header.
  3328. */
  3329. write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  3330. /**
  3331. * A `Boolean` specifying whether the request will use HTTP chunked transfer
  3332. * encoding or not. Defaults to false. The property is readable and writable,
  3333. * however it can be set only before the first write operation as the HTTP headers
  3334. * are not yet put on the wire. Trying to set the `chunkedEncoding` property after
  3335. * the first write will throw an error.
  3336. *
  3337. * Using chunked encoding is strongly recommended if you need to send a large
  3338. * request body as data will be streamed in small chunks instead of being
  3339. * internally buffered inside Electron process memory.
  3340. */
  3341. chunkedEncoding: boolean;
  3342. }
  3343. interface Clipboard {
  3344. // Docs: https://electronjs.org/docs/api/clipboard
  3345. /**
  3346. * An array of supported formats for the clipboard `type`.
  3347. */
  3348. availableFormats(type?: 'selection' | 'clipboard'): string[];
  3349. /**
  3350. * Clears the clipboard content.
  3351. */
  3352. clear(type?: 'selection' | 'clipboard'): void;
  3353. /**
  3354. * Whether the clipboard supports the specified `format`.
  3355. *
  3356. * @experimental
  3357. */
  3358. has(format: string, type?: 'selection' | 'clipboard'): boolean;
  3359. /**
  3360. * Reads `format` type from the clipboard.
  3361. *
  3362. * `format` should contain valid ASCII characters and have `/` separator. `a/c`,
  3363. * `a/bc` are valid formats while `/abc`, `abc/`, `a/`, `/a`, `a` are not valid.
  3364. *
  3365. * @experimental
  3366. */
  3367. read(format: string): string;
  3368. /**
  3369. * * `title` String
  3370. * * `url` String
  3371. *
  3372. * Returns an Object containing `title` and `url` keys representing the bookmark in
  3373. * the clipboard. The `title` and `url` values will be empty strings when the
  3374. * bookmark is unavailable. The `title` value will always be empty on Windows.
  3375. *
  3376. * @platform darwin,win32
  3377. */
  3378. readBookmark(): ReadBookmark;
  3379. /**
  3380. * Reads `format` type from the clipboard.
  3381. *
  3382. * @experimental
  3383. */
  3384. readBuffer(format: string): Buffer;
  3385. /**
  3386. * The text on the find pasteboard, which is the pasteboard that holds information
  3387. * about the current state of the active application’s find panel.
  3388. *
  3389. * This method uses synchronous IPC when called from the renderer process. The
  3390. * cached value is reread from the find pasteboard whenever the application is
  3391. * activated.
  3392. *
  3393. * @platform darwin
  3394. */
  3395. readFindText(): string;
  3396. /**
  3397. * The content in the clipboard as markup.
  3398. */
  3399. readHTML(type?: 'selection' | 'clipboard'): string;
  3400. /**
  3401. * The image content in the clipboard.
  3402. */
  3403. readImage(type?: 'selection' | 'clipboard'): NativeImage;
  3404. /**
  3405. * The content in the clipboard as RTF.
  3406. */
  3407. readRTF(type?: 'selection' | 'clipboard'): string;
  3408. /**
  3409. * The content in the clipboard as plain text.
  3410. */
  3411. readText(type?: 'selection' | 'clipboard'): string;
  3412. /**
  3413. * Writes `data` to the clipboard.
  3414. */
  3415. write(data: Data, type?: 'selection' | 'clipboard'): void;
  3416. /**
  3417. * Writes the `title` (macOS only) and `url` into the clipboard as a bookmark.
  3418. *
  3419. * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
  3420. * can use `clipboard.write` to write both a bookmark and fallback text to the
  3421. * clipboard.
  3422. *
  3423. * @platform darwin,win32
  3424. */
  3425. writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
  3426. /**
  3427. * Writes the `buffer` into the clipboard as `format`.
  3428. *
  3429. * @experimental
  3430. */
  3431. writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
  3432. /**
  3433. * Writes the `text` into the find pasteboard (the pasteboard that holds
  3434. * information about the current state of the active application’s find panel) as
  3435. * plain text. This method uses synchronous IPC when called from the renderer
  3436. * process.
  3437. *
  3438. * @platform darwin
  3439. */
  3440. writeFindText(text: string): void;
  3441. /**
  3442. * Writes `markup` to the clipboard.
  3443. */
  3444. writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
  3445. /**
  3446. * Writes `image` to the clipboard.
  3447. */
  3448. writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
  3449. /**
  3450. * Writes the `text` into the clipboard in RTF.
  3451. */
  3452. writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
  3453. /**
  3454. * Writes the `text` into the clipboard as plain text.
  3455. */
  3456. writeText(text: string, type?: 'selection' | 'clipboard'): void;
  3457. }
  3458. class CommandLine {
  3459. // Docs: https://electronjs.org/docs/api/command-line
  3460. /**
  3461. * Append an argument to Chromium's command line. The argument will be quoted
  3462. * correctly. Switches will precede arguments regardless of appending order.
  3463. *
  3464. * If you're appending an argument like `--switch=value`, consider using
  3465. * `appendSwitch('switch', 'value')` instead.
  3466. *
  3467. * **Note:** This will not affect `process.argv`. The intended usage of this
  3468. * function is to control Chromium's behavior.
  3469. */
  3470. appendArgument(value: string): void;
  3471. /**
  3472. * Append a switch (with optional `value`) to Chromium's command line.
  3473. *
  3474. * **Note:** This will not affect `process.argv`. The intended usage of this
  3475. * function is to control Chromium's behavior.
  3476. */
  3477. appendSwitch(the_switch: string, value?: string): void;
  3478. /**
  3479. * The command-line switch value.
  3480. *
  3481. * **Note:** When the switch is not present or has no value, it returns empty
  3482. * string.
  3483. */
  3484. getSwitchValue(the_switch: string): string;
  3485. /**
  3486. * Whether the command-line switch is present.
  3487. */
  3488. hasSwitch(the_switch: string): boolean;
  3489. /**
  3490. * Removes the specified switch from Chromium's command line.
  3491. *
  3492. * **Note:** This will not affect `process.argv`. The intended usage of this
  3493. * function is to control Chromium's behavior.
  3494. */
  3495. removeSwitch(the_switch: string): void;
  3496. }
  3497. interface ContentTracing {
  3498. // Docs: https://electronjs.org/docs/api/content-tracing
  3499. /**
  3500. * resolves with an array of category groups once all child processes have
  3501. * acknowledged the `getCategories` request
  3502. *
  3503. * Get a set of category groups. The category groups can change as new code paths
  3504. * are reached. See also the list of built-in tracing categories.
  3505. *
  3506. * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
  3507. * This category can be used to capture Electron-specific tracing events.
  3508. */
  3509. getCategories(): Promise<string[]>;
  3510. /**
  3511. * Resolves with an object containing the `value` and `percentage` of trace buffer
  3512. * maximum usage
  3513. *
  3514. * * `value` Number
  3515. * * `percentage` Number
  3516. *
  3517. * Get the maximum usage across processes of trace buffer as a percentage of the
  3518. * full state.
  3519. */
  3520. getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
  3521. /**
  3522. * resolved once all child processes have acknowledged the `startRecording`
  3523. * request.
  3524. *
  3525. * Start recording on all processes.
  3526. *
  3527. * Recording begins immediately locally and asynchronously on child processes as
  3528. * soon as they receive the EnableRecording request.
  3529. *
  3530. * If a recording is already running, the promise will be immediately resolved, as
  3531. * only one trace operation can be in progress at a time.
  3532. */
  3533. startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
  3534. /**
  3535. * resolves with a path to a file that contains the traced data once all child
  3536. * processes have acknowledged the `stopRecording` request
  3537. *
  3538. * Stop recording on all processes.
  3539. *
  3540. * Child processes typically cache trace data and only rarely flush and send trace
  3541. * data back to the main process. This helps to minimize the runtime overhead of
  3542. * tracing since sending trace data over IPC can be an expensive operation. So, to
  3543. * end tracing, Chromium asynchronously asks all child processes to flush any
  3544. * pending trace data.
  3545. *
  3546. * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
  3547. * or not provided, trace data will be written to a temporary file, and the path
  3548. * will be returned in the promise.
  3549. */
  3550. stopRecording(resultFilePath?: string): Promise<string>;
  3551. }
  3552. interface ContextBridge {
  3553. // Docs: https://electronjs.org/docs/api/context-bridge
  3554. exposeInMainWorld(apiKey: string, api: any): void;
  3555. }
  3556. interface Cookie {
  3557. // Docs: https://electronjs.org/docs/api/structures/cookie
  3558. /**
  3559. * The domain of the cookie; this will be normalized with a preceding dot so that
  3560. * it's also valid for subdomains.
  3561. */
  3562. domain?: string;
  3563. /**
  3564. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  3565. * Not provided for session cookies.
  3566. */
  3567. expirationDate?: number;
  3568. /**
  3569. * Whether the cookie is a host-only cookie; this will only be `true` if no domain
  3570. * was passed.
  3571. */
  3572. hostOnly?: boolean;
  3573. /**
  3574. * Whether the cookie is marked as HTTP only.
  3575. */
  3576. httpOnly?: boolean;
  3577. /**
  3578. * The name of the cookie.
  3579. */
  3580. name: string;
  3581. /**
  3582. * The path of the cookie.
  3583. */
  3584. path?: string;
  3585. /**
  3586. * The Same Site policy applied to this cookie. Can be `unspecified`,
  3587. * `no_restriction`, `lax` or `strict`.
  3588. */
  3589. sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  3590. /**
  3591. * Whether the cookie is marked as secure.
  3592. */
  3593. secure?: boolean;
  3594. /**
  3595. * Whether the cookie is a session cookie or a persistent cookie with an expiration
  3596. * date.
  3597. */
  3598. session?: boolean;
  3599. /**
  3600. * The value of the cookie.
  3601. */
  3602. value: string;
  3603. }
  3604. class Cookies extends NodeEventEmitter {
  3605. // Docs: https://electronjs.org/docs/api/cookies
  3606. /**
  3607. * Emitted when a cookie is changed because it was added, edited, removed, or
  3608. * expired.
  3609. */
  3610. on(event: 'changed', listener: (event: Event,
  3611. /**
  3612. * The cookie that was changed.
  3613. */
  3614. cookie: Cookie,
  3615. /**
  3616. * The cause of the change with one of the following values:
  3617. */
  3618. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3619. /**
  3620. * `true` if the cookie was removed, `false` otherwise.
  3621. */
  3622. removed: boolean) => void): this;
  3623. once(event: 'changed', listener: (event: Event,
  3624. /**
  3625. * The cookie that was changed.
  3626. */
  3627. cookie: Cookie,
  3628. /**
  3629. * The cause of the change with one of the following values:
  3630. */
  3631. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3632. /**
  3633. * `true` if the cookie was removed, `false` otherwise.
  3634. */
  3635. removed: boolean) => void): this;
  3636. addListener(event: 'changed', listener: (event: Event,
  3637. /**
  3638. * The cookie that was changed.
  3639. */
  3640. cookie: Cookie,
  3641. /**
  3642. * The cause of the change with one of the following values:
  3643. */
  3644. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3645. /**
  3646. * `true` if the cookie was removed, `false` otherwise.
  3647. */
  3648. removed: boolean) => void): this;
  3649. removeListener(event: 'changed', listener: (event: Event,
  3650. /**
  3651. * The cookie that was changed.
  3652. */
  3653. cookie: Cookie,
  3654. /**
  3655. * The cause of the change with one of the following values:
  3656. */
  3657. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3658. /**
  3659. * `true` if the cookie was removed, `false` otherwise.
  3660. */
  3661. removed: boolean) => void): this;
  3662. /**
  3663. * A promise which resolves when the cookie store has been flushed
  3664. *
  3665. * Writes any unwritten cookies data to disk.
  3666. */
  3667. flushStore(): Promise<void>;
  3668. /**
  3669. * A promise which resolves an array of cookie objects.
  3670. *
  3671. * Sends a request to get all cookies matching `filter`, and resolves a promise
  3672. * with the response.
  3673. */
  3674. get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
  3675. /**
  3676. * A promise which resolves when the cookie has been removed
  3677. *
  3678. * Removes the cookies matching `url` and `name`
  3679. */
  3680. remove(url: string, name: string): Promise<void>;
  3681. /**
  3682. * A promise which resolves when the cookie has been set
  3683. *
  3684. * Sets a cookie with `details`.
  3685. */
  3686. set(details: CookiesSetDetails): Promise<void>;
  3687. }
  3688. interface CPUUsage {
  3689. // Docs: https://electronjs.org/docs/api/structures/cpu-usage
  3690. /**
  3691. * The number of average idle CPU wakeups per second since the last call to
  3692. * getCPUUsage. First call returns 0. Will always return 0 on Windows.
  3693. */
  3694. idleWakeupsPerSecond: number;
  3695. /**
  3696. * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
  3697. */
  3698. percentCPUUsage: number;
  3699. }
  3700. interface CrashReport {
  3701. // Docs: https://electronjs.org/docs/api/structures/crash-report
  3702. date: Date;
  3703. id: string;
  3704. }
  3705. interface CrashReporter {
  3706. // Docs: https://electronjs.org/docs/api/crash-reporter
  3707. /**
  3708. * Set an extra parameter to be sent with the crash report. The values specified
  3709. * here will be sent in addition to any values set via the `extra` option when
  3710. * `start` was called.
  3711. *
  3712. * Parameters added in this fashion (or via the `extra` parameter to
  3713. * `crashReporter.start`) are specific to the calling process. Adding extra
  3714. * parameters in the main process will not cause those parameters to be sent along
  3715. * with crashes from renderer or other child processes. Similarly, adding extra
  3716. * parameters in a renderer process will not result in those parameters being sent
  3717. * with crashes that occur in other renderer processes or in the main process.
  3718. *
  3719. * **Note:** Parameters have limits on the length of the keys and values. Key names
  3720. * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
  3721. * Keys with names longer than the maximum will be silently ignored. Key values
  3722. * longer than the maximum length will be truncated.
  3723. */
  3724. addExtraParameter(key: string, value: string): void;
  3725. /**
  3726. * The date and ID of the last crash report. Only crash reports that have been
  3727. * uploaded will be returned; even if a crash report is present on disk it will not
  3728. * be returned until it is uploaded. In the case that there are no uploaded
  3729. * reports, `null` is returned.
  3730. *
  3731. * **Note:** This method is only available in the main process.
  3732. */
  3733. getLastCrashReport(): CrashReport;
  3734. /**
  3735. * The current 'extra' parameters of the crash reporter.
  3736. */
  3737. getParameters(): Record<string, string>;
  3738. /**
  3739. * Returns all uploaded crash reports. Each report contains the date and uploaded
  3740. * ID.
  3741. *
  3742. * **Note:** This method is only available in the main process.
  3743. */
  3744. getUploadedReports(): CrashReport[];
  3745. /**
  3746. * Whether reports should be submitted to the server. Set through the `start`
  3747. * method or `setUploadToServer`.
  3748. *
  3749. * **Note:** This method is only available in the main process.
  3750. */
  3751. getUploadToServer(): boolean;
  3752. /**
  3753. * Remove an extra parameter from the current set of parameters. Future crashes
  3754. * will not include this parameter.
  3755. */
  3756. removeExtraParameter(key: string): void;
  3757. /**
  3758. * This would normally be controlled by user preferences. This has no effect if
  3759. * called before `start` is called.
  3760. *
  3761. * **Note:** This method is only available in the main process.
  3762. */
  3763. setUploadToServer(uploadToServer: boolean): void;
  3764. /**
  3765. * This method must be called before using any other `crashReporter` APIs. Once
  3766. * initialized this way, the crashpad handler collects crashes from all
  3767. * subsequently created processes. The crash reporter cannot be disabled once
  3768. * started.
  3769. *
  3770. * This method should be called as early as possible in app startup, preferably
  3771. * before `app.on('ready')`. If the crash reporter is not initialized at the time a
  3772. * renderer process is created, then that renderer process will not be monitored by
  3773. * the crash reporter.
  3774. *
  3775. * **Note:** You can test out the crash reporter by generating a crash using
  3776. * `process.crash()`.
  3777. *
  3778. * **Note:** If you need to send additional/updated `extra` parameters after your
  3779. * first call `start` you can call `addExtraParameter`.
  3780. *
  3781. * **Note:** Parameters passed in `extra`, `globalExtra` or set with
  3782. * `addExtraParameter` have limits on the length of the keys and values. Key names
  3783. * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
  3784. * with names longer than the maximum will be silently ignored. Key values longer
  3785. * than the maximum length will be truncated.
  3786. *
  3787. * **Note:** This method is only available in the main process.
  3788. */
  3789. start(options: CrashReporterStartOptions): void;
  3790. }
  3791. interface CustomScheme {
  3792. // Docs: https://electronjs.org/docs/api/structures/custom-scheme
  3793. privileges?: Privileges;
  3794. /**
  3795. * Custom schemes to be registered with options.
  3796. */
  3797. scheme: string;
  3798. }
  3799. class Debugger extends NodeEventEmitter {
  3800. // Docs: https://electronjs.org/docs/api/debugger
  3801. /**
  3802. * Emitted when the debugging session is terminated. This happens either when
  3803. * `webContents` is closed or devtools is invoked for the attached `webContents`.
  3804. */
  3805. on(event: 'detach', listener: (event: Event,
  3806. /**
  3807. * Reason for detaching debugger.
  3808. */
  3809. reason: string) => void): this;
  3810. once(event: 'detach', listener: (event: Event,
  3811. /**
  3812. * Reason for detaching debugger.
  3813. */
  3814. reason: string) => void): this;
  3815. addListener(event: 'detach', listener: (event: Event,
  3816. /**
  3817. * Reason for detaching debugger.
  3818. */
  3819. reason: string) => void): this;
  3820. removeListener(event: 'detach', listener: (event: Event,
  3821. /**
  3822. * Reason for detaching debugger.
  3823. */
  3824. reason: string) => void): this;
  3825. /**
  3826. * Emitted whenever the debugging target issues an instrumentation event.
  3827. */
  3828. on(event: 'message', listener: (event: Event,
  3829. /**
  3830. * Method name.
  3831. */
  3832. method: string,
  3833. /**
  3834. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3835. * protocol.
  3836. */
  3837. params: any,
  3838. /**
  3839. * Unique identifier of attached debugging session, will match the value sent from
  3840. * `debugger.sendCommand`.
  3841. */
  3842. sessionId: string) => void): this;
  3843. once(event: 'message', listener: (event: Event,
  3844. /**
  3845. * Method name.
  3846. */
  3847. method: string,
  3848. /**
  3849. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3850. * protocol.
  3851. */
  3852. params: any,
  3853. /**
  3854. * Unique identifier of attached debugging session, will match the value sent from
  3855. * `debugger.sendCommand`.
  3856. */
  3857. sessionId: string) => void): this;
  3858. addListener(event: 'message', listener: (event: Event,
  3859. /**
  3860. * Method name.
  3861. */
  3862. method: string,
  3863. /**
  3864. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3865. * protocol.
  3866. */
  3867. params: any,
  3868. /**
  3869. * Unique identifier of attached debugging session, will match the value sent from
  3870. * `debugger.sendCommand`.
  3871. */
  3872. sessionId: string) => void): this;
  3873. removeListener(event: 'message', listener: (event: Event,
  3874. /**
  3875. * Method name.
  3876. */
  3877. method: string,
  3878. /**
  3879. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3880. * protocol.
  3881. */
  3882. params: any,
  3883. /**
  3884. * Unique identifier of attached debugging session, will match the value sent from
  3885. * `debugger.sendCommand`.
  3886. */
  3887. sessionId: string) => void): this;
  3888. /**
  3889. * Attaches the debugger to the `webContents`.
  3890. */
  3891. attach(protocolVersion?: string): void;
  3892. /**
  3893. * Detaches the debugger from the `webContents`.
  3894. */
  3895. detach(): void;
  3896. /**
  3897. * Whether a debugger is attached to the `webContents`.
  3898. */
  3899. isAttached(): boolean;
  3900. /**
  3901. * A promise that resolves with the response defined by the 'returns' attribute of
  3902. * the command description in the remote debugging protocol or is rejected
  3903. * indicating the failure of the command.
  3904. *
  3905. * Send given command to the debugging target.
  3906. */
  3907. sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
  3908. }
  3909. interface DesktopCapturer {
  3910. // Docs: https://electronjs.org/docs/api/desktop-capturer
  3911. /**
  3912. * Resolves with an array of `DesktopCapturerSource` objects, each
  3913. * `DesktopCapturerSource` represents a screen or an individual window that can be
  3914. * captured.
  3915. *
  3916. * **Note** Capturing the screen contents requires user consent on macOS 10.15
  3917. * Catalina or higher, which can detected by
  3918. * `systemPreferences.getMediaAccessStatus`.
  3919. */
  3920. getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
  3921. }
  3922. interface DesktopCapturerSource {
  3923. // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
  3924. /**
  3925. * An icon image of the application that owns the window or null if the source has
  3926. * a type screen. The size of the icon is not known in advance and depends on what
  3927. * the application provides.
  3928. */
  3929. appIcon: NativeImage;
  3930. /**
  3931. * A unique identifier that will correspond to the `id` of the matching Display
  3932. * returned by the Screen API. On some platforms, this is equivalent to the `XX`
  3933. * portion of the `id` field above and on others it will differ. It will be an
  3934. * empty string if not available.
  3935. */
  3936. display_id: string;
  3937. /**
  3938. * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
  3939. * constraint when calling [`navigator.webkitGetUserMedia`]. The format of the
  3940. * identifier will be `window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle.
  3941. * YY is 1 for the current process, and 0 for all others. ZZ is a sequential number
  3942. * that represents the screen, and it does not equal to the index in the source's
  3943. * name.
  3944. */
  3945. id: string;
  3946. /**
  3947. * A screen source will be named either `Entire Screen` or `Screen <index>`, while
  3948. * the name of a window source will match the window title.
  3949. */
  3950. name: string;
  3951. /**
  3952. * A thumbnail image. **Note:** There is no guarantee that the size of the
  3953. * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
  3954. * to `desktopCapturer.getSources`. The actual size depends on the scale of the
  3955. * screen or window.
  3956. */
  3957. thumbnail: NativeImage;
  3958. }
  3959. interface Dialog {
  3960. // Docs: https://electronjs.org/docs/api/dialog
  3961. /**
  3962. * resolves when the certificate trust dialog is shown.
  3963. *
  3964. * On macOS, this displays a modal dialog that shows a message and certificate
  3965. * information, and gives the user the option of trusting/importing the
  3966. * certificate. If you provide a `browserWindow` argument the dialog will be
  3967. * attached to the parent window, making it modal.
  3968. *
  3969. * On Windows the options are more limited, due to the Win32 APIs used:
  3970. *
  3971. * * The `message` argument is not used, as the OS provides its own confirmation
  3972. * dialog.
  3973. * * The `browserWindow` argument is ignored since it is not possible to make this
  3974. * confirmation dialog modal.
  3975. *
  3976. * @platform darwin,win32
  3977. */
  3978. showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
  3979. /**
  3980. * resolves when the certificate trust dialog is shown.
  3981. *
  3982. * On macOS, this displays a modal dialog that shows a message and certificate
  3983. * information, and gives the user the option of trusting/importing the
  3984. * certificate. If you provide a `browserWindow` argument the dialog will be
  3985. * attached to the parent window, making it modal.
  3986. *
  3987. * On Windows the options are more limited, due to the Win32 APIs used:
  3988. *
  3989. * * The `message` argument is not used, as the OS provides its own confirmation
  3990. * dialog.
  3991. * * The `browserWindow` argument is ignored since it is not possible to make this
  3992. * confirmation dialog modal.
  3993. *
  3994. * @platform darwin,win32
  3995. */
  3996. showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
  3997. /**
  3998. * Displays a modal dialog that shows an error message.
  3999. *
  4000. * This API can be called safely before the `ready` event the `app` module emits,
  4001. * it is usually used to report errors in early stage of startup. If called before
  4002. * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
  4003. * dialog will appear.
  4004. */
  4005. showErrorBox(title: string, content: string): void;
  4006. /**
  4007. * resolves with a promise containing the following properties:
  4008. *
  4009. * * `response` Number - The index of the clicked button.
  4010. * * `checkboxChecked` Boolean - The checked state of the checkbox if
  4011. * `checkboxLabel` was set. Otherwise `false`.
  4012. *
  4013. * Shows a message box.
  4014. *
  4015. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4016. * window, making it modal.
  4017. */
  4018. showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  4019. /**
  4020. * resolves with a promise containing the following properties:
  4021. *
  4022. * * `response` Number - The index of the clicked button.
  4023. * * `checkboxChecked` Boolean - The checked state of the checkbox if
  4024. * `checkboxLabel` was set. Otherwise `false`.
  4025. *
  4026. * Shows a message box.
  4027. *
  4028. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4029. * window, making it modal.
  4030. */
  4031. showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  4032. /**
  4033. * the index of the clicked button.
  4034. *
  4035. * Shows a message box, it will block the process until the message box is closed.
  4036. * It returns the index of the clicked button.
  4037. *
  4038. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4039. * window, making it modal. If `browserWindow` is not shown dialog will not be
  4040. * attached to it. In such case it will be displayed as an independent window.
  4041. */
  4042. showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
  4043. /**
  4044. * the index of the clicked button.
  4045. *
  4046. * Shows a message box, it will block the process until the message box is closed.
  4047. * It returns the index of the clicked button.
  4048. *
  4049. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4050. * window, making it modal. If `browserWindow` is not shown dialog will not be
  4051. * attached to it. In such case it will be displayed as an independent window.
  4052. */
  4053. showMessageBoxSync(options: MessageBoxSyncOptions): number;
  4054. /**
  4055. * Resolve with an object containing the following:
  4056. *
  4057. * * `canceled` Boolean - whether or not the dialog was canceled.
  4058. * * `filePaths` String[] - An array of file paths chosen by the user. If the
  4059. * dialog is cancelled this will be an empty array.
  4060. * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
  4061. * `filePaths` array of base64 encoded strings which contains security scoped
  4062. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  4063. * populated. (For return values, see table here.)
  4064. *
  4065. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4066. * window, making it modal.
  4067. *
  4068. * The `filters` specifies an array of file types that can be displayed or selected
  4069. * when you want to limit the user to a specific type. For example:
  4070. *
  4071. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  4072. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  4073. * `'*'` wildcard (no other wildcard is supported).
  4074. *
  4075. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  4076. * and a directory selector, so if you set `properties` to `['openFile',
  4077. * 'openDirectory']` on these platforms, a directory selector will be shown.
  4078. */
  4079. showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  4080. /**
  4081. * Resolve with an object containing the following:
  4082. *
  4083. * * `canceled` Boolean - whether or not the dialog was canceled.
  4084. * * `filePaths` String[] - An array of file paths chosen by the user. If the
  4085. * dialog is cancelled this will be an empty array.
  4086. * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
  4087. * `filePaths` array of base64 encoded strings which contains security scoped
  4088. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  4089. * populated. (For return values, see table here.)
  4090. *
  4091. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4092. * window, making it modal.
  4093. *
  4094. * The `filters` specifies an array of file types that can be displayed or selected
  4095. * when you want to limit the user to a specific type. For example:
  4096. *
  4097. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  4098. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  4099. * `'*'` wildcard (no other wildcard is supported).
  4100. *
  4101. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  4102. * and a directory selector, so if you set `properties` to `['openFile',
  4103. * 'openDirectory']` on these platforms, a directory selector will be shown.
  4104. */
  4105. showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  4106. /**
  4107. * the file paths chosen by the user; if the dialog is cancelled it returns
  4108. * `undefined`.
  4109. *
  4110. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4111. * window, making it modal.
  4112. *
  4113. * The `filters` specifies an array of file types that can be displayed or selected
  4114. * when you want to limit the user to a specific type. For example:
  4115. *
  4116. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  4117. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  4118. * `'*'` wildcard (no other wildcard is supported).
  4119. *
  4120. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  4121. * and a directory selector, so if you set `properties` to `['openFile',
  4122. * 'openDirectory']` on these platforms, a directory selector will be shown.
  4123. */
  4124. showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
  4125. /**
  4126. * the file paths chosen by the user; if the dialog is cancelled it returns
  4127. * `undefined`.
  4128. *
  4129. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4130. * window, making it modal.
  4131. *
  4132. * The `filters` specifies an array of file types that can be displayed or selected
  4133. * when you want to limit the user to a specific type. For example:
  4134. *
  4135. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  4136. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  4137. * `'*'` wildcard (no other wildcard is supported).
  4138. *
  4139. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  4140. * and a directory selector, so if you set `properties` to `['openFile',
  4141. * 'openDirectory']` on these platforms, a directory selector will be shown.
  4142. */
  4143. showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
  4144. /**
  4145. * Resolve with an object containing the following:
  4146. *
  4147. * * `canceled` Boolean - whether or not the dialog was canceled.
  4148. * * `filePath` String (optional) - If the dialog is canceled, this will be
  4149. * `undefined`.
  4150. * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
  4151. * contains the security scoped bookmark data for the saved file.
  4152. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  4153. * values, see table here.)
  4154. *
  4155. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4156. * window, making it modal.
  4157. *
  4158. * The `filters` specifies an array of file types that can be displayed, see
  4159. * `dialog.showOpenDialog` for an example.
  4160. *
  4161. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  4162. * issues when expanding and collapsing the dialog.
  4163. */
  4164. showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  4165. /**
  4166. * Resolve with an object containing the following:
  4167. *
  4168. * * `canceled` Boolean - whether or not the dialog was canceled.
  4169. * * `filePath` String (optional) - If the dialog is canceled, this will be
  4170. * `undefined`.
  4171. * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
  4172. * contains the security scoped bookmark data for the saved file.
  4173. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  4174. * values, see table here.)
  4175. *
  4176. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4177. * window, making it modal.
  4178. *
  4179. * The `filters` specifies an array of file types that can be displayed, see
  4180. * `dialog.showOpenDialog` for an example.
  4181. *
  4182. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  4183. * issues when expanding and collapsing the dialog.
  4184. */
  4185. showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  4186. /**
  4187. * the path of the file chosen by the user; if the dialog is cancelled it returns
  4188. * `undefined`.
  4189. *
  4190. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4191. * window, making it modal.
  4192. *
  4193. * The `filters` specifies an array of file types that can be displayed, see
  4194. * `dialog.showOpenDialog` for an example.
  4195. */
  4196. showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
  4197. /**
  4198. * the path of the file chosen by the user; if the dialog is cancelled it returns
  4199. * `undefined`.
  4200. *
  4201. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4202. * window, making it modal.
  4203. *
  4204. * The `filters` specifies an array of file types that can be displayed, see
  4205. * `dialog.showOpenDialog` for an example.
  4206. */
  4207. showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
  4208. }
  4209. interface Display {
  4210. // Docs: https://electronjs.org/docs/api/structures/display
  4211. /**
  4212. * Can be `available`, `unavailable`, `unknown`.
  4213. */
  4214. accelerometerSupport: ('available' | 'unavailable' | 'unknown');
  4215. /**
  4216. * the bounds of the display in DIP points.
  4217. */
  4218. bounds: Rectangle;
  4219. /**
  4220. * The number of bits per pixel.
  4221. */
  4222. colorDepth: number;
  4223. /**
  4224. * represent a color space (three-dimensional object which contains all realizable
  4225. * color combinations) for the purpose of color conversions
  4226. */
  4227. colorSpace: string;
  4228. /**
  4229. * The number of bits per color component.
  4230. */
  4231. depthPerComponent: number;
  4232. /**
  4233. * The display refresh rate.
  4234. */
  4235. displayFrequency: number;
  4236. /**
  4237. * Unique identifier associated with the display.
  4238. */
  4239. id: number;
  4240. /**
  4241. * `true` for an internal display and `false` for an external display
  4242. */
  4243. internal: boolean;
  4244. /**
  4245. * Whether or not the display is a monochrome display.
  4246. */
  4247. monochrome: boolean;
  4248. /**
  4249. * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
  4250. */
  4251. rotation: number;
  4252. /**
  4253. * Output device's pixel scale factor.
  4254. */
  4255. scaleFactor: number;
  4256. size: Size;
  4257. /**
  4258. * Can be `available`, `unavailable`, `unknown`.
  4259. */
  4260. touchSupport: ('available' | 'unavailable' | 'unknown');
  4261. /**
  4262. * the work area of the display in DIP points.
  4263. */
  4264. workArea: Rectangle;
  4265. workAreaSize: Size;
  4266. }
  4267. class Dock {
  4268. // Docs: https://electronjs.org/docs/api/dock
  4269. /**
  4270. * an ID representing the request.
  4271. *
  4272. * When `critical` is passed, the dock icon will bounce until either the
  4273. * application becomes active or the request is canceled.
  4274. *
  4275. * When `informational` is passed, the dock icon will bounce for one second.
  4276. * However, the request remains active until either the application becomes active
  4277. * or the request is canceled.
  4278. *
  4279. * **Nota Bene:** This method can only be used while the app is not focused; when
  4280. * the app is focused it will return -1.
  4281. *
  4282. * @platform darwin
  4283. */
  4284. bounce(type?: 'critical' | 'informational'): number;
  4285. /**
  4286. * Cancel the bounce of `id`.
  4287. *
  4288. * @platform darwin
  4289. */
  4290. cancelBounce(id: number): void;
  4291. /**
  4292. * Bounces the Downloads stack if the filePath is inside the Downloads folder.
  4293. *
  4294. * @platform darwin
  4295. */
  4296. downloadFinished(filePath: string): void;
  4297. /**
  4298. * The badge string of the dock.
  4299. *
  4300. * @platform darwin
  4301. */
  4302. getBadge(): string;
  4303. /**
  4304. * The application's [dock menu][dock-menu].
  4305. *
  4306. * @platform darwin
  4307. */
  4308. getMenu(): (Menu) | (null);
  4309. /**
  4310. * Hides the dock icon.
  4311. *
  4312. * @platform darwin
  4313. */
  4314. hide(): void;
  4315. /**
  4316. * Whether the dock icon is visible.
  4317. *
  4318. * @platform darwin
  4319. */
  4320. isVisible(): boolean;
  4321. /**
  4322. * Sets the string to be displayed in the dock’s badging area.
  4323. *
  4324. * @platform darwin
  4325. */
  4326. setBadge(text: string): void;
  4327. /**
  4328. * Sets the `image` associated with this dock icon.
  4329. *
  4330. * @platform darwin
  4331. */
  4332. setIcon(image: (NativeImage) | (string)): void;
  4333. /**
  4334. * Sets the application's [dock menu][dock-menu].
  4335. *
  4336. * @platform darwin
  4337. */
  4338. setMenu(menu: Menu): void;
  4339. /**
  4340. * Resolves when the dock icon is shown.
  4341. *
  4342. * @platform darwin
  4343. */
  4344. show(): Promise<void>;
  4345. }
  4346. class DownloadItem extends NodeEventEmitter {
  4347. // Docs: https://electronjs.org/docs/api/download-item
  4348. /**
  4349. * Emitted when the download is in a terminal state. This includes a completed
  4350. * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
  4351. * download that can't be resumed.
  4352. *
  4353. * The `state` can be one of following:
  4354. *
  4355. * * `completed` - The download completed successfully.
  4356. * * `cancelled` - The download has been cancelled.
  4357. * * `interrupted` - The download has interrupted and can not resume.
  4358. */
  4359. on(event: 'done', listener: (event: Event,
  4360. /**
  4361. * Can be `completed`, `cancelled` or `interrupted`.
  4362. */
  4363. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4364. once(event: 'done', listener: (event: Event,
  4365. /**
  4366. * Can be `completed`, `cancelled` or `interrupted`.
  4367. */
  4368. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4369. addListener(event: 'done', listener: (event: Event,
  4370. /**
  4371. * Can be `completed`, `cancelled` or `interrupted`.
  4372. */
  4373. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4374. removeListener(event: 'done', listener: (event: Event,
  4375. /**
  4376. * Can be `completed`, `cancelled` or `interrupted`.
  4377. */
  4378. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4379. /**
  4380. * Emitted when the download has been updated and is not done.
  4381. *
  4382. * The `state` can be one of following:
  4383. *
  4384. * * `progressing` - The download is in-progress.
  4385. * * `interrupted` - The download has interrupted and can be resumed.
  4386. */
  4387. on(event: 'updated', listener: (event: Event,
  4388. /**
  4389. * Can be `progressing` or `interrupted`.
  4390. */
  4391. state: ('progressing' | 'interrupted')) => void): this;
  4392. once(event: 'updated', listener: (event: Event,
  4393. /**
  4394. * Can be `progressing` or `interrupted`.
  4395. */
  4396. state: ('progressing' | 'interrupted')) => void): this;
  4397. addListener(event: 'updated', listener: (event: Event,
  4398. /**
  4399. * Can be `progressing` or `interrupted`.
  4400. */
  4401. state: ('progressing' | 'interrupted')) => void): this;
  4402. removeListener(event: 'updated', listener: (event: Event,
  4403. /**
  4404. * Can be `progressing` or `interrupted`.
  4405. */
  4406. state: ('progressing' | 'interrupted')) => void): this;
  4407. /**
  4408. * Cancels the download operation.
  4409. */
  4410. cancel(): void;
  4411. /**
  4412. * Whether the download can resume.
  4413. */
  4414. canResume(): boolean;
  4415. /**
  4416. * The Content-Disposition field from the response header.
  4417. */
  4418. getContentDisposition(): string;
  4419. /**
  4420. * ETag header value.
  4421. */
  4422. getETag(): string;
  4423. /**
  4424. * The file name of the download item.
  4425. *
  4426. * **Note:** The file name is not always the same as the actual one saved in local
  4427. * disk. If user changes the file name in a prompted download saving dialog, the
  4428. * actual name of saved file will be different.
  4429. */
  4430. getFilename(): string;
  4431. /**
  4432. * Last-Modified header value.
  4433. */
  4434. getLastModifiedTime(): string;
  4435. /**
  4436. * The files mime type.
  4437. */
  4438. getMimeType(): string;
  4439. /**
  4440. * The received bytes of the download item.
  4441. */
  4442. getReceivedBytes(): number;
  4443. /**
  4444. * Returns the object previously set by
  4445. * `downloadItem.setSaveDialogOptions(options)`.
  4446. */
  4447. getSaveDialogOptions(): SaveDialogOptions;
  4448. /**
  4449. * The save path of the download item. This will be either the path set via
  4450. * `downloadItem.setSavePath(path)` or the path selected from the shown save
  4451. * dialog.
  4452. */
  4453. getSavePath(): string;
  4454. /**
  4455. * Number of seconds since the UNIX epoch when the download was started.
  4456. */
  4457. getStartTime(): number;
  4458. /**
  4459. * The current state. Can be `progressing`, `completed`, `cancelled` or
  4460. * `interrupted`.
  4461. *
  4462. * **Note:** The following methods are useful specifically to resume a `cancelled`
  4463. * item when session is restarted.
  4464. */
  4465. getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
  4466. /**
  4467. * The total size in bytes of the download item.
  4468. *
  4469. * If the size is unknown, it returns 0.
  4470. */
  4471. getTotalBytes(): number;
  4472. /**
  4473. * The origin URL where the item is downloaded from.
  4474. */
  4475. getURL(): string;
  4476. /**
  4477. * The complete URL chain of the item including any redirects.
  4478. */
  4479. getURLChain(): string[];
  4480. /**
  4481. * Whether the download has user gesture.
  4482. */
  4483. hasUserGesture(): boolean;
  4484. /**
  4485. * Whether the download is paused.
  4486. */
  4487. isPaused(): boolean;
  4488. /**
  4489. * Pauses the download.
  4490. */
  4491. pause(): void;
  4492. /**
  4493. * Resumes the download that has been paused.
  4494. *
  4495. * **Note:** To enable resumable downloads the server you are downloading from must
  4496. * support range requests and provide both `Last-Modified` and `ETag` header
  4497. * values. Otherwise `resume()` will dismiss previously received bytes and restart
  4498. * the download from the beginning.
  4499. */
  4500. resume(): void;
  4501. /**
  4502. * This API allows the user to set custom options for the save dialog that opens
  4503. * for the download item by default. The API is only available in session's
  4504. * `will-download` callback function.
  4505. */
  4506. setSaveDialogOptions(options: SaveDialogOptions): void;
  4507. /**
  4508. * The API is only available in session's `will-download` callback function. If
  4509. * `path` doesn't exist, Electron will try to make the directory recursively. If
  4510. * user doesn't set the save path via the API, Electron will use the original
  4511. * routine to determine the save path; this usually prompts a save dialog.
  4512. */
  4513. setSavePath(path: string): void;
  4514. /**
  4515. * A `String` property that determines the save file path of the download item.
  4516. *
  4517. * The property is only available in session's `will-download` callback function.
  4518. * If user doesn't set the save path via the property, Electron will use the
  4519. * original routine to determine the save path; this usually prompts a save dialog.
  4520. */
  4521. savePath: string;
  4522. }
  4523. interface Event extends GlobalEvent {
  4524. // Docs: https://electronjs.org/docs/api/structures/event
  4525. preventDefault: (() => void);
  4526. }
  4527. interface Extension {
  4528. // Docs: https://electronjs.org/docs/api/structures/extension
  4529. id: string;
  4530. /**
  4531. * Copy of the extension's manifest data.
  4532. */
  4533. manifest: any;
  4534. name: string;
  4535. /**
  4536. * The extension's file path.
  4537. */
  4538. path: string;
  4539. /**
  4540. * The extension's `chrome-extension://` URL.
  4541. */
  4542. url: string;
  4543. version: string;
  4544. }
  4545. interface ExtensionInfo {
  4546. // Docs: https://electronjs.org/docs/api/structures/extension-info
  4547. name: string;
  4548. version: string;
  4549. }
  4550. interface FileFilter {
  4551. // Docs: https://electronjs.org/docs/api/structures/file-filter
  4552. extensions: string[];
  4553. name: string;
  4554. }
  4555. interface FilePathWithHeaders {
  4556. // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
  4557. /**
  4558. * Additional headers to be sent.
  4559. */
  4560. headers?: Record<string, string>;
  4561. /**
  4562. * The path to the file to send.
  4563. */
  4564. path: string;
  4565. }
  4566. interface GlobalShortcut {
  4567. // Docs: https://electronjs.org/docs/api/global-shortcut
  4568. /**
  4569. * Whether this application has registered `accelerator`.
  4570. *
  4571. * When the accelerator is already taken by other applications, this call will
  4572. * still return `false`. This behavior is intended by operating systems, since they
  4573. * don't want applications to fight for global shortcuts.
  4574. */
  4575. isRegistered(accelerator: Accelerator): boolean;
  4576. /**
  4577. * Whether or not the shortcut was registered successfully.
  4578. *
  4579. * Registers a global shortcut of `accelerator`. The `callback` is called when the
  4580. * registered shortcut is pressed by the user.
  4581. *
  4582. * When the accelerator is already taken by other applications, this call will
  4583. * silently fail. This behavior is intended by operating systems, since they don't
  4584. * want applications to fight for global shortcuts.
  4585. *
  4586. * The following accelerators will not be registered successfully on macOS 10.14
  4587. * Mojave unless the app has been authorized as a trusted accessibility client:
  4588. *
  4589. * * "Media Play/Pause"
  4590. * * "Media Next Track"
  4591. * * "Media Previous Track"
  4592. * * "Media Stop"
  4593. */
  4594. register(accelerator: Accelerator, callback: () => void): boolean;
  4595. /**
  4596. * Registers a global shortcut of all `accelerator` items in `accelerators`. The
  4597. * `callback` is called when any of the registered shortcuts are pressed by the
  4598. * user.
  4599. *
  4600. * When a given accelerator is already taken by other applications, this call will
  4601. * silently fail. This behavior is intended by operating systems, since they don't
  4602. * want applications to fight for global shortcuts.
  4603. *
  4604. * The following accelerators will not be registered successfully on macOS 10.14
  4605. * Mojave unless the app has been authorized as a trusted accessibility client:
  4606. *
  4607. * * "Media Play/Pause"
  4608. * * "Media Next Track"
  4609. * * "Media Previous Track"
  4610. * * "Media Stop"
  4611. */
  4612. registerAll(accelerators: string[], callback: () => void): void;
  4613. /**
  4614. * Unregisters the global shortcut of `accelerator`.
  4615. */
  4616. unregister(accelerator: Accelerator): void;
  4617. /**
  4618. * Unregisters all of the global shortcuts.
  4619. */
  4620. unregisterAll(): void;
  4621. }
  4622. interface GPUFeatureStatus {
  4623. // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
  4624. /**
  4625. * Canvas.
  4626. */
  4627. '2d_canvas': string;
  4628. /**
  4629. * Flash.
  4630. */
  4631. flash_3d: string;
  4632. /**
  4633. * Flash Stage3D.
  4634. */
  4635. flash_stage3d: string;
  4636. /**
  4637. * Flash Stage3D Baseline profile.
  4638. */
  4639. flash_stage3d_baseline: string;
  4640. /**
  4641. * Compositing.
  4642. */
  4643. gpu_compositing: string;
  4644. /**
  4645. * Multiple Raster Threads.
  4646. */
  4647. multiple_raster_threads: string;
  4648. /**
  4649. * Native GpuMemoryBuffers.
  4650. */
  4651. native_gpu_memory_buffers: string;
  4652. /**
  4653. * Rasterization.
  4654. */
  4655. rasterization: string;
  4656. /**
  4657. * Video Decode.
  4658. */
  4659. video_decode: string;
  4660. /**
  4661. * Video Encode.
  4662. */
  4663. video_encode: string;
  4664. /**
  4665. * VPx Video Decode.
  4666. */
  4667. vpx_decode: string;
  4668. /**
  4669. * WebGL.
  4670. */
  4671. webgl: string;
  4672. /**
  4673. * WebGL2.
  4674. */
  4675. webgl2: string;
  4676. }
  4677. interface HIDDevice {
  4678. // Docs: https://electronjs.org/docs/api/structures/hid-device
  4679. /**
  4680. * Unique identifier for the device.
  4681. */
  4682. deviceId: string;
  4683. /**
  4684. * Unique identifier for the HID interface. A device may have multiple HID
  4685. * interfaces.
  4686. */
  4687. guid?: string;
  4688. /**
  4689. * Name of the device.
  4690. */
  4691. name: string;
  4692. /**
  4693. * The USB product ID.
  4694. */
  4695. productId: number;
  4696. /**
  4697. * The USB device serial number.
  4698. */
  4699. serialNumber?: string;
  4700. /**
  4701. * The USB vendor ID.
  4702. */
  4703. vendorId: number;
  4704. }
  4705. interface InAppPurchase extends NodeJS.EventEmitter {
  4706. // Docs: https://electronjs.org/docs/api/in-app-purchase
  4707. on(event: 'transactions-updated', listener: Function): this;
  4708. once(event: 'transactions-updated', listener: Function): this;
  4709. addListener(event: 'transactions-updated', listener: Function): this;
  4710. removeListener(event: 'transactions-updated', listener: Function): this;
  4711. /**
  4712. * whether a user can make a payment.
  4713. */
  4714. canMakePayments(): boolean;
  4715. /**
  4716. * Completes all pending transactions.
  4717. */
  4718. finishAllTransactions(): void;
  4719. /**
  4720. * Completes the pending transactions corresponding to the date.
  4721. */
  4722. finishTransactionByDate(date: string): void;
  4723. /**
  4724. * Resolves with an array of `Product` objects.
  4725. *
  4726. * Retrieves the product descriptions.
  4727. */
  4728. getProducts(productIDs: string[]): Promise<Electron.Product[]>;
  4729. /**
  4730. * the path to the receipt.
  4731. */
  4732. getReceiptURL(): string;
  4733. /**
  4734. * Returns `true` if the product is valid and added to the payment queue.
  4735. *
  4736. * You should listen for the `transactions-updated` event as soon as possible and
  4737. * certainly before you call `purchaseProduct`.
  4738. */
  4739. purchaseProduct(productID: string, quantity?: number): Promise<boolean>;
  4740. /**
  4741. * Restores finished transactions. This method can be called either to install
  4742. * purchases on additional devices, or to restore purchases for an application that
  4743. * the user deleted and reinstalled.
  4744. *
  4745. * The payment queue delivers a new transaction for each previously completed
  4746. * transaction that can be restored. Each transaction includes a copy of the
  4747. * original transaction.
  4748. */
  4749. restoreCompletedTransactions(): void;
  4750. }
  4751. class IncomingMessage extends NodeEventEmitter {
  4752. // Docs: https://electronjs.org/docs/api/incoming-message
  4753. /**
  4754. * Emitted when a request has been canceled during an ongoing HTTP transaction.
  4755. */
  4756. on(event: 'aborted', listener: Function): this;
  4757. once(event: 'aborted', listener: Function): this;
  4758. addListener(event: 'aborted', listener: Function): this;
  4759. removeListener(event: 'aborted', listener: Function): this;
  4760. /**
  4761. * The `data` event is the usual method of transferring response data into
  4762. * applicative code.
  4763. */
  4764. on(event: 'data', listener: (
  4765. /**
  4766. * A chunk of response body's data.
  4767. */
  4768. chunk: Buffer) => void): this;
  4769. once(event: 'data', listener: (
  4770. /**
  4771. * A chunk of response body's data.
  4772. */
  4773. chunk: Buffer) => void): this;
  4774. addListener(event: 'data', listener: (
  4775. /**
  4776. * A chunk of response body's data.
  4777. */
  4778. chunk: Buffer) => void): this;
  4779. removeListener(event: 'data', listener: (
  4780. /**
  4781. * A chunk of response body's data.
  4782. */
  4783. chunk: Buffer) => void): this;
  4784. /**
  4785. * Indicates that response body has ended. Must be placed before 'data' event.
  4786. */
  4787. on(event: 'end', listener: Function): this;
  4788. once(event: 'end', listener: Function): this;
  4789. addListener(event: 'end', listener: Function): this;
  4790. removeListener(event: 'end', listener: Function): this;
  4791. /**
  4792. * Returns:
  4793. *
  4794. * `error` Error - Typically holds an error string identifying failure root cause.
  4795. *
  4796. * Emitted when an error was encountered while streaming response data events. For
  4797. * instance, if the server closes the underlying while the response is still
  4798. * streaming, an `error` event will be emitted on the response object and a `close`
  4799. * event will subsequently follow on the request object.
  4800. */
  4801. on(event: 'error', listener: Function): this;
  4802. once(event: 'error', listener: Function): this;
  4803. addListener(event: 'error', listener: Function): this;
  4804. removeListener(event: 'error', listener: Function): this;
  4805. /**
  4806. * A `Record<string, string | string[]>` representing the HTTP response headers.
  4807. * The `headers` object is formatted as follows:
  4808. *
  4809. * * All header names are lowercased.
  4810. * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,
  4811. * `etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,
  4812. * `last-modified`, `location`, `max-forwards`, `proxy-authorization`, `referer`,
  4813. * `retry-after`, `server`, or `user-agent` are discarded.
  4814. * * `set-cookie` is always an array. Duplicates are added to the array.
  4815. * * For duplicate `cookie` headers, the values are joined together with '; '.
  4816. * * For all other headers, the values are joined together with ', '.
  4817. */
  4818. headers: Record<string, (string) | (string[])>;
  4819. /**
  4820. * A `String` indicating the HTTP protocol version number. Typical values are '1.0'
  4821. * or '1.1'. Additionally `httpVersionMajor` and `httpVersionMinor` are two
  4822. * Integer-valued readable properties that return respectively the HTTP major and
  4823. * minor version numbers.
  4824. */
  4825. httpVersion: string;
  4826. /**
  4827. * An `Integer` indicating the HTTP protocol major version number.
  4828. */
  4829. httpVersionMajor: number;
  4830. /**
  4831. * An `Integer` indicating the HTTP protocol minor version number.
  4832. */
  4833. httpVersionMinor: number;
  4834. /**
  4835. * An `Integer` indicating the HTTP response status code.
  4836. */
  4837. statusCode: number;
  4838. /**
  4839. * A `String` representing the HTTP status message.
  4840. */
  4841. statusMessage: string;
  4842. }
  4843. interface InputEvent {
  4844. // Docs: https://electronjs.org/docs/api/structures/input-event
  4845. /**
  4846. * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
  4847. * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
  4848. * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
  4849. */
  4850. modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
  4851. }
  4852. interface IOCounters {
  4853. // Docs: https://electronjs.org/docs/api/structures/io-counters
  4854. /**
  4855. * Then number of I/O other operations.
  4856. */
  4857. otherOperationCount: number;
  4858. /**
  4859. * Then number of I/O other transfers.
  4860. */
  4861. otherTransferCount: number;
  4862. /**
  4863. * The number of I/O read operations.
  4864. */
  4865. readOperationCount: number;
  4866. /**
  4867. * The number of I/O read transfers.
  4868. */
  4869. readTransferCount: number;
  4870. /**
  4871. * The number of I/O write operations.
  4872. */
  4873. writeOperationCount: number;
  4874. /**
  4875. * The number of I/O write transfers.
  4876. */
  4877. writeTransferCount: number;
  4878. }
  4879. interface IpcMain extends NodeJS.EventEmitter {
  4880. // Docs: https://electronjs.org/docs/api/ipc-main
  4881. /**
  4882. * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
  4883. * renderer calls `ipcRenderer.invoke(channel, ...args)`.
  4884. *
  4885. * If `listener` returns a Promise, the eventual result of the promise will be
  4886. * returned as a reply to the remote caller. Otherwise, the return value of the
  4887. * listener will be used as the value of the reply.
  4888. *
  4889. * The `event` that is passed as the first argument to the handler is the same as
  4890. * that passed to a regular event listener. It includes information about which
  4891. * WebContents is the source of the invoke request.
  4892. *
  4893. * Errors thrown through `handle` in the main process are not transparent as they
  4894. * are serialized and only the `message` property from the original error is
  4895. * provided to the renderer process. Please refer to #24427 for details.
  4896. */
  4897. handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
  4898. /**
  4899. * Handles a single `invoke`able IPC message, then removes the listener. See
  4900. * `ipcMain.handle(channel, listener)`.
  4901. */
  4902. handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
  4903. /**
  4904. * Listens to `channel`, when a new message arrives `listener` would be called with
  4905. * `listener(event, args...)`.
  4906. */
  4907. on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  4908. /**
  4909. * Adds a one time `listener` function for the event. This `listener` is invoked
  4910. * only the next time a message is sent to `channel`, after which it is removed.
  4911. */
  4912. once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  4913. /**
  4914. * Removes listeners of the specified `channel`.
  4915. */
  4916. removeAllListeners(channel?: string): this;
  4917. /**
  4918. * Removes any handler for `channel`, if present.
  4919. */
  4920. removeHandler(channel: string): void;
  4921. /**
  4922. * Removes the specified `listener` from the listener array for the specified
  4923. * `channel`.
  4924. */
  4925. removeListener(channel: string, listener: (...args: any[]) => void): this;
  4926. }
  4927. interface IpcMainEvent extends Event {
  4928. // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
  4929. /**
  4930. * The ID of the renderer frame that sent this message
  4931. */
  4932. frameId: number;
  4933. /**
  4934. * A list of MessagePorts that were transferred with this message
  4935. */
  4936. ports: MessagePortMain[];
  4937. /**
  4938. * The internal ID of the renderer process that sent this message
  4939. */
  4940. processId: number;
  4941. /**
  4942. * A function that will send an IPC message to the renderer frame that sent the
  4943. * original message that you are currently handling. You should use this method to
  4944. * "reply" to the sent message in order to guarantee the reply will go to the
  4945. * correct process and frame.
  4946. */
  4947. reply: Function;
  4948. /**
  4949. * Set this to the value to be returned in a synchronous message
  4950. */
  4951. returnValue: any;
  4952. /**
  4953. * Returns the `webContents` that sent the message
  4954. */
  4955. sender: WebContents;
  4956. /**
  4957. * The frame that sent this message
  4958. *
  4959. */
  4960. readonly senderFrame: WebFrameMain;
  4961. }
  4962. interface IpcMainInvokeEvent extends Event {
  4963. // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
  4964. /**
  4965. * The ID of the renderer frame that sent this message
  4966. */
  4967. frameId: number;
  4968. /**
  4969. * The internal ID of the renderer process that sent this message
  4970. */
  4971. processId: number;
  4972. /**
  4973. * Returns the `webContents` that sent the message
  4974. */
  4975. sender: WebContents;
  4976. /**
  4977. * The frame that sent this message
  4978. *
  4979. */
  4980. readonly senderFrame: WebFrameMain;
  4981. }
  4982. interface IpcRenderer extends NodeJS.EventEmitter {
  4983. // Docs: https://electronjs.org/docs/api/ipc-renderer
  4984. /**
  4985. * Resolves with the response from the main process.
  4986. *
  4987. * Send a message to the main process via `channel` and expect a result
  4988. * asynchronously. Arguments will be serialized with the Structured Clone
  4989. * Algorithm, just like `window.postMessage`, so prototype chains will not be
  4990. * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
  4991. * an exception.
  4992. *
  4993. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  4994. * Electron objects will throw an exception.
  4995. *
  4996. * Since the main process does not have support for DOM objects such as
  4997. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  4998. * Electron's IPC to the main process, as the main process would have no way to
  4999. * decode them. Attempting to send such objects over IPC will result in an error.
  5000. *
  5001. * The main process should listen for `channel` with `ipcMain.handle()`.
  5002. *
  5003. * For example:
  5004. *
  5005. * If you need to transfer a `MessagePort` to the main process, use
  5006. * `ipcRenderer.postMessage`.
  5007. *
  5008. * If you do not need a response to the message, consider using `ipcRenderer.send`.
  5009. */
  5010. invoke(channel: string, ...args: any[]): Promise<any>;
  5011. /**
  5012. * Listens to `channel`, when a new message arrives `listener` would be called with
  5013. * `listener(event, args...)`.
  5014. */
  5015. on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  5016. /**
  5017. * Adds a one time `listener` function for the event. This `listener` is invoked
  5018. * only the next time a message is sent to `channel`, after which it is removed.
  5019. */
  5020. once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  5021. /**
  5022. * Send a message to the main process, optionally transferring ownership of zero or
  5023. * more `MessagePort` objects.
  5024. *
  5025. * The transferred `MessagePort` objects will be available in the main process as
  5026. * `MessagePortMain` objects by accessing the `ports` property of the emitted
  5027. * event.
  5028. *
  5029. * For example:
  5030. *
  5031. * For more information on using `MessagePort` and `MessageChannel`, see the MDN
  5032. * documentation.
  5033. */
  5034. postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
  5035. /**
  5036. * Removes all listeners, or those of the specified `channel`.
  5037. */
  5038. removeAllListeners(channel: string): this;
  5039. /**
  5040. * Removes the specified `listener` from the listener array for the specified
  5041. * `channel`.
  5042. */
  5043. removeListener(channel: string, listener: (...args: any[]) => void): this;
  5044. /**
  5045. * Send an asynchronous message to the main process via `channel`, along with
  5046. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  5047. * just like `window.postMessage`, so prototype chains will not be included.
  5048. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  5049. * exception.
  5050. *
  5051. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  5052. * Electron objects will throw an exception.
  5053. *
  5054. * Since the main process does not have support for DOM objects such as
  5055. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  5056. * Electron's IPC to the main process, as the main process would have no way to
  5057. * decode them. Attempting to send such objects over IPC will result in an error.
  5058. *
  5059. * The main process handles it by listening for `channel` with the `ipcMain`
  5060. * module.
  5061. *
  5062. * If you need to transfer a `MessagePort` to the main process, use
  5063. * `ipcRenderer.postMessage`.
  5064. *
  5065. * If you want to receive a single response from the main process, like the result
  5066. * of a method call, consider using `ipcRenderer.invoke`.
  5067. */
  5068. send(channel: string, ...args: any[]): void;
  5069. /**
  5070. * The value sent back by the `ipcMain` handler.
  5071. *
  5072. * Send a message to the main process via `channel` and expect a result
  5073. * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
  5074. * just like `window.postMessage`, so prototype chains will not be included.
  5075. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  5076. * exception.
  5077. *
  5078. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  5079. * Electron objects will throw an exception.
  5080. *
  5081. * Since the main process does not have support for DOM objects such as
  5082. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  5083. * Electron's IPC to the main process, as the main process would have no way to
  5084. * decode them. Attempting to send such objects over IPC will result in an error.
  5085. *
  5086. * The main process handles it by listening for `channel` with `ipcMain` module,
  5087. * and replies by setting `event.returnValue`.
  5088. *
  5089. * > :warning: **WARNING**: Sending a synchronous message will block the whole
  5090. * renderer process until the reply is received, so use this method only as a last
  5091. * resort. It's much better to use the asynchronous version, `invoke()`.
  5092. */
  5093. sendSync(channel: string, ...args: any[]): any;
  5094. /**
  5095. * Sends a message to a window with `webContentsId` via `channel`.
  5096. */
  5097. sendTo(webContentsId: number, channel: string, ...args: any[]): void;
  5098. /**
  5099. * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
  5100. * the host page instead of the main process.
  5101. */
  5102. sendToHost(channel: string, ...args: any[]): void;
  5103. }
  5104. interface IpcRendererEvent extends Event {
  5105. // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
  5106. /**
  5107. * A list of MessagePorts that were transferred with this message
  5108. */
  5109. ports: MessagePort[];
  5110. /**
  5111. * The `IpcRenderer` instance that emitted the event originally
  5112. */
  5113. sender: IpcRenderer;
  5114. /**
  5115. * The `webContents.id` that sent the message, you can call
  5116. * `event.sender.sendTo(event.senderId, ...)` to reply to the message, see
  5117. * ipcRenderer.sendTo for more information. This only applies to messages sent from
  5118. * a different renderer. Messages sent directly from the main process set
  5119. * `event.senderId` to `0`.
  5120. */
  5121. senderId: number;
  5122. }
  5123. interface JumpListCategory {
  5124. // Docs: https://electronjs.org/docs/api/structures/jump-list-category
  5125. /**
  5126. * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
  5127. * should be omitted.
  5128. */
  5129. items?: JumpListItem[];
  5130. /**
  5131. * Must be set if `type` is `custom`, otherwise it should be omitted.
  5132. */
  5133. name?: string;
  5134. /**
  5135. * One of the following:
  5136. */
  5137. type?: ('tasks' | 'frequent' | 'recent' | 'custom');
  5138. }
  5139. interface JumpListItem {
  5140. // Docs: https://electronjs.org/docs/api/structures/jump-list-item
  5141. /**
  5142. * The command line arguments when `program` is executed. Should only be set if
  5143. * `type` is `task`.
  5144. */
  5145. args?: string;
  5146. /**
  5147. * Description of the task (displayed in a tooltip). Should only be set if `type`
  5148. * is `task`. Maximum length 260 characters.
  5149. */
  5150. description?: string;
  5151. /**
  5152. * The index of the icon in the resource file. If a resource file contains multiple
  5153. * icons this value can be used to specify the zero-based index of the icon that
  5154. * should be displayed for this task. If a resource file contains only one icon,
  5155. * this property should be set to zero.
  5156. */
  5157. iconIndex?: number;
  5158. /**
  5159. * The absolute path to an icon to be displayed in a Jump List, which can be an
  5160. * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
  5161. * can usually specify `process.execPath` to show the program icon.
  5162. */
  5163. iconPath?: string;
  5164. /**
  5165. * Path of the file to open, should only be set if `type` is `file`.
  5166. */
  5167. path?: string;
  5168. /**
  5169. * Path of the program to execute, usually you should specify `process.execPath`
  5170. * which opens the current program. Should only be set if `type` is `task`.
  5171. */
  5172. program?: string;
  5173. /**
  5174. * The text to be displayed for the item in the Jump List. Should only be set if
  5175. * `type` is `task`.
  5176. */
  5177. title?: string;
  5178. /**
  5179. * One of the following:
  5180. */
  5181. type?: ('task' | 'separator' | 'file');
  5182. /**
  5183. * The working directory. Default is empty.
  5184. */
  5185. workingDirectory?: string;
  5186. }
  5187. interface KeyboardEvent {
  5188. // Docs: https://electronjs.org/docs/api/structures/keyboard-event
  5189. /**
  5190. * whether an Alt key was used in an accelerator to trigger the Event
  5191. */
  5192. altKey?: boolean;
  5193. /**
  5194. * whether the Control key was used in an accelerator to trigger the Event
  5195. */
  5196. ctrlKey?: boolean;
  5197. /**
  5198. * whether a meta key was used in an accelerator to trigger the Event
  5199. */
  5200. metaKey?: boolean;
  5201. /**
  5202. * whether a Shift key was used in an accelerator to trigger the Event
  5203. */
  5204. shiftKey?: boolean;
  5205. /**
  5206. * whether an accelerator was used to trigger the event as opposed to another user
  5207. * gesture like mouse click
  5208. */
  5209. triggeredByAccelerator?: boolean;
  5210. }
  5211. interface KeyboardInputEvent extends InputEvent {
  5212. // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
  5213. /**
  5214. * The character that will be sent as the keyboard event. Should only use the valid
  5215. * key codes in Accelerator.
  5216. */
  5217. keyCode: string;
  5218. /**
  5219. * The type of the event, can be `keyDown`, `keyUp` or `char`.
  5220. */
  5221. type: ('keyDown' | 'keyUp' | 'char');
  5222. }
  5223. interface MemoryInfo {
  5224. // Docs: https://electronjs.org/docs/api/structures/memory-info
  5225. /**
  5226. * The maximum amount of memory that has ever been pinned to actual physical RAM.
  5227. */
  5228. peakWorkingSetSize: number;
  5229. /**
  5230. * The amount of memory not shared by other processes, such as JS heap or HTML
  5231. * content.
  5232. *
  5233. * @platform win32
  5234. */
  5235. privateBytes?: number;
  5236. /**
  5237. * The amount of memory currently pinned to actual physical RAM.
  5238. */
  5239. workingSetSize: number;
  5240. }
  5241. interface MemoryUsageDetails {
  5242. // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
  5243. count: number;
  5244. liveSize: number;
  5245. size: number;
  5246. }
  5247. class Menu {
  5248. // Docs: https://electronjs.org/docs/api/menu
  5249. /**
  5250. * Emitted when a popup is closed either manually or with `menu.closePopup()`.
  5251. */
  5252. on(event: 'menu-will-close', listener: (event: Event) => void): this;
  5253. once(event: 'menu-will-close', listener: (event: Event) => void): this;
  5254. addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  5255. removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  5256. /**
  5257. * Emitted when `menu.popup()` is called.
  5258. */
  5259. on(event: 'menu-will-show', listener: (event: Event) => void): this;
  5260. once(event: 'menu-will-show', listener: (event: Event) => void): this;
  5261. addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  5262. removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  5263. /**
  5264. * Menu
  5265. */
  5266. constructor();
  5267. /**
  5268. * Generally, the `template` is an array of `options` for constructing a MenuItem.
  5269. * The usage can be referenced above.
  5270. *
  5271. * You can also attach other fields to the element of the `template` and they will
  5272. * become properties of the constructed menu items.
  5273. */
  5274. static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
  5275. /**
  5276. * The application menu, if set, or `null`, if not set.
  5277. *
  5278. * **Note:** The returned `Menu` instance doesn't support dynamic addition or
  5279. * removal of menu items. Instance properties can still be dynamically modified.
  5280. */
  5281. static getApplicationMenu(): (Menu) | (null);
  5282. /**
  5283. * Sends the `action` to the first responder of application. This is used for
  5284. * emulating default macOS menu behaviors. Usually you would use the `role`
  5285. * property of a `MenuItem`.
  5286. *
  5287. * See the macOS Cocoa Event Handling Guide for more information on macOS' native
  5288. * actions.
  5289. *
  5290. * @platform darwin
  5291. */
  5292. static sendActionToFirstResponder(action: string): void;
  5293. /**
  5294. * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
  5295. * will be set as each window's top menu.
  5296. *
  5297. * Also on Windows and Linux, you can use a `&` in the top-level item name to
  5298. * indicate which letter should get a generated accelerator. For example, using
  5299. * `&File` for the file menu would result in a generated `Alt-F` accelerator that
  5300. * opens the associated menu. The indicated character in the button label then gets
  5301. * an underline, and the `&` character is not displayed on the button label.
  5302. *
  5303. * In order to escape the `&` character in an item name, add a proceeding `&`. For
  5304. * example, `&&File` would result in `&File` displayed on the button label.
  5305. *
  5306. * Passing `null` will suppress the default menu. On Windows and Linux, this has
  5307. * the additional effect of removing the menu bar from the window.
  5308. *
  5309. * **Note:** The default menu will be created automatically if the app does not set
  5310. * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
  5311. * `Help`.
  5312. */
  5313. static setApplicationMenu(menu: (Menu) | (null)): void;
  5314. /**
  5315. * Appends the `menuItem` to the menu.
  5316. */
  5317. append(menuItem: MenuItem): void;
  5318. /**
  5319. * Closes the context menu in the `browserWindow`.
  5320. */
  5321. closePopup(browserWindow?: BrowserWindow): void;
  5322. /**
  5323. * the item with the specified `id`
  5324. */
  5325. getMenuItemById(id: string): (MenuItem) | (null);
  5326. /**
  5327. * Inserts the `menuItem` to the `pos` position of the menu.
  5328. */
  5329. insert(pos: number, menuItem: MenuItem): void;
  5330. /**
  5331. * Pops up this menu as a context menu in the `BrowserWindow`.
  5332. */
  5333. popup(options?: PopupOptions): void;
  5334. /**
  5335. * A `MenuItem[]` array containing the menu's items.
  5336. *
  5337. * Each `Menu` consists of multiple `MenuItem`s and each `MenuItem` can have a
  5338. * submenu.
  5339. */
  5340. items: MenuItem[];
  5341. }
  5342. class MenuItem {
  5343. // Docs: https://electronjs.org/docs/api/menu-item
  5344. /**
  5345. * MenuItem
  5346. */
  5347. constructor(options: MenuItemConstructorOptions);
  5348. /**
  5349. * An `Accelerator` (optional) indicating the item's accelerator, if set.
  5350. */
  5351. accelerator?: Accelerator;
  5352. /**
  5353. * A `Boolean` indicating whether the item is checked, this property can be
  5354. * dynamically changed.
  5355. *
  5356. * A `checkbox` menu item will toggle the `checked` property on and off when
  5357. * selected.
  5358. *
  5359. * A `radio` menu item will turn on its `checked` property when clicked, and will
  5360. * turn off that property for all adjacent items in the same menu.
  5361. *
  5362. * You can add a `click` function for additional behavior.
  5363. */
  5364. checked: boolean;
  5365. /**
  5366. * A `Function` that is fired when the MenuItem receives a click event. It can be
  5367. * called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
  5368. *
  5369. * * `event` KeyboardEvent
  5370. * * `focusedWindow` BrowserWindow
  5371. * * `focusedWebContents` WebContents
  5372. */
  5373. click: Function;
  5374. /**
  5375. * A `Number` indicating an item's sequential unique id.
  5376. */
  5377. commandId: number;
  5378. /**
  5379. * A `Boolean` indicating whether the item is enabled, this property can be
  5380. * dynamically changed.
  5381. */
  5382. enabled: boolean;
  5383. /**
  5384. * A `NativeImage | String` (optional) indicating the item's icon, if set.
  5385. */
  5386. icon?: (NativeImage) | (string);
  5387. /**
  5388. * A `String` indicating the item's unique id, this property can be dynamically
  5389. * changed.
  5390. */
  5391. id: string;
  5392. /**
  5393. * A `String` indicating the item's visible label.
  5394. */
  5395. label: string;
  5396. /**
  5397. * A `Menu` that the item is a part of.
  5398. */
  5399. menu: Menu;
  5400. /**
  5401. * A `Boolean` indicating if the accelerator should be registered with the system
  5402. * or just displayed.
  5403. *
  5404. * This property can be dynamically changed.
  5405. */
  5406. registerAccelerator: boolean;
  5407. /**
  5408. * A `String` (optional) indicating the item's role, if set. Can be `undo`, `redo`,
  5409. * `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`, `selectAll`, `reload`,
  5410. * `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`, `zoomOut`,
  5411. * `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`, `close`, `help`,
  5412. * `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
  5413. * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
  5414. * `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`,
  5415. * `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`,
  5416. * `moveTabToNewWindow` or `windowMenu`
  5417. */
  5418. 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' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  5419. /**
  5420. * A `SharingItem` indicating the item to share when the `role` is `shareMenu`.
  5421. *
  5422. * This property can be dynamically changed.
  5423. *
  5424. * @platform darwin
  5425. */
  5426. sharingItem: SharingItem;
  5427. /**
  5428. * A `String` indicating the item's sublabel.
  5429. */
  5430. sublabel: string;
  5431. /**
  5432. * A `Menu` (optional) containing the menu item's submenu, if present.
  5433. */
  5434. submenu?: Menu;
  5435. /**
  5436. * A `String` indicating the item's hover text.
  5437. *
  5438. * @platform darwin
  5439. */
  5440. toolTip: string;
  5441. /**
  5442. * A `String` indicating the type of the item. Can be `normal`, `separator`,
  5443. * `submenu`, `checkbox` or `radio`.
  5444. */
  5445. type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  5446. /**
  5447. * An `Accelerator | null` indicating the item's user-assigned accelerator for the
  5448. * menu item.
  5449. *
  5450. * **Note:** This property is only initialized after the `MenuItem` has been added
  5451. * to a `Menu`. Either via `Menu.buildFromTemplate` or via
  5452. * `Menu.append()/insert()`. Accessing before initialization will just return
  5453. * `null`.
  5454. *
  5455. * @platform darwin
  5456. */
  5457. readonly userAccelerator: (Accelerator) | (null);
  5458. /**
  5459. * A `Boolean` indicating whether the item is visible, this property can be
  5460. * dynamically changed.
  5461. */
  5462. visible: boolean;
  5463. }
  5464. class MessageChannelMain extends NodeEventEmitter {
  5465. // Docs: https://electronjs.org/docs/api/message-channel-main
  5466. /**
  5467. * A `MessagePortMain` property.
  5468. */
  5469. port1: MessagePortMain;
  5470. /**
  5471. * A `MessagePortMain` property.
  5472. */
  5473. port2: MessagePortMain;
  5474. }
  5475. class MessagePortMain extends NodeEventEmitter {
  5476. // Docs: https://electronjs.org/docs/api/message-port-main
  5477. /**
  5478. * Emitted when the remote end of a MessagePortMain object becomes disconnected.
  5479. */
  5480. on(event: 'close', listener: Function): this;
  5481. once(event: 'close', listener: Function): this;
  5482. addListener(event: 'close', listener: Function): this;
  5483. removeListener(event: 'close', listener: Function): this;
  5484. /**
  5485. * Emitted when a MessagePortMain object receives a message.
  5486. */
  5487. on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5488. once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5489. addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5490. removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5491. /**
  5492. * Disconnects the port, so it is no longer active.
  5493. */
  5494. close(): void;
  5495. /**
  5496. * Sends a message from the port, and optionally, transfers ownership of objects to
  5497. * other browsing contexts.
  5498. */
  5499. postMessage(message: any, transfer?: MessagePortMain[]): void;
  5500. /**
  5501. * Starts the sending of messages queued on the port. Messages will be queued until
  5502. * this method is called.
  5503. */
  5504. start(): void;
  5505. }
  5506. interface MimeTypedBuffer {
  5507. // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
  5508. /**
  5509. * Charset of the buffer.
  5510. */
  5511. charset?: string;
  5512. /**
  5513. * The actual Buffer content.
  5514. */
  5515. data: Buffer;
  5516. /**
  5517. * MIME type of the buffer.
  5518. */
  5519. mimeType?: string;
  5520. }
  5521. interface MouseInputEvent extends InputEvent {
  5522. // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
  5523. /**
  5524. * The button pressed, can be `left`, `middle`, `right`.
  5525. */
  5526. button?: ('left' | 'middle' | 'right');
  5527. clickCount?: number;
  5528. globalX?: number;
  5529. globalY?: number;
  5530. movementX?: number;
  5531. movementY?: number;
  5532. /**
  5533. * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
  5534. * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
  5535. */
  5536. type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
  5537. x: number;
  5538. y: number;
  5539. }
  5540. interface MouseWheelInputEvent extends MouseInputEvent {
  5541. // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
  5542. accelerationRatioX?: number;
  5543. accelerationRatioY?: number;
  5544. canScroll?: boolean;
  5545. deltaX?: number;
  5546. deltaY?: number;
  5547. hasPreciseScrollingDeltas?: boolean;
  5548. /**
  5549. * The type of the event, can be `mouseWheel`.
  5550. */
  5551. type: ('mouseWheel');
  5552. wheelTicksX?: number;
  5553. wheelTicksY?: number;
  5554. }
  5555. class NativeImage {
  5556. // Docs: https://electronjs.org/docs/api/native-image
  5557. /**
  5558. * Creates an empty `NativeImage` instance.
  5559. */
  5560. static createEmpty(): NativeImage;
  5561. /**
  5562. * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
  5563. * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
  5564. */
  5565. static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
  5566. /**
  5567. * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
  5568. * JPEG first.
  5569. */
  5570. static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
  5571. /**
  5572. * Creates a new `NativeImage` instance from `dataURL`.
  5573. */
  5574. static createFromDataURL(dataURL: string): NativeImage;
  5575. /**
  5576. * Creates a new `NativeImage` instance from the NSImage that maps to the given
  5577. * image name. See `System Icons` for a list of possible values.
  5578. *
  5579. * The `hslShift` is applied to the image with the following rules:
  5580. *
  5581. * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
  5582. * and 360 on the hue color wheel (red).
  5583. * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
  5584. * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
  5585. * saturate the image.
  5586. * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
  5587. * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
  5588. * leave unchanged. 1 = full lightness (make all pixels white).
  5589. *
  5590. * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
  5591. * 0]` will make the image completely black.
  5592. *
  5593. * In some cases, the `NSImageName` doesn't match its string representation; one
  5594. * example of this is `NSFolderImageName`, whose string representation would
  5595. * actually be `NSFolder`. Therefore, you'll need to determine the correct string
  5596. * representation for your image before passing it in. This can be done with the
  5597. * following:
  5598. *
  5599. * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
  5600. * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
  5601. *
  5602. * where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
  5603. *
  5604. * @platform darwin
  5605. */
  5606. static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
  5607. /**
  5608. * Creates a new `NativeImage` instance from a file located at `path`. This method
  5609. * returns an empty image if the `path` does not exist, cannot be read, or is not a
  5610. * valid image.
  5611. */
  5612. static createFromPath(path: string): NativeImage;
  5613. /**
  5614. * fulfilled with the file's thumbnail preview image, which is a NativeImage.
  5615. *
  5616. * @platform darwin,win32
  5617. */
  5618. static createThumbnailFromPath(path: string, maxSize: Size): Promise<Electron.NativeImage>;
  5619. /**
  5620. * Add an image representation for a specific scale factor. This can be used to
  5621. * explicitly add different scale factor representations to an image. This can be
  5622. * called on empty images.
  5623. */
  5624. addRepresentation(options: AddRepresentationOptions): void;
  5625. /**
  5626. * The cropped image.
  5627. */
  5628. crop(rect: Rectangle): NativeImage;
  5629. /**
  5630. * The image's aspect ratio.
  5631. *
  5632. * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
  5633. * the image representation most closely matching the passed value.
  5634. */
  5635. getAspectRatio(scaleFactor?: number): number;
  5636. /**
  5637. * A Buffer that contains the image's raw bitmap pixel data.
  5638. *
  5639. * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
  5640. * not copy the bitmap data, so you have to use the returned Buffer immediately in
  5641. * current event loop tick; otherwise the data might be changed or destroyed.
  5642. */
  5643. getBitmap(options?: BitmapOptions): Buffer;
  5644. /**
  5645. * A Buffer that stores C pointer to underlying native handle of the image. On
  5646. * macOS, a pointer to `NSImage` instance would be returned.
  5647. *
  5648. * Notice that the returned pointer is a weak pointer to the underlying native
  5649. * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
  5650. * instance is kept around.
  5651. *
  5652. * @platform darwin
  5653. */
  5654. getNativeHandle(): Buffer;
  5655. /**
  5656. * An array of all scale factors corresponding to representations for a given
  5657. * nativeImage.
  5658. */
  5659. getScaleFactors(): number[];
  5660. /**
  5661. * If `scaleFactor` is passed, this will return the size corresponding to the image
  5662. * representation most closely matching the passed value.
  5663. */
  5664. getSize(scaleFactor?: number): Size;
  5665. /**
  5666. * Whether the image is empty.
  5667. */
  5668. isEmpty(): boolean;
  5669. /**
  5670. * Whether the image is a template image.
  5671. */
  5672. isTemplateImage(): boolean;
  5673. /**
  5674. * The resized image.
  5675. *
  5676. * If only the `height` or the `width` are specified then the current aspect ratio
  5677. * will be preserved in the resized image.
  5678. */
  5679. resize(options: ResizeOptions): NativeImage;
  5680. /**
  5681. * Marks the image as a template image.
  5682. */
  5683. setTemplateImage(option: boolean): void;
  5684. /**
  5685. * A Buffer that contains a copy of the image's raw bitmap pixel data.
  5686. */
  5687. toBitmap(options?: ToBitmapOptions): Buffer;
  5688. /**
  5689. * The data URL of the image.
  5690. */
  5691. toDataURL(options?: ToDataURLOptions): string;
  5692. /**
  5693. * A Buffer that contains the image's `JPEG` encoded data.
  5694. */
  5695. toJPEG(quality: number): Buffer;
  5696. /**
  5697. * A Buffer that contains the image's `PNG` encoded data.
  5698. */
  5699. toPNG(options?: ToPNGOptions): Buffer;
  5700. /**
  5701. * A `Boolean` property that determines whether the image is considered a template
  5702. * image.
  5703. *
  5704. * Please note that this property only has an effect on macOS.
  5705. *
  5706. * @platform darwin
  5707. */
  5708. isMacTemplateImage: boolean;
  5709. }
  5710. interface NativeTheme extends NodeJS.EventEmitter {
  5711. // Docs: https://electronjs.org/docs/api/native-theme
  5712. /**
  5713. * Emitted when something in the underlying NativeTheme has changed. This normally
  5714. * means that either the value of `shouldUseDarkColors`,
  5715. * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
  5716. * will have to check them to determine which one has changed.
  5717. */
  5718. on(event: 'updated', listener: Function): this;
  5719. once(event: 'updated', listener: Function): this;
  5720. addListener(event: 'updated', listener: Function): this;
  5721. removeListener(event: 'updated', listener: Function): this;
  5722. /**
  5723. * A `Boolean` for if the OS / Chromium currently has a dark mode enabled or is
  5724. * being instructed to show a dark-style UI. If you want to modify this value you
  5725. * should use `themeSource` below.
  5726. *
  5727. */
  5728. readonly shouldUseDarkColors: boolean;
  5729. /**
  5730. * A `Boolean` for if the OS / Chromium currently has high-contrast mode enabled or
  5731. * is being instructed to show a high-contrast UI.
  5732. *
  5733. * @platform darwin,win32
  5734. */
  5735. readonly shouldUseHighContrastColors: boolean;
  5736. /**
  5737. * A `Boolean` for if the OS / Chromium currently has an inverted color scheme or
  5738. * is being instructed to use an inverted color scheme.
  5739. *
  5740. * @platform darwin,win32
  5741. */
  5742. readonly shouldUseInvertedColorScheme: boolean;
  5743. /**
  5744. * A `String` property that can be `system`, `light` or `dark`. It is used to
  5745. * override and supersede the value that Chromium has chosen to use internally.
  5746. *
  5747. * Setting this property to `system` will remove the override and everything will
  5748. * be reset to the OS default. By default `themeSource` is `system`.
  5749. *
  5750. * Settings this property to `dark` will have the following effects:
  5751. *
  5752. * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
  5753. * * Any UI Electron renders on Linux and Windows including context menus,
  5754. * devtools, etc. will use the dark UI.
  5755. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  5756. * the dark UI.
  5757. * * The `prefers-color-scheme` CSS query will match `dark` mode.
  5758. * * The `updated` event will be emitted
  5759. *
  5760. * Settings this property to `light` will have the following effects:
  5761. *
  5762. * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
  5763. * * Any UI Electron renders on Linux and Windows including context menus,
  5764. * devtools, etc. will use the light UI.
  5765. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  5766. * the light UI.
  5767. * * The `prefers-color-scheme` CSS query will match `light` mode.
  5768. * * The `updated` event will be emitted
  5769. *
  5770. * The usage of this property should align with a classic "dark mode" state machine
  5771. * in your application where the user has three options.
  5772. *
  5773. * * `Follow OS` --> `themeSource = 'system'`
  5774. * * `Dark Mode` --> `themeSource = 'dark'`
  5775. * * `Light Mode` --> `themeSource = 'light'`
  5776. *
  5777. * Your application should then always use `shouldUseDarkColors` to determine what
  5778. * CSS to apply.
  5779. */
  5780. themeSource: ('system' | 'light' | 'dark');
  5781. }
  5782. interface Net {
  5783. // Docs: https://electronjs.org/docs/api/net
  5784. /**
  5785. * Whether there is currently internet connection.
  5786. *
  5787. * A return value of `false` is a pretty strong indicator that the user won't be
  5788. * able to connect to remote sites. However, a return value of `true` is
  5789. * inconclusive; even if some link is up, it is uncertain whether a particular
  5790. * connection attempt to a particular remote site will be successful.
  5791. */
  5792. isOnline(): boolean;
  5793. /**
  5794. * Creates a `ClientRequest` instance using the provided `options` which are
  5795. * directly forwarded to the `ClientRequest` constructor. The `net.request` method
  5796. * would be used to issue both secure and insecure HTTP requests according to the
  5797. * specified protocol scheme in the `options` object.
  5798. */
  5799. request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
  5800. /**
  5801. * A `Boolean` property. Whether there is currently internet connection.
  5802. *
  5803. * A return value of `false` is a pretty strong indicator that the user won't be
  5804. * able to connect to remote sites. However, a return value of `true` is
  5805. * inconclusive; even if some link is up, it is uncertain whether a particular
  5806. * connection attempt to a particular remote site will be successful.
  5807. *
  5808. */
  5809. readonly online: boolean;
  5810. }
  5811. interface NetLog {
  5812. // Docs: https://electronjs.org/docs/api/net-log
  5813. /**
  5814. * resolves when the net log has begun recording.
  5815. *
  5816. * Starts recording network events to `path`.
  5817. */
  5818. startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
  5819. /**
  5820. * resolves when the net log has been flushed to disk.
  5821. *
  5822. * Stops recording network events. If not called, net logging will automatically
  5823. * end when app quits.
  5824. */
  5825. stopLogging(): Promise<void>;
  5826. /**
  5827. * A `Boolean` property that indicates whether network logs are currently being
  5828. * recorded.
  5829. *
  5830. */
  5831. readonly currentlyLogging: boolean;
  5832. }
  5833. interface NewWindowWebContentsEvent extends Event {
  5834. // Docs: https://electronjs.org/docs/api/structures/new-window-web-contents-event
  5835. newGuest?: BrowserWindow;
  5836. }
  5837. class Notification extends NodeEventEmitter {
  5838. // Docs: https://electronjs.org/docs/api/notification
  5839. on(event: 'action', listener: (event: Event,
  5840. /**
  5841. * The index of the action that was activated.
  5842. */
  5843. index: number) => void): this;
  5844. once(event: 'action', listener: (event: Event,
  5845. /**
  5846. * The index of the action that was activated.
  5847. */
  5848. index: number) => void): this;
  5849. addListener(event: 'action', listener: (event: Event,
  5850. /**
  5851. * The index of the action that was activated.
  5852. */
  5853. index: number) => void): this;
  5854. removeListener(event: 'action', listener: (event: Event,
  5855. /**
  5856. * The index of the action that was activated.
  5857. */
  5858. index: number) => void): this;
  5859. /**
  5860. * Emitted when the notification is clicked by the user.
  5861. */
  5862. on(event: 'click', listener: (event: Event) => void): this;
  5863. once(event: 'click', listener: (event: Event) => void): this;
  5864. addListener(event: 'click', listener: (event: Event) => void): this;
  5865. removeListener(event: 'click', listener: (event: Event) => void): this;
  5866. /**
  5867. * Emitted when the notification is closed by manual intervention from the user.
  5868. *
  5869. * This event is not guaranteed to be emitted in all cases where the notification
  5870. * is closed.
  5871. */
  5872. on(event: 'close', listener: (event: Event) => void): this;
  5873. once(event: 'close', listener: (event: Event) => void): this;
  5874. addListener(event: 'close', listener: (event: Event) => void): this;
  5875. removeListener(event: 'close', listener: (event: Event) => void): this;
  5876. /**
  5877. * Emitted when an error is encountered while creating and showing the native
  5878. * notification.
  5879. *
  5880. * @platform win32
  5881. */
  5882. on(event: 'failed', listener: (event: Event,
  5883. /**
  5884. * The error encountered during execution of the `show()` method.
  5885. */
  5886. error: string) => void): this;
  5887. once(event: 'failed', listener: (event: Event,
  5888. /**
  5889. * The error encountered during execution of the `show()` method.
  5890. */
  5891. error: string) => void): this;
  5892. addListener(event: 'failed', listener: (event: Event,
  5893. /**
  5894. * The error encountered during execution of the `show()` method.
  5895. */
  5896. error: string) => void): this;
  5897. removeListener(event: 'failed', listener: (event: Event,
  5898. /**
  5899. * The error encountered during execution of the `show()` method.
  5900. */
  5901. error: string) => void): this;
  5902. /**
  5903. * Emitted when the user clicks the "Reply" button on a notification with
  5904. * `hasReply: true`.
  5905. *
  5906. * @platform darwin
  5907. */
  5908. on(event: 'reply', listener: (event: Event,
  5909. /**
  5910. * The string the user entered into the inline reply field.
  5911. */
  5912. reply: string) => void): this;
  5913. once(event: 'reply', listener: (event: Event,
  5914. /**
  5915. * The string the user entered into the inline reply field.
  5916. */
  5917. reply: string) => void): this;
  5918. addListener(event: 'reply', listener: (event: Event,
  5919. /**
  5920. * The string the user entered into the inline reply field.
  5921. */
  5922. reply: string) => void): this;
  5923. removeListener(event: 'reply', listener: (event: Event,
  5924. /**
  5925. * The string the user entered into the inline reply field.
  5926. */
  5927. reply: string) => void): this;
  5928. /**
  5929. * Emitted when the notification is shown to the user, note this could be fired
  5930. * multiple times as a notification can be shown multiple times through the
  5931. * `show()` method.
  5932. */
  5933. on(event: 'show', listener: (event: Event) => void): this;
  5934. once(event: 'show', listener: (event: Event) => void): this;
  5935. addListener(event: 'show', listener: (event: Event) => void): this;
  5936. removeListener(event: 'show', listener: (event: Event) => void): this;
  5937. /**
  5938. * Notification
  5939. */
  5940. constructor(options?: NotificationConstructorOptions);
  5941. /**
  5942. * Whether or not desktop notifications are supported on the current system
  5943. */
  5944. static isSupported(): boolean;
  5945. /**
  5946. * Dismisses the notification.
  5947. */
  5948. close(): void;
  5949. /**
  5950. * Immediately shows the notification to the user, please note this means unlike
  5951. * the HTML5 Notification implementation, instantiating a `new Notification` does
  5952. * not immediately show it to the user, you need to call this method before the OS
  5953. * will display it.
  5954. *
  5955. * If the notification has been shown before, this method will dismiss the
  5956. * previously shown notification and create a new one with identical properties.
  5957. */
  5958. show(): void;
  5959. /**
  5960. * A `NotificationAction[]` property representing the actions of the notification.
  5961. */
  5962. actions: NotificationAction[];
  5963. /**
  5964. * A `String` property representing the body of the notification.
  5965. */
  5966. body: string;
  5967. /**
  5968. * A `String` property representing the close button text of the notification.
  5969. */
  5970. closeButtonText: string;
  5971. /**
  5972. * A `Boolean` property representing whether the notification has a reply action.
  5973. */
  5974. hasReply: boolean;
  5975. /**
  5976. * A `String` property representing the reply placeholder of the notification.
  5977. */
  5978. replyPlaceholder: string;
  5979. /**
  5980. * A `Boolean` property representing whether the notification is silent.
  5981. */
  5982. silent: boolean;
  5983. /**
  5984. * A `String` property representing the sound of the notification.
  5985. */
  5986. sound: string;
  5987. /**
  5988. * A `String` property representing the subtitle of the notification.
  5989. */
  5990. subtitle: string;
  5991. /**
  5992. * A `String` property representing the type of timeout duration for the
  5993. * notification. Can be 'default' or 'never'.
  5994. *
  5995. * If `timeoutType` is set to 'never', the notification never expires. It stays
  5996. * open until closed by the calling API or the user.
  5997. *
  5998. * @platform linux,win32
  5999. */
  6000. timeoutType: ('default' | 'never');
  6001. /**
  6002. * A `String` property representing the title of the notification.
  6003. */
  6004. title: string;
  6005. /**
  6006. * A `String` property representing the custom Toast XML of the notification.
  6007. *
  6008. * @platform win32
  6009. */
  6010. toastXml: string;
  6011. /**
  6012. * A `String` property representing the urgency level of the notification. Can be
  6013. * 'normal', 'critical', or 'low'.
  6014. *
  6015. * Default is 'low' - see NotifyUrgency for more information.
  6016. *
  6017. * @platform linux
  6018. */
  6019. urgency: ('normal' | 'critical' | 'low');
  6020. }
  6021. interface NotificationAction {
  6022. // Docs: https://electronjs.org/docs/api/structures/notification-action
  6023. /**
  6024. * The label for the given action.
  6025. */
  6026. text?: string;
  6027. /**
  6028. * The type of action, can be `button`.
  6029. */
  6030. type: ('button');
  6031. }
  6032. interface NotificationResponse {
  6033. // Docs: https://electronjs.org/docs/api/structures/notification-response
  6034. /**
  6035. * The identifier string of the action that the user selected.
  6036. */
  6037. actionIdentifier: string;
  6038. /**
  6039. * The delivery date of the notification.
  6040. */
  6041. date: number;
  6042. /**
  6043. * The unique identifier for this notification request.
  6044. */
  6045. identifier: string;
  6046. /**
  6047. * A dictionary of custom information associated with the notification.
  6048. */
  6049. userInfo: Record<string, any>;
  6050. /**
  6051. * The text entered or chosen by the user.
  6052. */
  6053. userText?: string;
  6054. }
  6055. interface Point {
  6056. // Docs: https://electronjs.org/docs/api/structures/point
  6057. x: number;
  6058. y: number;
  6059. }
  6060. interface PostBody {
  6061. // Docs: https://electronjs.org/docs/api/structures/post-body
  6062. /**
  6063. * The boundary used to separate multiple parts of the message. Only valid when
  6064. * `contentType` is `multipart/form-data`.
  6065. */
  6066. boundary?: string;
  6067. /**
  6068. * The `content-type` header used for the data. One of
  6069. * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
  6070. * `enctype` attribute of the submitted HTML form.
  6071. */
  6072. contentType: string;
  6073. /**
  6074. * The post data to be sent to the new window.
  6075. */
  6076. data: Array<(UploadRawData) | (UploadFile)>;
  6077. }
  6078. interface PowerMonitor extends NodeJS.EventEmitter {
  6079. // Docs: https://electronjs.org/docs/api/power-monitor
  6080. /**
  6081. * Emitted when the system is about to lock the screen.
  6082. *
  6083. * @platform darwin,win32
  6084. */
  6085. on(event: 'lock-screen', listener: Function): this;
  6086. once(event: 'lock-screen', listener: Function): this;
  6087. addListener(event: 'lock-screen', listener: Function): this;
  6088. removeListener(event: 'lock-screen', listener: Function): this;
  6089. /**
  6090. * Emitted when the system changes to AC power.
  6091. *
  6092. * @platform darwin,win32
  6093. */
  6094. on(event: 'on-ac', listener: Function): this;
  6095. once(event: 'on-ac', listener: Function): this;
  6096. addListener(event: 'on-ac', listener: Function): this;
  6097. removeListener(event: 'on-ac', listener: Function): this;
  6098. /**
  6099. * Emitted when system changes to battery power.
  6100. *
  6101. * @platform darwin
  6102. */
  6103. on(event: 'on-battery', listener: Function): this;
  6104. once(event: 'on-battery', listener: Function): this;
  6105. addListener(event: 'on-battery', listener: Function): this;
  6106. removeListener(event: 'on-battery', listener: Function): this;
  6107. /**
  6108. * Emitted when system is resuming.
  6109. */
  6110. on(event: 'resume', listener: Function): this;
  6111. once(event: 'resume', listener: Function): this;
  6112. addListener(event: 'resume', listener: Function): this;
  6113. removeListener(event: 'resume', listener: Function): this;
  6114. /**
  6115. * Emitted when the system is about to reboot or shut down. If the event handler
  6116. * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
  6117. * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
  6118. * should exit as soon as possible by calling something like `app.quit()`.
  6119. *
  6120. * @platform linux,darwin
  6121. */
  6122. on(event: 'shutdown', listener: Function): this;
  6123. once(event: 'shutdown', listener: Function): this;
  6124. addListener(event: 'shutdown', listener: Function): this;
  6125. removeListener(event: 'shutdown', listener: Function): this;
  6126. /**
  6127. * Emitted when the system is suspending.
  6128. */
  6129. on(event: 'suspend', listener: Function): this;
  6130. once(event: 'suspend', listener: Function): this;
  6131. addListener(event: 'suspend', listener: Function): this;
  6132. removeListener(event: 'suspend', listener: Function): this;
  6133. /**
  6134. * Emitted as soon as the systems screen is unlocked.
  6135. *
  6136. * @platform darwin,win32
  6137. */
  6138. on(event: 'unlock-screen', listener: Function): this;
  6139. once(event: 'unlock-screen', listener: Function): this;
  6140. addListener(event: 'unlock-screen', listener: Function): this;
  6141. removeListener(event: 'unlock-screen', listener: Function): this;
  6142. /**
  6143. * Emitted when a login session is activated. See documentation for more
  6144. * information.
  6145. *
  6146. * @platform darwin
  6147. */
  6148. on(event: 'user-did-become-active', listener: Function): this;
  6149. once(event: 'user-did-become-active', listener: Function): this;
  6150. addListener(event: 'user-did-become-active', listener: Function): this;
  6151. removeListener(event: 'user-did-become-active', listener: Function): this;
  6152. /**
  6153. * Emitted when a login session is deactivated. See documentation for more
  6154. * information.
  6155. *
  6156. * @platform darwin
  6157. */
  6158. on(event: 'user-did-resign-active', listener: Function): this;
  6159. once(event: 'user-did-resign-active', listener: Function): this;
  6160. addListener(event: 'user-did-resign-active', listener: Function): this;
  6161. removeListener(event: 'user-did-resign-active', listener: Function): this;
  6162. /**
  6163. * The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
  6164. *
  6165. * Calculate the system idle state. `idleThreshold` is the amount of time (in
  6166. * seconds) before considered idle. `locked` is available on supported systems
  6167. * only.
  6168. */
  6169. getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
  6170. /**
  6171. * Idle time in seconds
  6172. *
  6173. * Calculate system idle time in seconds.
  6174. */
  6175. getSystemIdleTime(): number;
  6176. /**
  6177. * Whether the system is on battery power.
  6178. *
  6179. * To monitor for changes in this property, use the `on-battery` and `on-ac`
  6180. * events.
  6181. */
  6182. isOnBatteryPower(): boolean;
  6183. /**
  6184. * A `Boolean` property. True if the system is on battery power.
  6185. *
  6186. * See `powerMonitor.isOnBatteryPower()`.
  6187. */
  6188. onBatteryPower: boolean;
  6189. }
  6190. interface PowerSaveBlocker {
  6191. // Docs: https://electronjs.org/docs/api/power-save-blocker
  6192. /**
  6193. * Whether the corresponding `powerSaveBlocker` has started.
  6194. */
  6195. isStarted(id: number): boolean;
  6196. /**
  6197. * The blocker ID that is assigned to this power blocker.
  6198. *
  6199. * Starts preventing the system from entering lower-power mode. Returns an integer
  6200. * identifying the power save blocker.
  6201. *
  6202. * **Note:** `prevent-display-sleep` has higher precedence over
  6203. * `prevent-app-suspension`. Only the highest precedence type takes effect. In
  6204. * other words, `prevent-display-sleep` always takes precedence over
  6205. * `prevent-app-suspension`.
  6206. *
  6207. * For example, an API calling A requests for `prevent-app-suspension`, and another
  6208. * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
  6209. * used until B stops its request. After that, `prevent-app-suspension` is used.
  6210. */
  6211. start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
  6212. /**
  6213. * Stops the specified power save blocker.
  6214. */
  6215. stop(id: number): void;
  6216. }
  6217. interface PrinterInfo {
  6218. // Docs: https://electronjs.org/docs/api/structures/printer-info
  6219. /**
  6220. * a longer description of the printer's type.
  6221. */
  6222. description: string;
  6223. /**
  6224. * the name of the printer as shown in Print Preview.
  6225. */
  6226. displayName: string;
  6227. /**
  6228. * whether or not a given printer is set as the default printer on the OS.
  6229. */
  6230. isDefault: boolean;
  6231. /**
  6232. * the name of the printer as understood by the OS.
  6233. */
  6234. name: string;
  6235. /**
  6236. * an object containing a variable number of platform-specific printer information.
  6237. */
  6238. options: Options;
  6239. /**
  6240. * the current status of the printer.
  6241. */
  6242. status: number;
  6243. }
  6244. interface ProcessMemoryInfo {
  6245. // Docs: https://electronjs.org/docs/api/structures/process-memory-info
  6246. /**
  6247. * The amount of memory not shared by other processes, such as JS heap or HTML
  6248. * content in Kilobytes.
  6249. */
  6250. private: number;
  6251. /**
  6252. * The amount of memory currently pinned to actual physical RAM in Kilobytes.
  6253. *
  6254. * @platform linux,win32
  6255. */
  6256. residentSet: number;
  6257. /**
  6258. * The amount of memory shared between processes, typically memory consumed by the
  6259. * Electron code itself in Kilobytes.
  6260. */
  6261. shared: number;
  6262. }
  6263. interface ProcessMetric {
  6264. // Docs: https://electronjs.org/docs/api/structures/process-metric
  6265. /**
  6266. * CPU usage of the process.
  6267. */
  6268. cpu: CPUUsage;
  6269. /**
  6270. * Creation time for this process. The time is represented as number of
  6271. * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
  6272. * is useful to use both the `pid` and the `creationTime` to uniquely identify a
  6273. * process.
  6274. */
  6275. creationTime: number;
  6276. /**
  6277. * One of the following values:
  6278. *
  6279. * @platform win32
  6280. */
  6281. integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
  6282. /**
  6283. * Memory information for the process.
  6284. */
  6285. memory: MemoryInfo;
  6286. /**
  6287. * The name of the process. Examples for utility: `Audio Service`, `Content
  6288. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  6289. */
  6290. name?: string;
  6291. /**
  6292. * Process id of the process.
  6293. */
  6294. pid: number;
  6295. /**
  6296. * Whether the process is sandboxed on OS level.
  6297. *
  6298. * @platform darwin,win32
  6299. */
  6300. sandboxed?: boolean;
  6301. /**
  6302. * The non-localized name of the process.
  6303. */
  6304. serviceName?: string;
  6305. /**
  6306. * Process type. One of the following values:
  6307. */
  6308. type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  6309. }
  6310. interface Product {
  6311. // Docs: https://electronjs.org/docs/api/structures/product
  6312. /**
  6313. * The total size of the content, in bytes.
  6314. */
  6315. contentLengths: number[];
  6316. /**
  6317. * A string that identifies the version of the content.
  6318. */
  6319. contentVersion: string;
  6320. /**
  6321. * 3 character code presenting a product's currency based on the ISO 4217 standard.
  6322. */
  6323. currencyCode: string;
  6324. /**
  6325. * The locale formatted price of the product.
  6326. */
  6327. formattedPrice: string;
  6328. /**
  6329. * A Boolean value that indicates whether the App Store has downloadable content
  6330. * for this product. `true` if at least one file has been associated with the
  6331. * product.
  6332. */
  6333. isDownloadable: boolean;
  6334. /**
  6335. * A description of the product.
  6336. */
  6337. localizedDescription: string;
  6338. /**
  6339. * The name of the product.
  6340. */
  6341. localizedTitle: string;
  6342. /**
  6343. * The cost of the product in the local currency.
  6344. */
  6345. price: number;
  6346. /**
  6347. * The string that identifies the product to the Apple App Store.
  6348. */
  6349. productIdentifier: string;
  6350. }
  6351. interface Protocol {
  6352. // Docs: https://electronjs.org/docs/api/protocol
  6353. /**
  6354. * Whether the protocol was successfully intercepted
  6355. *
  6356. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6357. * which sends a `Buffer` as a response.
  6358. */
  6359. interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  6360. /**
  6361. * Whether the protocol was successfully intercepted
  6362. *
  6363. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6364. * which sends a file as a response.
  6365. */
  6366. interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6367. /**
  6368. * Whether the protocol was successfully intercepted
  6369. *
  6370. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6371. * which sends a new HTTP request as a response.
  6372. */
  6373. interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  6374. /**
  6375. * Whether the protocol was successfully intercepted
  6376. *
  6377. * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
  6378. * protocol handler.
  6379. */
  6380. interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  6381. /**
  6382. * Whether the protocol was successfully intercepted
  6383. *
  6384. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6385. * which sends a `String` as a response.
  6386. */
  6387. interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6388. /**
  6389. * Whether `scheme` is already intercepted.
  6390. */
  6391. isProtocolIntercepted(scheme: string): boolean;
  6392. /**
  6393. * Whether `scheme` is already registered.
  6394. */
  6395. isProtocolRegistered(scheme: string): boolean;
  6396. /**
  6397. * Whether the protocol was successfully registered
  6398. *
  6399. * Registers a protocol of `scheme` that will send a `Buffer` as a response.
  6400. *
  6401. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6402. * should be called with either a `Buffer` object or an object that has the `data`
  6403. * property.
  6404. *
  6405. * Example:
  6406. */
  6407. registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  6408. /**
  6409. * Whether the protocol was successfully registered
  6410. *
  6411. * Registers a protocol of `scheme` that will send a file as the response. The
  6412. * `handler` will be called with `request` and `callback` where `request` is an
  6413. * incoming request for the `scheme`.
  6414. *
  6415. * To handle the `request`, the `callback` should be called with either the file's
  6416. * path or an object that has a `path` property, e.g. `callback(filePath)` or
  6417. * `callback({ path: filePath })`. The `filePath` must be an absolute path.
  6418. *
  6419. * By default the `scheme` is treated like `http:`, which is parsed differently
  6420. * from protocols that follow the "generic URI syntax" like `file:`.
  6421. */
  6422. registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6423. /**
  6424. * Whether the protocol was successfully registered
  6425. *
  6426. * Registers a protocol of `scheme` that will send an HTTP request as a response.
  6427. *
  6428. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6429. * should be called with an object that has the `url` property.
  6430. */
  6431. registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  6432. /**
  6433. * **Note:** This method can only be used before the `ready` event of the `app`
  6434. * module gets emitted and can be called only once.
  6435. *
  6436. * Registers the `scheme` as standard, secure, bypasses content security policy for
  6437. * resources, allows registering ServiceWorker, supports fetch API, and streaming
  6438. * video/audio. Specify a privilege with the value of `true` to enable the
  6439. * capability.
  6440. *
  6441. * An example of registering a privileged scheme, that bypasses Content Security
  6442. * Policy:
  6443. *
  6444. * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
  6445. * `http` and `https` are standard schemes, while `file` is not.
  6446. *
  6447. * Registering a scheme as standard allows relative and absolute resources to be
  6448. * resolved correctly when served. Otherwise the scheme will behave like the `file`
  6449. * protocol, but without the ability to resolve relative URLs.
  6450. *
  6451. * For example when you load following page with custom protocol without
  6452. * registering it as standard scheme, the image will not be loaded because
  6453. * non-standard schemes can not recognize relative URLs:
  6454. *
  6455. * Registering a scheme as standard will allow access to files through the
  6456. * FileSystem API. Otherwise the renderer will throw a security error for the
  6457. * scheme.
  6458. *
  6459. * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
  6460. * cookies) are disabled for non standard schemes. So in general if you want to
  6461. * register a custom protocol to replace the `http` protocol, you have to register
  6462. * it as a standard scheme.
  6463. *
  6464. * Protocols that use streams (http and stream protocols) should set `stream:
  6465. * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
  6466. * their responses by default. The `stream` flag configures those elements to
  6467. * correctly expect streaming responses.
  6468. */
  6469. registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
  6470. /**
  6471. * Whether the protocol was successfully registered
  6472. *
  6473. * Registers a protocol of `scheme` that will send a stream as a response.
  6474. *
  6475. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6476. * should be called with either a `ReadableStream` object or an object that has the
  6477. * `data` property.
  6478. *
  6479. * Example:
  6480. *
  6481. * It is possible to pass any object that implements the readable stream API (emits
  6482. * `data`/`end`/`error` events). For example, here's how a file could be returned:
  6483. */
  6484. registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  6485. /**
  6486. * Whether the protocol was successfully registered
  6487. *
  6488. * Registers a protocol of `scheme` that will send a `String` as a response.
  6489. *
  6490. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6491. * should be called with either a `String` or an object that has the `data`
  6492. * property.
  6493. */
  6494. registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6495. /**
  6496. * Whether the protocol was successfully unintercepted
  6497. *
  6498. * Remove the interceptor installed for `scheme` and restore its original handler.
  6499. */
  6500. uninterceptProtocol(scheme: string): boolean;
  6501. /**
  6502. * Whether the protocol was successfully unregistered
  6503. *
  6504. * Unregisters the custom protocol of `scheme`.
  6505. */
  6506. unregisterProtocol(scheme: string): boolean;
  6507. }
  6508. interface ProtocolRequest {
  6509. // Docs: https://electronjs.org/docs/api/structures/protocol-request
  6510. headers: Record<string, string>;
  6511. method: string;
  6512. referrer: string;
  6513. uploadData?: UploadData[];
  6514. url: string;
  6515. }
  6516. interface ProtocolResponse {
  6517. // Docs: https://electronjs.org/docs/api/structures/protocol-response
  6518. /**
  6519. * The charset of response body, default is `"utf-8"`.
  6520. */
  6521. charset?: string;
  6522. /**
  6523. * The response body. When returning stream as response, this is a Node.js readable
  6524. * stream representing the response body. When returning `Buffer` as response, this
  6525. * is a `Buffer`. When returning `String` as response, this is a `String`. This is
  6526. * ignored for other types of responses.
  6527. */
  6528. data?: (Buffer) | (string) | (NodeJS.ReadableStream);
  6529. /**
  6530. * When assigned, the `request` will fail with the `error` number . For the
  6531. * available error numbers you can use, please see the net error list.
  6532. */
  6533. error?: number;
  6534. /**
  6535. * An object containing the response headers. The keys must be String, and values
  6536. * must be either String or Array of String.
  6537. */
  6538. headers?: Record<string, (string) | (string[])>;
  6539. /**
  6540. * The HTTP `method`. This is only used for file and URL responses.
  6541. */
  6542. method?: string;
  6543. /**
  6544. * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
  6545. * would implicitly set the `content-type` header in response, but if
  6546. * `content-type` is already set in `headers`, the `mimeType` would be ignored.
  6547. */
  6548. mimeType?: string;
  6549. /**
  6550. * Path to the file which would be sent as response body. This is only used for
  6551. * file responses.
  6552. */
  6553. path?: string;
  6554. /**
  6555. * The `referrer` URL. This is only used for file and URL responses.
  6556. */
  6557. referrer?: string;
  6558. /**
  6559. * The session used for requesting URL, by default the HTTP request will reuse the
  6560. * current session. Setting `session` to `null` would use a random independent
  6561. * session. This is only used for URL responses.
  6562. */
  6563. session?: Session;
  6564. /**
  6565. * The HTTP response code, default is 200.
  6566. */
  6567. statusCode?: number;
  6568. /**
  6569. * The data used as upload data. This is only used for URL responses when `method`
  6570. * is `"POST"`.
  6571. */
  6572. uploadData?: ProtocolResponseUploadData;
  6573. /**
  6574. * Download the `url` and pipe the result as response body. This is only used for
  6575. * URL responses.
  6576. */
  6577. url?: string;
  6578. }
  6579. interface ProtocolResponseUploadData {
  6580. // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
  6581. /**
  6582. * MIME type of the content.
  6583. */
  6584. contentType: string;
  6585. /**
  6586. * Content to be sent.
  6587. */
  6588. data: (string) | (Buffer);
  6589. }
  6590. interface Rectangle {
  6591. // Docs: https://electronjs.org/docs/api/structures/rectangle
  6592. /**
  6593. * The height of the rectangle (must be an integer).
  6594. */
  6595. height: number;
  6596. /**
  6597. * The width of the rectangle (must be an integer).
  6598. */
  6599. width: number;
  6600. /**
  6601. * The x coordinate of the origin of the rectangle (must be an integer).
  6602. */
  6603. x: number;
  6604. /**
  6605. * The y coordinate of the origin of the rectangle (must be an integer).
  6606. */
  6607. y: number;
  6608. }
  6609. interface Referrer {
  6610. // Docs: https://electronjs.org/docs/api/structures/referrer
  6611. /**
  6612. * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
  6613. * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
  6614. * See the Referrer-Policy spec for more details on the meaning of these values.
  6615. */
  6616. policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
  6617. /**
  6618. * HTTP Referrer URL.
  6619. */
  6620. url: string;
  6621. }
  6622. interface SafeStorage extends NodeJS.EventEmitter {
  6623. // Docs: https://electronjs.org/docs/api/safe-storage
  6624. /**
  6625. * the decrypted string. Decrypts the encrypted buffer obtained with
  6626. * `safeStorage.encryptString` back into a string.
  6627. *
  6628. * This function will throw an error if decryption fails.
  6629. */
  6630. decryptString(encrypted: Buffer): string;
  6631. /**
  6632. * An array of bytes representing the encrypted string.
  6633. *
  6634. * This function will throw an error if encryption fails.
  6635. */
  6636. encryptString(plainText: string): Buffer;
  6637. /**
  6638. * Whether encryption is available.
  6639. *
  6640. * On Linux, returns true if the secret key is available. On MacOS, returns true if
  6641. * Keychain is available. On Windows, returns true with no other preconditions.
  6642. */
  6643. isEncryptionAvailable(): boolean;
  6644. }
  6645. interface Screen extends NodeJS.EventEmitter {
  6646. // Docs: https://electronjs.org/docs/api/screen
  6647. /**
  6648. * Emitted when `newDisplay` has been added.
  6649. */
  6650. on(event: 'display-added', listener: (event: Event,
  6651. newDisplay: Display) => void): this;
  6652. once(event: 'display-added', listener: (event: Event,
  6653. newDisplay: Display) => void): this;
  6654. addListener(event: 'display-added', listener: (event: Event,
  6655. newDisplay: Display) => void): this;
  6656. removeListener(event: 'display-added', listener: (event: Event,
  6657. newDisplay: Display) => void): this;
  6658. /**
  6659. * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
  6660. * an array of strings that describe the changes. Possible changes are `bounds`,
  6661. * `workArea`, `scaleFactor` and `rotation`.
  6662. */
  6663. on(event: 'display-metrics-changed', listener: (event: Event,
  6664. display: Display,
  6665. changedMetrics: string[]) => void): this;
  6666. once(event: 'display-metrics-changed', listener: (event: Event,
  6667. display: Display,
  6668. changedMetrics: string[]) => void): this;
  6669. addListener(event: 'display-metrics-changed', listener: (event: Event,
  6670. display: Display,
  6671. changedMetrics: string[]) => void): this;
  6672. removeListener(event: 'display-metrics-changed', listener: (event: Event,
  6673. display: Display,
  6674. changedMetrics: string[]) => void): this;
  6675. /**
  6676. * Emitted when `oldDisplay` has been removed.
  6677. */
  6678. on(event: 'display-removed', listener: (event: Event,
  6679. oldDisplay: Display) => void): this;
  6680. once(event: 'display-removed', listener: (event: Event,
  6681. oldDisplay: Display) => void): this;
  6682. addListener(event: 'display-removed', listener: (event: Event,
  6683. oldDisplay: Display) => void): this;
  6684. removeListener(event: 'display-removed', listener: (event: Event,
  6685. oldDisplay: Display) => void): this;
  6686. /**
  6687. * Converts a screen DIP point to a screen physical point. The DPI scale is
  6688. * performed relative to the display containing the DIP point.
  6689. *
  6690. * @platform win32
  6691. */
  6692. dipToScreenPoint(point: Point): Point;
  6693. /**
  6694. * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
  6695. * relative to the display nearest to `window`. If `window` is null, scaling will
  6696. * be performed to the display nearest to `rect`.
  6697. *
  6698. * @platform win32
  6699. */
  6700. dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  6701. /**
  6702. * An array of displays that are currently available.
  6703. */
  6704. getAllDisplays(): Display[];
  6705. /**
  6706. * The current absolute position of the mouse pointer.
  6707. *
  6708. * **Note:** The return value is a DIP point, not a screen physical point.
  6709. */
  6710. getCursorScreenPoint(): Point;
  6711. /**
  6712. * The display that most closely intersects the provided bounds.
  6713. */
  6714. getDisplayMatching(rect: Rectangle): Display;
  6715. /**
  6716. * The display nearest the specified point.
  6717. */
  6718. getDisplayNearestPoint(point: Point): Display;
  6719. /**
  6720. * The primary display.
  6721. */
  6722. getPrimaryDisplay(): Display;
  6723. /**
  6724. * Converts a screen physical point to a screen DIP point. The DPI scale is
  6725. * performed relative to the display containing the physical point.
  6726. *
  6727. * @platform win32
  6728. */
  6729. screenToDipPoint(point: Point): Point;
  6730. /**
  6731. * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
  6732. * relative to the display nearest to `window`. If `window` is null, scaling will
  6733. * be performed to the display nearest to `rect`.
  6734. *
  6735. * @platform win32
  6736. */
  6737. screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  6738. }
  6739. interface ScrubberItem {
  6740. // Docs: https://electronjs.org/docs/api/structures/scrubber-item
  6741. /**
  6742. * The image to appear in this item.
  6743. */
  6744. icon?: NativeImage;
  6745. /**
  6746. * The text to appear in this item.
  6747. */
  6748. label?: string;
  6749. }
  6750. interface SegmentedControlSegment {
  6751. // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
  6752. /**
  6753. * Whether this segment is selectable. Default: true.
  6754. */
  6755. enabled?: boolean;
  6756. /**
  6757. * The image to appear in this segment.
  6758. */
  6759. icon?: NativeImage;
  6760. /**
  6761. * The text to appear in this segment.
  6762. */
  6763. label?: string;
  6764. }
  6765. interface SerialPort {
  6766. // Docs: https://electronjs.org/docs/api/structures/serial-port
  6767. /**
  6768. * A stable identifier on Windows that can be used for device permissions.
  6769. */
  6770. deviceInstanceId?: string;
  6771. /**
  6772. * A string suitable for display to the user for describing this device.
  6773. */
  6774. displayName: string;
  6775. /**
  6776. * Unique identifier for the port.
  6777. */
  6778. portId: string;
  6779. /**
  6780. * Name of the port.
  6781. */
  6782. portName: string;
  6783. /**
  6784. * Optional USB product ID.
  6785. */
  6786. productId: string;
  6787. /**
  6788. * The USB device serial number.
  6789. */
  6790. serialNumber: string;
  6791. /**
  6792. * Represents a single serial port on macOS can be enumerated by multiple drivers.
  6793. */
  6794. usbDriverName?: string;
  6795. /**
  6796. * Optional USB vendor ID.
  6797. */
  6798. vendorId: string;
  6799. }
  6800. interface ServiceWorkerInfo {
  6801. // Docs: https://electronjs.org/docs/api/structures/service-worker-info
  6802. /**
  6803. * The virtual ID of the process that this service worker is running in. This is
  6804. * not an OS level PID. This aligns with the ID set used for
  6805. * `webContents.getProcessId()`.
  6806. */
  6807. renderProcessId: number;
  6808. /**
  6809. * The base URL that this service worker is active for.
  6810. */
  6811. scope: string;
  6812. /**
  6813. * The full URL to the script that this service worker runs
  6814. */
  6815. scriptUrl: string;
  6816. }
  6817. class ServiceWorkers extends NodeEventEmitter {
  6818. // Docs: https://electronjs.org/docs/api/service-workers
  6819. /**
  6820. * Emitted when a service worker logs something to the console.
  6821. */
  6822. on(event: 'console-message', listener: (event: Event,
  6823. /**
  6824. * Information about the console message
  6825. */
  6826. messageDetails: MessageDetails) => void): this;
  6827. once(event: 'console-message', listener: (event: Event,
  6828. /**
  6829. * Information about the console message
  6830. */
  6831. messageDetails: MessageDetails) => void): this;
  6832. addListener(event: 'console-message', listener: (event: Event,
  6833. /**
  6834. * Information about the console message
  6835. */
  6836. messageDetails: MessageDetails) => void): this;
  6837. removeListener(event: 'console-message', listener: (event: Event,
  6838. /**
  6839. * Information about the console message
  6840. */
  6841. messageDetails: MessageDetails) => void): this;
  6842. /**
  6843. * Emitted when a service worker has been registered. Can occur after a call to
  6844. * `navigator.serviceWorker.register('/sw.js')` successfully resolves or when a
  6845. * Chrome extension is loaded.
  6846. */
  6847. on(event: 'registration-completed', listener: (event: Event,
  6848. /**
  6849. * Information about the registered service worker
  6850. */
  6851. details: RegistrationCompletedDetails) => void): this;
  6852. once(event: 'registration-completed', listener: (event: Event,
  6853. /**
  6854. * Information about the registered service worker
  6855. */
  6856. details: RegistrationCompletedDetails) => void): this;
  6857. addListener(event: 'registration-completed', listener: (event: Event,
  6858. /**
  6859. * Information about the registered service worker
  6860. */
  6861. details: RegistrationCompletedDetails) => void): this;
  6862. removeListener(event: 'registration-completed', listener: (event: Event,
  6863. /**
  6864. * Information about the registered service worker
  6865. */
  6866. details: RegistrationCompletedDetails) => void): this;
  6867. /**
  6868. * A ServiceWorkerInfo object where the keys are the service worker version ID and
  6869. * the values are the information about that service worker.
  6870. */
  6871. getAllRunning(): Record<number, ServiceWorkerInfo>;
  6872. /**
  6873. * Information about this service worker
  6874. *
  6875. * If the service worker does not exist or is not running this method will throw an
  6876. * exception.
  6877. */
  6878. getFromVersionID(versionId: number): ServiceWorkerInfo;
  6879. }
  6880. class Session extends NodeEventEmitter {
  6881. // Docs: https://electronjs.org/docs/api/session
  6882. /**
  6883. * A session instance from `partition` string. When there is an existing `Session`
  6884. * with the same `partition`, it will be returned; otherwise a new `Session`
  6885. * instance will be created with `options`.
  6886. *
  6887. * If `partition` starts with `persist:`, the page will use a persistent session
  6888. * available to all pages in the app with the same `partition`. if there is no
  6889. * `persist:` prefix, the page will use an in-memory session. If the `partition` is
  6890. * empty then default session of the app will be returned.
  6891. *
  6892. * To create a `Session` with `options`, you have to ensure the `Session` with the
  6893. * `partition` has never been used before. There is no way to change the `options`
  6894. * of an existing `Session` object.
  6895. */
  6896. static fromPartition(partition: string, options?: FromPartitionOptions): Session;
  6897. /**
  6898. * A `Session` object, the default session object of the app.
  6899. */
  6900. static defaultSession: Session;
  6901. /**
  6902. * Emitted after an extension is loaded. This occurs whenever an extension is added
  6903. * to the "enabled" set of extensions. This includes:
  6904. *
  6905. * * Extensions being loaded from `Session.loadExtension`.
  6906. * * Extensions being reloaded:
  6907. * * from a crash.
  6908. * * if the extension requested it (`chrome.runtime.reload()`).
  6909. */
  6910. on(event: 'extension-loaded', listener: (event: Event,
  6911. extension: Extension) => void): this;
  6912. once(event: 'extension-loaded', listener: (event: Event,
  6913. extension: Extension) => void): this;
  6914. addListener(event: 'extension-loaded', listener: (event: Event,
  6915. extension: Extension) => void): this;
  6916. removeListener(event: 'extension-loaded', listener: (event: Event,
  6917. extension: Extension) => void): this;
  6918. /**
  6919. * Emitted after an extension is loaded and all necessary browser state is
  6920. * initialized to support the start of the extension's background page.
  6921. */
  6922. on(event: 'extension-ready', listener: (event: Event,
  6923. extension: Extension) => void): this;
  6924. once(event: 'extension-ready', listener: (event: Event,
  6925. extension: Extension) => void): this;
  6926. addListener(event: 'extension-ready', listener: (event: Event,
  6927. extension: Extension) => void): this;
  6928. removeListener(event: 'extension-ready', listener: (event: Event,
  6929. extension: Extension) => void): this;
  6930. /**
  6931. * Emitted after an extension is unloaded. This occurs when
  6932. * `Session.removeExtension` is called.
  6933. */
  6934. on(event: 'extension-unloaded', listener: (event: Event,
  6935. extension: Extension) => void): this;
  6936. once(event: 'extension-unloaded', listener: (event: Event,
  6937. extension: Extension) => void): this;
  6938. addListener(event: 'extension-unloaded', listener: (event: Event,
  6939. extension: Extension) => void): this;
  6940. removeListener(event: 'extension-unloaded', listener: (event: Event,
  6941. extension: Extension) => void): this;
  6942. /**
  6943. * Emitted when a new HID device becomes available. For example, when a new USB
  6944. * device is plugged in.
  6945. *
  6946. * This event will only be emitted after `navigator.hid.requestDevice` has been
  6947. * called and `select-hid-device` has fired.
  6948. */
  6949. on(event: 'hid-device-added', listener: (event: Event,
  6950. details: HidDeviceAddedDetails) => void): this;
  6951. once(event: 'hid-device-added', listener: (event: Event,
  6952. details: HidDeviceAddedDetails) => void): this;
  6953. addListener(event: 'hid-device-added', listener: (event: Event,
  6954. details: HidDeviceAddedDetails) => void): this;
  6955. removeListener(event: 'hid-device-added', listener: (event: Event,
  6956. details: HidDeviceAddedDetails) => void): this;
  6957. /**
  6958. * Emitted when a HID device has been removed. For example, this event will fire
  6959. * when a USB device is unplugged.
  6960. *
  6961. * This event will only be emitted after `navigator.hid.requestDevice` has been
  6962. * called and `select-hid-device` has fired.
  6963. */
  6964. on(event: 'hid-device-removed', listener: (event: Event,
  6965. details: HidDeviceRemovedDetails) => void): this;
  6966. once(event: 'hid-device-removed', listener: (event: Event,
  6967. details: HidDeviceRemovedDetails) => void): this;
  6968. addListener(event: 'hid-device-removed', listener: (event: Event,
  6969. details: HidDeviceRemovedDetails) => void): this;
  6970. removeListener(event: 'hid-device-removed', listener: (event: Event,
  6971. details: HidDeviceRemovedDetails) => void): this;
  6972. /**
  6973. * Emitted when a render process requests preconnection to a URL, generally due to
  6974. * a resource hint.
  6975. */
  6976. on(event: 'preconnect', listener: (event: Event,
  6977. /**
  6978. * The URL being requested for preconnection by the renderer.
  6979. */
  6980. preconnectUrl: string,
  6981. /**
  6982. * True if the renderer is requesting that the connection include credentials (see
  6983. * the spec for more details.)
  6984. */
  6985. allowCredentials: boolean) => void): this;
  6986. once(event: 'preconnect', listener: (event: Event,
  6987. /**
  6988. * The URL being requested for preconnection by the renderer.
  6989. */
  6990. preconnectUrl: string,
  6991. /**
  6992. * True if the renderer is requesting that the connection include credentials (see
  6993. * the spec for more details.)
  6994. */
  6995. allowCredentials: boolean) => void): this;
  6996. addListener(event: 'preconnect', listener: (event: Event,
  6997. /**
  6998. * The URL being requested for preconnection by the renderer.
  6999. */
  7000. preconnectUrl: string,
  7001. /**
  7002. * True if the renderer is requesting that the connection include credentials (see
  7003. * the spec for more details.)
  7004. */
  7005. allowCredentials: boolean) => void): this;
  7006. removeListener(event: 'preconnect', listener: (event: Event,
  7007. /**
  7008. * The URL being requested for preconnection by the renderer.
  7009. */
  7010. preconnectUrl: string,
  7011. /**
  7012. * True if the renderer is requesting that the connection include credentials (see
  7013. * the spec for more details.)
  7014. */
  7015. allowCredentials: boolean) => void): this;
  7016. /**
  7017. * Emitted when a HID device needs to be selected when a call to
  7018. * `navigator.hid.requestDevice` is made. `callback` should be called with
  7019. * `deviceId` to be selected; passing no arguments to `callback` will cancel the
  7020. * request. Additionally, permissioning on `navigator.hid` can be further managed
  7021. * by using ses.setPermissionCheckHandler(handler) and
  7022. * ses.setDevicePermissionHandler(handler)`.
  7023. */
  7024. on(event: 'select-hid-device', listener: (event: Event,
  7025. details: SelectHidDeviceDetails,
  7026. callback: (deviceId?: (string) | (null)) => void) => void): this;
  7027. once(event: 'select-hid-device', listener: (event: Event,
  7028. details: SelectHidDeviceDetails,
  7029. callback: (deviceId?: (string) | (null)) => void) => void): this;
  7030. addListener(event: 'select-hid-device', listener: (event: Event,
  7031. details: SelectHidDeviceDetails,
  7032. callback: (deviceId?: (string) | (null)) => void) => void): this;
  7033. removeListener(event: 'select-hid-device', listener: (event: Event,
  7034. details: SelectHidDeviceDetails,
  7035. callback: (deviceId?: (string) | (null)) => void) => void): this;
  7036. /**
  7037. * Emitted when a serial port needs to be selected when a call to
  7038. * `navigator.serial.requestPort` is made. `callback` should be called with
  7039. * `portId` to be selected, passing an empty string to `callback` will cancel the
  7040. * request. Additionally, permissioning on `navigator.serial` can be managed by
  7041. * using ses.setPermissionCheckHandler(handler) with the `serial` permission.
  7042. */
  7043. on(event: 'select-serial-port', listener: (event: Event,
  7044. portList: SerialPort[],
  7045. webContents: WebContents,
  7046. callback: (portId: string) => void) => void): this;
  7047. once(event: 'select-serial-port', listener: (event: Event,
  7048. portList: SerialPort[],
  7049. webContents: WebContents,
  7050. callback: (portId: string) => void) => void): this;
  7051. addListener(event: 'select-serial-port', listener: (event: Event,
  7052. portList: SerialPort[],
  7053. webContents: WebContents,
  7054. callback: (portId: string) => void) => void): this;
  7055. removeListener(event: 'select-serial-port', listener: (event: Event,
  7056. portList: SerialPort[],
  7057. webContents: WebContents,
  7058. callback: (portId: string) => void) => void): this;
  7059. /**
  7060. * Emitted after `navigator.serial.requestPort` has been called and
  7061. * `select-serial-port` has fired if a new serial port becomes available. For
  7062. * example, this event will fire when a new USB device is plugged in.
  7063. */
  7064. on(event: 'serial-port-added', listener: (event: Event,
  7065. port: SerialPort,
  7066. webContents: WebContents) => void): this;
  7067. once(event: 'serial-port-added', listener: (event: Event,
  7068. port: SerialPort,
  7069. webContents: WebContents) => void): this;
  7070. addListener(event: 'serial-port-added', listener: (event: Event,
  7071. port: SerialPort,
  7072. webContents: WebContents) => void): this;
  7073. removeListener(event: 'serial-port-added', listener: (event: Event,
  7074. port: SerialPort,
  7075. webContents: WebContents) => void): this;
  7076. /**
  7077. * Emitted after `navigator.serial.requestPort` has been called and
  7078. * `select-serial-port` has fired if a serial port has been removed. For example,
  7079. * this event will fire when a USB device is unplugged.
  7080. */
  7081. on(event: 'serial-port-removed', listener: (event: Event,
  7082. port: SerialPort,
  7083. webContents: WebContents) => void): this;
  7084. once(event: 'serial-port-removed', listener: (event: Event,
  7085. port: SerialPort,
  7086. webContents: WebContents) => void): this;
  7087. addListener(event: 'serial-port-removed', listener: (event: Event,
  7088. port: SerialPort,
  7089. webContents: WebContents) => void): this;
  7090. removeListener(event: 'serial-port-removed', listener: (event: Event,
  7091. port: SerialPort,
  7092. webContents: WebContents) => void): this;
  7093. /**
  7094. * Emitted when a hunspell dictionary file starts downloading
  7095. */
  7096. on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  7097. /**
  7098. * The language code of the dictionary file
  7099. */
  7100. languageCode: string) => void): this;
  7101. once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  7102. /**
  7103. * The language code of the dictionary file
  7104. */
  7105. languageCode: string) => void): this;
  7106. addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  7107. /**
  7108. * The language code of the dictionary file
  7109. */
  7110. languageCode: string) => void): this;
  7111. removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  7112. /**
  7113. * The language code of the dictionary file
  7114. */
  7115. languageCode: string) => void): this;
  7116. /**
  7117. * Emitted when a hunspell dictionary file download fails. For details on the
  7118. * failure you should collect a netlog and inspect the download request.
  7119. */
  7120. on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  7121. /**
  7122. * The language code of the dictionary file
  7123. */
  7124. languageCode: string) => void): this;
  7125. once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  7126. /**
  7127. * The language code of the dictionary file
  7128. */
  7129. languageCode: string) => void): this;
  7130. addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  7131. /**
  7132. * The language code of the dictionary file
  7133. */
  7134. languageCode: string) => void): this;
  7135. removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  7136. /**
  7137. * The language code of the dictionary file
  7138. */
  7139. languageCode: string) => void): this;
  7140. /**
  7141. * Emitted when a hunspell dictionary file has been successfully downloaded
  7142. */
  7143. on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  7144. /**
  7145. * The language code of the dictionary file
  7146. */
  7147. languageCode: string) => void): this;
  7148. once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  7149. /**
  7150. * The language code of the dictionary file
  7151. */
  7152. languageCode: string) => void): this;
  7153. addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  7154. /**
  7155. * The language code of the dictionary file
  7156. */
  7157. languageCode: string) => void): this;
  7158. removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  7159. /**
  7160. * The language code of the dictionary file
  7161. */
  7162. languageCode: string) => void): this;
  7163. /**
  7164. * Emitted when a hunspell dictionary file has been successfully initialized. This
  7165. * occurs after the file has been downloaded.
  7166. */
  7167. on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  7168. /**
  7169. * The language code of the dictionary file
  7170. */
  7171. languageCode: string) => void): this;
  7172. once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  7173. /**
  7174. * The language code of the dictionary file
  7175. */
  7176. languageCode: string) => void): this;
  7177. addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  7178. /**
  7179. * The language code of the dictionary file
  7180. */
  7181. languageCode: string) => void): this;
  7182. removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  7183. /**
  7184. * The language code of the dictionary file
  7185. */
  7186. languageCode: string) => void): this;
  7187. /**
  7188. * Emitted when Electron is about to download `item` in `webContents`.
  7189. *
  7190. * Calling `event.preventDefault()` will cancel the download and `item` will not be
  7191. * available from next tick of the process.
  7192. */
  7193. on(event: 'will-download', listener: (event: Event,
  7194. item: DownloadItem,
  7195. webContents: WebContents) => void): this;
  7196. once(event: 'will-download', listener: (event: Event,
  7197. item: DownloadItem,
  7198. webContents: WebContents) => void): this;
  7199. addListener(event: 'will-download', listener: (event: Event,
  7200. item: DownloadItem,
  7201. webContents: WebContents) => void): this;
  7202. removeListener(event: 'will-download', listener: (event: Event,
  7203. item: DownloadItem,
  7204. webContents: WebContents) => void): this;
  7205. /**
  7206. * Whether the word was successfully written to the custom dictionary. This API
  7207. * will not work on non-persistent (in-memory) sessions.
  7208. *
  7209. * **Note:** On macOS and Windows 10 this word will be written to the OS custom
  7210. * dictionary as well
  7211. */
  7212. addWordToSpellCheckerDictionary(word: string): boolean;
  7213. /**
  7214. * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
  7215. * authentication.
  7216. */
  7217. allowNTLMCredentialsForDomains(domains: string): void;
  7218. /**
  7219. * resolves when the session’s HTTP authentication cache has been cleared.
  7220. */
  7221. clearAuthCache(): Promise<void>;
  7222. /**
  7223. * resolves when the cache clear operation is complete.
  7224. *
  7225. * Clears the session’s HTTP cache.
  7226. */
  7227. clearCache(): Promise<void>;
  7228. /**
  7229. * Resolves when the operation is complete.
  7230. *
  7231. * Clears the host resolver cache.
  7232. */
  7233. clearHostResolverCache(): Promise<void>;
  7234. /**
  7235. * resolves when the storage data has been cleared.
  7236. */
  7237. clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
  7238. /**
  7239. * Resolves when all connections are closed.
  7240. *
  7241. * **Note:** It will terminate / fail all requests currently in flight.
  7242. */
  7243. closeAllConnections(): Promise<void>;
  7244. /**
  7245. * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
  7246. * The API will generate a DownloadItem that can be accessed with the will-download
  7247. * event. The DownloadItem will not have any `WebContents` associated with it and
  7248. * the initial state will be `interrupted`. The download will start only when the
  7249. * `resume` API is called on the DownloadItem.
  7250. */
  7251. createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
  7252. /**
  7253. * Disables any network emulation already active for the `session`. Resets to the
  7254. * original network configuration.
  7255. */
  7256. disableNetworkEmulation(): void;
  7257. /**
  7258. * Initiates a download of the resource at `url`. The API will generate a
  7259. * DownloadItem that can be accessed with the will-download event.
  7260. *
  7261. * **Note:** This does not perform any security checks that relate to a page's
  7262. * origin, unlike `webContents.downloadURL`.
  7263. */
  7264. downloadURL(url: string): void;
  7265. /**
  7266. * Emulates network with the given configuration for the `session`.
  7267. */
  7268. enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
  7269. /**
  7270. * Writes any unwritten DOMStorage data to disk.
  7271. */
  7272. flushStorageData(): void;
  7273. /**
  7274. * Resolves when the all internal states of proxy service is reset and the latest
  7275. * proxy configuration is reapplied if it's already available. The pac script will
  7276. * be fetched from `pacScript` again if the proxy mode is `pac_script`.
  7277. */
  7278. forceReloadProxyConfig(): Promise<void>;
  7279. /**
  7280. * A list of all loaded extensions.
  7281. *
  7282. * **Note:** This API cannot be called before the `ready` event of the `app` module
  7283. * is emitted.
  7284. */
  7285. getAllExtensions(): Extension[];
  7286. /**
  7287. * resolves with blob data.
  7288. */
  7289. getBlobData(identifier: string): Promise<Buffer>;
  7290. /**
  7291. * the session's current cache size, in bytes.
  7292. */
  7293. getCacheSize(): Promise<number>;
  7294. /**
  7295. * | `null` - The loaded extension with the given ID.
  7296. *
  7297. * **Note:** This API cannot be called before the `ready` event of the `app` module
  7298. * is emitted.
  7299. */
  7300. getExtension(extensionId: string): Extension;
  7301. /**
  7302. * an array of paths to preload scripts that have been registered.
  7303. */
  7304. getPreloads(): string[];
  7305. /**
  7306. * An array of language codes the spellchecker is enabled for. If this list is
  7307. * empty the spellchecker will fallback to using `en-US`. By default on launch if
  7308. * this setting is an empty list Electron will try to populate this setting with
  7309. * the current OS locale. This setting is persisted across restarts.
  7310. *
  7311. * **Note:** On macOS the OS spellchecker is used and has its own list of
  7312. * languages. This API is a no-op on macOS.
  7313. */
  7314. getSpellCheckerLanguages(): string[];
  7315. /**
  7316. * A `String | null` indicating the absolute file system path where data for this
  7317. * session is persisted on disk. For in memory sessions this returns `null`.
  7318. */
  7319. getStoragePath(): void;
  7320. /**
  7321. * The user agent for this session.
  7322. */
  7323. getUserAgent(): string;
  7324. /**
  7325. * Whether or not this session is a persistent one. The default `webContents`
  7326. * session of a `BrowserWindow` is persistent. When creating a session from a
  7327. * partition, session prefixed with `persist:` will be persistent, while others
  7328. * will be temporary.
  7329. */
  7330. isPersistent(): boolean;
  7331. /**
  7332. * Whether the builtin spell checker is enabled.
  7333. */
  7334. isSpellCheckerEnabled(): boolean;
  7335. /**
  7336. * An array of all words in app's custom dictionary. Resolves when the full
  7337. * dictionary is loaded from disk.
  7338. */
  7339. listWordsInSpellCheckerDictionary(): Promise<string[]>;
  7340. /**
  7341. * resolves when the extension is loaded.
  7342. *
  7343. * This method will raise an exception if the extension could not be loaded. If
  7344. * there are warnings when installing the extension (e.g. if the extension requests
  7345. * an API that Electron does not support) then they will be logged to the console.
  7346. *
  7347. * Note that Electron does not support the full range of Chrome extensions APIs.
  7348. * See Supported Extensions APIs for more details on what is supported.
  7349. *
  7350. * Note that in previous versions of Electron, extensions that were loaded would be
  7351. * remembered for future runs of the application. This is no longer the case:
  7352. * `loadExtension` must be called on every boot of your app if you want the
  7353. * extension to be loaded.
  7354. *
  7355. * This API does not support loading packed (.crx) extensions.
  7356. *
  7357. * **Note:** This API cannot be called before the `ready` event of the `app` module
  7358. * is emitted.
  7359. *
  7360. * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
  7361. * supported and will throw an error.
  7362. */
  7363. loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
  7364. /**
  7365. * Preconnects the given number of sockets to an origin.
  7366. */
  7367. preconnect(options: PreconnectOptions): void;
  7368. /**
  7369. * Unloads an extension.
  7370. *
  7371. * **Note:** This API cannot be called before the `ready` event of the `app` module
  7372. * is emitted.
  7373. */
  7374. removeExtension(extensionId: string): void;
  7375. /**
  7376. * Whether the word was successfully removed from the custom dictionary. This API
  7377. * will not work on non-persistent (in-memory) sessions.
  7378. *
  7379. * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
  7380. * dictionary as well
  7381. */
  7382. removeWordFromSpellCheckerDictionary(word: string): boolean;
  7383. /**
  7384. * Resolves with the proxy information for `url`.
  7385. */
  7386. resolveProxy(url: string): Promise<string>;
  7387. /**
  7388. * Sets the certificate verify proc for `session`, the `proc` will be called with
  7389. * `proc(request, callback)` whenever a server certificate verification is
  7390. * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
  7391. * rejects it.
  7392. *
  7393. * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
  7394. * verify proc.
  7395. *
  7396. * > **NOTE:** The result of this procedure is cached by the network service.
  7397. */
  7398. setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
  7399. /**
  7400. * Sets the handler which can be used to respond to device permission checks for
  7401. * the `session`. Returning `true` will allow the device to be permitted and
  7402. * `false` will reject it. To clear the handler, call
  7403. * `setDevicePermissionHandler(null)`. This handler can be used to provide default
  7404. * permissioning to devices without first calling for permission to devices (eg via
  7405. * `navigator.hid.requestDevice`). If this handler is not defined, the default
  7406. * device permissions as granted through device selection (eg via
  7407. * `navigator.hid.requestDevice`) will be used. Additionally, the default behavior
  7408. * of Electron is to store granted device permision through the lifetime of the
  7409. * corresponding WebContents. If longer term storage is needed, a developer can
  7410. * store granted device permissions (eg when handling the `select-hid-device`
  7411. * event) and then read from that storage with `setDevicePermissionHandler`.
  7412. */
  7413. setDevicePermissionHandler(handler: ((details: DevicePermissionHandlerHandlerDetails) => boolean) | (null)): void;
  7414. /**
  7415. * Sets download saving directory. By default, the download directory will be the
  7416. * `Downloads` under the respective app folder.
  7417. */
  7418. setDownloadPath(path: string): void;
  7419. /**
  7420. * Sets the handler which can be used to respond to permission checks for the
  7421. * `session`. Returning `true` will allow the permission and `false` will reject
  7422. * it. Please note that you must also implement `setPermissionRequestHandler` to
  7423. * get complete permission handling. Most web APIs do a permission check and then
  7424. * make a permission request if the check is denied. To clear the handler, call
  7425. * `setPermissionCheckHandler(null)`.
  7426. */
  7427. setPermissionCheckHandler(handler: ((webContents: (WebContents) | (null), permission: string, requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
  7428. /**
  7429. * Sets the handler which can be used to respond to permission requests for the
  7430. * `session`. Calling `callback(true)` will allow the permission and
  7431. * `callback(false)` will reject it. To clear the handler, call
  7432. * `setPermissionRequestHandler(null)`. Please note that you must also implement
  7433. * `setPermissionCheckHandler` to get complete permission handling. Most web APIs
  7434. * do a permission check and then make a permission request if the check is denied.
  7435. */
  7436. setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'media' | 'display-capture' | 'mediaKeySystem' | 'geolocation' | 'notifications' | 'midi' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal' | 'unknown', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
  7437. /**
  7438. * Adds scripts that will be executed on ALL web contents that are associated with
  7439. * this session just before normal `preload` scripts run.
  7440. */
  7441. setPreloads(preloads: string[]): void;
  7442. /**
  7443. * Resolves when the proxy setting process is complete.
  7444. *
  7445. * Sets the proxy settings.
  7446. *
  7447. * When `mode` is unspecified, `pacScript` and `proxyRules` are provided together,
  7448. * the `proxyRules` option is ignored and `pacScript` configuration is applied.
  7449. *
  7450. * You may need `ses.closeAllConnections` to close currently in flight connections
  7451. * to prevent pooled sockets using previous proxy from being reused by future
  7452. * requests.
  7453. *
  7454. * The `proxyRules` has to follow the rules below:
  7455. *
  7456. * For example:
  7457. *
  7458. * * `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
  7459. * HTTP proxy `foopy2:80` for `ftp://` URLs.
  7460. * * `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
  7461. * * `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
  7462. * over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
  7463. * * `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
  7464. * * `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
  7465. * over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
  7466. * * `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
  7467. * proxy if `foopy` is unavailable.
  7468. * * `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
  7469. * `socks4://foopy2` for all other URLs.
  7470. *
  7471. * The `proxyBypassRules` is a comma separated list of rules described below:
  7472. *
  7473. * * `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
  7474. *
  7475. * Match all hostnames that match the pattern HOSTNAME_PATTERN.
  7476. *
  7477. * Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
  7478. * "https://x.*.y.com:99"
  7479. * * `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
  7480. *
  7481. * Match a particular domain suffix.
  7482. *
  7483. * Examples: ".google.com", ".com", "http://.google.com"
  7484. * * `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
  7485. *
  7486. * Match URLs which are IP address literals.
  7487. *
  7488. * Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
  7489. * * `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
  7490. *
  7491. * Match any URL that is to an IP literal that falls between the given range. IP
  7492. * range is specified using CIDR notation.
  7493. *
  7494. * Examples: "192.168.1.1/16", "fefe:13::abc/33".
  7495. * * `<local>`
  7496. *
  7497. * Match local addresses. The meaning of `<local>` is whether the host matches one
  7498. * of: "127.0.0.1", "::1", "localhost".
  7499. */
  7500. setProxy(config: Config): Promise<void>;
  7501. /**
  7502. * By default Electron will download hunspell dictionaries from the Chromium CDN.
  7503. * If you want to override this behavior you can use this API to point the
  7504. * dictionary downloader at your own hosted version of the hunspell dictionaries.
  7505. * We publish a `hunspell_dictionaries.zip` file with each release which contains
  7506. * the files you need to host here, the file server must be **case insensitive**
  7507. * you must upload each file twice, once with the case it has in the ZIP file and
  7508. * once with the filename as all lower case.
  7509. *
  7510. * If the files present in `hunspell_dictionaries.zip` are available at
  7511. * `https://example.com/dictionaries/language-code.bdic` then you should call this
  7512. * api with
  7513. * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
  7514. * Please note the trailing slash. The URL to the dictionaries is formed as
  7515. * `${url}${filename}`.
  7516. *
  7517. * **Note:** On macOS the OS spellchecker is used and therefore we do not download
  7518. * any dictionary files. This API is a no-op on macOS.
  7519. */
  7520. setSpellCheckerDictionaryDownloadURL(url: string): void;
  7521. /**
  7522. * Sets whether to enable the builtin spell checker.
  7523. */
  7524. setSpellCheckerEnabled(enable: boolean): void;
  7525. /**
  7526. * The built in spellchecker does not automatically detect what language a user is
  7527. * typing in. In order for the spell checker to correctly check their words you
  7528. * must call this API with an array of language codes. You can get the list of
  7529. * supported language codes with the `ses.availableSpellCheckerLanguages` property.
  7530. *
  7531. * **Note:** On macOS the OS spellchecker is used and will detect your language
  7532. * automatically. This API is a no-op on macOS.
  7533. */
  7534. setSpellCheckerLanguages(languages: string[]): void;
  7535. /**
  7536. * Sets the SSL configuration for the session. All subsequent network requests will
  7537. * use the new configuration. Existing network connections (such as WebSocket
  7538. * connections) will not be terminated, but old sockets in the pool will not be
  7539. * reused for new connections.
  7540. */
  7541. setSSLConfig(config: SSLConfigConfig): void;
  7542. /**
  7543. * Overrides the `userAgent` and `acceptLanguages` for this session.
  7544. *
  7545. * The `acceptLanguages` must a comma separated ordered list of language codes, for
  7546. * example `"en-US,fr,de,ko,zh-CN,ja"`.
  7547. *
  7548. * This doesn't affect existing `WebContents`, and each `WebContents` can use
  7549. * `webContents.setUserAgent` to override the session-wide user agent.
  7550. */
  7551. setUserAgent(userAgent: string, acceptLanguages?: string): void;
  7552. /**
  7553. * A `String[]` array which consists of all the known available spell checker
  7554. * languages. Providing a language code to the `setSpellCheckerLanguages` API that
  7555. * isn't in this array will result in an error.
  7556. *
  7557. */
  7558. readonly availableSpellCheckerLanguages: string[];
  7559. /**
  7560. * A `Cookies` object for this session.
  7561. *
  7562. */
  7563. readonly cookies: Cookies;
  7564. /**
  7565. * A `NetLog` object for this session.
  7566. *
  7567. */
  7568. readonly netLog: NetLog;
  7569. /**
  7570. * A `Protocol` object for this session.
  7571. *
  7572. */
  7573. readonly protocol: Protocol;
  7574. /**
  7575. * A `ServiceWorkers` object for this session.
  7576. *
  7577. */
  7578. readonly serviceWorkers: ServiceWorkers;
  7579. /**
  7580. * A `Boolean` indicating whether builtin spell checker is enabled.
  7581. */
  7582. spellCheckerEnabled: boolean;
  7583. /**
  7584. * A `String | null` indicating the absolute file system path where data for this
  7585. * session is persisted on disk. For in memory sessions this returns `null`.
  7586. *
  7587. */
  7588. readonly storagePath: (string) | (null);
  7589. /**
  7590. * A `WebRequest` object for this session.
  7591. *
  7592. */
  7593. readonly webRequest: WebRequest;
  7594. }
  7595. interface SharedWorkerInfo {
  7596. // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
  7597. /**
  7598. * The unique id of the shared worker.
  7599. */
  7600. id: string;
  7601. /**
  7602. * The url of the shared worker.
  7603. */
  7604. url: string;
  7605. }
  7606. class ShareMenu extends NodeEventEmitter {
  7607. // Docs: https://electronjs.org/docs/api/share-menu
  7608. /**
  7609. * ShareMenu
  7610. */
  7611. constructor(sharingItem: SharingItem);
  7612. /**
  7613. * Closes the context menu in the `browserWindow`.
  7614. */
  7615. closePopup(browserWindow?: BrowserWindow): void;
  7616. /**
  7617. * Pops up this menu as a context menu in the `BrowserWindow`.
  7618. */
  7619. popup(options?: PopupOptions): void;
  7620. }
  7621. interface SharingItem {
  7622. // Docs: https://electronjs.org/docs/api/structures/sharing-item
  7623. /**
  7624. * An array of files to share.
  7625. */
  7626. filePaths?: string[];
  7627. /**
  7628. * An array of text to share.
  7629. */
  7630. texts?: string[];
  7631. /**
  7632. * An array of URLs to share.
  7633. */
  7634. urls?: string[];
  7635. }
  7636. interface Shell {
  7637. // Docs: https://electronjs.org/docs/api/shell
  7638. /**
  7639. * Play the beep sound.
  7640. */
  7641. beep(): void;
  7642. /**
  7643. * Open the given external protocol URL in the desktop's default manner. (For
  7644. * example, mailto: URLs in the user's default mail agent).
  7645. */
  7646. openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
  7647. /**
  7648. * Resolves with a string containing the error message corresponding to the failure
  7649. * if a failure occurred, otherwise "".
  7650. *
  7651. * Open the given file in the desktop's default manner.
  7652. */
  7653. openPath(path: string): Promise<string>;
  7654. /**
  7655. * Resolves the shortcut link at `shortcutPath`.
  7656. *
  7657. * An exception will be thrown when any error happens.
  7658. *
  7659. * @platform win32
  7660. */
  7661. readShortcutLink(shortcutPath: string): ShortcutDetails;
  7662. /**
  7663. * Show the given file in a file manager. If possible, select the file.
  7664. */
  7665. showItemInFolder(fullPath: string): void;
  7666. /**
  7667. * Resolves when the operation has been completed. Rejects if there was an error
  7668. * while deleting the requested item.
  7669. *
  7670. * This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin
  7671. * on Windows, and a desktop-environment-specific location on Linux).
  7672. */
  7673. trashItem(path: string): Promise<void>;
  7674. /**
  7675. * Whether the shortcut was created successfully.
  7676. *
  7677. * Creates or updates a shortcut link at `shortcutPath`.
  7678. *
  7679. * @platform win32
  7680. */
  7681. writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
  7682. /**
  7683. * Whether the shortcut was created successfully.
  7684. *
  7685. * Creates or updates a shortcut link at `shortcutPath`.
  7686. *
  7687. * @platform win32
  7688. */
  7689. writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
  7690. }
  7691. interface ShortcutDetails {
  7692. // Docs: https://electronjs.org/docs/api/structures/shortcut-details
  7693. /**
  7694. * The Application User Model ID. Default is empty.
  7695. */
  7696. appUserModelId?: string;
  7697. /**
  7698. * The arguments to be applied to `target` when launching from this shortcut.
  7699. * Default is empty.
  7700. */
  7701. args?: string;
  7702. /**
  7703. * The working directory. Default is empty.
  7704. */
  7705. cwd?: string;
  7706. /**
  7707. * The description of the shortcut. Default is empty.
  7708. */
  7709. description?: string;
  7710. /**
  7711. * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
  7712. * together. Default is empty, which uses the target's icon.
  7713. */
  7714. icon?: string;
  7715. /**
  7716. * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
  7717. */
  7718. iconIndex?: number;
  7719. /**
  7720. * The target to launch from this shortcut.
  7721. */
  7722. target: string;
  7723. /**
  7724. * The Application Toast Activator CLSID. Needed for participating in Action
  7725. * Center.
  7726. */
  7727. toastActivatorClsid?: string;
  7728. }
  7729. interface Size {
  7730. // Docs: https://electronjs.org/docs/api/structures/size
  7731. height: number;
  7732. width: number;
  7733. }
  7734. interface SystemPreferences extends NodeJS.EventEmitter {
  7735. // Docs: https://electronjs.org/docs/api/system-preferences
  7736. on(event: 'accent-color-changed', listener: (event: Event,
  7737. /**
  7738. * The new RGBA color the user assigned to be their system accent color.
  7739. */
  7740. newColor: string) => void): this;
  7741. once(event: 'accent-color-changed', listener: (event: Event,
  7742. /**
  7743. * The new RGBA color the user assigned to be their system accent color.
  7744. */
  7745. newColor: string) => void): this;
  7746. addListener(event: 'accent-color-changed', listener: (event: Event,
  7747. /**
  7748. * The new RGBA color the user assigned to be their system accent color.
  7749. */
  7750. newColor: string) => void): this;
  7751. removeListener(event: 'accent-color-changed', listener: (event: Event,
  7752. /**
  7753. * The new RGBA color the user assigned to be their system accent color.
  7754. */
  7755. newColor: string) => void): this;
  7756. on(event: 'color-changed', listener: (event: Event) => void): this;
  7757. once(event: 'color-changed', listener: (event: Event) => void): this;
  7758. addListener(event: 'color-changed', listener: (event: Event) => void): this;
  7759. removeListener(event: 'color-changed', listener: (event: Event) => void): this;
  7760. /**
  7761. * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
  7762. *
  7763. * @deprecated
  7764. * @platform win32
  7765. */
  7766. on(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7767. /**
  7768. * `true` if a high contrast theme is being used, `false` otherwise.
  7769. */
  7770. highContrastColorScheme: boolean) => void): this;
  7771. once(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7772. /**
  7773. * `true` if a high contrast theme is being used, `false` otherwise.
  7774. */
  7775. highContrastColorScheme: boolean) => void): this;
  7776. addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7777. /**
  7778. * `true` if a high contrast theme is being used, `false` otherwise.
  7779. */
  7780. highContrastColorScheme: boolean) => void): this;
  7781. removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7782. /**
  7783. * `true` if a high contrast theme is being used, `false` otherwise.
  7784. */
  7785. highContrastColorScheme: boolean) => void): this;
  7786. /**
  7787. * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
  7788. *
  7789. * @deprecated
  7790. * @platform win32
  7791. */
  7792. on(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7793. /**
  7794. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7795. * and dark backgrounds) is being used, `false` otherwise.
  7796. */
  7797. invertedColorScheme: boolean) => void): this;
  7798. once(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7799. /**
  7800. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7801. * and dark backgrounds) is being used, `false` otherwise.
  7802. */
  7803. invertedColorScheme: boolean) => void): this;
  7804. addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7805. /**
  7806. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7807. * and dark backgrounds) is being used, `false` otherwise.
  7808. */
  7809. invertedColorScheme: boolean) => void): this;
  7810. removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7811. /**
  7812. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7813. * and dark backgrounds) is being used, `false` otherwise.
  7814. */
  7815. invertedColorScheme: boolean) => void): this;
  7816. /**
  7817. * A promise that resolves with `true` if consent was granted and `false` if it was
  7818. * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
  7819. * access request was denied and later is changed through the System Preferences
  7820. * pane, a restart of the app will be required for the new permissions to take
  7821. * effect. If access has already been requested and denied, it _must_ be changed
  7822. * through the preference pane; an alert will not pop up and the promise will
  7823. * resolve with the existing access status.
  7824. *
  7825. * **Important:** In order to properly leverage this API, you must set the
  7826. * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
  7827. * app's `Info.plist` file. The values for these keys will be used to populate the
  7828. * permission dialogs so that the user will be properly informed as to the purpose
  7829. * of the permission request. See Electron Application Distribution for more
  7830. * information about how to set these in the context of Electron.
  7831. *
  7832. * This user consent was not required until macOS 10.14 Mojave, so this method will
  7833. * always return `true` if your system is running 10.13 High Sierra or lower.
  7834. *
  7835. * @platform darwin
  7836. */
  7837. askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
  7838. /**
  7839. * whether or not this device has the ability to use Touch ID.
  7840. *
  7841. * **NOTE:** This API will return `false` on macOS systems older than Sierra
  7842. * 10.12.2.
  7843. *
  7844. * @platform darwin
  7845. */
  7846. canPromptTouchID(): boolean;
  7847. /**
  7848. * The users current system wide accent color preference in RGBA hexadecimal form.
  7849. *
  7850. * This API is only available on macOS 10.14 Mojave or newer.
  7851. *
  7852. * @platform win32,darwin
  7853. */
  7854. getAccentColor(): string;
  7855. /**
  7856. * * `shouldRenderRichAnimation` Boolean - Returns true if rich animations should
  7857. * be rendered. Looks at session type (e.g. remote desktop) and accessibility
  7858. * settings to give guidance for heavy animations.
  7859. * * `scrollAnimationsEnabledBySystem` Boolean - Determines on a per-platform basis
  7860. * whether scroll animations (e.g. produced by home/end key) should be enabled.
  7861. * * `prefersReducedMotion` Boolean - Determines whether the user desires reduced
  7862. * motion based on platform APIs.
  7863. *
  7864. * Returns an object with system animation settings.
  7865. */
  7866. getAnimationSettings(): AnimationSettings;
  7867. /**
  7868. * | `null` - Can be `dark`, `light` or `unknown`.
  7869. *
  7870. * Gets the macOS appearance setting that you have declared you want for your
  7871. * application, maps to NSApplication.appearance. You can use the
  7872. * `setAppLevelAppearance` API to set this value.
  7873. *
  7874. * @deprecated
  7875. * @platform darwin
  7876. */
  7877. getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
  7878. /**
  7879. * The system color setting in RGB hexadecimal form (`#ABCDEF`). See the Windows
  7880. * docs and the macOS docs for more details.
  7881. *
  7882. * The following colors are only available on macOS 10.14: `find-highlight`,
  7883. * `selected-content-background`, `separator`,
  7884. * `unemphasized-selected-content-background`,
  7885. * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
  7886. *
  7887. * @platform win32,darwin
  7888. */
  7889. getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text' | 'alternate-selected-control-text' | 'control-background' | 'control' | 'control-text' | 'disabled-control-text' | 'find-highlight' | 'grid' | 'header-text' | 'highlight' | 'keyboard-focus-indicator' | 'label' | 'link' | 'placeholder-text' | 'quaternary-label' | 'scrubber-textured-background' | 'secondary-label' | 'selected-content-background' | 'selected-control' | 'selected-control-text' | 'selected-menu-item-text' | 'selected-text-background' | 'selected-text' | 'separator' | 'shadow' | 'tertiary-label' | 'text-background' | 'text' | 'under-page-background' | 'unemphasized-selected-content-background' | 'unemphasized-selected-text-background' | 'unemphasized-selected-text' | 'window-background' | 'window-frame-text'): string;
  7890. /**
  7891. * Can be `dark`, `light` or `unknown`.
  7892. *
  7893. * Gets the macOS appearance setting that is currently applied to your application,
  7894. * maps to NSApplication.effectiveAppearance
  7895. *
  7896. * @platform darwin
  7897. */
  7898. getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
  7899. /**
  7900. * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
  7901. *
  7902. * This user consent was not required on macOS 10.13 High Sierra or lower so this
  7903. * method will always return `granted`. macOS 10.14 Mojave or higher requires
  7904. * consent for `microphone` and `camera` access. macOS 10.15 Catalina or higher
  7905. * requires consent for `screen` access.
  7906. *
  7907. * Windows 10 has a global setting controlling `microphone` and `camera` access for
  7908. * all win32 applications. It will always return `granted` for `screen` and for all
  7909. * media types on older versions of Windows.
  7910. *
  7911. * @platform win32,darwin
  7912. */
  7913. getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
  7914. /**
  7915. * The standard system color formatted as `#RRGGBBAA`.
  7916. *
  7917. * Returns one of several standard system colors that automatically adapt to
  7918. * vibrancy and changes in accessibility settings like 'Increase contrast' and
  7919. * 'Reduce transparency'. See Apple Documentation for more details.
  7920. *
  7921. * @platform darwin
  7922. */
  7923. getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
  7924. /**
  7925. * The value of `key` in `NSUserDefaults`.
  7926. *
  7927. * Some popular `key` and `type`s are:
  7928. *
  7929. * * `AppleInterfaceStyle`: `string`
  7930. * * `AppleAquaColorVariant`: `integer`
  7931. * * `AppleHighlightColor`: `string`
  7932. * * `AppleShowScrollBars`: `string`
  7933. * * `NSNavRecentPlaces`: `array`
  7934. * * `NSPreferredWebServices`: `dictionary`
  7935. * * `NSUserDictionaryReplacementItems`: `array`
  7936. *
  7937. * @platform darwin
  7938. */
  7939. getUserDefault<Type extends keyof UserDefaultTypes>(key: string, type: Type): UserDefaultTypes[Type];
  7940. /**
  7941. * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
  7942. *
  7943. * An example of using it to determine if you should create a transparent window or
  7944. * not (transparent windows won't work correctly when DWM composition is disabled):
  7945. *
  7946. * @platform win32
  7947. */
  7948. isAeroGlassEnabled(): boolean;
  7949. /**
  7950. * Whether the system is in Dark Mode.
  7951. *
  7952. * **Deprecated:** Should use the new `nativeTheme.shouldUseDarkColors` API.
  7953. *
  7954. * @deprecated
  7955. * @platform darwin,win32
  7956. */
  7957. isDarkMode(): boolean;
  7958. /**
  7959. * `true` if a high contrast theme is active, `false` otherwise.
  7960. *
  7961. * **Deprecated:** Should use the new `nativeTheme.shouldUseHighContrastColors`
  7962. * API.
  7963. *
  7964. * @deprecated
  7965. * @platform darwin,win32
  7966. */
  7967. isHighContrastColorScheme(): boolean;
  7968. /**
  7969. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7970. * and dark backgrounds) is active, `false` otherwise.
  7971. *
  7972. * **Deprecated:** Should use the new `nativeTheme.shouldUseInvertedColorScheme`
  7973. * API.
  7974. *
  7975. * @deprecated
  7976. * @platform win32
  7977. */
  7978. isInvertedColorScheme(): boolean;
  7979. /**
  7980. * Whether the Swipe between pages setting is on.
  7981. *
  7982. * @platform darwin
  7983. */
  7984. isSwipeTrackingFromScrollEventsEnabled(): boolean;
  7985. /**
  7986. * `true` if the current process is a trusted accessibility client and `false` if
  7987. * it is not.
  7988. *
  7989. * @platform darwin
  7990. */
  7991. isTrustedAccessibilityClient(prompt: boolean): boolean;
  7992. /**
  7993. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7994. * contains the user information dictionary sent along with the notification.
  7995. *
  7996. * @platform darwin
  7997. */
  7998. postLocalNotification(event: string, userInfo: Record<string, any>): void;
  7999. /**
  8000. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  8001. * contains the user information dictionary sent along with the notification.
  8002. *
  8003. * @platform darwin
  8004. */
  8005. postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
  8006. /**
  8007. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  8008. * contains the user information dictionary sent along with the notification.
  8009. *
  8010. * @platform darwin
  8011. */
  8012. postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
  8013. /**
  8014. * resolves if the user has successfully authenticated with Touch ID.
  8015. *
  8016. * This API itself will not protect your user data; rather, it is a mechanism to
  8017. * allow you to do so. Native apps will need to set Access Control Constants like
  8018. * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
  8019. * auto-prompt for Touch ID biometric consent. This could be done with
  8020. * `node-keytar`, such that one would store an encryption key with `node-keytar`
  8021. * and only fetch it if `promptTouchID()` resolves.
  8022. *
  8023. * **NOTE:** This API will return a rejected Promise on macOS systems older than
  8024. * Sierra 10.12.2.
  8025. *
  8026. * @platform darwin
  8027. */
  8028. promptTouchID(reason: string): Promise<void>;
  8029. /**
  8030. * Add the specified defaults to your application's `NSUserDefaults`.
  8031. *
  8032. * @platform darwin
  8033. */
  8034. registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
  8035. /**
  8036. * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
  8037. * or global value of a `key` previously set with `setUserDefault`.
  8038. *
  8039. * @platform darwin
  8040. */
  8041. removeUserDefault(key: string): void;
  8042. /**
  8043. * Sets the appearance setting for your application, this should override the
  8044. * system default and override the value of `getEffectiveAppearance`.
  8045. *
  8046. * @deprecated
  8047. * @platform darwin
  8048. */
  8049. setAppLevelAppearance(appearance: (('dark' | 'light')) | (null)): void;
  8050. /**
  8051. * Set the value of `key` in `NSUserDefaults`.
  8052. *
  8053. * Note that `type` should match actual type of `value`. An exception is thrown if
  8054. * they don't.
  8055. *
  8056. * Some popular `key` and `type`s are:
  8057. *
  8058. * * `ApplePressAndHoldEnabled`: `boolean`
  8059. *
  8060. * @platform darwin
  8061. */
  8062. setUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary', value: string): void;
  8063. /**
  8064. * The ID of this subscription
  8065. *
  8066. * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
  8067. * defaults. This is necessary for events such as
  8068. * `NSUserDefaultsDidChangeNotification`.
  8069. *
  8070. * @platform darwin
  8071. */
  8072. subscribeLocalNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  8073. /**
  8074. * The ID of this subscription
  8075. *
  8076. * Subscribes to native notifications of macOS, `callback` will be called with
  8077. * `callback(event, userInfo)` when the corresponding `event` happens. The
  8078. * `userInfo` is an Object that contains the user information dictionary sent along
  8079. * with the notification. The `object` is the sender of the notification, and only
  8080. * supports `NSString` values for now.
  8081. *
  8082. * The `id` of the subscriber is returned, which can be used to unsubscribe the
  8083. * `event`.
  8084. *
  8085. * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
  8086. * values of `event` are:
  8087. *
  8088. * * `AppleInterfaceThemeChangedNotification`
  8089. * * `AppleAquaColorVariantChanged`
  8090. * * `AppleColorPreferencesChangedNotification`
  8091. * * `AppleShowScrollBarsSettingChanged`
  8092. *
  8093. * @platform darwin
  8094. */
  8095. subscribeNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  8096. /**
  8097. * The ID of this subscription
  8098. *
  8099. * Same as `subscribeNotification`, but uses
  8100. * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
  8101. * such as `NSWorkspaceDidActivateApplicationNotification`.
  8102. *
  8103. * @platform darwin
  8104. */
  8105. subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  8106. /**
  8107. * Same as `unsubscribeNotification`, but removes the subscriber from
  8108. * `NSNotificationCenter`.
  8109. *
  8110. * @platform darwin
  8111. */
  8112. unsubscribeLocalNotification(id: number): void;
  8113. /**
  8114. * Removes the subscriber with `id`.
  8115. *
  8116. * @platform darwin
  8117. */
  8118. unsubscribeNotification(id: number): void;
  8119. /**
  8120. * Same as `unsubscribeNotification`, but removes the subscriber from
  8121. * `NSWorkspace.sharedWorkspace.notificationCenter`.
  8122. *
  8123. * @platform darwin
  8124. */
  8125. unsubscribeWorkspaceNotification(id: number): void;
  8126. /**
  8127. * A `String` property that can be `dark`, `light` or `unknown`. It determines the
  8128. * macOS appearance setting for your application. This maps to values in:
  8129. * NSApplication.appearance. Setting this will override the system default as well
  8130. * as the value of `getEffectiveAppearance`.
  8131. *
  8132. * Possible values that can be set are `dark` and `light`, and possible return
  8133. * values are `dark`, `light`, and `unknown`.
  8134. *
  8135. * This property is only available on macOS 10.14 Mojave or newer.
  8136. *
  8137. * @platform darwin
  8138. */
  8139. appLevelAppearance: ('dark' | 'light' | 'unknown');
  8140. /**
  8141. * A `String` property that can be `dark`, `light` or `unknown`.
  8142. *
  8143. * Returns the macOS appearance setting that is currently applied to your
  8144. * application, maps to NSApplication.effectiveAppearance
  8145. *
  8146. * @platform darwin
  8147. */
  8148. readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
  8149. }
  8150. interface Task {
  8151. // Docs: https://electronjs.org/docs/api/structures/task
  8152. /**
  8153. * The command line arguments when `program` is executed.
  8154. */
  8155. arguments: string;
  8156. /**
  8157. * Description of this task.
  8158. */
  8159. description: string;
  8160. /**
  8161. * The icon index in the icon file. If an icon file consists of two or more icons,
  8162. * set this value to identify the icon. If an icon file consists of one icon, this
  8163. * value is 0.
  8164. */
  8165. iconIndex: number;
  8166. /**
  8167. * The absolute path to an icon to be displayed in a JumpList, which can be an
  8168. * arbitrary resource file that contains an icon. You can usually specify
  8169. * `process.execPath` to show the icon of the program.
  8170. */
  8171. iconPath: string;
  8172. /**
  8173. * Path of the program to execute, usually you should specify `process.execPath`
  8174. * which opens the current program.
  8175. */
  8176. program: string;
  8177. /**
  8178. * The string to be displayed in a JumpList.
  8179. */
  8180. title: string;
  8181. /**
  8182. * The working directory. Default is empty.
  8183. */
  8184. workingDirectory?: string;
  8185. }
  8186. interface ThumbarButton {
  8187. // Docs: https://electronjs.org/docs/api/structures/thumbar-button
  8188. click: Function;
  8189. /**
  8190. * Control specific states and behaviors of the button. By default, it is
  8191. * `['enabled']`.
  8192. */
  8193. flags?: string[];
  8194. /**
  8195. * The icon showing in thumbnail toolbar.
  8196. */
  8197. icon: NativeImage;
  8198. /**
  8199. * The text of the button's tooltip.
  8200. */
  8201. tooltip?: string;
  8202. }
  8203. class TouchBar {
  8204. // Docs: https://electronjs.org/docs/api/touch-bar
  8205. /**
  8206. * TouchBar
  8207. */
  8208. constructor(options: TouchBarConstructorOptions);
  8209. /**
  8210. * A `TouchBarItem` that will replace the "esc" button on the touch bar when set.
  8211. * Setting to `null` restores the default "esc" button. Changing this value
  8212. * immediately updates the escape item in the touch bar.
  8213. */
  8214. escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
  8215. /**
  8216. * A `typeof TouchBarButton` reference to the `TouchBarButton` class.
  8217. */
  8218. static TouchBarButton: typeof TouchBarButton;
  8219. /**
  8220. * A `typeof TouchBarColorPicker` reference to the `TouchBarColorPicker` class.
  8221. */
  8222. static TouchBarColorPicker: typeof TouchBarColorPicker;
  8223. /**
  8224. * A `typeof TouchBarGroup` reference to the `TouchBarGroup` class.
  8225. */
  8226. static TouchBarGroup: typeof TouchBarGroup;
  8227. /**
  8228. * A `typeof TouchBarLabel` reference to the `TouchBarLabel` class.
  8229. */
  8230. static TouchBarLabel: typeof TouchBarLabel;
  8231. /**
  8232. * A `typeof TouchBarOtherItemsProxy` reference to the `TouchBarOtherItemsProxy`
  8233. * class.
  8234. */
  8235. static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
  8236. /**
  8237. * A `typeof TouchBarPopover` reference to the `TouchBarPopover` class.
  8238. */
  8239. static TouchBarPopover: typeof TouchBarPopover;
  8240. /**
  8241. * A `typeof TouchBarScrubber` reference to the `TouchBarScrubber` class.
  8242. */
  8243. static TouchBarScrubber: typeof TouchBarScrubber;
  8244. /**
  8245. * A `typeof TouchBarSegmentedControl` reference to the `TouchBarSegmentedControl`
  8246. * class.
  8247. */
  8248. static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
  8249. /**
  8250. * A `typeof TouchBarSlider` reference to the `TouchBarSlider` class.
  8251. */
  8252. static TouchBarSlider: typeof TouchBarSlider;
  8253. /**
  8254. * A `typeof TouchBarSpacer` reference to the `TouchBarSpacer` class.
  8255. */
  8256. static TouchBarSpacer: typeof TouchBarSpacer;
  8257. }
  8258. class TouchBarButton {
  8259. // Docs: https://electronjs.org/docs/api/touch-bar-button
  8260. /**
  8261. * TouchBarButton
  8262. */
  8263. constructor(options: TouchBarButtonConstructorOptions);
  8264. /**
  8265. * A `String` representing the description of the button to be read by a screen
  8266. * reader. Will only be read by screen readers if no label is set.
  8267. */
  8268. accessibilityLabel: string;
  8269. /**
  8270. * A `String` hex code representing the button's current background color. Changing
  8271. * this value immediately updates the button in the touch bar.
  8272. */
  8273. backgroundColor: string;
  8274. /**
  8275. * A `Boolean` representing whether the button is in an enabled state.
  8276. */
  8277. enabled: boolean;
  8278. /**
  8279. * A `NativeImage` representing the button's current icon. Changing this value
  8280. * immediately updates the button in the touch bar.
  8281. */
  8282. icon: NativeImage;
  8283. /**
  8284. * A `String` - Can be `left`, `right` or `overlay`. Defaults to `overlay`.
  8285. */
  8286. iconPosition: ('left' | 'right' | 'overlay');
  8287. /**
  8288. * A `String` representing the button's current text. Changing this value
  8289. * immediately updates the button in the touch bar.
  8290. */
  8291. label: string;
  8292. }
  8293. class TouchBarColorPicker extends NodeEventEmitter {
  8294. // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
  8295. /**
  8296. * TouchBarColorPicker
  8297. */
  8298. constructor(options: TouchBarColorPickerConstructorOptions);
  8299. /**
  8300. * A `String[]` array representing the color picker's available colors to select.
  8301. * Changing this value immediately updates the color picker in the touch bar.
  8302. */
  8303. availableColors: string[];
  8304. /**
  8305. * A `String` hex code representing the color picker's currently selected color.
  8306. * Changing this value immediately updates the color picker in the touch bar.
  8307. */
  8308. selectedColor: string;
  8309. }
  8310. class TouchBarGroup extends NodeEventEmitter {
  8311. // Docs: https://electronjs.org/docs/api/touch-bar-group
  8312. /**
  8313. * TouchBarGroup
  8314. */
  8315. constructor(options: TouchBarGroupConstructorOptions);
  8316. }
  8317. class TouchBarLabel extends NodeEventEmitter {
  8318. // Docs: https://electronjs.org/docs/api/touch-bar-label
  8319. /**
  8320. * TouchBarLabel
  8321. */
  8322. constructor(options: TouchBarLabelConstructorOptions);
  8323. /**
  8324. * A `String` representing the description of the label to be read by a screen
  8325. * reader.
  8326. */
  8327. accessibilityLabel: string;
  8328. /**
  8329. * A `String` representing the label's current text. Changing this value
  8330. * immediately updates the label in the touch bar.
  8331. */
  8332. label: string;
  8333. /**
  8334. * A `String` hex code representing the label's current text color. Changing this
  8335. * value immediately updates the label in the touch bar.
  8336. */
  8337. textColor: string;
  8338. }
  8339. class TouchBarOtherItemsProxy extends NodeEventEmitter {
  8340. // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
  8341. /**
  8342. * TouchBarOtherItemsProxy
  8343. */
  8344. constructor();
  8345. }
  8346. class TouchBarPopover extends NodeEventEmitter {
  8347. // Docs: https://electronjs.org/docs/api/touch-bar-popover
  8348. /**
  8349. * TouchBarPopover
  8350. */
  8351. constructor(options: TouchBarPopoverConstructorOptions);
  8352. /**
  8353. * A `NativeImage` representing the popover's current button icon. Changing this
  8354. * value immediately updates the popover in the touch bar.
  8355. */
  8356. icon: NativeImage;
  8357. /**
  8358. * A `String` representing the popover's current button text. Changing this value
  8359. * immediately updates the popover in the touch bar.
  8360. */
  8361. label: string;
  8362. }
  8363. class TouchBarScrubber extends NodeEventEmitter {
  8364. // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
  8365. /**
  8366. * TouchBarScrubber
  8367. */
  8368. constructor(options: TouchBarScrubberConstructorOptions);
  8369. /**
  8370. * A `Boolean` representing whether this scrubber is continuous or not. Updating
  8371. * this value immediately updates the control in the touch bar.
  8372. */
  8373. continuous: boolean;
  8374. /**
  8375. * A `ScrubberItem[]` array representing the items in this scrubber. Updating this
  8376. * value immediately updates the control in the touch bar. Updating deep properties
  8377. * inside this array **does not update the touch bar**.
  8378. */
  8379. items: ScrubberItem[];
  8380. /**
  8381. * A `String` representing the mode of this scrubber. Updating this value
  8382. * immediately updates the control in the touch bar. Possible values:
  8383. *
  8384. * * `fixed` - Maps to `NSScrubberModeFixed`.
  8385. * * `free` - Maps to `NSScrubberModeFree`.
  8386. */
  8387. mode: ('fixed' | 'free');
  8388. /**
  8389. * A `String` representing the style that selected items in the scrubber should
  8390. * have. This style is overlayed on top of the scrubber item instead of being
  8391. * placed behind it. Updating this value immediately updates the control in the
  8392. * touch bar. Possible values:
  8393. *
  8394. * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
  8395. * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
  8396. * * `none` - Removes all styles.
  8397. */
  8398. overlayStyle: ('background' | 'outline' | 'none');
  8399. /**
  8400. * A `String` representing the style that selected items in the scrubber should
  8401. * have. Updating this value immediately updates the control in the touch bar.
  8402. * Possible values:
  8403. *
  8404. * * `background` - Maps to `[NSScrubberSelectionStyle roundedBackgroundStyle]`.
  8405. * * `outline` - Maps to `[NSScrubberSelectionStyle outlineOverlayStyle]`.
  8406. * * `none` - Removes all styles.
  8407. */
  8408. selectedStyle: ('background' | 'outline' | 'none');
  8409. /**
  8410. * A `Boolean` representing whether to show the left / right selection arrows in
  8411. * this scrubber. Updating this value immediately updates the control in the touch
  8412. * bar.
  8413. */
  8414. showArrowButtons: boolean;
  8415. }
  8416. class TouchBarSegmentedControl extends NodeEventEmitter {
  8417. // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
  8418. /**
  8419. * TouchBarSegmentedControl
  8420. */
  8421. constructor(options: TouchBarSegmentedControlConstructorOptions);
  8422. /**
  8423. * A `String` representing the current selection mode of the control. Can be
  8424. * `single`, `multiple` or `buttons`.
  8425. */
  8426. mode: ('single' | 'multiple' | 'buttons');
  8427. /**
  8428. * A `SegmentedControlSegment[]` array representing the segments in this control.
  8429. * Updating this value immediately updates the control in the touch bar. Updating
  8430. * deep properties inside this array **does not update the touch bar**.
  8431. */
  8432. segments: SegmentedControlSegment[];
  8433. /**
  8434. * A `String` representing the controls current segment style. Updating this value
  8435. * immediately updates the control in the touch bar.
  8436. */
  8437. segmentStyle: string;
  8438. /**
  8439. * An `Integer` representing the currently selected segment. Changing this value
  8440. * immediately updates the control in the touch bar. User interaction with the
  8441. * touch bar will update this value automatically.
  8442. */
  8443. selectedIndex: number;
  8444. }
  8445. class TouchBarSlider extends NodeEventEmitter {
  8446. // Docs: https://electronjs.org/docs/api/touch-bar-slider
  8447. /**
  8448. * TouchBarSlider
  8449. */
  8450. constructor(options: TouchBarSliderConstructorOptions);
  8451. /**
  8452. * A `String` representing the slider's current text. Changing this value
  8453. * immediately updates the slider in the touch bar.
  8454. */
  8455. label: string;
  8456. /**
  8457. * A `Number` representing the slider's current maximum value. Changing this value
  8458. * immediately updates the slider in the touch bar.
  8459. */
  8460. maxValue: number;
  8461. /**
  8462. * A `Number` representing the slider's current minimum value. Changing this value
  8463. * immediately updates the slider in the touch bar.
  8464. */
  8465. minValue: number;
  8466. /**
  8467. * A `Number` representing the slider's current value. Changing this value
  8468. * immediately updates the slider in the touch bar.
  8469. */
  8470. value: number;
  8471. }
  8472. class TouchBarSpacer extends NodeEventEmitter {
  8473. // Docs: https://electronjs.org/docs/api/touch-bar-spacer
  8474. /**
  8475. * TouchBarSpacer
  8476. */
  8477. constructor(options: TouchBarSpacerConstructorOptions);
  8478. /**
  8479. * A `String` representing the size of the spacer. Can be `small`, `large` or
  8480. * `flexible`.
  8481. */
  8482. size: ('small' | 'large' | 'flexible');
  8483. }
  8484. interface TraceCategoriesAndOptions {
  8485. // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
  8486. /**
  8487. * A filter to control what category groups should be traced. A filter can have an
  8488. * optional '-' prefix to exclude category groups that contain a matching category.
  8489. * Having both included and excluded category patterns in the same list is not
  8490. * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
  8491. * `-excluded_category1,-excluded_category2`.
  8492. */
  8493. categoryFilter: string;
  8494. /**
  8495. * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
  8496. * the following strings: `record-until-full`, `record-continuously`,
  8497. * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
  8498. * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
  8499. * modes and hence mutually exclusive. If more than one trace recording modes
  8500. * appear in the `traceOptions` string, the last one takes precedence. If none of
  8501. * the trace recording modes are specified, recording mode is `record-until-full`.
  8502. * The trace option will first be reset to the default option (`record_mode` set to
  8503. * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
  8504. * before options parsed from `traceOptions` are applied on it.
  8505. */
  8506. traceOptions: string;
  8507. }
  8508. interface TraceConfig {
  8509. // Docs: https://electronjs.org/docs/api/structures/trace-config
  8510. /**
  8511. * if true, filter event data according to a specific list of events that have been
  8512. * manually vetted to not include any PII. See the implementation in Chromium for
  8513. * specifics.
  8514. */
  8515. enable_argument_filter?: boolean;
  8516. /**
  8517. * a list of tracing categories to exclude. Can include glob-like patterns using
  8518. * `*` at the end of the category name. See tracing categories for the list of
  8519. * categories.
  8520. */
  8521. excluded_categories?: string[];
  8522. /**
  8523. * a list of histogram names to report with the trace.
  8524. */
  8525. histogram_names?: string[];
  8526. /**
  8527. * a list of tracing categories to include. Can include glob-like patterns using
  8528. * `*` at the end of the category name. See tracing categories for the list of
  8529. * categories.
  8530. */
  8531. included_categories?: string[];
  8532. /**
  8533. * a list of process IDs to include in the trace. If not specified, trace all
  8534. * processes.
  8535. */
  8536. included_process_ids?: number[];
  8537. /**
  8538. * if the `disabled-by-default-memory-infra` category is enabled, this contains
  8539. * optional additional configuration for data collection. See the Chromium
  8540. * memory-infra docs for more information.
  8541. */
  8542. memory_dump_config?: Record<string, any>;
  8543. /**
  8544. * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
  8545. * or `trace-to-console`. Defaults to `record-until-full`.
  8546. */
  8547. recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
  8548. /**
  8549. * maximum size of the trace recording buffer in events.
  8550. */
  8551. trace_buffer_size_in_events?: number;
  8552. /**
  8553. * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
  8554. */
  8555. trace_buffer_size_in_kb?: number;
  8556. }
  8557. interface Transaction {
  8558. // Docs: https://electronjs.org/docs/api/structures/transaction
  8559. /**
  8560. * The error code if an error occurred while processing the transaction.
  8561. */
  8562. errorCode: number;
  8563. /**
  8564. * The error message if an error occurred while processing the transaction.
  8565. */
  8566. errorMessage: string;
  8567. /**
  8568. * The identifier of the restored transaction by the App Store.
  8569. */
  8570. originalTransactionIdentifier: string;
  8571. payment: Payment;
  8572. /**
  8573. * The date the transaction was added to the App Store’s payment queue.
  8574. */
  8575. transactionDate: string;
  8576. /**
  8577. * A string that uniquely identifies a successful payment transaction.
  8578. */
  8579. transactionIdentifier: string;
  8580. /**
  8581. * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
  8582. * `deferred`.
  8583. */
  8584. transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
  8585. }
  8586. class Tray extends NodeEventEmitter {
  8587. // Docs: https://electronjs.org/docs/api/tray
  8588. /**
  8589. * Emitted when the tray balloon is clicked.
  8590. *
  8591. * @platform win32
  8592. */
  8593. on(event: 'balloon-click', listener: Function): this;
  8594. once(event: 'balloon-click', listener: Function): this;
  8595. addListener(event: 'balloon-click', listener: Function): this;
  8596. removeListener(event: 'balloon-click', listener: Function): this;
  8597. /**
  8598. * Emitted when the tray balloon is closed because of timeout or user manually
  8599. * closes it.
  8600. *
  8601. * @platform win32
  8602. */
  8603. on(event: 'balloon-closed', listener: Function): this;
  8604. once(event: 'balloon-closed', listener: Function): this;
  8605. addListener(event: 'balloon-closed', listener: Function): this;
  8606. removeListener(event: 'balloon-closed', listener: Function): this;
  8607. /**
  8608. * Emitted when the tray balloon shows.
  8609. *
  8610. * @platform win32
  8611. */
  8612. on(event: 'balloon-show', listener: Function): this;
  8613. once(event: 'balloon-show', listener: Function): this;
  8614. addListener(event: 'balloon-show', listener: Function): this;
  8615. removeListener(event: 'balloon-show', listener: Function): this;
  8616. /**
  8617. * Emitted when the tray icon is clicked.
  8618. */
  8619. on(event: 'click', listener: (event: KeyboardEvent,
  8620. /**
  8621. * The bounds of tray icon.
  8622. */
  8623. bounds: Rectangle,
  8624. /**
  8625. * The position of the event.
  8626. */
  8627. position: Point) => void): this;
  8628. once(event: 'click', listener: (event: KeyboardEvent,
  8629. /**
  8630. * The bounds of tray icon.
  8631. */
  8632. bounds: Rectangle,
  8633. /**
  8634. * The position of the event.
  8635. */
  8636. position: Point) => void): this;
  8637. addListener(event: 'click', listener: (event: KeyboardEvent,
  8638. /**
  8639. * The bounds of tray icon.
  8640. */
  8641. bounds: Rectangle,
  8642. /**
  8643. * The position of the event.
  8644. */
  8645. position: Point) => void): this;
  8646. removeListener(event: 'click', listener: (event: KeyboardEvent,
  8647. /**
  8648. * The bounds of tray icon.
  8649. */
  8650. bounds: Rectangle,
  8651. /**
  8652. * The position of the event.
  8653. */
  8654. position: Point) => void): this;
  8655. /**
  8656. * Emitted when the tray icon is double clicked.
  8657. *
  8658. * @platform darwin,win32
  8659. */
  8660. on(event: 'double-click', listener: (event: KeyboardEvent,
  8661. /**
  8662. * The bounds of tray icon.
  8663. */
  8664. bounds: Rectangle) => void): this;
  8665. once(event: 'double-click', listener: (event: KeyboardEvent,
  8666. /**
  8667. * The bounds of tray icon.
  8668. */
  8669. bounds: Rectangle) => void): this;
  8670. addListener(event: 'double-click', listener: (event: KeyboardEvent,
  8671. /**
  8672. * The bounds of tray icon.
  8673. */
  8674. bounds: Rectangle) => void): this;
  8675. removeListener(event: 'double-click', listener: (event: KeyboardEvent,
  8676. /**
  8677. * The bounds of tray icon.
  8678. */
  8679. bounds: Rectangle) => void): this;
  8680. /**
  8681. * Emitted when a drag operation ends on the tray or ends at another location.
  8682. *
  8683. * @platform darwin
  8684. */
  8685. on(event: 'drag-end', listener: Function): this;
  8686. once(event: 'drag-end', listener: Function): this;
  8687. addListener(event: 'drag-end', listener: Function): this;
  8688. removeListener(event: 'drag-end', listener: Function): this;
  8689. /**
  8690. * Emitted when a drag operation enters the tray icon.
  8691. *
  8692. * @platform darwin
  8693. */
  8694. on(event: 'drag-enter', listener: Function): this;
  8695. once(event: 'drag-enter', listener: Function): this;
  8696. addListener(event: 'drag-enter', listener: Function): this;
  8697. removeListener(event: 'drag-enter', listener: Function): this;
  8698. /**
  8699. * Emitted when a drag operation exits the tray icon.
  8700. *
  8701. * @platform darwin
  8702. */
  8703. on(event: 'drag-leave', listener: Function): this;
  8704. once(event: 'drag-leave', listener: Function): this;
  8705. addListener(event: 'drag-leave', listener: Function): this;
  8706. removeListener(event: 'drag-leave', listener: Function): this;
  8707. /**
  8708. * Emitted when any dragged items are dropped on the tray icon.
  8709. *
  8710. * @platform darwin
  8711. */
  8712. on(event: 'drop', listener: Function): this;
  8713. once(event: 'drop', listener: Function): this;
  8714. addListener(event: 'drop', listener: Function): this;
  8715. removeListener(event: 'drop', listener: Function): this;
  8716. /**
  8717. * Emitted when dragged files are dropped in the tray icon.
  8718. *
  8719. * @platform darwin
  8720. */
  8721. on(event: 'drop-files', listener: (event: Event,
  8722. /**
  8723. * The paths of the dropped files.
  8724. */
  8725. files: string[]) => void): this;
  8726. once(event: 'drop-files', listener: (event: Event,
  8727. /**
  8728. * The paths of the dropped files.
  8729. */
  8730. files: string[]) => void): this;
  8731. addListener(event: 'drop-files', listener: (event: Event,
  8732. /**
  8733. * The paths of the dropped files.
  8734. */
  8735. files: string[]) => void): this;
  8736. removeListener(event: 'drop-files', listener: (event: Event,
  8737. /**
  8738. * The paths of the dropped files.
  8739. */
  8740. files: string[]) => void): this;
  8741. /**
  8742. * Emitted when dragged text is dropped in the tray icon.
  8743. *
  8744. * @platform darwin
  8745. */
  8746. on(event: 'drop-text', listener: (event: Event,
  8747. /**
  8748. * the dropped text string.
  8749. */
  8750. text: string) => void): this;
  8751. once(event: 'drop-text', listener: (event: Event,
  8752. /**
  8753. * the dropped text string.
  8754. */
  8755. text: string) => void): this;
  8756. addListener(event: 'drop-text', listener: (event: Event,
  8757. /**
  8758. * the dropped text string.
  8759. */
  8760. text: string) => void): this;
  8761. removeListener(event: 'drop-text', listener: (event: Event,
  8762. /**
  8763. * the dropped text string.
  8764. */
  8765. text: string) => void): this;
  8766. /**
  8767. * Emitted when the mouse clicks the tray icon.
  8768. *
  8769. * @platform darwin
  8770. */
  8771. on(event: 'mouse-down', listener: (event: KeyboardEvent,
  8772. /**
  8773. * The position of the event.
  8774. */
  8775. position: Point) => void): this;
  8776. once(event: 'mouse-down', listener: (event: KeyboardEvent,
  8777. /**
  8778. * The position of the event.
  8779. */
  8780. position: Point) => void): this;
  8781. addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  8782. /**
  8783. * The position of the event.
  8784. */
  8785. position: Point) => void): this;
  8786. removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  8787. /**
  8788. * The position of the event.
  8789. */
  8790. position: Point) => void): this;
  8791. /**
  8792. * Emitted when the mouse enters the tray icon.
  8793. *
  8794. * @platform darwin
  8795. */
  8796. on(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8797. /**
  8798. * The position of the event.
  8799. */
  8800. position: Point) => void): this;
  8801. once(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8802. /**
  8803. * The position of the event.
  8804. */
  8805. position: Point) => void): this;
  8806. addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8807. /**
  8808. * The position of the event.
  8809. */
  8810. position: Point) => void): this;
  8811. removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8812. /**
  8813. * The position of the event.
  8814. */
  8815. position: Point) => void): this;
  8816. /**
  8817. * Emitted when the mouse exits the tray icon.
  8818. *
  8819. * @platform darwin
  8820. */
  8821. on(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8822. /**
  8823. * The position of the event.
  8824. */
  8825. position: Point) => void): this;
  8826. once(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8827. /**
  8828. * The position of the event.
  8829. */
  8830. position: Point) => void): this;
  8831. addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8832. /**
  8833. * The position of the event.
  8834. */
  8835. position: Point) => void): this;
  8836. removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8837. /**
  8838. * The position of the event.
  8839. */
  8840. position: Point) => void): this;
  8841. /**
  8842. * Emitted when the mouse moves in the tray icon.
  8843. *
  8844. * @platform darwin,win32
  8845. */
  8846. on(event: 'mouse-move', listener: (event: KeyboardEvent,
  8847. /**
  8848. * The position of the event.
  8849. */
  8850. position: Point) => void): this;
  8851. once(event: 'mouse-move', listener: (event: KeyboardEvent,
  8852. /**
  8853. * The position of the event.
  8854. */
  8855. position: Point) => void): this;
  8856. addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  8857. /**
  8858. * The position of the event.
  8859. */
  8860. position: Point) => void): this;
  8861. removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  8862. /**
  8863. * The position of the event.
  8864. */
  8865. position: Point) => void): this;
  8866. /**
  8867. * Emitted when the mouse is released from clicking the tray icon.
  8868. *
  8869. * Note: This will not be emitted if you have set a context menu for your Tray
  8870. * using `tray.setContextMenu`, as a result of macOS-level constraints.
  8871. *
  8872. * @platform darwin
  8873. */
  8874. on(event: 'mouse-up', listener: (event: KeyboardEvent,
  8875. /**
  8876. * The position of the event.
  8877. */
  8878. position: Point) => void): this;
  8879. once(event: 'mouse-up', listener: (event: KeyboardEvent,
  8880. /**
  8881. * The position of the event.
  8882. */
  8883. position: Point) => void): this;
  8884. addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  8885. /**
  8886. * The position of the event.
  8887. */
  8888. position: Point) => void): this;
  8889. removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  8890. /**
  8891. * The position of the event.
  8892. */
  8893. position: Point) => void): this;
  8894. /**
  8895. * Emitted when the tray icon is right clicked.
  8896. *
  8897. * @platform darwin,win32
  8898. */
  8899. on(event: 'right-click', listener: (event: KeyboardEvent,
  8900. /**
  8901. * The bounds of tray icon.
  8902. */
  8903. bounds: Rectangle) => void): this;
  8904. once(event: 'right-click', listener: (event: KeyboardEvent,
  8905. /**
  8906. * The bounds of tray icon.
  8907. */
  8908. bounds: Rectangle) => void): this;
  8909. addListener(event: 'right-click', listener: (event: KeyboardEvent,
  8910. /**
  8911. * The bounds of tray icon.
  8912. */
  8913. bounds: Rectangle) => void): this;
  8914. removeListener(event: 'right-click', listener: (event: KeyboardEvent,
  8915. /**
  8916. * The bounds of tray icon.
  8917. */
  8918. bounds: Rectangle) => void): this;
  8919. /**
  8920. * Tray
  8921. */
  8922. constructor(image: (NativeImage) | (string), guid?: string);
  8923. /**
  8924. * Closes an open context menu, as set by `tray.setContextMenu()`.
  8925. *
  8926. * @platform darwin,win32
  8927. */
  8928. closeContextMenu(): void;
  8929. /**
  8930. * Destroys the tray icon immediately.
  8931. */
  8932. destroy(): void;
  8933. /**
  8934. * Displays a tray balloon.
  8935. *
  8936. * @platform win32
  8937. */
  8938. displayBalloon(options: DisplayBalloonOptions): void;
  8939. /**
  8940. * Returns focus to the taskbar notification area. Notification area icons should
  8941. * use this message when they have completed their UI operation. For example, if
  8942. * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
  8943. * `tray.focus()` to return focus to the notification area.
  8944. *
  8945. * @platform win32
  8946. */
  8947. focus(): void;
  8948. /**
  8949. * The `bounds` of this tray icon as `Object`.
  8950. *
  8951. * @platform darwin,win32
  8952. */
  8953. getBounds(): Rectangle;
  8954. /**
  8955. * Whether double click events will be ignored.
  8956. *
  8957. * @platform darwin
  8958. */
  8959. getIgnoreDoubleClickEvents(): boolean;
  8960. /**
  8961. * the title displayed next to the tray icon in the status bar
  8962. *
  8963. * @platform darwin
  8964. */
  8965. getTitle(): string;
  8966. /**
  8967. * Whether the tray icon is destroyed.
  8968. */
  8969. isDestroyed(): boolean;
  8970. /**
  8971. * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
  8972. * will be shown instead of the tray icon's context menu.
  8973. *
  8974. * The `position` is only available on Windows, and it is (0, 0) by default.
  8975. *
  8976. * @platform darwin,win32
  8977. */
  8978. popUpContextMenu(menu?: Menu, position?: Point): void;
  8979. /**
  8980. * Removes a tray balloon.
  8981. *
  8982. * @platform win32
  8983. */
  8984. removeBalloon(): void;
  8985. /**
  8986. * Sets the context menu for this icon.
  8987. */
  8988. setContextMenu(menu: (Menu) | (null)): void;
  8989. /**
  8990. * Sets the option to ignore double click events. Ignoring these events allows you
  8991. * to detect every individual click of the tray icon.
  8992. *
  8993. * This value is set to false by default.
  8994. *
  8995. * @platform darwin
  8996. */
  8997. setIgnoreDoubleClickEvents(ignore: boolean): void;
  8998. /**
  8999. * Sets the `image` associated with this tray icon.
  9000. */
  9001. setImage(image: (NativeImage) | (string)): void;
  9002. /**
  9003. * Sets the `image` associated with this tray icon when pressed on macOS.
  9004. *
  9005. * @platform darwin
  9006. */
  9007. setPressedImage(image: (NativeImage) | (string)): void;
  9008. /**
  9009. * Sets the title displayed next to the tray icon in the status bar (Support ANSI
  9010. * colors).
  9011. *
  9012. * @platform darwin
  9013. */
  9014. setTitle(title: string, options?: TitleOptions): void;
  9015. /**
  9016. * Sets the hover text for this tray icon.
  9017. */
  9018. setToolTip(toolTip: string): void;
  9019. }
  9020. interface UploadData {
  9021. // Docs: https://electronjs.org/docs/api/structures/upload-data
  9022. /**
  9023. * UUID of blob data. Use ses.getBlobData method to retrieve the data.
  9024. */
  9025. blobUUID?: string;
  9026. /**
  9027. * Content being sent.
  9028. */
  9029. bytes: Buffer;
  9030. /**
  9031. * Path of file being uploaded.
  9032. */
  9033. file?: string;
  9034. }
  9035. interface UploadFile {
  9036. // Docs: https://electronjs.org/docs/api/structures/upload-file
  9037. /**
  9038. * Path of file to be uploaded.
  9039. */
  9040. filePath: string;
  9041. /**
  9042. * Number of bytes to read from `offset`. Defaults to `0`.
  9043. */
  9044. length: number;
  9045. /**
  9046. * Last Modification time in number of seconds since the UNIX epoch.
  9047. */
  9048. modificationTime: number;
  9049. /**
  9050. * Defaults to `0`.
  9051. */
  9052. offset: number;
  9053. /**
  9054. * `file`.
  9055. */
  9056. type: 'file';
  9057. }
  9058. interface UploadRawData {
  9059. // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
  9060. /**
  9061. * Data to be uploaded.
  9062. */
  9063. bytes: Buffer;
  9064. /**
  9065. * `rawData`.
  9066. */
  9067. type: 'rawData';
  9068. }
  9069. interface UserDefaultTypes {
  9070. // Docs: https://electronjs.org/docs/api/structures/user-default-types
  9071. array: Array<unknown>;
  9072. boolean: boolean;
  9073. dictionary: Record<string, unknown>;
  9074. double: number;
  9075. float: number;
  9076. integer: number;
  9077. string: string;
  9078. url: string;
  9079. }
  9080. class WebContents extends NodeEventEmitter {
  9081. // Docs: https://electronjs.org/docs/api/web-contents
  9082. /**
  9083. * | undefined - A WebContents instance with the given TargetID, or `undefined` if
  9084. * there is no WebContents associated with the given TargetID.
  9085. *
  9086. * When communicating with the Chrome DevTools Protocol, it can be useful to lookup
  9087. * a WebContents instance based on its assigned TargetID.
  9088. */
  9089. static fromDevToolsTargetId(targetId: string): WebContents;
  9090. /**
  9091. * | undefined - A WebContents instance with the given ID, or `undefined` if there
  9092. * is no WebContents associated with the given ID.
  9093. */
  9094. static fromId(id: number): WebContents;
  9095. /**
  9096. * An array of all `WebContents` instances. This will contain web contents for all
  9097. * windows, webviews, opened devtools, and devtools extension background pages.
  9098. */
  9099. static getAllWebContents(): WebContents[];
  9100. /**
  9101. * The web contents that is focused in this application, otherwise returns `null`.
  9102. */
  9103. static getFocusedWebContents(): WebContents;
  9104. /**
  9105. * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
  9106. * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
  9107. * menu shortcuts.
  9108. *
  9109. * To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
  9110. */
  9111. on(event: 'before-input-event', listener: (event: Event,
  9112. /**
  9113. * Input properties.
  9114. */
  9115. input: Input) => void): this;
  9116. once(event: 'before-input-event', listener: (event: Event,
  9117. /**
  9118. * Input properties.
  9119. */
  9120. input: Input) => void): this;
  9121. addListener(event: 'before-input-event', listener: (event: Event,
  9122. /**
  9123. * Input properties.
  9124. */
  9125. input: Input) => void): this;
  9126. removeListener(event: 'before-input-event', listener: (event: Event,
  9127. /**
  9128. * Input properties.
  9129. */
  9130. input: Input) => void): this;
  9131. /**
  9132. * Emitted when failed to verify the `certificate` for `url`.
  9133. *
  9134. * The usage is the same with the `certificate-error` event of `app`.
  9135. */
  9136. on(event: 'certificate-error', listener: (event: Event,
  9137. url: string,
  9138. /**
  9139. * The error code.
  9140. */
  9141. error: string,
  9142. certificate: Certificate,
  9143. callback: (isTrusted: boolean) => void,
  9144. isMainFrame: boolean) => void): this;
  9145. once(event: 'certificate-error', listener: (event: Event,
  9146. url: string,
  9147. /**
  9148. * The error code.
  9149. */
  9150. error: string,
  9151. certificate: Certificate,
  9152. callback: (isTrusted: boolean) => void,
  9153. isMainFrame: boolean) => void): this;
  9154. addListener(event: 'certificate-error', listener: (event: Event,
  9155. url: string,
  9156. /**
  9157. * The error code.
  9158. */
  9159. error: string,
  9160. certificate: Certificate,
  9161. callback: (isTrusted: boolean) => void,
  9162. isMainFrame: boolean) => void): this;
  9163. removeListener(event: 'certificate-error', listener: (event: Event,
  9164. url: string,
  9165. /**
  9166. * The error code.
  9167. */
  9168. error: string,
  9169. certificate: Certificate,
  9170. callback: (isTrusted: boolean) => void,
  9171. isMainFrame: boolean) => void): this;
  9172. /**
  9173. * Emitted when the associated window logs a console message.
  9174. */
  9175. on(event: 'console-message', listener: (event: Event,
  9176. /**
  9177. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  9178. * `error`.
  9179. */
  9180. level: number,
  9181. /**
  9182. * The actual console message
  9183. */
  9184. message: string,
  9185. /**
  9186. * The line number of the source that triggered this console message
  9187. */
  9188. line: number,
  9189. sourceId: string) => void): this;
  9190. once(event: 'console-message', listener: (event: Event,
  9191. /**
  9192. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  9193. * `error`.
  9194. */
  9195. level: number,
  9196. /**
  9197. * The actual console message
  9198. */
  9199. message: string,
  9200. /**
  9201. * The line number of the source that triggered this console message
  9202. */
  9203. line: number,
  9204. sourceId: string) => void): this;
  9205. addListener(event: 'console-message', listener: (event: Event,
  9206. /**
  9207. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  9208. * `error`.
  9209. */
  9210. level: number,
  9211. /**
  9212. * The actual console message
  9213. */
  9214. message: string,
  9215. /**
  9216. * The line number of the source that triggered this console message
  9217. */
  9218. line: number,
  9219. sourceId: string) => void): this;
  9220. removeListener(event: 'console-message', listener: (event: Event,
  9221. /**
  9222. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  9223. * `error`.
  9224. */
  9225. level: number,
  9226. /**
  9227. * The actual console message
  9228. */
  9229. message: string,
  9230. /**
  9231. * The line number of the source that triggered this console message
  9232. */
  9233. line: number,
  9234. sourceId: string) => void): this;
  9235. /**
  9236. * Emitted when there is a new context menu that needs to be handled.
  9237. */
  9238. on(event: 'context-menu', listener: (event: Event,
  9239. params: ContextMenuParams) => void): this;
  9240. once(event: 'context-menu', listener: (event: Event,
  9241. params: ContextMenuParams) => void): this;
  9242. addListener(event: 'context-menu', listener: (event: Event,
  9243. params: ContextMenuParams) => void): this;
  9244. removeListener(event: 'context-menu', listener: (event: Event,
  9245. params: ContextMenuParams) => void): this;
  9246. /**
  9247. * Emitted when the renderer process crashes or is killed.
  9248. *
  9249. * **Deprecated:** This event is superceded by the `render-process-gone` event
  9250. * which contains more information about why the render process disappeared. It
  9251. * isn't always because it crashed. The `killed` boolean can be replaced by
  9252. * checking `reason === 'killed'` when you switch to that event.
  9253. *
  9254. * @deprecated
  9255. */
  9256. on(event: 'crashed', listener: (event: Event,
  9257. killed: boolean) => void): this;
  9258. once(event: 'crashed', listener: (event: Event,
  9259. killed: boolean) => void): this;
  9260. addListener(event: 'crashed', listener: (event: Event,
  9261. killed: boolean) => void): this;
  9262. removeListener(event: 'crashed', listener: (event: Event,
  9263. killed: boolean) => void): this;
  9264. /**
  9265. * Emitted when the cursor's type changes. The `type` parameter can be `default`,
  9266. * `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
  9267. * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
  9268. * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
  9269. * `row-resize`, `m-panning`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`,
  9270. * `s-panning`, `se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`,
  9271. * `cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`, `none`,
  9272. * `not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing` or `custom`.
  9273. *
  9274. * If the `type` parameter is `custom`, the `image` parameter will hold the custom
  9275. * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
  9276. * additional information about the custom cursor.
  9277. */
  9278. on(event: 'cursor-changed', listener: (event: Event,
  9279. type: string,
  9280. image: NativeImage,
  9281. /**
  9282. * scaling factor for the custom cursor.
  9283. */
  9284. scale: number,
  9285. /**
  9286. * the size of the `image`.
  9287. */
  9288. size: Size,
  9289. /**
  9290. * coordinates of the custom cursor's hotspot.
  9291. */
  9292. hotspot: Point) => void): this;
  9293. once(event: 'cursor-changed', listener: (event: Event,
  9294. type: string,
  9295. image: NativeImage,
  9296. /**
  9297. * scaling factor for the custom cursor.
  9298. */
  9299. scale: number,
  9300. /**
  9301. * the size of the `image`.
  9302. */
  9303. size: Size,
  9304. /**
  9305. * coordinates of the custom cursor's hotspot.
  9306. */
  9307. hotspot: Point) => void): this;
  9308. addListener(event: 'cursor-changed', listener: (event: Event,
  9309. type: string,
  9310. image: NativeImage,
  9311. /**
  9312. * scaling factor for the custom cursor.
  9313. */
  9314. scale: number,
  9315. /**
  9316. * the size of the `image`.
  9317. */
  9318. size: Size,
  9319. /**
  9320. * coordinates of the custom cursor's hotspot.
  9321. */
  9322. hotspot: Point) => void): this;
  9323. removeListener(event: 'cursor-changed', listener: (event: Event,
  9324. type: string,
  9325. image: NativeImage,
  9326. /**
  9327. * scaling factor for the custom cursor.
  9328. */
  9329. scale: number,
  9330. /**
  9331. * the size of the `image`.
  9332. */
  9333. size: Size,
  9334. /**
  9335. * coordinates of the custom cursor's hotspot.
  9336. */
  9337. hotspot: Point) => void): this;
  9338. /**
  9339. * Emitted when `desktopCapturer.getSources()` is called in the renderer process.
  9340. * Calling `event.preventDefault()` will make it return empty sources.
  9341. */
  9342. on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  9343. once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  9344. addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  9345. removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  9346. /**
  9347. * Emitted when `webContents` is destroyed.
  9348. */
  9349. on(event: 'destroyed', listener: Function): this;
  9350. once(event: 'destroyed', listener: Function): this;
  9351. addListener(event: 'destroyed', listener: Function): this;
  9352. removeListener(event: 'destroyed', listener: Function): this;
  9353. /**
  9354. * Emitted when DevTools is closed.
  9355. */
  9356. on(event: 'devtools-closed', listener: Function): this;
  9357. once(event: 'devtools-closed', listener: Function): this;
  9358. addListener(event: 'devtools-closed', listener: Function): this;
  9359. removeListener(event: 'devtools-closed', listener: Function): this;
  9360. /**
  9361. * Emitted when DevTools is focused / opened.
  9362. */
  9363. on(event: 'devtools-focused', listener: Function): this;
  9364. once(event: 'devtools-focused', listener: Function): this;
  9365. addListener(event: 'devtools-focused', listener: Function): this;
  9366. removeListener(event: 'devtools-focused', listener: Function): this;
  9367. /**
  9368. * Emitted when DevTools is opened.
  9369. */
  9370. on(event: 'devtools-opened', listener: Function): this;
  9371. once(event: 'devtools-opened', listener: Function): this;
  9372. addListener(event: 'devtools-opened', listener: Function): this;
  9373. removeListener(event: 'devtools-opened', listener: Function): this;
  9374. /**
  9375. * Emitted when the devtools window instructs the webContents to reload
  9376. */
  9377. on(event: 'devtools-reload-page', listener: Function): this;
  9378. once(event: 'devtools-reload-page', listener: Function): this;
  9379. addListener(event: 'devtools-reload-page', listener: Function): this;
  9380. removeListener(event: 'devtools-reload-page', listener: Function): this;
  9381. /**
  9382. * Emitted when a `<webview>` has been attached to this web contents.
  9383. */
  9384. on(event: 'did-attach-webview', listener: (event: Event,
  9385. /**
  9386. * The guest web contents that is used by the `<webview>`.
  9387. */
  9388. webContents: WebContents) => void): this;
  9389. once(event: 'did-attach-webview', listener: (event: Event,
  9390. /**
  9391. * The guest web contents that is used by the `<webview>`.
  9392. */
  9393. webContents: WebContents) => void): this;
  9394. addListener(event: 'did-attach-webview', listener: (event: Event,
  9395. /**
  9396. * The guest web contents that is used by the `<webview>`.
  9397. */
  9398. webContents: WebContents) => void): this;
  9399. removeListener(event: 'did-attach-webview', listener: (event: Event,
  9400. /**
  9401. * The guest web contents that is used by the `<webview>`.
  9402. */
  9403. webContents: WebContents) => void): this;
  9404. /**
  9405. * Emitted when a page's theme color changes. This is usually due to encountering a
  9406. * meta tag:
  9407. */
  9408. on(event: 'did-change-theme-color', listener: (event: Event,
  9409. /**
  9410. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  9411. */
  9412. color: (string) | (null)) => void): this;
  9413. once(event: 'did-change-theme-color', listener: (event: Event,
  9414. /**
  9415. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  9416. */
  9417. color: (string) | (null)) => void): this;
  9418. addListener(event: 'did-change-theme-color', listener: (event: Event,
  9419. /**
  9420. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  9421. */
  9422. color: (string) | (null)) => void): this;
  9423. removeListener(event: 'did-change-theme-color', listener: (event: Event,
  9424. /**
  9425. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  9426. */
  9427. color: (string) | (null)) => void): this;
  9428. /**
  9429. * Emitted _after_ successful creation of a window via `window.open` in the
  9430. * renderer. Not emitted if the creation of the window is canceled from
  9431. * `webContents.setWindowOpenHandler`.
  9432. *
  9433. * See `window.open()` for more details and how to use this in conjunction with
  9434. * `webContents.setWindowOpenHandler`.
  9435. */
  9436. on(event: 'did-create-window', listener: (window: BrowserWindow,
  9437. details: DidCreateWindowDetails) => void): this;
  9438. once(event: 'did-create-window', listener: (window: BrowserWindow,
  9439. details: DidCreateWindowDetails) => void): this;
  9440. addListener(event: 'did-create-window', listener: (window: BrowserWindow,
  9441. details: DidCreateWindowDetails) => void): this;
  9442. removeListener(event: 'did-create-window', listener: (window: BrowserWindow,
  9443. details: DidCreateWindowDetails) => void): this;
  9444. /**
  9445. * This event is like `did-finish-load` but emitted when the load failed. The full
  9446. * list of error codes and their meaning is available here.
  9447. */
  9448. on(event: 'did-fail-load', listener: (event: Event,
  9449. errorCode: number,
  9450. errorDescription: string,
  9451. validatedURL: string,
  9452. isMainFrame: boolean,
  9453. frameProcessId: number,
  9454. frameRoutingId: number) => void): this;
  9455. once(event: 'did-fail-load', listener: (event: Event,
  9456. errorCode: number,
  9457. errorDescription: string,
  9458. validatedURL: string,
  9459. isMainFrame: boolean,
  9460. frameProcessId: number,
  9461. frameRoutingId: number) => void): this;
  9462. addListener(event: 'did-fail-load', listener: (event: Event,
  9463. errorCode: number,
  9464. errorDescription: string,
  9465. validatedURL: string,
  9466. isMainFrame: boolean,
  9467. frameProcessId: number,
  9468. frameRoutingId: number) => void): this;
  9469. removeListener(event: 'did-fail-load', listener: (event: Event,
  9470. errorCode: number,
  9471. errorDescription: string,
  9472. validatedURL: string,
  9473. isMainFrame: boolean,
  9474. frameProcessId: number,
  9475. frameRoutingId: number) => void): this;
  9476. /**
  9477. * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
  9478. * `window.stop()` was invoked).
  9479. */
  9480. on(event: 'did-fail-provisional-load', listener: (event: Event,
  9481. errorCode: number,
  9482. errorDescription: string,
  9483. validatedURL: string,
  9484. isMainFrame: boolean,
  9485. frameProcessId: number,
  9486. frameRoutingId: number) => void): this;
  9487. once(event: 'did-fail-provisional-load', listener: (event: Event,
  9488. errorCode: number,
  9489. errorDescription: string,
  9490. validatedURL: string,
  9491. isMainFrame: boolean,
  9492. frameProcessId: number,
  9493. frameRoutingId: number) => void): this;
  9494. addListener(event: 'did-fail-provisional-load', listener: (event: Event,
  9495. errorCode: number,
  9496. errorDescription: string,
  9497. validatedURL: string,
  9498. isMainFrame: boolean,
  9499. frameProcessId: number,
  9500. frameRoutingId: number) => void): this;
  9501. removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
  9502. errorCode: number,
  9503. errorDescription: string,
  9504. validatedURL: string,
  9505. isMainFrame: boolean,
  9506. frameProcessId: number,
  9507. frameRoutingId: number) => void): this;
  9508. /**
  9509. * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
  9510. * spinning, and the `onload` event was dispatched.
  9511. */
  9512. on(event: 'did-finish-load', listener: Function): this;
  9513. once(event: 'did-finish-load', listener: Function): this;
  9514. addListener(event: 'did-finish-load', listener: Function): this;
  9515. removeListener(event: 'did-finish-load', listener: Function): this;
  9516. /**
  9517. * Emitted when a frame has done navigation.
  9518. */
  9519. on(event: 'did-frame-finish-load', listener: (event: Event,
  9520. isMainFrame: boolean,
  9521. frameProcessId: number,
  9522. frameRoutingId: number) => void): this;
  9523. once(event: 'did-frame-finish-load', listener: (event: Event,
  9524. isMainFrame: boolean,
  9525. frameProcessId: number,
  9526. frameRoutingId: number) => void): this;
  9527. addListener(event: 'did-frame-finish-load', listener: (event: Event,
  9528. isMainFrame: boolean,
  9529. frameProcessId: number,
  9530. frameRoutingId: number) => void): this;
  9531. removeListener(event: 'did-frame-finish-load', listener: (event: Event,
  9532. isMainFrame: boolean,
  9533. frameProcessId: number,
  9534. frameRoutingId: number) => void): this;
  9535. /**
  9536. * Emitted when any frame navigation is done.
  9537. *
  9538. * This event is not emitted for in-page navigations, such as clicking anchor links
  9539. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  9540. * this purpose.
  9541. */
  9542. on(event: 'did-frame-navigate', listener: (event: Event,
  9543. url: string,
  9544. /**
  9545. * -1 for non HTTP navigations
  9546. */
  9547. httpResponseCode: number,
  9548. /**
  9549. * empty for non HTTP navigations,
  9550. */
  9551. httpStatusText: string,
  9552. isMainFrame: boolean,
  9553. frameProcessId: number,
  9554. frameRoutingId: number) => void): this;
  9555. once(event: 'did-frame-navigate', listener: (event: Event,
  9556. url: string,
  9557. /**
  9558. * -1 for non HTTP navigations
  9559. */
  9560. httpResponseCode: number,
  9561. /**
  9562. * empty for non HTTP navigations,
  9563. */
  9564. httpStatusText: string,
  9565. isMainFrame: boolean,
  9566. frameProcessId: number,
  9567. frameRoutingId: number) => void): this;
  9568. addListener(event: 'did-frame-navigate', listener: (event: Event,
  9569. url: string,
  9570. /**
  9571. * -1 for non HTTP navigations
  9572. */
  9573. httpResponseCode: number,
  9574. /**
  9575. * empty for non HTTP navigations,
  9576. */
  9577. httpStatusText: string,
  9578. isMainFrame: boolean,
  9579. frameProcessId: number,
  9580. frameRoutingId: number) => void): this;
  9581. removeListener(event: 'did-frame-navigate', listener: (event: Event,
  9582. url: string,
  9583. /**
  9584. * -1 for non HTTP navigations
  9585. */
  9586. httpResponseCode: number,
  9587. /**
  9588. * empty for non HTTP navigations,
  9589. */
  9590. httpStatusText: string,
  9591. isMainFrame: boolean,
  9592. frameProcessId: number,
  9593. frameRoutingId: number) => void): this;
  9594. /**
  9595. * Emitted when a main frame navigation is done.
  9596. *
  9597. * This event is not emitted for in-page navigations, such as clicking anchor links
  9598. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  9599. * this purpose.
  9600. */
  9601. on(event: 'did-navigate', listener: (event: Event,
  9602. url: string,
  9603. /**
  9604. * -1 for non HTTP navigations
  9605. */
  9606. httpResponseCode: number,
  9607. /**
  9608. * empty for non HTTP navigations
  9609. */
  9610. httpStatusText: string) => void): this;
  9611. once(event: 'did-navigate', listener: (event: Event,
  9612. url: string,
  9613. /**
  9614. * -1 for non HTTP navigations
  9615. */
  9616. httpResponseCode: number,
  9617. /**
  9618. * empty for non HTTP navigations
  9619. */
  9620. httpStatusText: string) => void): this;
  9621. addListener(event: 'did-navigate', listener: (event: Event,
  9622. url: string,
  9623. /**
  9624. * -1 for non HTTP navigations
  9625. */
  9626. httpResponseCode: number,
  9627. /**
  9628. * empty for non HTTP navigations
  9629. */
  9630. httpStatusText: string) => void): this;
  9631. removeListener(event: 'did-navigate', listener: (event: Event,
  9632. url: string,
  9633. /**
  9634. * -1 for non HTTP navigations
  9635. */
  9636. httpResponseCode: number,
  9637. /**
  9638. * empty for non HTTP navigations
  9639. */
  9640. httpStatusText: string) => void): this;
  9641. /**
  9642. * Emitted when an in-page navigation happened in any frame.
  9643. *
  9644. * When in-page navigation happens, the page URL changes but does not cause
  9645. * navigation outside of the page. Examples of this occurring are when anchor links
  9646. * are clicked or when the DOM `hashchange` event is triggered.
  9647. */
  9648. on(event: 'did-navigate-in-page', listener: (event: Event,
  9649. url: string,
  9650. isMainFrame: boolean,
  9651. frameProcessId: number,
  9652. frameRoutingId: number) => void): this;
  9653. once(event: 'did-navigate-in-page', listener: (event: Event,
  9654. url: string,
  9655. isMainFrame: boolean,
  9656. frameProcessId: number,
  9657. frameRoutingId: number) => void): this;
  9658. addListener(event: 'did-navigate-in-page', listener: (event: Event,
  9659. url: string,
  9660. isMainFrame: boolean,
  9661. frameProcessId: number,
  9662. frameRoutingId: number) => void): this;
  9663. removeListener(event: 'did-navigate-in-page', listener: (event: Event,
  9664. url: string,
  9665. isMainFrame: boolean,
  9666. frameProcessId: number,
  9667. frameRoutingId: number) => void): this;
  9668. /**
  9669. * Emitted after a server side redirect occurs during navigation. For example a
  9670. * 302 redirect.
  9671. *
  9672. * This event cannot be prevented, if you want to prevent redirects you should
  9673. * checkout out the `will-redirect` event above.
  9674. */
  9675. on(event: 'did-redirect-navigation', listener: (event: Event,
  9676. url: string,
  9677. isInPlace: boolean,
  9678. isMainFrame: boolean,
  9679. frameProcessId: number,
  9680. frameRoutingId: number) => void): this;
  9681. once(event: 'did-redirect-navigation', listener: (event: Event,
  9682. url: string,
  9683. isInPlace: boolean,
  9684. isMainFrame: boolean,
  9685. frameProcessId: number,
  9686. frameRoutingId: number) => void): this;
  9687. addListener(event: 'did-redirect-navigation', listener: (event: Event,
  9688. url: string,
  9689. isInPlace: boolean,
  9690. isMainFrame: boolean,
  9691. frameProcessId: number,
  9692. frameRoutingId: number) => void): this;
  9693. removeListener(event: 'did-redirect-navigation', listener: (event: Event,
  9694. url: string,
  9695. isInPlace: boolean,
  9696. isMainFrame: boolean,
  9697. frameProcessId: number,
  9698. frameRoutingId: number) => void): this;
  9699. /**
  9700. * Corresponds to the points in time when the spinner of the tab started spinning.
  9701. */
  9702. on(event: 'did-start-loading', listener: Function): this;
  9703. once(event: 'did-start-loading', listener: Function): this;
  9704. addListener(event: 'did-start-loading', listener: Function): this;
  9705. removeListener(event: 'did-start-loading', listener: Function): this;
  9706. /**
  9707. * Emitted when any frame (including main) starts navigating. `isInPlace` will be
  9708. * `true` for in-page navigations.
  9709. */
  9710. on(event: 'did-start-navigation', listener: (event: Event,
  9711. url: string,
  9712. isInPlace: boolean,
  9713. isMainFrame: boolean,
  9714. frameProcessId: number,
  9715. frameRoutingId: number) => void): this;
  9716. once(event: 'did-start-navigation', listener: (event: Event,
  9717. url: string,
  9718. isInPlace: boolean,
  9719. isMainFrame: boolean,
  9720. frameProcessId: number,
  9721. frameRoutingId: number) => void): this;
  9722. addListener(event: 'did-start-navigation', listener: (event: Event,
  9723. url: string,
  9724. isInPlace: boolean,
  9725. isMainFrame: boolean,
  9726. frameProcessId: number,
  9727. frameRoutingId: number) => void): this;
  9728. removeListener(event: 'did-start-navigation', listener: (event: Event,
  9729. url: string,
  9730. isInPlace: boolean,
  9731. isMainFrame: boolean,
  9732. frameProcessId: number,
  9733. frameRoutingId: number) => void): this;
  9734. /**
  9735. * Corresponds to the points in time when the spinner of the tab stopped spinning.
  9736. */
  9737. on(event: 'did-stop-loading', listener: Function): this;
  9738. once(event: 'did-stop-loading', listener: Function): this;
  9739. addListener(event: 'did-stop-loading', listener: Function): this;
  9740. removeListener(event: 'did-stop-loading', listener: Function): this;
  9741. /**
  9742. * Emitted when the document in the top-level frame is loaded.
  9743. */
  9744. on(event: 'dom-ready', listener: (event: Event) => void): this;
  9745. once(event: 'dom-ready', listener: (event: Event) => void): this;
  9746. addListener(event: 'dom-ready', listener: (event: Event) => void): this;
  9747. removeListener(event: 'dom-ready', listener: (event: Event) => void): this;
  9748. /**
  9749. * Emitted when the window enters a full-screen state triggered by HTML API.
  9750. */
  9751. on(event: 'enter-html-full-screen', listener: Function): this;
  9752. once(event: 'enter-html-full-screen', listener: Function): this;
  9753. addListener(event: 'enter-html-full-screen', listener: Function): this;
  9754. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  9755. /**
  9756. * Emitted when a result is available for [`webContents.findInPage`] request.
  9757. */
  9758. on(event: 'found-in-page', listener: (event: Event,
  9759. result: Result) => void): this;
  9760. once(event: 'found-in-page', listener: (event: Event,
  9761. result: Result) => void): this;
  9762. addListener(event: 'found-in-page', listener: (event: Event,
  9763. result: Result) => void): this;
  9764. removeListener(event: 'found-in-page', listener: (event: Event,
  9765. result: Result) => void): this;
  9766. /**
  9767. * Emitted when the mainFrame, an `<iframe>`, or a nested `<iframe>` is loaded
  9768. * within the page.
  9769. */
  9770. on(event: 'frame-created', listener: (event: Event,
  9771. details: FrameCreatedDetails) => void): this;
  9772. once(event: 'frame-created', listener: (event: Event,
  9773. details: FrameCreatedDetails) => void): this;
  9774. addListener(event: 'frame-created', listener: (event: Event,
  9775. details: FrameCreatedDetails) => void): this;
  9776. removeListener(event: 'frame-created', listener: (event: Event,
  9777. details: FrameCreatedDetails) => void): this;
  9778. /**
  9779. * Emitted when the renderer process sends an asynchronous message via
  9780. * `ipcRenderer.send()`.
  9781. */
  9782. on(event: 'ipc-message', listener: (event: Event,
  9783. channel: string,
  9784. ...args: any[]) => void): this;
  9785. once(event: 'ipc-message', listener: (event: Event,
  9786. channel: string,
  9787. ...args: any[]) => void): this;
  9788. addListener(event: 'ipc-message', listener: (event: Event,
  9789. channel: string,
  9790. ...args: any[]) => void): this;
  9791. removeListener(event: 'ipc-message', listener: (event: Event,
  9792. channel: string,
  9793. ...args: any[]) => void): this;
  9794. /**
  9795. * Emitted when the renderer process sends a synchronous message via
  9796. * `ipcRenderer.sendSync()`.
  9797. */
  9798. on(event: 'ipc-message-sync', listener: (event: Event,
  9799. channel: string,
  9800. ...args: any[]) => void): this;
  9801. once(event: 'ipc-message-sync', listener: (event: Event,
  9802. channel: string,
  9803. ...args: any[]) => void): this;
  9804. addListener(event: 'ipc-message-sync', listener: (event: Event,
  9805. channel: string,
  9806. ...args: any[]) => void): this;
  9807. removeListener(event: 'ipc-message-sync', listener: (event: Event,
  9808. channel: string,
  9809. ...args: any[]) => void): this;
  9810. /**
  9811. * Emitted when the window leaves a full-screen state triggered by HTML API.
  9812. */
  9813. on(event: 'leave-html-full-screen', listener: Function): this;
  9814. once(event: 'leave-html-full-screen', listener: Function): this;
  9815. addListener(event: 'leave-html-full-screen', listener: Function): this;
  9816. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  9817. /**
  9818. * Emitted when `webContents` wants to do basic auth.
  9819. *
  9820. * The usage is the same with the `login` event of `app`.
  9821. */
  9822. on(event: 'login', listener: (event: Event,
  9823. authenticationResponseDetails: AuthenticationResponseDetails,
  9824. authInfo: AuthInfo,
  9825. callback: (username?: string, password?: string) => void) => void): this;
  9826. once(event: 'login', listener: (event: Event,
  9827. authenticationResponseDetails: AuthenticationResponseDetails,
  9828. authInfo: AuthInfo,
  9829. callback: (username?: string, password?: string) => void) => void): this;
  9830. addListener(event: 'login', listener: (event: Event,
  9831. authenticationResponseDetails: AuthenticationResponseDetails,
  9832. authInfo: AuthInfo,
  9833. callback: (username?: string, password?: string) => void) => void): this;
  9834. removeListener(event: 'login', listener: (event: Event,
  9835. authenticationResponseDetails: AuthenticationResponseDetails,
  9836. authInfo: AuthInfo,
  9837. callback: (username?: string, password?: string) => void) => void): this;
  9838. /**
  9839. * Emitted when media is paused or done playing.
  9840. */
  9841. on(event: 'media-paused', listener: Function): this;
  9842. once(event: 'media-paused', listener: Function): this;
  9843. addListener(event: 'media-paused', listener: Function): this;
  9844. removeListener(event: 'media-paused', listener: Function): this;
  9845. /**
  9846. * Emitted when media starts playing.
  9847. */
  9848. on(event: 'media-started-playing', listener: Function): this;
  9849. once(event: 'media-started-playing', listener: Function): this;
  9850. addListener(event: 'media-started-playing', listener: Function): this;
  9851. removeListener(event: 'media-started-playing', listener: Function): this;
  9852. /**
  9853. * Deprecated in favor of `webContents.setWindowOpenHandler`.
  9854. *
  9855. * Emitted when the page requests to open a new window for a `url`. It could be
  9856. * requested by `window.open` or an external link like `<a target='_blank'>`.
  9857. *
  9858. * By default a new `BrowserWindow` will be created for the `url`.
  9859. *
  9860. * Calling `event.preventDefault()` will prevent Electron from automatically
  9861. * creating a new `BrowserWindow`. If you call `event.preventDefault()` and
  9862. * manually create a new `BrowserWindow` then you must set `event.newGuest` to
  9863. * reference the new `BrowserWindow` instance, failing to do so may result in
  9864. * unexpected behavior. For example:
  9865. *
  9866. * @deprecated
  9867. */
  9868. on(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9869. url: string,
  9870. frameName: string,
  9871. /**
  9872. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9873. * `save-to-disk` and `other`.
  9874. */
  9875. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9876. /**
  9877. * The options which will be used for creating the new `BrowserWindow`.
  9878. */
  9879. options: BrowserWindowConstructorOptions,
  9880. /**
  9881. * The non-standard features (features not handled by Chromium or Electron) given
  9882. * to `window.open()`. Deprecated, and will now always be the empty array `[]`.
  9883. */
  9884. additionalFeatures: string[],
  9885. /**
  9886. * The referrer that will be passed to the new window. May or may not result in the
  9887. * `Referer` header being sent, depending on the referrer policy.
  9888. */
  9889. referrer: Referrer,
  9890. /**
  9891. * The post data that will be sent to the new window, along with the appropriate
  9892. * headers that will be set. If no post data is to be sent, the value will be
  9893. * `null`. Only defined when the window is being created by a form that set
  9894. * `target=_blank`.
  9895. */
  9896. postBody: PostBody) => void): this;
  9897. once(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9898. url: string,
  9899. frameName: string,
  9900. /**
  9901. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9902. * `save-to-disk` and `other`.
  9903. */
  9904. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9905. /**
  9906. * The options which will be used for creating the new `BrowserWindow`.
  9907. */
  9908. options: BrowserWindowConstructorOptions,
  9909. /**
  9910. * The non-standard features (features not handled by Chromium or Electron) given
  9911. * to `window.open()`. Deprecated, and will now always be the empty array `[]`.
  9912. */
  9913. additionalFeatures: string[],
  9914. /**
  9915. * The referrer that will be passed to the new window. May or may not result in the
  9916. * `Referer` header being sent, depending on the referrer policy.
  9917. */
  9918. referrer: Referrer,
  9919. /**
  9920. * The post data that will be sent to the new window, along with the appropriate
  9921. * headers that will be set. If no post data is to be sent, the value will be
  9922. * `null`. Only defined when the window is being created by a form that set
  9923. * `target=_blank`.
  9924. */
  9925. postBody: PostBody) => void): this;
  9926. addListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9927. url: string,
  9928. frameName: string,
  9929. /**
  9930. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9931. * `save-to-disk` and `other`.
  9932. */
  9933. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9934. /**
  9935. * The options which will be used for creating the new `BrowserWindow`.
  9936. */
  9937. options: BrowserWindowConstructorOptions,
  9938. /**
  9939. * The non-standard features (features not handled by Chromium or Electron) given
  9940. * to `window.open()`. Deprecated, and will now always be the empty array `[]`.
  9941. */
  9942. additionalFeatures: string[],
  9943. /**
  9944. * The referrer that will be passed to the new window. May or may not result in the
  9945. * `Referer` header being sent, depending on the referrer policy.
  9946. */
  9947. referrer: Referrer,
  9948. /**
  9949. * The post data that will be sent to the new window, along with the appropriate
  9950. * headers that will be set. If no post data is to be sent, the value will be
  9951. * `null`. Only defined when the window is being created by a form that set
  9952. * `target=_blank`.
  9953. */
  9954. postBody: PostBody) => void): this;
  9955. removeListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9956. url: string,
  9957. frameName: string,
  9958. /**
  9959. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9960. * `save-to-disk` and `other`.
  9961. */
  9962. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9963. /**
  9964. * The options which will be used for creating the new `BrowserWindow`.
  9965. */
  9966. options: BrowserWindowConstructorOptions,
  9967. /**
  9968. * The non-standard features (features not handled by Chromium or Electron) given
  9969. * to `window.open()`. Deprecated, and will now always be the empty array `[]`.
  9970. */
  9971. additionalFeatures: string[],
  9972. /**
  9973. * The referrer that will be passed to the new window. May or may not result in the
  9974. * `Referer` header being sent, depending on the referrer policy.
  9975. */
  9976. referrer: Referrer,
  9977. /**
  9978. * The post data that will be sent to the new window, along with the appropriate
  9979. * headers that will be set. If no post data is to be sent, the value will be
  9980. * `null`. Only defined when the window is being created by a form that set
  9981. * `target=_blank`.
  9982. */
  9983. postBody: PostBody) => void): this;
  9984. /**
  9985. * Emitted when page receives favicon urls.
  9986. */
  9987. on(event: 'page-favicon-updated', listener: (event: Event,
  9988. /**
  9989. * Array of URLs.
  9990. */
  9991. favicons: string[]) => void): this;
  9992. once(event: 'page-favicon-updated', listener: (event: Event,
  9993. /**
  9994. * Array of URLs.
  9995. */
  9996. favicons: string[]) => void): this;
  9997. addListener(event: 'page-favicon-updated', listener: (event: Event,
  9998. /**
  9999. * Array of URLs.
  10000. */
  10001. favicons: string[]) => void): this;
  10002. removeListener(event: 'page-favicon-updated', listener: (event: Event,
  10003. /**
  10004. * Array of URLs.
  10005. */
  10006. favicons: string[]) => void): this;
  10007. /**
  10008. * Fired when page title is set during navigation. `explicitSet` is false when
  10009. * title is synthesized from file url.
  10010. */
  10011. on(event: 'page-title-updated', listener: (event: Event,
  10012. title: string,
  10013. explicitSet: boolean) => void): this;
  10014. once(event: 'page-title-updated', listener: (event: Event,
  10015. title: string,
  10016. explicitSet: boolean) => void): this;
  10017. addListener(event: 'page-title-updated', listener: (event: Event,
  10018. title: string,
  10019. explicitSet: boolean) => void): this;
  10020. removeListener(event: 'page-title-updated', listener: (event: Event,
  10021. title: string,
  10022. explicitSet: boolean) => void): this;
  10023. /**
  10024. * Emitted when a new frame is generated. Only the dirty area is passed in the
  10025. * buffer.
  10026. */
  10027. on(event: 'paint', listener: (event: Event,
  10028. dirtyRect: Rectangle,
  10029. /**
  10030. * The image data of the whole frame.
  10031. */
  10032. image: NativeImage) => void): this;
  10033. once(event: 'paint', listener: (event: Event,
  10034. dirtyRect: Rectangle,
  10035. /**
  10036. * The image data of the whole frame.
  10037. */
  10038. image: NativeImage) => void): this;
  10039. addListener(event: 'paint', listener: (event: Event,
  10040. dirtyRect: Rectangle,
  10041. /**
  10042. * The image data of the whole frame.
  10043. */
  10044. image: NativeImage) => void): this;
  10045. removeListener(event: 'paint', listener: (event: Event,
  10046. dirtyRect: Rectangle,
  10047. /**
  10048. * The image data of the whole frame.
  10049. */
  10050. image: NativeImage) => void): this;
  10051. /**
  10052. * Emitted when a plugin process has crashed.
  10053. */
  10054. on(event: 'plugin-crashed', listener: (event: Event,
  10055. name: string,
  10056. version: string) => void): this;
  10057. once(event: 'plugin-crashed', listener: (event: Event,
  10058. name: string,
  10059. version: string) => void): this;
  10060. addListener(event: 'plugin-crashed', listener: (event: Event,
  10061. name: string,
  10062. version: string) => void): this;
  10063. removeListener(event: 'plugin-crashed', listener: (event: Event,
  10064. name: string,
  10065. version: string) => void): this;
  10066. /**
  10067. * Emitted when the `WebContents` preferred size has changed.
  10068. *
  10069. * This event will only be emitted when `enablePreferredSizeMode` is set to `true`
  10070. * in `webPreferences`.
  10071. */
  10072. on(event: 'preferred-size-changed', listener: (event: Event,
  10073. /**
  10074. * The minimum size needed to contain the layout of the document—without requiring
  10075. * scrolling.
  10076. */
  10077. preferredSize: Size) => void): this;
  10078. once(event: 'preferred-size-changed', listener: (event: Event,
  10079. /**
  10080. * The minimum size needed to contain the layout of the document—without requiring
  10081. * scrolling.
  10082. */
  10083. preferredSize: Size) => void): this;
  10084. addListener(event: 'preferred-size-changed', listener: (event: Event,
  10085. /**
  10086. * The minimum size needed to contain the layout of the document—without requiring
  10087. * scrolling.
  10088. */
  10089. preferredSize: Size) => void): this;
  10090. removeListener(event: 'preferred-size-changed', listener: (event: Event,
  10091. /**
  10092. * The minimum size needed to contain the layout of the document—without requiring
  10093. * scrolling.
  10094. */
  10095. preferredSize: Size) => void): this;
  10096. /**
  10097. * Emitted when the preload script `preloadPath` throws an unhandled exception
  10098. * `error`.
  10099. */
  10100. on(event: 'preload-error', listener: (event: Event,
  10101. preloadPath: string,
  10102. error: Error) => void): this;
  10103. once(event: 'preload-error', listener: (event: Event,
  10104. preloadPath: string,
  10105. error: Error) => void): this;
  10106. addListener(event: 'preload-error', listener: (event: Event,
  10107. preloadPath: string,
  10108. error: Error) => void): this;
  10109. removeListener(event: 'preload-error', listener: (event: Event,
  10110. preloadPath: string,
  10111. error: Error) => void): this;
  10112. /**
  10113. * Emitted when the renderer process unexpectedly disappears. This is normally
  10114. * because it was crashed or killed.
  10115. */
  10116. on(event: 'render-process-gone', listener: (event: Event,
  10117. details: RenderProcessGoneDetails) => void): this;
  10118. once(event: 'render-process-gone', listener: (event: Event,
  10119. details: RenderProcessGoneDetails) => void): this;
  10120. addListener(event: 'render-process-gone', listener: (event: Event,
  10121. details: RenderProcessGoneDetails) => void): this;
  10122. removeListener(event: 'render-process-gone', listener: (event: Event,
  10123. details: RenderProcessGoneDetails) => void): this;
  10124. /**
  10125. * Emitted when the unresponsive web page becomes responsive again.
  10126. */
  10127. on(event: 'responsive', listener: Function): this;
  10128. once(event: 'responsive', listener: Function): this;
  10129. addListener(event: 'responsive', listener: Function): this;
  10130. removeListener(event: 'responsive', listener: Function): this;
  10131. /**
  10132. * Emitted when bluetooth device needs to be selected on call to
  10133. * `navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
  10134. * `webBluetooth` should be enabled. If `event.preventDefault` is not called, first
  10135. * available device will be selected. `callback` should be called with `deviceId`
  10136. * to be selected, passing empty string to `callback` will cancel the request.
  10137. */
  10138. on(event: 'select-bluetooth-device', listener: (event: Event,
  10139. devices: BluetoothDevice[],
  10140. callback: (deviceId: string) => void) => void): this;
  10141. once(event: 'select-bluetooth-device', listener: (event: Event,
  10142. devices: BluetoothDevice[],
  10143. callback: (deviceId: string) => void) => void): this;
  10144. addListener(event: 'select-bluetooth-device', listener: (event: Event,
  10145. devices: BluetoothDevice[],
  10146. callback: (deviceId: string) => void) => void): this;
  10147. removeListener(event: 'select-bluetooth-device', listener: (event: Event,
  10148. devices: BluetoothDevice[],
  10149. callback: (deviceId: string) => void) => void): this;
  10150. /**
  10151. * Emitted when a client certificate is requested.
  10152. *
  10153. * The usage is the same with the `select-client-certificate` event of `app`.
  10154. */
  10155. on(event: 'select-client-certificate', listener: (event: Event,
  10156. url: string,
  10157. certificateList: Certificate[],
  10158. callback: (certificate: Certificate) => void) => void): this;
  10159. once(event: 'select-client-certificate', listener: (event: Event,
  10160. url: string,
  10161. certificateList: Certificate[],
  10162. callback: (certificate: Certificate) => void) => void): this;
  10163. addListener(event: 'select-client-certificate', listener: (event: Event,
  10164. url: string,
  10165. certificateList: Certificate[],
  10166. callback: (certificate: Certificate) => void) => void): this;
  10167. removeListener(event: 'select-client-certificate', listener: (event: Event,
  10168. url: string,
  10169. certificateList: Certificate[],
  10170. callback: (certificate: Certificate) => void) => void): this;
  10171. /**
  10172. * Emitted when the web page becomes unresponsive.
  10173. */
  10174. on(event: 'unresponsive', listener: Function): this;
  10175. once(event: 'unresponsive', listener: Function): this;
  10176. addListener(event: 'unresponsive', listener: Function): this;
  10177. removeListener(event: 'unresponsive', listener: Function): this;
  10178. /**
  10179. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  10180. */
  10181. on(event: 'update-target-url', listener: (event: Event,
  10182. url: string) => void): this;
  10183. once(event: 'update-target-url', listener: (event: Event,
  10184. url: string) => void): this;
  10185. addListener(event: 'update-target-url', listener: (event: Event,
  10186. url: string) => void): this;
  10187. removeListener(event: 'update-target-url', listener: (event: Event,
  10188. url: string) => void): this;
  10189. /**
  10190. * Emitted when a `<webview>`'s web contents is being attached to this web
  10191. * contents. Calling `event.preventDefault()` will destroy the guest page.
  10192. *
  10193. * This event can be used to configure `webPreferences` for the `webContents` of a
  10194. * `<webview>` before it's loaded, and provides the ability to set settings that
  10195. * can't be set via `<webview>` attributes.
  10196. *
  10197. * **Note:** The specified `preload` script option will appear as `preloadURL` (not
  10198. * `preload`) in the `webPreferences` object emitted with this event.
  10199. */
  10200. on(event: 'will-attach-webview', listener: (event: Event,
  10201. /**
  10202. * The web preferences that will be used by the guest page. This object can be
  10203. * modified to adjust the preferences for the guest page.
  10204. */
  10205. webPreferences: WebPreferences,
  10206. /**
  10207. * The other `<webview>` parameters such as the `src` URL. This object can be
  10208. * modified to adjust the parameters of the guest page.
  10209. */
  10210. params: Record<string, string>) => void): this;
  10211. once(event: 'will-attach-webview', listener: (event: Event,
  10212. /**
  10213. * The web preferences that will be used by the guest page. This object can be
  10214. * modified to adjust the preferences for the guest page.
  10215. */
  10216. webPreferences: WebPreferences,
  10217. /**
  10218. * The other `<webview>` parameters such as the `src` URL. This object can be
  10219. * modified to adjust the parameters of the guest page.
  10220. */
  10221. params: Record<string, string>) => void): this;
  10222. addListener(event: 'will-attach-webview', listener: (event: Event,
  10223. /**
  10224. * The web preferences that will be used by the guest page. This object can be
  10225. * modified to adjust the preferences for the guest page.
  10226. */
  10227. webPreferences: WebPreferences,
  10228. /**
  10229. * The other `<webview>` parameters such as the `src` URL. This object can be
  10230. * modified to adjust the parameters of the guest page.
  10231. */
  10232. params: Record<string, string>) => void): this;
  10233. removeListener(event: 'will-attach-webview', listener: (event: Event,
  10234. /**
  10235. * The web preferences that will be used by the guest page. This object can be
  10236. * modified to adjust the preferences for the guest page.
  10237. */
  10238. webPreferences: WebPreferences,
  10239. /**
  10240. * The other `<webview>` parameters such as the `src` URL. This object can be
  10241. * modified to adjust the parameters of the guest page.
  10242. */
  10243. params: Record<string, string>) => void): this;
  10244. /**
  10245. * Emitted when a user or the page wants to start navigation. It can happen when
  10246. * the `window.location` object is changed or a user clicks a link in the page.
  10247. *
  10248. * This event will not emit when the navigation is started programmatically with
  10249. * APIs like `webContents.loadURL` and `webContents.back`.
  10250. *
  10251. * It is also not emitted for in-page navigations, such as clicking anchor links or
  10252. * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
  10253. * purpose.
  10254. *
  10255. * Calling `event.preventDefault()` will prevent the navigation.
  10256. */
  10257. on(event: 'will-navigate', listener: (event: Event,
  10258. url: string) => void): this;
  10259. once(event: 'will-navigate', listener: (event: Event,
  10260. url: string) => void): this;
  10261. addListener(event: 'will-navigate', listener: (event: Event,
  10262. url: string) => void): this;
  10263. removeListener(event: 'will-navigate', listener: (event: Event,
  10264. url: string) => void): this;
  10265. /**
  10266. * Emitted when a `beforeunload` event handler is attempting to cancel a page
  10267. * unload.
  10268. *
  10269. * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
  10270. * and allow the page to be unloaded.
  10271. *
  10272. * **Note:** This will be emitted for `BrowserViews` but will _not_ be respected -
  10273. * this is because we have chosen not to tie the `BrowserView` lifecycle to its
  10274. * owning BrowserWindow should one exist per the specification.
  10275. */
  10276. on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  10277. once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  10278. addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  10279. removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  10280. /**
  10281. * Emitted as a server side redirect occurs during navigation. For example a 302
  10282. * redirect.
  10283. *
  10284. * This event will be emitted after `did-start-navigation` and always before the
  10285. * `did-redirect-navigation` event for the same navigation.
  10286. *
  10287. * Calling `event.preventDefault()` will prevent the navigation (not just the
  10288. * redirect).
  10289. */
  10290. on(event: 'will-redirect', listener: (event: Event,
  10291. url: string,
  10292. isInPlace: boolean,
  10293. isMainFrame: boolean,
  10294. frameProcessId: number,
  10295. frameRoutingId: number) => void): this;
  10296. once(event: 'will-redirect', listener: (event: Event,
  10297. url: string,
  10298. isInPlace: boolean,
  10299. isMainFrame: boolean,
  10300. frameProcessId: number,
  10301. frameRoutingId: number) => void): this;
  10302. addListener(event: 'will-redirect', listener: (event: Event,
  10303. url: string,
  10304. isInPlace: boolean,
  10305. isMainFrame: boolean,
  10306. frameProcessId: number,
  10307. frameRoutingId: number) => void): this;
  10308. removeListener(event: 'will-redirect', listener: (event: Event,
  10309. url: string,
  10310. isInPlace: boolean,
  10311. isMainFrame: boolean,
  10312. frameProcessId: number,
  10313. frameRoutingId: number) => void): this;
  10314. /**
  10315. * Emitted when the user is requesting to change the zoom level using the mouse
  10316. * wheel.
  10317. */
  10318. on(event: 'zoom-changed', listener: (event: Event,
  10319. /**
  10320. * Can be `in` or `out`.
  10321. */
  10322. zoomDirection: ('in' | 'out')) => void): this;
  10323. once(event: 'zoom-changed', listener: (event: Event,
  10324. /**
  10325. * Can be `in` or `out`.
  10326. */
  10327. zoomDirection: ('in' | 'out')) => void): this;
  10328. addListener(event: 'zoom-changed', listener: (event: Event,
  10329. /**
  10330. * Can be `in` or `out`.
  10331. */
  10332. zoomDirection: ('in' | 'out')) => void): this;
  10333. removeListener(event: 'zoom-changed', listener: (event: Event,
  10334. /**
  10335. * Can be `in` or `out`.
  10336. */
  10337. zoomDirection: ('in' | 'out')) => void): this;
  10338. /**
  10339. * Adds the specified path to DevTools workspace. Must be used after DevTools
  10340. * creation:
  10341. */
  10342. addWorkSpace(path: string): void;
  10343. /**
  10344. * Begin subscribing for presentation events and captured frames, the `callback`
  10345. * will be called with `callback(image, dirtyRect)` when there is a presentation
  10346. * event.
  10347. *
  10348. * The `image` is an instance of NativeImage that stores the captured frame.
  10349. *
  10350. * The `dirtyRect` is an object with `x, y, width, height` properties that
  10351. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  10352. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  10353. */
  10354. beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  10355. /**
  10356. * Begin subscribing for presentation events and captured frames, the `callback`
  10357. * will be called with `callback(image, dirtyRect)` when there is a presentation
  10358. * event.
  10359. *
  10360. * The `image` is an instance of NativeImage that stores the captured frame.
  10361. *
  10362. * The `dirtyRect` is an object with `x, y, width, height` properties that
  10363. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  10364. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  10365. */
  10366. beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  10367. /**
  10368. * Whether the browser can go back to previous web page.
  10369. */
  10370. canGoBack(): boolean;
  10371. /**
  10372. * Whether the browser can go forward to next web page.
  10373. */
  10374. canGoForward(): boolean;
  10375. /**
  10376. * Whether the web page can go to `offset`.
  10377. */
  10378. canGoToOffset(offset: number): boolean;
  10379. /**
  10380. * Resolves with a NativeImage
  10381. *
  10382. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  10383. * whole visible page.
  10384. */
  10385. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  10386. /**
  10387. * Clears the navigation history.
  10388. */
  10389. clearHistory(): void;
  10390. /**
  10391. * Closes the devtools.
  10392. */
  10393. closeDevTools(): void;
  10394. /**
  10395. * Executes the editing command `copy` in web page.
  10396. */
  10397. copy(): void;
  10398. /**
  10399. * Copy the image at the given position to the clipboard.
  10400. */
  10401. copyImageAt(x: number, y: number): void;
  10402. /**
  10403. * Executes the editing command `cut` in web page.
  10404. */
  10405. cut(): void;
  10406. /**
  10407. * Decrease the capturer count by one. The page will be set to hidden or occluded
  10408. * state when its browser window is hidden or occluded and the capturer count
  10409. * reaches zero. If you want to decrease the hidden capturer count instead you
  10410. * should set `stayHidden` to true.
  10411. */
  10412. decrementCapturerCount(stayHidden?: boolean, stayAwake?: boolean): void;
  10413. /**
  10414. * Executes the editing command `delete` in web page.
  10415. */
  10416. delete(): void;
  10417. /**
  10418. * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
  10419. */
  10420. disableDeviceEmulation(): void;
  10421. /**
  10422. * Initiates a download of the resource at `url` without navigating. The
  10423. * `will-download` event of `session` will be triggered.
  10424. */
  10425. downloadURL(url: string): void;
  10426. /**
  10427. * Enable device emulation with the given parameters.
  10428. */
  10429. enableDeviceEmulation(parameters: Parameters): void;
  10430. /**
  10431. * End subscribing for frame presentation events.
  10432. */
  10433. endFrameSubscription(): void;
  10434. /**
  10435. * A promise that resolves with the result of the executed code or is rejected if
  10436. * the result of the code is a rejected promise.
  10437. *
  10438. * Evaluates `code` in page.
  10439. *
  10440. * In the browser window some HTML APIs like `requestFullScreen` can only be
  10441. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  10442. * this limitation.
  10443. *
  10444. * Code execution will be suspended until web page stop loading.
  10445. */
  10446. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  10447. /**
  10448. * A promise that resolves with the result of the executed code or is rejected if
  10449. * the result of the code is a rejected promise.
  10450. *
  10451. * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  10452. */
  10453. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
  10454. /**
  10455. * The request id used for the request.
  10456. *
  10457. * Starts a request to find all matches for the `text` in the web page. The result
  10458. * of the request can be obtained by subscribing to `found-in-page` event.
  10459. */
  10460. findInPage(text: string, options?: FindInPageOptions): number;
  10461. /**
  10462. * Focuses the web page.
  10463. */
  10464. focus(): void;
  10465. /**
  10466. * Forcefully terminates the renderer process that is currently hosting this
  10467. * `webContents`. This will cause the `render-process-gone` event to be emitted
  10468. * with the `reason=killed || reason=crashed`. Please note that some webContents
  10469. * share renderer processes and therefore calling this method may also crash the
  10470. * host process for other webContents as well.
  10471. *
  10472. * Calling `reload()` immediately after calling this method will force the reload
  10473. * to occur in a new process. This should be used when this process is unstable or
  10474. * unusable, for instance in order to recover from the `unresponsive` event.
  10475. */
  10476. forcefullyCrashRenderer(): void;
  10477. /**
  10478. * Information about all Shared Workers.
  10479. */
  10480. getAllSharedWorkers(): SharedWorkerInfo[];
  10481. /**
  10482. * whether or not this WebContents will throttle animations and timers when the
  10483. * page becomes backgrounded. This also affects the Page Visibility API.
  10484. */
  10485. getBackgroundThrottling(): boolean;
  10486. /**
  10487. * If *offscreen rendering* is enabled returns the current frame rate.
  10488. */
  10489. getFrameRate(): number;
  10490. /**
  10491. * The operating system `pid` of the associated renderer process.
  10492. */
  10493. getOSProcessId(): number;
  10494. /**
  10495. * Get the system printer list.
  10496. */
  10497. getPrinters(): PrinterInfo[];
  10498. /**
  10499. * The Chromium internal `pid` of the associated renderer. Can be compared to the
  10500. * `frameProcessId` passed by frame specific navigation events (e.g.
  10501. * `did-frame-navigate`)
  10502. */
  10503. getProcessId(): number;
  10504. /**
  10505. * The title of the current web page.
  10506. */
  10507. getTitle(): string;
  10508. /**
  10509. * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
  10510. * `remote`, `webview` or `offscreen`.
  10511. */
  10512. getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
  10513. /**
  10514. * The URL of the current web page.
  10515. */
  10516. getURL(): string;
  10517. /**
  10518. * The user agent for this web page.
  10519. */
  10520. getUserAgent(): string;
  10521. /**
  10522. * Returns the WebRTC IP Handling Policy.
  10523. */
  10524. getWebRTCIPHandlingPolicy(): string;
  10525. /**
  10526. * the current zoom factor.
  10527. */
  10528. getZoomFactor(): number;
  10529. /**
  10530. * the current zoom level.
  10531. */
  10532. getZoomLevel(): number;
  10533. /**
  10534. * Makes the browser go back a web page.
  10535. */
  10536. goBack(): void;
  10537. /**
  10538. * Makes the browser go forward a web page.
  10539. */
  10540. goForward(): void;
  10541. /**
  10542. * Navigates browser to the specified absolute web page index.
  10543. */
  10544. goToIndex(index: number): void;
  10545. /**
  10546. * Navigates to the specified offset from the "current entry".
  10547. */
  10548. goToOffset(offset: number): void;
  10549. /**
  10550. * Increase the capturer count by one. The page is considered visible when its
  10551. * browser window is hidden and the capturer count is non-zero. If you would like
  10552. * the page to stay hidden, you should ensure that `stayHidden` is set to true.
  10553. *
  10554. * This also affects the Page Visibility API.
  10555. */
  10556. incrementCapturerCount(size?: Size, stayHidden?: boolean, stayAwake?: boolean): void;
  10557. /**
  10558. * A promise that resolves with a key for the inserted CSS that can later be used
  10559. * to remove the CSS via `contents.removeInsertedCSS(key)`.
  10560. *
  10561. * Injects CSS into the current web page and returns a unique key for the inserted
  10562. * stylesheet.
  10563. */
  10564. insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
  10565. /**
  10566. * Inserts `text` to the focused element.
  10567. */
  10568. insertText(text: string): Promise<void>;
  10569. /**
  10570. * Starts inspecting element at position (`x`, `y`).
  10571. */
  10572. inspectElement(x: number, y: number): void;
  10573. /**
  10574. * Opens the developer tools for the service worker context.
  10575. */
  10576. inspectServiceWorker(): void;
  10577. /**
  10578. * Opens the developer tools for the shared worker context.
  10579. */
  10580. inspectSharedWorker(): void;
  10581. /**
  10582. * Inspects the shared worker based on its ID.
  10583. */
  10584. inspectSharedWorkerById(workerId: string): void;
  10585. /**
  10586. * Schedules a full repaint of the window this web contents is in.
  10587. *
  10588. * If *offscreen rendering* is enabled invalidates the frame and generates a new
  10589. * one through the `'paint'` event.
  10590. */
  10591. invalidate(): void;
  10592. /**
  10593. * Whether this page has been muted.
  10594. */
  10595. isAudioMuted(): boolean;
  10596. /**
  10597. * Whether this page is being captured. It returns true when the capturer count is
  10598. * large then 0.
  10599. */
  10600. isBeingCaptured(): boolean;
  10601. /**
  10602. * Whether the renderer process has crashed.
  10603. */
  10604. isCrashed(): boolean;
  10605. /**
  10606. * Whether audio is currently playing.
  10607. */
  10608. isCurrentlyAudible(): boolean;
  10609. /**
  10610. * Whether the web page is destroyed.
  10611. */
  10612. isDestroyed(): boolean;
  10613. /**
  10614. * Whether the devtools view is focused .
  10615. */
  10616. isDevToolsFocused(): boolean;
  10617. /**
  10618. * Whether the devtools is opened.
  10619. */
  10620. isDevToolsOpened(): boolean;
  10621. /**
  10622. * Whether the web page is focused.
  10623. */
  10624. isFocused(): boolean;
  10625. /**
  10626. * Whether web page is still loading resources.
  10627. */
  10628. isLoading(): boolean;
  10629. /**
  10630. * Whether the main frame (and not just iframes or frames within it) is still
  10631. * loading.
  10632. */
  10633. isLoadingMainFrame(): boolean;
  10634. /**
  10635. * Indicates whether *offscreen rendering* is enabled.
  10636. */
  10637. isOffscreen(): boolean;
  10638. /**
  10639. * If *offscreen rendering* is enabled returns whether it is currently painting.
  10640. */
  10641. isPainting(): boolean;
  10642. /**
  10643. * Whether the web page is waiting for a first-response from the main resource of
  10644. * the page.
  10645. */
  10646. isWaitingForResponse(): boolean;
  10647. /**
  10648. * the promise will resolve when the page has finished loading (see
  10649. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  10650. *
  10651. * Loads the given file in the window, `filePath` should be a path to an HTML file
  10652. * relative to the root of your application. For instance an app structure like
  10653. * this:
  10654. *
  10655. * Would require code like this
  10656. */
  10657. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  10658. /**
  10659. * the promise will resolve when the page has finished loading (see
  10660. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  10661. * A noop rejection handler is already attached, which avoids unhandled rejection
  10662. * errors.
  10663. *
  10664. * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
  10665. * the `http://` or `file://`. If the load should bypass http cache then use the
  10666. * `pragma` header to achieve it.
  10667. */
  10668. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  10669. /**
  10670. * Opens the devtools.
  10671. *
  10672. * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
  10673. * explicitly passing an empty `mode` can force using last used dock state.
  10674. */
  10675. openDevTools(options?: OpenDevToolsOptions): void;
  10676. /**
  10677. * Executes the editing command `paste` in web page.
  10678. */
  10679. paste(): void;
  10680. /**
  10681. * Executes the editing command `pasteAndMatchStyle` in web page.
  10682. */
  10683. pasteAndMatchStyle(): void;
  10684. /**
  10685. * Send a message to the renderer process, optionally transferring ownership of
  10686. * zero or more [`MessagePortMain`][] objects.
  10687. *
  10688. * The transferred `MessagePortMain` objects will be available in the renderer
  10689. * process by accessing the `ports` property of the emitted event. When they arrive
  10690. * in the renderer, they will be native DOM `MessagePort` objects.
  10691. *
  10692. * For example:
  10693. */
  10694. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  10695. /**
  10696. * When a custom `pageSize` is passed, Chromium attempts to validate platform
  10697. * specific minimum values for `width_microns` and `height_microns`. Width and
  10698. * height must both be minimum 353 microns but may be higher on some operating
  10699. * systems.
  10700. *
  10701. * Prints window's web page. When `silent` is set to `true`, Electron will pick the
  10702. * system's default printer if `deviceName` is empty and the default settings for
  10703. * printing.
  10704. *
  10705. * Use `page-break-before: always;` CSS style to force to print to a new page.
  10706. *
  10707. * Example usage:
  10708. */
  10709. print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
  10710. /**
  10711. * Resolves with the generated PDF data.
  10712. *
  10713. * Prints window's web page as PDF with Chromium's preview printing custom
  10714. * settings.
  10715. *
  10716. * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
  10717. *
  10718. * By default, an empty `options` will be regarded as:
  10719. *
  10720. * Use `page-break-before: always;` CSS style to force to print to a new page.
  10721. *
  10722. * An example of `webContents.printToPDF`:
  10723. */
  10724. printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
  10725. /**
  10726. * Executes the editing command `redo` in web page.
  10727. */
  10728. redo(): void;
  10729. /**
  10730. * Reloads the current web page.
  10731. */
  10732. reload(): void;
  10733. /**
  10734. * Reloads current page and ignores cache.
  10735. */
  10736. reloadIgnoringCache(): void;
  10737. /**
  10738. * Resolves if the removal was successful.
  10739. *
  10740. * Removes the inserted CSS from the current web page. The stylesheet is identified
  10741. * by its key, which is returned from `contents.insertCSS(css)`.
  10742. */
  10743. removeInsertedCSS(key: string): Promise<void>;
  10744. /**
  10745. * Removes the specified path from DevTools workspace.
  10746. */
  10747. removeWorkSpace(path: string): void;
  10748. /**
  10749. * Executes the editing command `replace` in web page.
  10750. */
  10751. replace(text: string): void;
  10752. /**
  10753. * Executes the editing command `replaceMisspelling` in web page.
  10754. */
  10755. replaceMisspelling(text: string): void;
  10756. /**
  10757. * resolves if the page is saved.
  10758. */
  10759. savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
  10760. /**
  10761. * Executes the editing command `selectAll` in web page.
  10762. */
  10763. selectAll(): void;
  10764. /**
  10765. * Send an asynchronous message to the renderer process via `channel`, along with
  10766. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  10767. * just like `postMessage`, so prototype chains will not be included. Sending
  10768. * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
  10769. *
  10770. * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
  10771. * Electron objects will throw an exception.
  10772. *
  10773. * The renderer process can handle the message by listening to `channel` with the
  10774. * `ipcRenderer` module.
  10775. *
  10776. * An example of sending messages from the main process to the renderer process:
  10777. */
  10778. send(channel: string, ...args: any[]): void;
  10779. /**
  10780. * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
  10781. * contents needs to be focused for `sendInputEvent()` to work.
  10782. */
  10783. sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
  10784. /**
  10785. * Send an asynchronous message to a specific frame in a renderer process via
  10786. * `channel`, along with arguments. Arguments will be serialized with the
  10787. * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
  10788. * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
  10789. * will throw an exception.
  10790. *
  10791. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  10792. * Electron objects will throw an exception.
  10793. *
  10794. * The renderer process can handle the message by listening to `channel` with the
  10795. * `ipcRenderer` module.
  10796. *
  10797. * If you want to get the `frameId` of a given renderer context you should use the
  10798. * `webFrame.routingId` value. E.g.
  10799. *
  10800. * You can also read `frameId` from all incoming IPC messages in the main process.
  10801. */
  10802. sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
  10803. /**
  10804. * Mute the audio on the current web page.
  10805. */
  10806. setAudioMuted(muted: boolean): void;
  10807. /**
  10808. * Controls whether or not this WebContents will throttle animations and timers
  10809. * when the page becomes backgrounded. This also affects the Page Visibility API.
  10810. */
  10811. setBackgroundThrottling(allowed: boolean): void;
  10812. /**
  10813. * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
  10814. *
  10815. * The `devToolsWebContents` must not have done any navigation, and it should not
  10816. * be used for other purposes after the call.
  10817. *
  10818. * By default Electron manages the devtools by creating an internal `WebContents`
  10819. * with native view, which developers have very limited control of. With the
  10820. * `setDevToolsWebContents` method, developers can use any `WebContents` to show
  10821. * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
  10822. * tag.
  10823. *
  10824. * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
  10825. * caller's responsibility to destroy `devToolsWebContents`.
  10826. *
  10827. * An example of showing devtools in a `<webview>` tag:
  10828. *
  10829. * An example of showing devtools in a `BrowserWindow`:
  10830. */
  10831. setDevToolsWebContents(devToolsWebContents: WebContents): void;
  10832. /**
  10833. * If *offscreen rendering* is enabled sets the frame rate to the specified number.
  10834. * Only values between 1 and 240 are accepted.
  10835. */
  10836. setFrameRate(fps: number): void;
  10837. /**
  10838. * Ignore application menu shortcuts while this web contents is focused.
  10839. */
  10840. setIgnoreMenuShortcuts(ignore: boolean): void;
  10841. /**
  10842. * Sets the image animation policy for this webContents. The policy only affects
  10843. * _new_ images, existing images that are currently being animated are unaffected.
  10844. * This is a known limitation in Chromium, you can force image animation to be
  10845. * recalculated with `img.src = img.src` which will result in no network traffic
  10846. * but will update the animation policy.
  10847. *
  10848. * This corresponds to the animationPolicy accessibility feature in Chromium.
  10849. */
  10850. setImageAnimationPolicy(policy: 'animate' | 'animateOnce' | 'noAnimation'): void;
  10851. /**
  10852. * Overrides the user agent for this web page.
  10853. */
  10854. setUserAgent(userAgent: string): void;
  10855. /**
  10856. * Sets the maximum and minimum pinch-to-zoom level.
  10857. *
  10858. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  10859. * call:
  10860. */
  10861. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  10862. /**
  10863. * Setting the WebRTC IP handling policy allows you to control which IPs are
  10864. * exposed via WebRTC. See BrowserLeaks for more details.
  10865. */
  10866. setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
  10867. /**
  10868. * Called before creating a window a new window is requested by the renderer, e.g.
  10869. * by `window.open()`, a link with `target="_blank"`, shift+clicking on a link, or
  10870. * submitting a form with `<form target="_blank">`. See `window.open()` for more
  10871. * details and how to use this in conjunction with `did-create-window`.
  10872. */
  10873. setWindowOpenHandler(handler: (details: HandlerDetails) => ({action: 'deny'}) | ({action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions})): void;
  10874. /**
  10875. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  10876. * divided by 100, so 300% = 3.0.
  10877. *
  10878. * The factor must be greater than 0.0.
  10879. */
  10880. setZoomFactor(factor: number): void;
  10881. /**
  10882. * Changes the zoom level to the specified level. The original size is 0 and each
  10883. * increment above or below represents zooming 20% larger or smaller to default
  10884. * limits of 300% and 50% of original size, respectively. The formula for this is
  10885. * `scale := 1.2 ^ level`.
  10886. *
  10887. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  10888. * the zoom level for a specific domain propagates across all instances of windows
  10889. * with the same domain. Differentiating the window URLs will make zoom work
  10890. * per-window.
  10891. */
  10892. setZoomLevel(level: number): void;
  10893. /**
  10894. * Shows pop-up dictionary that searches the selected word on the page.
  10895. *
  10896. * @platform darwin
  10897. */
  10898. showDefinitionForSelection(): void;
  10899. /**
  10900. * Sets the `item` as dragging item for current drag-drop operation, `file` is the
  10901. * absolute path of the file to be dragged, and `icon` is the image showing under
  10902. * the cursor when dragging.
  10903. */
  10904. startDrag(item: Item): void;
  10905. /**
  10906. * If *offscreen rendering* is enabled and not painting, start painting.
  10907. */
  10908. startPainting(): void;
  10909. /**
  10910. * Stops any pending navigation.
  10911. */
  10912. stop(): void;
  10913. /**
  10914. * Stops any `findInPage` request for the `webContents` with the provided `action`.
  10915. */
  10916. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  10917. /**
  10918. * If *offscreen rendering* is enabled and painting, stop painting.
  10919. */
  10920. stopPainting(): void;
  10921. /**
  10922. * Indicates whether the snapshot has been created successfully.
  10923. *
  10924. * Takes a V8 heap snapshot and saves it to `filePath`.
  10925. */
  10926. takeHeapSnapshot(filePath: string): Promise<void>;
  10927. /**
  10928. * Toggles the developer tools.
  10929. */
  10930. toggleDevTools(): void;
  10931. /**
  10932. * Executes the editing command `undo` in web page.
  10933. */
  10934. undo(): void;
  10935. /**
  10936. * Executes the editing command `unselect` in web page.
  10937. */
  10938. unselect(): void;
  10939. /**
  10940. * A `Boolean` property that determines whether this page is muted.
  10941. */
  10942. audioMuted: boolean;
  10943. /**
  10944. * A `Boolean` property that determines whether or not this WebContents will
  10945. * throttle animations and timers when the page becomes backgrounded. This also
  10946. * affects the Page Visibility API.
  10947. */
  10948. backgroundThrottling: boolean;
  10949. /**
  10950. * A `Debugger` instance for this webContents.
  10951. *
  10952. */
  10953. readonly debugger: Debugger;
  10954. /**
  10955. * A `WebContents | null` property that represents the of DevTools `WebContents`
  10956. * associated with a given `WebContents`.
  10957. *
  10958. * **Note:** Users should never store this object because it may become `null` when
  10959. * the DevTools has been closed.
  10960. *
  10961. */
  10962. readonly devToolsWebContents: (WebContents) | (null);
  10963. /**
  10964. * An `Integer` property that sets the frame rate of the web contents to the
  10965. * specified number. Only values between 1 and 240 are accepted.
  10966. *
  10967. * Only applicable if *offscreen rendering* is enabled.
  10968. */
  10969. frameRate: number;
  10970. /**
  10971. * A `WebContents` instance that might own this `WebContents`.
  10972. *
  10973. */
  10974. readonly hostWebContents: WebContents;
  10975. /**
  10976. * A `Integer` representing the unique ID of this WebContents. Each ID is unique
  10977. * among all `WebContents` instances of the entire Electron application.
  10978. *
  10979. */
  10980. readonly id: number;
  10981. /**
  10982. * A `WebFrameMain` property that represents the top frame of the page's frame
  10983. * hierarchy.
  10984. *
  10985. */
  10986. readonly mainFrame: WebFrameMain;
  10987. /**
  10988. * A `Session` used by this webContents.
  10989. *
  10990. */
  10991. readonly session: Session;
  10992. /**
  10993. * A `String` property that determines the user agent for this web page.
  10994. */
  10995. userAgent: string;
  10996. /**
  10997. * A `Number` property that determines the zoom factor for this web contents.
  10998. *
  10999. * The zoom factor is the zoom percent divided by 100, so 300% = 3.0.
  11000. */
  11001. zoomFactor: number;
  11002. /**
  11003. * A `Number` property that determines the zoom level for this web contents.
  11004. *
  11005. * The original size is 0 and each increment above or below represents zooming 20%
  11006. * larger or smaller to default limits of 300% and 50% of original size,
  11007. * respectively. The formula for this is `scale := 1.2 ^ level`.
  11008. */
  11009. zoomLevel: number;
  11010. }
  11011. interface WebFrame extends NodeJS.EventEmitter {
  11012. // Docs: https://electronjs.org/docs/api/web-frame
  11013. /**
  11014. * Attempts to free memory that is no longer being used (like images from a
  11015. * previous navigation).
  11016. *
  11017. * Note that blindly calling this method probably makes Electron slower since it
  11018. * will have to refill these emptied caches, you should only call it if an event in
  11019. * your app has occurred that makes you think your page is actually using less
  11020. * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
  11021. * and intend to stay there).
  11022. */
  11023. clearCache(): void;
  11024. /**
  11025. * A promise that resolves with the result of the executed code or is rejected if
  11026. * execution throws or results in a rejected promise.
  11027. *
  11028. * Evaluates `code` in page.
  11029. *
  11030. * In the browser window some HTML APIs like `requestFullScreen` can only be
  11031. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  11032. * this limitation.
  11033. */
  11034. executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  11035. /**
  11036. * A promise that resolves with the result of the executed code or is rejected if
  11037. * execution could not start.
  11038. *
  11039. * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  11040. *
  11041. * Note that when the execution of script fails, the returned promise will not
  11042. * reject and the `result` would be `undefined`. This is because Chromium does not
  11043. * dispatch errors of isolated worlds to foreign worlds.
  11044. */
  11045. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  11046. /**
  11047. * A child of `webFrame` with the supplied `name`, `null` would be returned if
  11048. * there's no such frame or if the frame is not in the current renderer process.
  11049. */
  11050. findFrameByName(name: string): WebFrame;
  11051. /**
  11052. * that has the supplied `routingId`, `null` if not found.
  11053. */
  11054. findFrameByRoutingId(routingId: number): WebFrame;
  11055. /**
  11056. * The frame element in `webFrame's` document selected by `selector`, `null` would
  11057. * be returned if `selector` does not select a frame or if the frame is not in the
  11058. * current renderer process.
  11059. */
  11060. getFrameForSelector(selector: string): WebFrame;
  11061. /**
  11062. * * `images` MemoryUsageDetails
  11063. * * `scripts` MemoryUsageDetails
  11064. * * `cssStyleSheets` MemoryUsageDetails
  11065. * * `xslStyleSheets` MemoryUsageDetails
  11066. * * `fonts` MemoryUsageDetails
  11067. * * `other` MemoryUsageDetails
  11068. *
  11069. * Returns an object describing usage information of Blink's internal memory
  11070. * caches.
  11071. *
  11072. * This will generate:
  11073. */
  11074. getResourceUsage(): ResourceUsage;
  11075. /**
  11076. * A list of suggested words for a given word. If the word is spelled correctly,
  11077. * the result will be empty.
  11078. */
  11079. getWordSuggestions(word: string): string[];
  11080. /**
  11081. * The current zoom factor.
  11082. */
  11083. getZoomFactor(): number;
  11084. /**
  11085. * The current zoom level.
  11086. */
  11087. getZoomLevel(): number;
  11088. /**
  11089. * A key for the inserted CSS that can later be used to remove the CSS via
  11090. * `webFrame.removeInsertedCSS(key)`.
  11091. *
  11092. * Injects CSS into the current web page and returns a unique key for the inserted
  11093. * stylesheet.
  11094. */
  11095. insertCSS(css: string): string;
  11096. /**
  11097. * Inserts `text` to the focused element.
  11098. */
  11099. insertText(text: string): void;
  11100. /**
  11101. * True if the word is misspelled according to the built in spellchecker, false
  11102. * otherwise. If no dictionary is loaded, always return false.
  11103. */
  11104. isWordMisspelled(word: string): boolean;
  11105. /**
  11106. * Removes the inserted CSS from the current web page. The stylesheet is identified
  11107. * by its key, which is returned from `webFrame.insertCSS(css)`.
  11108. */
  11109. removeInsertedCSS(key: string): void;
  11110. /**
  11111. * Set the security origin, content security policy and name of the isolated world.
  11112. * Note: If the `csp` is specified, then the `securityOrigin` also has to be
  11113. * specified.
  11114. */
  11115. setIsolatedWorldInfo(worldId: number, info: Info): void;
  11116. /**
  11117. * Sets a provider for spell checking in input fields and text areas.
  11118. *
  11119. * If you want to use this method you must disable the builtin spellchecker when
  11120. * you construct the window.
  11121. *
  11122. * The `provider` must be an object that has a `spellCheck` method that accepts an
  11123. * array of individual words for spellchecking. The `spellCheck` function runs
  11124. * asynchronously and calls the `callback` function with an array of misspelt words
  11125. * when complete.
  11126. *
  11127. * An example of using node-spellchecker as provider:
  11128. */
  11129. setSpellCheckProvider(language: string, provider: Provider): void;
  11130. /**
  11131. * Sets the maximum and minimum pinch-to-zoom level.
  11132. *
  11133. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  11134. * call:
  11135. *
  11136. * > **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom
  11137. * shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem
  11138. * roles in the application Menu. To disable shortcuts, manually define the Menu
  11139. * and omit zoom roles from the definition.
  11140. */
  11141. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
  11142. /**
  11143. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  11144. * divided by 100, so 300% = 3.0.
  11145. *
  11146. * The factor must be greater than 0.0.
  11147. */
  11148. setZoomFactor(factor: number): void;
  11149. /**
  11150. * Changes the zoom level to the specified level. The original size is 0 and each
  11151. * increment above or below represents zooming 20% larger or smaller to default
  11152. * limits of 300% and 50% of original size, respectively.
  11153. *
  11154. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  11155. * the zoom level for a specific domain propagates across all instances of windows
  11156. * with the same domain. Differentiating the window URLs will make zoom work
  11157. * per-window.
  11158. */
  11159. setZoomLevel(level: number): void;
  11160. /**
  11161. * A `WebFrame | null` representing the first child frame of `webFrame`, the
  11162. * property would be `null` if `webFrame` has no children or if first child is not
  11163. * in the current renderer process.
  11164. *
  11165. */
  11166. readonly firstChild: (WebFrame) | (null);
  11167. /**
  11168. * A `WebFrame | null` representing next sibling frame, the property would be
  11169. * `null` if `webFrame` is the last frame in its parent or if the next sibling is
  11170. * not in the current renderer process.
  11171. *
  11172. */
  11173. readonly nextSibling: (WebFrame) | (null);
  11174. /**
  11175. * A `WebFrame | null` representing the frame which opened `webFrame`, the property
  11176. * would be `null` if there's no opener or opener is not in the current renderer
  11177. * process.
  11178. *
  11179. */
  11180. readonly opener: (WebFrame) | (null);
  11181. /**
  11182. * A `WebFrame | null` representing parent frame of `webFrame`, the property would
  11183. * be `null` if `webFrame` is top or parent is not in the current renderer process.
  11184. *
  11185. */
  11186. readonly parent: (WebFrame) | (null);
  11187. /**
  11188. * An `Integer` representing the unique frame id in the current renderer process.
  11189. * Distinct WebFrame instances that refer to the same underlying frame will have
  11190. * the same `routingId`.
  11191. *
  11192. */
  11193. readonly routingId: number;
  11194. /**
  11195. * A `WebFrame | null` representing top frame in frame hierarchy to which
  11196. * `webFrame` belongs, the property would be `null` if top frame is not in the
  11197. * current renderer process.
  11198. *
  11199. */
  11200. readonly top: (WebFrame) | (null);
  11201. }
  11202. class WebFrameMain extends NodeEventEmitter {
  11203. // Docs: https://electronjs.org/docs/api/web-frame-main
  11204. /**
  11205. * A frame with the given process and routing IDs, or `undefined` if there is no
  11206. * WebFrameMain associated with the given IDs.
  11207. */
  11208. static fromId(processId: number, routingId: number): (WebFrameMain) | (undefined);
  11209. /**
  11210. * Emitted when the document is loaded.
  11211. */
  11212. on(event: 'dom-ready', listener: Function): this;
  11213. once(event: 'dom-ready', listener: Function): this;
  11214. addListener(event: 'dom-ready', listener: Function): this;
  11215. removeListener(event: 'dom-ready', listener: Function): this;
  11216. /**
  11217. * A promise that resolves with the result of the executed code or is rejected if
  11218. * execution throws or results in a rejected promise.
  11219. *
  11220. * Evaluates `code` in page.
  11221. *
  11222. * In the browser window some HTML APIs like `requestFullScreen` can only be
  11223. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  11224. * this limitation.
  11225. */
  11226. executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>;
  11227. /**
  11228. * Send a message to the renderer process, optionally transferring ownership of
  11229. * zero or more [`MessagePortMain`][] objects.
  11230. *
  11231. * The transferred `MessagePortMain` objects will be available in the renderer
  11232. * process by accessing the `ports` property of the emitted event. When they arrive
  11233. * in the renderer, they will be native DOM `MessagePort` objects.
  11234. *
  11235. * For example:
  11236. */
  11237. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  11238. /**
  11239. * Whether the reload was initiated successfully. Only results in `false` when the
  11240. * frame has no history.
  11241. */
  11242. reload(): boolean;
  11243. /**
  11244. * Send an asynchronous message to the renderer process via `channel`, along with
  11245. * arguments. Arguments will be serialized with the [Structured Clone
  11246. * Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
  11247. * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
  11248. * an exception.
  11249. *
  11250. * The renderer process can handle the message by listening to `channel` with the
  11251. * `ipcRenderer` module.
  11252. */
  11253. send(channel: string, ...args: any[]): void;
  11254. /**
  11255. * A `WebFrameMain[]` collection containing the direct descendents of `frame`.
  11256. *
  11257. */
  11258. readonly frames: WebFrameMain[];
  11259. /**
  11260. * A `WebFrameMain[]` collection containing every frame in the subtree of `frame`,
  11261. * including itself. This can be useful when traversing through all frames.
  11262. *
  11263. */
  11264. readonly framesInSubtree: WebFrameMain[];
  11265. /**
  11266. * An `Integer` representing the id of the frame's internal FrameTreeNode instance.
  11267. * This id is browser-global and uniquely identifies a frame that hosts content.
  11268. * The identifier is fixed at the creation of the frame and stays constant for the
  11269. * lifetime of the frame. When the frame is removed, the id is not used again.
  11270. *
  11271. */
  11272. readonly frameTreeNodeId: number;
  11273. /**
  11274. * A `String` representing the frame name.
  11275. *
  11276. */
  11277. readonly name: string;
  11278. /**
  11279. * An `Integer` representing the operating system `pid` of the process which owns
  11280. * this frame.
  11281. *
  11282. */
  11283. readonly osProcessId: number;
  11284. /**
  11285. * A `WebFrameMain | null` representing parent frame of `frame`, the property would
  11286. * be `null` if `frame` is the top frame in the frame hierarchy.
  11287. *
  11288. */
  11289. readonly parent: (WebFrameMain) | (null);
  11290. /**
  11291. * An `Integer` representing the Chromium internal `pid` of the process which owns
  11292. * this frame. This is not the same as the OS process ID; to read that use
  11293. * `frame.osProcessId`.
  11294. *
  11295. */
  11296. readonly processId: number;
  11297. /**
  11298. * An `Integer` representing the unique frame id in the current renderer process.
  11299. * Distinct `WebFrameMain` instances that refer to the same underlying frame will
  11300. * have the same `routingId`.
  11301. *
  11302. */
  11303. readonly routingId: number;
  11304. /**
  11305. * A `WebFrameMain | null` representing top frame in the frame hierarchy to which
  11306. * `frame` belongs.
  11307. *
  11308. */
  11309. readonly top: (WebFrameMain) | (null);
  11310. /**
  11311. * A `string` representing the current URL of the frame.
  11312. *
  11313. */
  11314. readonly url: string;
  11315. /**
  11316. * A `string` representing the visibility state of the frame.
  11317. *
  11318. * See also how the Page Visibility API is affected by other Electron APIs.
  11319. *
  11320. */
  11321. readonly visibilityState: string;
  11322. }
  11323. class WebRequest {
  11324. // Docs: https://electronjs.org/docs/api/web-request
  11325. /**
  11326. * The `listener` will be called with `listener(details)` when a server initiated
  11327. * redirect is about to occur.
  11328. */
  11329. onBeforeRedirect(filter: WebRequestFilter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  11330. /**
  11331. * The `listener` will be called with `listener(details)` when a server initiated
  11332. * redirect is about to occur.
  11333. */
  11334. onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  11335. /**
  11336. * The `listener` will be called with `listener(details, callback)` when a request
  11337. * is about to occur.
  11338. *
  11339. * The `uploadData` is an array of `UploadData` objects.
  11340. *
  11341. * The `callback` has to be called with an `response` object.
  11342. *
  11343. * Some examples of valid `urls`:
  11344. */
  11345. onBeforeRequest(filter: WebRequestFilter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
  11346. /**
  11347. * The `listener` will be called with `listener(details, callback)` when a request
  11348. * is about to occur.
  11349. *
  11350. * The `uploadData` is an array of `UploadData` objects.
  11351. *
  11352. * The `callback` has to be called with an `response` object.
  11353. *
  11354. * Some examples of valid `urls`:
  11355. */
  11356. onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
  11357. /**
  11358. * The `listener` will be called with `listener(details, callback)` before sending
  11359. * an HTTP request, once the request headers are available. This may occur after a
  11360. * TCP connection is made to the server, but before any http data is sent.
  11361. *
  11362. * The `callback` has to be called with a `response` object.
  11363. */
  11364. onBeforeSendHeaders(filter: WebRequestFilter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  11365. /**
  11366. * The `listener` will be called with `listener(details, callback)` before sending
  11367. * an HTTP request, once the request headers are available. This may occur after a
  11368. * TCP connection is made to the server, but before any http data is sent.
  11369. *
  11370. * The `callback` has to be called with a `response` object.
  11371. */
  11372. onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  11373. /**
  11374. * The `listener` will be called with `listener(details)` when a request is
  11375. * completed.
  11376. */
  11377. onCompleted(filter: WebRequestFilter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  11378. /**
  11379. * The `listener` will be called with `listener(details)` when a request is
  11380. * completed.
  11381. */
  11382. onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  11383. /**
  11384. * The `listener` will be called with `listener(details)` when an error occurs.
  11385. */
  11386. onErrorOccurred(filter: WebRequestFilter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  11387. /**
  11388. * The `listener` will be called with `listener(details)` when an error occurs.
  11389. */
  11390. onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  11391. /**
  11392. * The `listener` will be called with `listener(details, callback)` when HTTP
  11393. * response headers of a request have been received.
  11394. *
  11395. * The `callback` has to be called with a `response` object.
  11396. */
  11397. onHeadersReceived(filter: WebRequestFilter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  11398. /**
  11399. * The `listener` will be called with `listener(details, callback)` when HTTP
  11400. * response headers of a request have been received.
  11401. *
  11402. * The `callback` has to be called with a `response` object.
  11403. */
  11404. onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  11405. /**
  11406. * The `listener` will be called with `listener(details)` when first byte of the
  11407. * response body is received. For HTTP requests, this means that the status line
  11408. * and response headers are available.
  11409. */
  11410. onResponseStarted(filter: WebRequestFilter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  11411. /**
  11412. * The `listener` will be called with `listener(details)` when first byte of the
  11413. * response body is received. For HTTP requests, this means that the status line
  11414. * and response headers are available.
  11415. */
  11416. onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  11417. /**
  11418. * The `listener` will be called with `listener(details)` just before a request is
  11419. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  11420. * response are visible by the time this listener is fired.
  11421. */
  11422. onSendHeaders(filter: WebRequestFilter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  11423. /**
  11424. * The `listener` will be called with `listener(details)` just before a request is
  11425. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  11426. * response are visible by the time this listener is fired.
  11427. */
  11428. onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  11429. }
  11430. interface WebRequestFilter {
  11431. // Docs: https://electronjs.org/docs/api/structures/web-request-filter
  11432. /**
  11433. * Array of URL patterns that will be used to filter out the requests that do not
  11434. * match the URL patterns.
  11435. */
  11436. urls: string[];
  11437. }
  11438. interface WebSource {
  11439. // Docs: https://electronjs.org/docs/api/structures/web-source
  11440. code: string;
  11441. /**
  11442. * Default is 1.
  11443. */
  11444. startLine?: number;
  11445. url?: string;
  11446. }
  11447. interface WebviewTag extends HTMLElement {
  11448. // Docs: https://electronjs.org/docs/api/webview-tag
  11449. /**
  11450. * Fired when a load has committed. This includes navigation within the current
  11451. * document as well as subframe document-level loads, but does not include
  11452. * asynchronous resource loads.
  11453. */
  11454. addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
  11455. removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
  11456. /**
  11457. * Fired when the navigation is done, i.e. the spinner of the tab will stop
  11458. * spinning, and the `onload` event is dispatched.
  11459. */
  11460. addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this;
  11461. removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this;
  11462. /**
  11463. * This event is like `did-finish-load`, but fired when the load failed or was
  11464. * cancelled, e.g. `window.stop()` is invoked.
  11465. */
  11466. addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
  11467. removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
  11468. /**
  11469. * Fired when a frame has done navigation.
  11470. */
  11471. addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
  11472. removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
  11473. /**
  11474. * Corresponds to the points in time when the spinner of the tab starts spinning.
  11475. */
  11476. addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this;
  11477. removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this;
  11478. /**
  11479. * Corresponds to the points in time when the spinner of the tab stops spinning.
  11480. */
  11481. addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this;
  11482. removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this;
  11483. /**
  11484. * Fired when attached to the embedder web contents.
  11485. */
  11486. addEventListener(event: 'did-attach', listener: (event: Event) => void, useCapture?: boolean): this;
  11487. removeEventListener(event: 'did-attach', listener: (event: Event) => void): this;
  11488. /**
  11489. * Fired when document in the given frame is loaded.
  11490. */
  11491. addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this;
  11492. removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this;
  11493. /**
  11494. * Fired when page title is set during navigation. `explicitSet` is false when
  11495. * title is synthesized from file url.
  11496. */
  11497. addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
  11498. removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
  11499. /**
  11500. * Fired when page receives favicon urls.
  11501. */
  11502. addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
  11503. removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
  11504. /**
  11505. * Fired when page enters fullscreen triggered by HTML API.
  11506. */
  11507. addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
  11508. removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this;
  11509. /**
  11510. * Fired when page leaves fullscreen triggered by HTML API.
  11511. */
  11512. addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
  11513. removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this;
  11514. /**
  11515. * Fired when the guest window logs a console message.
  11516. *
  11517. * The following example code forwards all log messages to the embedder's console
  11518. * without regard for log level or other properties.
  11519. */
  11520. addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
  11521. removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
  11522. /**
  11523. * Fired when a result is available for `webview.findInPage` request.
  11524. */
  11525. addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
  11526. removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
  11527. /**
  11528. * Fired when the guest page attempts to open a new browser window.
  11529. *
  11530. * The following example code opens the new url in system's default browser.
  11531. */
  11532. addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this;
  11533. removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this;
  11534. /**
  11535. * Emitted when a user or the page wants to start navigation. It can happen when
  11536. * the `window.location` object is changed or a user clicks a link in the page.
  11537. *
  11538. * This event will not emit when the navigation is started programmatically with
  11539. * APIs like `<webview>.loadURL` and `<webview>.back`.
  11540. *
  11541. * It is also not emitted during in-page navigation, such as clicking anchor links
  11542. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  11543. * this purpose.
  11544. *
  11545. * Calling `event.preventDefault()` does __NOT__ have any effect.
  11546. */
  11547. addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
  11548. removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
  11549. /**
  11550. * Emitted when any frame (including main) starts navigating. `isInPlace` will be
  11551. * `true` for in-page navigations.
  11552. */
  11553. addEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void, useCapture?: boolean): this;
  11554. removeEventListener(event: 'did-start-navigation', listener: (event: DidStartNavigationEvent) => void): this;
  11555. /**
  11556. * Emitted after a server side redirect occurs during navigation. For example a 302
  11557. * redirect.
  11558. */
  11559. addEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void, useCapture?: boolean): this;
  11560. removeEventListener(event: 'did-redirect-navigation', listener: (event: DidRedirectNavigationEvent) => void): this;
  11561. /**
  11562. * Emitted when a navigation is done.
  11563. *
  11564. * This event is not emitted for in-page navigations, such as clicking anchor links
  11565. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  11566. * this purpose.
  11567. */
  11568. addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
  11569. removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
  11570. /**
  11571. * Emitted when any frame navigation is done.
  11572. *
  11573. * This event is not emitted for in-page navigations, such as clicking anchor links
  11574. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  11575. * this purpose.
  11576. */
  11577. addEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void, useCapture?: boolean): this;
  11578. removeEventListener(event: 'did-frame-navigate', listener: (event: DidFrameNavigateEvent) => void): this;
  11579. /**
  11580. * Emitted when an in-page navigation happened.
  11581. *
  11582. * When in-page navigation happens, the page URL changes but does not cause
  11583. * navigation outside of the page. Examples of this occurring are when anchor links
  11584. * are clicked or when the DOM `hashchange` event is triggered.
  11585. */
  11586. addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
  11587. removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
  11588. /**
  11589. * Fired when the guest page attempts to close itself.
  11590. *
  11591. * The following example code navigates the `webview` to `about:blank` when the
  11592. * guest attempts to close itself.
  11593. */
  11594. addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this;
  11595. removeEventListener(event: 'close', listener: (event: Event) => void): this;
  11596. /**
  11597. * Fired when the guest page has sent an asynchronous message to embedder page.
  11598. *
  11599. * With `sendToHost` method and `ipc-message` event you can communicate between
  11600. * guest page and embedder page:
  11601. */
  11602. addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
  11603. removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
  11604. /**
  11605. * Fired when the renderer process is crashed.
  11606. */
  11607. addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this;
  11608. removeEventListener(event: 'crashed', listener: (event: Event) => void): this;
  11609. /**
  11610. * Fired when a plugin process is crashed.
  11611. */
  11612. addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
  11613. removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
  11614. /**
  11615. * Fired when the WebContents is destroyed.
  11616. */
  11617. addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this;
  11618. removeEventListener(event: 'destroyed', listener: (event: Event) => void): this;
  11619. /**
  11620. * Emitted when media starts playing.
  11621. */
  11622. addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this;
  11623. removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this;
  11624. /**
  11625. * Emitted when media is paused or done playing.
  11626. */
  11627. addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this;
  11628. removeEventListener(event: 'media-paused', listener: (event: Event) => void): this;
  11629. /**
  11630. * Emitted when a page's theme color changes. This is usually due to encountering a
  11631. * meta tag:
  11632. */
  11633. addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
  11634. removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
  11635. /**
  11636. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  11637. */
  11638. addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
  11639. removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
  11640. /**
  11641. * Emitted when DevTools is opened.
  11642. */
  11643. addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this;
  11644. removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this;
  11645. /**
  11646. * Emitted when DevTools is closed.
  11647. */
  11648. addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this;
  11649. removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this;
  11650. /**
  11651. * Emitted when DevTools is focused / opened.
  11652. */
  11653. addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this;
  11654. removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this;
  11655. /**
  11656. * Emitted when there is a new context menu that needs to be handled.
  11657. */
  11658. addEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void, useCapture?: boolean): this;
  11659. removeEventListener(event: 'context-menu', listener: (event: ContextMenuEvent) => void): this;
  11660. addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  11661. addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  11662. removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  11663. removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  11664. /**
  11665. * Whether the guest page can go back.
  11666. */
  11667. canGoBack(): boolean;
  11668. /**
  11669. * Whether the guest page can go forward.
  11670. */
  11671. canGoForward(): boolean;
  11672. /**
  11673. * Whether the guest page can go to `offset`.
  11674. */
  11675. canGoToOffset(offset: number): boolean;
  11676. /**
  11677. * Resolves with a NativeImage
  11678. *
  11679. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  11680. * whole visible page.
  11681. */
  11682. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  11683. /**
  11684. * Clears the navigation history.
  11685. */
  11686. clearHistory(): void;
  11687. /**
  11688. * Closes the DevTools window of guest page.
  11689. */
  11690. closeDevTools(): void;
  11691. /**
  11692. * Executes editing command `copy` in page.
  11693. */
  11694. copy(): void;
  11695. /**
  11696. * Executes editing command `cut` in page.
  11697. */
  11698. cut(): void;
  11699. /**
  11700. * Executes editing command `delete` in page.
  11701. */
  11702. delete(): void;
  11703. /**
  11704. * Initiates a download of the resource at `url` without navigating.
  11705. */
  11706. downloadURL(url: string): void;
  11707. /**
  11708. * A promise that resolves with the result of the executed code or is rejected if
  11709. * the result of the code is a rejected promise.
  11710. *
  11711. * Evaluates `code` in page. If `userGesture` is set, it will create the user
  11712. * gesture context in the page. HTML APIs like `requestFullScreen`, which require
  11713. * user action, can take advantage of this option for automation.
  11714. */
  11715. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  11716. /**
  11717. * The request id used for the request.
  11718. *
  11719. * Starts a request to find all matches for the `text` in the web page. The result
  11720. * of the request can be obtained by subscribing to `found-in-page` event.
  11721. */
  11722. findInPage(text: string, options?: FindInPageOptions): number;
  11723. /**
  11724. * The title of guest page.
  11725. */
  11726. getTitle(): string;
  11727. /**
  11728. * The URL of guest page.
  11729. */
  11730. getURL(): string;
  11731. /**
  11732. * The user agent for guest page.
  11733. */
  11734. getUserAgent(): string;
  11735. /**
  11736. * The WebContents ID of this `webview`.
  11737. */
  11738. getWebContentsId(): number;
  11739. /**
  11740. * the current zoom factor.
  11741. */
  11742. getZoomFactor(): number;
  11743. /**
  11744. * the current zoom level.
  11745. */
  11746. getZoomLevel(): number;
  11747. /**
  11748. * Makes the guest page go back.
  11749. */
  11750. goBack(): void;
  11751. /**
  11752. * Makes the guest page go forward.
  11753. */
  11754. goForward(): void;
  11755. /**
  11756. * Navigates to the specified absolute index.
  11757. */
  11758. goToIndex(index: number): void;
  11759. /**
  11760. * Navigates to the specified offset from the "current entry".
  11761. */
  11762. goToOffset(offset: number): void;
  11763. /**
  11764. * A promise that resolves with a key for the inserted CSS that can later be used
  11765. * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
  11766. *
  11767. * Injects CSS into the current web page and returns a unique key for the inserted
  11768. * stylesheet.
  11769. */
  11770. insertCSS(css: string): Promise<string>;
  11771. /**
  11772. * Inserts `text` to the focused element.
  11773. */
  11774. insertText(text: string): Promise<void>;
  11775. /**
  11776. * Starts inspecting element at position (`x`, `y`) of guest page.
  11777. */
  11778. inspectElement(x: number, y: number): void;
  11779. /**
  11780. * Opens the DevTools for the service worker context present in the guest page.
  11781. */
  11782. inspectServiceWorker(): void;
  11783. /**
  11784. * Opens the DevTools for the shared worker context present in the guest page.
  11785. */
  11786. inspectSharedWorker(): void;
  11787. /**
  11788. * Whether guest page has been muted.
  11789. */
  11790. isAudioMuted(): boolean;
  11791. /**
  11792. * Whether the renderer process has crashed.
  11793. */
  11794. isCrashed(): boolean;
  11795. /**
  11796. * Whether audio is currently playing.
  11797. */
  11798. isCurrentlyAudible(): boolean;
  11799. /**
  11800. * Whether DevTools window of guest page is focused.
  11801. */
  11802. isDevToolsFocused(): boolean;
  11803. /**
  11804. * Whether guest page has a DevTools window attached.
  11805. */
  11806. isDevToolsOpened(): boolean;
  11807. /**
  11808. * Whether guest page is still loading resources.
  11809. */
  11810. isLoading(): boolean;
  11811. /**
  11812. * Whether the main frame (and not just iframes or frames within it) is still
  11813. * loading.
  11814. */
  11815. isLoadingMainFrame(): boolean;
  11816. /**
  11817. * Whether the guest page is waiting for a first-response for the main resource of
  11818. * the page.
  11819. */
  11820. isWaitingForResponse(): boolean;
  11821. /**
  11822. * The promise will resolve when the page has finished loading (see
  11823. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  11824. *
  11825. * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
  11826. * the `http://` or `file://`.
  11827. */
  11828. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  11829. /**
  11830. * Opens a DevTools window for guest page.
  11831. */
  11832. openDevTools(): void;
  11833. /**
  11834. * Executes editing command `paste` in page.
  11835. */
  11836. paste(): void;
  11837. /**
  11838. * Executes editing command `pasteAndMatchStyle` in page.
  11839. */
  11840. pasteAndMatchStyle(): void;
  11841. /**
  11842. * Prints `webview`'s web page. Same as `webContents.print([options])`.
  11843. */
  11844. print(options?: WebviewTagPrintOptions): Promise<void>;
  11845. /**
  11846. * Resolves with the generated PDF data.
  11847. *
  11848. * Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
  11849. */
  11850. printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
  11851. /**
  11852. * Executes editing command `redo` in page.
  11853. */
  11854. redo(): void;
  11855. /**
  11856. * Reloads the guest page.
  11857. */
  11858. reload(): void;
  11859. /**
  11860. * Reloads the guest page and ignores cache.
  11861. */
  11862. reloadIgnoringCache(): void;
  11863. /**
  11864. * Resolves if the removal was successful.
  11865. *
  11866. * Removes the inserted CSS from the current web page. The stylesheet is identified
  11867. * by its key, which is returned from `<webview>.insertCSS(css)`.
  11868. */
  11869. removeInsertedCSS(key: string): Promise<void>;
  11870. /**
  11871. * Executes editing command `replace` in page.
  11872. */
  11873. replace(text: string): void;
  11874. /**
  11875. * Executes editing command `replaceMisspelling` in page.
  11876. */
  11877. replaceMisspelling(text: string): void;
  11878. /**
  11879. * Executes editing command `selectAll` in page.
  11880. */
  11881. selectAll(): void;
  11882. /**
  11883. * Send an asynchronous message to renderer process via `channel`, you can also
  11884. * send arbitrary arguments. The renderer process can handle the message by
  11885. * listening to the `channel` event with the `ipcRenderer` module.
  11886. *
  11887. * See webContents.send for examples.
  11888. */
  11889. send(channel: string, ...args: any[]): Promise<void>;
  11890. /**
  11891. * Sends an input `event` to the page.
  11892. *
  11893. * See webContents.sendInputEvent for detailed description of `event` object.
  11894. */
  11895. sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
  11896. /**
  11897. * Send an asynchronous message to renderer process via `channel`, you can also
  11898. * send arbitrary arguments. The renderer process can handle the message by
  11899. * listening to the `channel` event with the `ipcRenderer` module.
  11900. *
  11901. * See webContents.sendToFrame for examples.
  11902. */
  11903. sendToFrame(frameId: [number, number], channel: string, ...args: any[]): Promise<void>;
  11904. /**
  11905. * Set guest page muted.
  11906. */
  11907. setAudioMuted(muted: boolean): void;
  11908. /**
  11909. * Overrides the user agent for the guest page.
  11910. */
  11911. setUserAgent(userAgent: string): void;
  11912. /**
  11913. * Sets the maximum and minimum pinch-to-zoom level.
  11914. */
  11915. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  11916. /**
  11917. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  11918. * divided by 100, so 300% = 3.0.
  11919. */
  11920. setZoomFactor(factor: number): void;
  11921. /**
  11922. * Changes the zoom level to the specified level. The original size is 0 and each
  11923. * increment above or below represents zooming 20% larger or smaller to default
  11924. * limits of 300% and 50% of original size, respectively. The formula for this is
  11925. * `scale := 1.2 ^ level`.
  11926. *
  11927. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  11928. * the zoom level for a specific domain propagates across all instances of windows
  11929. * with the same domain. Differentiating the window URLs will make zoom work
  11930. * per-window.
  11931. */
  11932. setZoomLevel(level: number): void;
  11933. /**
  11934. * Shows pop-up dictionary that searches the selected word on the page.
  11935. *
  11936. * @platform darwin
  11937. */
  11938. showDefinitionForSelection(): void;
  11939. /**
  11940. * Stops any pending navigation.
  11941. */
  11942. stop(): void;
  11943. /**
  11944. * Stops any `findInPage` request for the `webview` with the provided `action`.
  11945. */
  11946. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  11947. /**
  11948. * Executes editing command `undo` in page.
  11949. */
  11950. undo(): void;
  11951. /**
  11952. * Executes editing command `unselect` in page.
  11953. */
  11954. unselect(): void;
  11955. /**
  11956. * A `Boolean`. When this attribute is present the guest page will be allowed to
  11957. * open new windows. Popups are disabled by default.
  11958. */
  11959. allowpopups: boolean;
  11960. /**
  11961. * A `String` which is a list of strings which specifies the blink features to be
  11962. * disabled separated by `,`. The full list of supported feature strings can be
  11963. * found in the RuntimeEnabledFeatures.json5 file.
  11964. */
  11965. disableblinkfeatures: string;
  11966. /**
  11967. * A `Boolean`. When this attribute is present the guest page will have web
  11968. * security disabled. Web security is enabled by default.
  11969. */
  11970. disablewebsecurity: boolean;
  11971. /**
  11972. * A `String` which is a list of strings which specifies the blink features to be
  11973. * enabled separated by `,`. The full list of supported feature strings can be
  11974. * found in the RuntimeEnabledFeatures.json5 file.
  11975. */
  11976. enableblinkfeatures: string;
  11977. /**
  11978. * A `String` that sets the referrer URL for the guest page.
  11979. */
  11980. httpreferrer: string;
  11981. /**
  11982. * A `Boolean`. When this attribute is present the guest page in `webview` will
  11983. * have node integration and can use node APIs like `require` and `process` to
  11984. * access low level system resources. Node integration is disabled by default in
  11985. * the guest page.
  11986. */
  11987. nodeintegration: boolean;
  11988. /**
  11989. * A `Boolean` for the experimental option for enabling NodeJS support in
  11990. * sub-frames such as iframes inside the `webview`. All your preloads will load for
  11991. * every iframe, you can use `process.isMainFrame` to determine if you are in the
  11992. * main frame or not. This option is disabled by default in the guest page.
  11993. */
  11994. nodeintegrationinsubframes: boolean;
  11995. /**
  11996. * A `String` that sets the session used by the page. If `partition` starts with
  11997. * `persist:`, the page will use a persistent session available to all pages in the
  11998. * app with the same `partition`. if there is no `persist:` prefix, the page will
  11999. * use an in-memory session. By assigning the same `partition`, multiple pages can
  12000. * share the same session. If the `partition` is unset then default session of the
  12001. * app will be used.
  12002. *
  12003. * This value can only be modified before the first navigation, since the session
  12004. * of an active renderer process cannot change. Subsequent attempts to modify the
  12005. * value will fail with a DOM exception.
  12006. */
  12007. partition: string;
  12008. /**
  12009. * A `Boolean`. When this attribute is present the guest page in `webview` will be
  12010. * able to use browser plugins. Plugins are disabled by default.
  12011. */
  12012. plugins: boolean;
  12013. /**
  12014. * A `String` that specifies a script that will be loaded before other scripts run
  12015. * in the guest page. The protocol of script's URL must be `file:` (even when using
  12016. * `asar:` archives) because it will be loaded by Node's `require` under the hood,
  12017. * which treats `asar:` archives as virtual directories.
  12018. *
  12019. * When the guest page doesn't have node integration this script will still have
  12020. * access to all Node APIs, but global objects injected by Node will be deleted
  12021. * after this script has finished executing.
  12022. *
  12023. * **Note:** This option will appear as `preloadURL` (not `preload`) in the
  12024. * `webPreferences` specified to the `will-attach-webview` event.
  12025. */
  12026. preload: string;
  12027. /**
  12028. * A `String` representing the visible URL. Writing to this attribute initiates
  12029. * top-level navigation.
  12030. *
  12031. * Assigning `src` its own value will reload the current page.
  12032. *
  12033. * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
  12034. * world!`.
  12035. */
  12036. src: string;
  12037. /**
  12038. * A `String` that sets the user agent for the guest page before the page is
  12039. * navigated to. Once the page is loaded, use the `setUserAgent` method to change
  12040. * the user agent.
  12041. */
  12042. useragent: string;
  12043. /**
  12044. * A `String` which is a comma separated list of strings which specifies the web
  12045. * preferences to be set on the webview. The full list of supported preference
  12046. * strings can be found in BrowserWindow.
  12047. *
  12048. * The string follows the same format as the features string in `window.open`. A
  12049. * name by itself is given a `true` boolean value. A preference can be set to
  12050. * another value by including an `=`, followed by the value. Special values `yes`
  12051. * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
  12052. * `false`.
  12053. */
  12054. webpreferences: string;
  12055. }
  12056. interface AboutPanelOptionsOptions {
  12057. /**
  12058. * The app's name.
  12059. */
  12060. applicationName?: string;
  12061. /**
  12062. * The app's version.
  12063. */
  12064. applicationVersion?: string;
  12065. /**
  12066. * Copyright information.
  12067. */
  12068. copyright?: string;
  12069. /**
  12070. * The app's build version number.
  12071. *
  12072. * @platform darwin
  12073. */
  12074. version?: string;
  12075. /**
  12076. * Credit information.
  12077. *
  12078. * @platform darwin,win32
  12079. */
  12080. credits?: string;
  12081. /**
  12082. * List of app authors.
  12083. *
  12084. * @platform linux
  12085. */
  12086. authors?: string[];
  12087. /**
  12088. * The app's website.
  12089. *
  12090. * @platform linux
  12091. */
  12092. website?: string;
  12093. /**
  12094. * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
  12095. * 64x64 pixels while retaining aspect ratio.
  12096. *
  12097. * @platform linux,win32
  12098. */
  12099. iconPath?: string;
  12100. }
  12101. interface AddRepresentationOptions {
  12102. /**
  12103. * The scale factor to add the image representation for.
  12104. */
  12105. scaleFactor: number;
  12106. /**
  12107. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  12108. */
  12109. width?: number;
  12110. /**
  12111. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  12112. */
  12113. height?: number;
  12114. /**
  12115. * The buffer containing the raw image data.
  12116. */
  12117. buffer?: Buffer;
  12118. /**
  12119. * The data URL containing either a base 64 encoded PNG or JPEG image.
  12120. */
  12121. dataURL?: string;
  12122. }
  12123. interface AnimationSettings {
  12124. /**
  12125. * Returns true if rich animations should be rendered. Looks at session type (e.g.
  12126. * remote desktop) and accessibility settings to give guidance for heavy
  12127. * animations.
  12128. */
  12129. shouldRenderRichAnimation: boolean;
  12130. /**
  12131. * Determines on a per-platform basis whether scroll animations (e.g. produced by
  12132. * home/end key) should be enabled.
  12133. */
  12134. scrollAnimationsEnabledBySystem: boolean;
  12135. /**
  12136. * Determines whether the user desires reduced motion based on platform APIs.
  12137. */
  12138. prefersReducedMotion: boolean;
  12139. }
  12140. interface AppDetailsOptions {
  12141. /**
  12142. * Window's App User Model ID. It has to be set, otherwise the other options will
  12143. * have no effect.
  12144. */
  12145. appId?: string;
  12146. /**
  12147. * Window's Relaunch Icon.
  12148. */
  12149. appIconPath?: string;
  12150. /**
  12151. * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
  12152. * Default is `0`.
  12153. */
  12154. appIconIndex?: number;
  12155. /**
  12156. * Window's Relaunch Command.
  12157. */
  12158. relaunchCommand?: string;
  12159. /**
  12160. * Window's Relaunch Display Name.
  12161. */
  12162. relaunchDisplayName?: string;
  12163. }
  12164. interface ApplicationInfoForProtocolReturnValue {
  12165. /**
  12166. * the display icon of the app handling the protocol.
  12167. */
  12168. icon: NativeImage;
  12169. /**
  12170. * installation path of the app handling the protocol.
  12171. */
  12172. path: string;
  12173. /**
  12174. * display name of the app handling the protocol.
  12175. */
  12176. name: string;
  12177. }
  12178. interface AuthenticationResponseDetails {
  12179. url: string;
  12180. }
  12181. interface AuthInfo {
  12182. isProxy: boolean;
  12183. scheme: string;
  12184. host: string;
  12185. port: number;
  12186. realm: string;
  12187. }
  12188. interface AutoResizeOptions {
  12189. /**
  12190. * If `true`, the view's width will grow and shrink together with the window.
  12191. * `false` by default.
  12192. */
  12193. width?: boolean;
  12194. /**
  12195. * If `true`, the view's height will grow and shrink together with the window.
  12196. * `false` by default.
  12197. */
  12198. height?: boolean;
  12199. /**
  12200. * If `true`, the view's x position and width will grow and shrink proportionally
  12201. * with the window. `false` by default.
  12202. */
  12203. horizontal?: boolean;
  12204. /**
  12205. * If `true`, the view's y position and height will grow and shrink proportionally
  12206. * with the window. `false` by default.
  12207. */
  12208. vertical?: boolean;
  12209. }
  12210. interface BeforeSendResponse {
  12211. cancel?: boolean;
  12212. /**
  12213. * When provided, request will be made with these headers.
  12214. */
  12215. requestHeaders?: Record<string, (string) | (string[])>;
  12216. }
  12217. interface BitmapOptions {
  12218. /**
  12219. * Defaults to 1.0.
  12220. */
  12221. scaleFactor?: number;
  12222. }
  12223. interface BlinkMemoryInfo {
  12224. /**
  12225. * Size of all allocated objects in Kilobytes.
  12226. */
  12227. allocated: number;
  12228. /**
  12229. * Size of all marked objects in Kilobytes.
  12230. */
  12231. marked: number;
  12232. /**
  12233. * Total allocated space in Kilobytes.
  12234. */
  12235. total: number;
  12236. }
  12237. interface BrowserViewConstructorOptions {
  12238. /**
  12239. * See BrowserWindow.
  12240. */
  12241. webPreferences?: WebPreferences;
  12242. }
  12243. interface BrowserWindowConstructorOptions {
  12244. /**
  12245. * Window's width in pixels. Default is `800`.
  12246. */
  12247. width?: number;
  12248. /**
  12249. * Window's height in pixels. Default is `600`.
  12250. */
  12251. height?: number;
  12252. /**
  12253. * (**required** if y is used) Window's left offset from screen. Default is to
  12254. * center the window.
  12255. */
  12256. x?: number;
  12257. /**
  12258. * (**required** if x is used) Window's top offset from screen. Default is to
  12259. * center the window.
  12260. */
  12261. y?: number;
  12262. /**
  12263. * The `width` and `height` would be used as web page's size, which means the
  12264. * actual window's size will include window frame's size and be slightly larger.
  12265. * Default is `false`.
  12266. */
  12267. useContentSize?: boolean;
  12268. /**
  12269. * Show window in the center of the screen.
  12270. */
  12271. center?: boolean;
  12272. /**
  12273. * Window's minimum width. Default is `0`.
  12274. */
  12275. minWidth?: number;
  12276. /**
  12277. * Window's minimum height. Default is `0`.
  12278. */
  12279. minHeight?: number;
  12280. /**
  12281. * Window's maximum width. Default is no limit.
  12282. */
  12283. maxWidth?: number;
  12284. /**
  12285. * Window's maximum height. Default is no limit.
  12286. */
  12287. maxHeight?: number;
  12288. /**
  12289. * Whether window is resizable. Default is `true`.
  12290. */
  12291. resizable?: boolean;
  12292. /**
  12293. * Whether window is movable. This is not implemented on Linux. Default is `true`.
  12294. */
  12295. movable?: boolean;
  12296. /**
  12297. * Whether window is minimizable. This is not implemented on Linux. Default is
  12298. * `true`.
  12299. */
  12300. minimizable?: boolean;
  12301. /**
  12302. * Whether window is maximizable. This is not implemented on Linux. Default is
  12303. * `true`.
  12304. */
  12305. maximizable?: boolean;
  12306. /**
  12307. * Whether window is closable. This is not implemented on Linux. Default is `true`.
  12308. */
  12309. closable?: boolean;
  12310. /**
  12311. * Whether the window can be focused. Default is `true`. On Windows setting
  12312. * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
  12313. * `focusable: false` makes the window stop interacting with wm, so the window will
  12314. * always stay on top in all workspaces.
  12315. */
  12316. focusable?: boolean;
  12317. /**
  12318. * Whether the window should always stay on top of other windows. Default is
  12319. * `false`.
  12320. */
  12321. alwaysOnTop?: boolean;
  12322. /**
  12323. * Whether the window should show in fullscreen. When explicitly set to `false` the
  12324. * fullscreen button will be hidden or disabled on macOS. Default is `false`.
  12325. */
  12326. fullscreen?: boolean;
  12327. /**
  12328. * Whether the window can be put into fullscreen mode. On macOS, also whether the
  12329. * maximize/zoom button should toggle full screen mode or maximize window. Default
  12330. * is `true`.
  12331. */
  12332. fullscreenable?: boolean;
  12333. /**
  12334. * Use pre-Lion fullscreen on macOS. Default is `false`.
  12335. */
  12336. simpleFullscreen?: boolean;
  12337. /**
  12338. * Whether to show the window in taskbar. Default is `false`.
  12339. */
  12340. skipTaskbar?: boolean;
  12341. /**
  12342. * Whether the window is in kiosk mode. Default is `false`.
  12343. */
  12344. kiosk?: boolean;
  12345. /**
  12346. * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
  12347. * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
  12348. */
  12349. title?: string;
  12350. /**
  12351. * The window icon. On Windows it is recommended to use `ICO` icons to get best
  12352. * visual effects, you can also leave it undefined so the executable's icon will be
  12353. * used.
  12354. */
  12355. icon?: (NativeImage) | (string);
  12356. /**
  12357. * Whether window should be shown when created. Default is `true`.
  12358. */
  12359. show?: boolean;
  12360. /**
  12361. * Whether the renderer should be active when `show` is `false` and it has just
  12362. * been created. In order for `document.visibilityState` to work correctly on
  12363. * first load with `show: false` you should set this to `false`. Setting this to
  12364. * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
  12365. */
  12366. paintWhenInitiallyHidden?: boolean;
  12367. /**
  12368. * Specify `false` to create a frameless window. Default is `true`.
  12369. */
  12370. frame?: boolean;
  12371. /**
  12372. * Specify parent window. Default is `null`.
  12373. */
  12374. parent?: BrowserWindow;
  12375. /**
  12376. * Whether this is a modal window. This only works when the window is a child
  12377. * window. Default is `false`.
  12378. */
  12379. modal?: boolean;
  12380. /**
  12381. * Whether clicking an inactive window will also click through to the web contents.
  12382. * Default is `false` on macOS. This option is not configurable on other platforms.
  12383. */
  12384. acceptFirstMouse?: boolean;
  12385. /**
  12386. * Whether to hide cursor when typing. Default is `false`.
  12387. */
  12388. disableAutoHideCursor?: boolean;
  12389. /**
  12390. * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
  12391. */
  12392. autoHideMenuBar?: boolean;
  12393. /**
  12394. * Enable the window to be resized larger than screen. Only relevant for macOS, as
  12395. * other OSes allow larger-than-screen windows by default. Default is `false`.
  12396. */
  12397. enableLargerThanScreen?: boolean;
  12398. /**
  12399. * Window's background color as a hexadecimal value, like `#66CD00` or `#FFF` or
  12400. * `#80FFFFFF` (alpha in #AARRGGBB format is supported if `transparent` is set to
  12401. * `true`). Default is `#FFF` (white).
  12402. */
  12403. backgroundColor?: string;
  12404. /**
  12405. * Whether window should have a shadow. Default is `true`.
  12406. */
  12407. hasShadow?: boolean;
  12408. /**
  12409. * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
  12410. * (fully opaque). This is only implemented on Windows and macOS.
  12411. */
  12412. opacity?: number;
  12413. /**
  12414. * Forces using dark theme for the window, only works on some GTK+3 desktop
  12415. * environments. Default is `false`.
  12416. */
  12417. darkTheme?: boolean;
  12418. /**
  12419. * Makes the window transparent. Default is `false`. On Windows, does not work
  12420. * unless the window is frameless.
  12421. */
  12422. transparent?: boolean;
  12423. /**
  12424. * The type of window, default is normal window. See more about this below.
  12425. */
  12426. type?: string;
  12427. /**
  12428. * Specify how the material appearance should reflect window activity state on
  12429. * macOS. Must be used with the `vibrancy` property. Possible values are:
  12430. */
  12431. visualEffectState?: ('followWindow' | 'active' | 'inactive');
  12432. /**
  12433. * The style of window title bar. Default is `default`. Possible values are:
  12434. *
  12435. * @platform darwin,win32
  12436. */
  12437. titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
  12438. /**
  12439. * Set a custom position for the traffic light buttons in frameless windows.
  12440. */
  12441. trafficLightPosition?: Point;
  12442. /**
  12443. * Whether frameless window should have rounded corners on macOS. Default is
  12444. * `true`.
  12445. */
  12446. roundedCorners?: boolean;
  12447. /**
  12448. * Shows the title in the title bar in full screen mode on macOS for `hiddenInset`
  12449. * titleBarStyle. Default is `false`.
  12450. *
  12451. * @deprecated
  12452. */
  12453. fullscreenWindowTitle?: boolean;
  12454. /**
  12455. * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
  12456. * window frame. Setting it to `false` will remove window shadow and window
  12457. * animations. Default is `true`.
  12458. */
  12459. thickFrame?: boolean;
  12460. /**
  12461. * Add a type of vibrancy effect to the window, only on macOS. Can be
  12462. * `appearance-based`, `light`, `dark`, `titlebar`, `selection`, `menu`, `popover`,
  12463. * `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`,
  12464. * `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please
  12465. * note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
  12466. * are deprecated and have been removed in macOS Catalina (10.15).
  12467. */
  12468. vibrancy?: ('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page');
  12469. /**
  12470. * Controls the behavior on macOS when option-clicking the green stoplight button
  12471. * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
  12472. * will grow to the preferred width of the web page when zoomed, `false` will cause
  12473. * it to zoom to the width of the screen. This will also affect the behavior when
  12474. * calling `maximize()` directly. Default is `false`.
  12475. */
  12476. zoomToPageWidth?: boolean;
  12477. /**
  12478. * Tab group name, allows opening the window as a native tab on macOS 10.12+.
  12479. * Windows with the same tabbing identifier will be grouped together. This also
  12480. * adds a native new tab button to your window's tab bar and allows your `app` and
  12481. * window to receive the `new-window-for-tab` event.
  12482. */
  12483. tabbingIdentifier?: string;
  12484. /**
  12485. * Settings of web page's features.
  12486. */
  12487. webPreferences?: WebPreferences;
  12488. /**
  12489. * When using a frameless window in conjuction with
  12490. * `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so
  12491. * that the standard window controls ("traffic lights" on macOS) are visible, this
  12492. * property enables the Window Controls Overlay JavaScript APIs and CSS Environment
  12493. * Variables. Specifying `true` will result in an overlay with default system
  12494. * colors. Default is `false`.
  12495. */
  12496. titleBarOverlay?: (TitleBarOverlay) | (boolean);
  12497. }
  12498. interface CertificateTrustDialogOptions {
  12499. /**
  12500. * The certificate to trust/import.
  12501. */
  12502. certificate: Certificate;
  12503. /**
  12504. * The message to display to the user.
  12505. */
  12506. message: string;
  12507. }
  12508. interface ClearStorageDataOptions {
  12509. /**
  12510. * Should follow `window.location.origin`’s representation `scheme://host:port`.
  12511. */
  12512. origin?: string;
  12513. /**
  12514. * The types of storages to clear, can contain: `appcache`, `cookies`,
  12515. * `filesystem`, `indexdb`, `localstorage`, `shadercache`, `websql`,
  12516. * `serviceworkers`, `cachestorage`. If not specified, clear all storage types.
  12517. */
  12518. storages?: string[];
  12519. /**
  12520. * The types of quotas to clear, can contain: `temporary`, `persistent`,
  12521. * `syncable`. If not specified, clear all quotas.
  12522. */
  12523. quotas?: string[];
  12524. }
  12525. interface ClientRequestConstructorOptions {
  12526. /**
  12527. * The HTTP request method. Defaults to the GET method.
  12528. */
  12529. method?: string;
  12530. /**
  12531. * The request URL. Must be provided in the absolute form with the protocol scheme
  12532. * specified as http or https.
  12533. */
  12534. url?: string;
  12535. /**
  12536. * The `Session` instance with which the request is associated.
  12537. */
  12538. session?: Session;
  12539. /**
  12540. * The name of the `partition` with which the request is associated. Defaults to
  12541. * the empty string. The `session` option supersedes `partition`. Thus if a
  12542. * `session` is explicitly specified, `partition` is ignored.
  12543. */
  12544. partition?: string;
  12545. /**
  12546. * Can be `include` or `omit`. Whether to send credentials with this request. If
  12547. * set to `include`, credentials from the session associated with the request will
  12548. * be used. If set to `omit`, credentials will not be sent with the request (and
  12549. * the `'login'` event will not be triggered in the event of a 401). This matches
  12550. * the behavior of the fetch option of the same name. If this option is not
  12551. * specified, authentication data from the session will be sent, and cookies will
  12552. * not be sent (unless `useSessionCookies` is set).
  12553. */
  12554. credentials?: ('include' | 'omit');
  12555. /**
  12556. * Whether to send cookies with this request from the provided session. If
  12557. * `credentials` is specified, this option has no effect. Default is `false`.
  12558. */
  12559. useSessionCookies?: boolean;
  12560. /**
  12561. * Can be `http:` or `https:`. The protocol scheme in the form 'scheme:'. Defaults
  12562. * to 'http:'.
  12563. */
  12564. protocol?: string;
  12565. /**
  12566. * The server host provided as a concatenation of the hostname and the port number
  12567. * 'hostname:port'.
  12568. */
  12569. host?: string;
  12570. /**
  12571. * The server host name.
  12572. */
  12573. hostname?: string;
  12574. /**
  12575. * The server's listening port number.
  12576. */
  12577. port?: number;
  12578. /**
  12579. * The path part of the request URL.
  12580. */
  12581. path?: string;
  12582. /**
  12583. * Can be `follow`, `error` or `manual`. The redirect mode for this request. When
  12584. * mode is `error`, any redirection will be aborted. When mode is `manual` the
  12585. * redirection will be cancelled unless `request.followRedirect` is invoked
  12586. * synchronously during the `redirect` event. Defaults to `follow`.
  12587. */
  12588. redirect?: ('follow' | 'error' | 'manual');
  12589. /**
  12590. * The origin URL of the request.
  12591. */
  12592. origin?: string;
  12593. }
  12594. interface Config {
  12595. /**
  12596. * The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`,
  12597. * `fixed_servers` or `system`. If it's unspecified, it will be automatically
  12598. * determined based on other specified options.
  12599. */
  12600. mode?: ('direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system');
  12601. /**
  12602. * The URL associated with the PAC file.
  12603. */
  12604. pacScript?: string;
  12605. /**
  12606. * Rules indicating which proxies to use.
  12607. */
  12608. proxyRules?: string;
  12609. /**
  12610. * Rules indicating which URLs should bypass the proxy settings.
  12611. */
  12612. proxyBypassRules?: string;
  12613. }
  12614. interface ConfigureHostResolverOptions {
  12615. /**
  12616. * Whether the built-in host resolver is used in preference to getaddrinfo. When
  12617. * enabled, the built-in resolver will attempt to use the system's DNS settings to
  12618. * do DNS lookups itself. Enabled by default on macOS, disabled by default on
  12619. * Windows and Linux.
  12620. */
  12621. enableBuiltInResolver?: boolean;
  12622. /**
  12623. * Can be "off", "automatic" or "secure". Configures the DNS-over-HTTP mode. When
  12624. * "off", no DoH lookups will be performed. When "automatic", DoH lookups will be
  12625. * performed first if DoH is available, and insecure DNS lookups will be performed
  12626. * as a fallback. When "secure", only DoH lookups will be performed. Defaults to
  12627. * "automatic".
  12628. */
  12629. secureDnsMode?: string;
  12630. /**
  12631. * A list of DNS-over-HTTP server templates. See RFC8484 § 3 for details on the
  12632. * template format. Most servers support the POST method; the template for such
  12633. * servers is simply a URI. Note that for some DNS providers, the resolver will
  12634. * automatically upgrade to DoH unless DoH is explicitly disabled, even if there
  12635. * are no DoH servers provided in this list.
  12636. */
  12637. secureDnsServers?: string[];
  12638. /**
  12639. * Controls whether additional DNS query types, e.g. HTTPS (DNS type 65) will be
  12640. * allowed besides the traditional A and AAAA queries when a request is being made
  12641. * via insecure DNS. Has no effect on Secure DNS which always allows additional
  12642. * types. Defaults to true.
  12643. */
  12644. enableAdditionalDnsQueryTypes?: boolean;
  12645. }
  12646. interface ConsoleMessageEvent extends Event {
  12647. /**
  12648. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  12649. * `error`.
  12650. */
  12651. level: number;
  12652. /**
  12653. * The actual console message
  12654. */
  12655. message: string;
  12656. /**
  12657. * The line number of the source that triggered this console message
  12658. */
  12659. line: number;
  12660. sourceId: string;
  12661. }
  12662. interface ContextMenuEvent extends Event {
  12663. params: Params;
  12664. }
  12665. interface ContextMenuParams {
  12666. /**
  12667. * x coordinate.
  12668. */
  12669. x: number;
  12670. /**
  12671. * y coordinate.
  12672. */
  12673. y: number;
  12674. /**
  12675. * Frame from which the context menu was invoked.
  12676. */
  12677. frame: WebFrameMain;
  12678. /**
  12679. * URL of the link that encloses the node the context menu was invoked on.
  12680. */
  12681. linkURL: string;
  12682. /**
  12683. * Text associated with the link. May be an empty string if the contents of the
  12684. * link are an image.
  12685. */
  12686. linkText: string;
  12687. /**
  12688. * URL of the top level page that the context menu was invoked on.
  12689. */
  12690. pageURL: string;
  12691. /**
  12692. * URL of the subframe that the context menu was invoked on.
  12693. */
  12694. frameURL: string;
  12695. /**
  12696. * Source URL for the element that the context menu was invoked on. Elements with
  12697. * source URLs are images, audio and video.
  12698. */
  12699. srcURL: string;
  12700. /**
  12701. * Type of the node the context menu was invoked on. Can be `none`, `image`,
  12702. * `audio`, `video`, `canvas`, `file` or `plugin`.
  12703. */
  12704. mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
  12705. /**
  12706. * Whether the context menu was invoked on an image which has non-empty contents.
  12707. */
  12708. hasImageContents: boolean;
  12709. /**
  12710. * Whether the context is editable.
  12711. */
  12712. isEditable: boolean;
  12713. /**
  12714. * Text of the selection that the context menu was invoked on.
  12715. */
  12716. selectionText: string;
  12717. /**
  12718. * Title text of the selection that the context menu was invoked on.
  12719. */
  12720. titleText: string;
  12721. /**
  12722. * Alt text of the selection that the context menu was invoked on.
  12723. */
  12724. altText: string;
  12725. /**
  12726. * Suggested filename to be used when saving file through 'Save Link As' option of
  12727. * context menu.
  12728. */
  12729. suggestedFilename: string;
  12730. /**
  12731. * Rect representing the coordinates in the document space of the selection.
  12732. */
  12733. selectionRect: Rectangle;
  12734. /**
  12735. * Start position of the selection text.
  12736. */
  12737. selectionStartOffset: number;
  12738. /**
  12739. * The referrer policy of the frame on which the menu is invoked.
  12740. */
  12741. referrerPolicy: Referrer;
  12742. /**
  12743. * The misspelled word under the cursor, if any.
  12744. */
  12745. misspelledWord: string;
  12746. /**
  12747. * An array of suggested words to show the user to replace the `misspelledWord`.
  12748. * Only available if there is a misspelled word and spellchecker is enabled.
  12749. */
  12750. dictionarySuggestions: string[];
  12751. /**
  12752. * The character encoding of the frame on which the menu was invoked.
  12753. */
  12754. frameCharset: string;
  12755. /**
  12756. * If the context menu was invoked on an input field, the type of that field.
  12757. * Possible values are `none`, `plainText`, `password`, `other`.
  12758. */
  12759. inputFieldType: string;
  12760. /**
  12761. * If the context is editable, whether or not spellchecking is enabled.
  12762. */
  12763. spellcheckEnabled: boolean;
  12764. /**
  12765. * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
  12766. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  12767. * `adjustSelection`, or `adjustSelectionReset`.
  12768. */
  12769. menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  12770. /**
  12771. * The flags for the media element the context menu was invoked on.
  12772. */
  12773. mediaFlags: MediaFlags;
  12774. /**
  12775. * These flags indicate whether the renderer believes it is able to perform the
  12776. * corresponding action.
  12777. */
  12778. editFlags: EditFlags;
  12779. }
  12780. interface ContinueActivityDetails {
  12781. /**
  12782. * A string identifying the URL of the webpage accessed by the activity on another
  12783. * device, if available.
  12784. */
  12785. webpageURL?: string;
  12786. }
  12787. interface CookiesGetFilter {
  12788. /**
  12789. * Retrieves cookies which are associated with `url`. Empty implies retrieving
  12790. * cookies of all URLs.
  12791. */
  12792. url?: string;
  12793. /**
  12794. * Filters cookies by name.
  12795. */
  12796. name?: string;
  12797. /**
  12798. * Retrieves cookies whose domains match or are subdomains of `domains`.
  12799. */
  12800. domain?: string;
  12801. /**
  12802. * Retrieves cookies whose path matches `path`.
  12803. */
  12804. path?: string;
  12805. /**
  12806. * Filters cookies by their Secure property.
  12807. */
  12808. secure?: boolean;
  12809. /**
  12810. * Filters out session or persistent cookies.
  12811. */
  12812. session?: boolean;
  12813. }
  12814. interface CookiesSetDetails {
  12815. /**
  12816. * The URL to associate the cookie with. The promise will be rejected if the URL is
  12817. * invalid.
  12818. */
  12819. url: string;
  12820. /**
  12821. * The name of the cookie. Empty by default if omitted.
  12822. */
  12823. name?: string;
  12824. /**
  12825. * The value of the cookie. Empty by default if omitted.
  12826. */
  12827. value?: string;
  12828. /**
  12829. * The domain of the cookie; this will be normalized with a preceding dot so that
  12830. * it's also valid for subdomains. Empty by default if omitted.
  12831. */
  12832. domain?: string;
  12833. /**
  12834. * The path of the cookie. Empty by default if omitted.
  12835. */
  12836. path?: string;
  12837. /**
  12838. * Whether the cookie should be marked as Secure. Defaults to false unless Same
  12839. * Site=None attribute is used.
  12840. */
  12841. secure?: boolean;
  12842. /**
  12843. * Whether the cookie should be marked as HTTP only. Defaults to false.
  12844. */
  12845. httpOnly?: boolean;
  12846. /**
  12847. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  12848. * If omitted then the cookie becomes a session cookie and will not be retained
  12849. * between sessions.
  12850. */
  12851. expirationDate?: number;
  12852. /**
  12853. * The Same Site policy to apply to this cookie. Can be `unspecified`,
  12854. * `no_restriction`, `lax` or `strict`. Default is `lax`.
  12855. */
  12856. sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  12857. }
  12858. interface CrashReporterStartOptions {
  12859. /**
  12860. * URL that crash reports will be sent to as POST. Required unless `uploadToServer`
  12861. * is `false`.
  12862. */
  12863. submitURL?: string;
  12864. /**
  12865. * Defaults to `app.name`.
  12866. */
  12867. productName?: string;
  12868. /**
  12869. * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
  12870. *
  12871. * @deprecated
  12872. */
  12873. companyName?: string;
  12874. /**
  12875. * Whether crash reports should be sent to the server. If false, crash reports will
  12876. * be collected and stored in the crashes directory, but not uploaded. Default is
  12877. * `true`.
  12878. */
  12879. uploadToServer?: boolean;
  12880. /**
  12881. * If true, crashes generated in the main process will not be forwarded to the
  12882. * system crash handler. Default is `false`.
  12883. */
  12884. ignoreSystemCrashHandler?: boolean;
  12885. /**
  12886. * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
  12887. *
  12888. * @platform darwin,win32
  12889. */
  12890. rateLimit?: boolean;
  12891. /**
  12892. * If true, crash reports will be compressed and uploaded with `Content-Encoding:
  12893. * gzip`. Default is `true`.
  12894. */
  12895. compress?: boolean;
  12896. /**
  12897. * Extra string key/value annotations that will be sent along with crash reports
  12898. * that are generated in the main process. Only string values are supported.
  12899. * Crashes generated in child processes will not contain these extra parameters to
  12900. * crash reports generated from child processes, call `addExtraParameter` from the
  12901. * child process.
  12902. */
  12903. extra?: Record<string, string>;
  12904. /**
  12905. * Extra string key/value annotations that will be sent along with any crash
  12906. * reports generated in any process. These annotations cannot be changed once the
  12907. * crash reporter has been started. If a key is present in both the global extra
  12908. * parameters and the process-specific extra parameters, then the global one will
  12909. * take precedence. By default, `productName` and the app version are included, as
  12910. * well as the Electron version.
  12911. */
  12912. globalExtra?: Record<string, string>;
  12913. }
  12914. interface CreateFromBitmapOptions {
  12915. width: number;
  12916. height: number;
  12917. /**
  12918. * Defaults to 1.0.
  12919. */
  12920. scaleFactor?: number;
  12921. }
  12922. interface CreateFromBufferOptions {
  12923. /**
  12924. * Required for bitmap buffers.
  12925. */
  12926. width?: number;
  12927. /**
  12928. * Required for bitmap buffers.
  12929. */
  12930. height?: number;
  12931. /**
  12932. * Defaults to 1.0.
  12933. */
  12934. scaleFactor?: number;
  12935. }
  12936. interface CreateInterruptedDownloadOptions {
  12937. /**
  12938. * Absolute path of the download.
  12939. */
  12940. path: string;
  12941. /**
  12942. * Complete URL chain for the download.
  12943. */
  12944. urlChain: string[];
  12945. mimeType?: string;
  12946. /**
  12947. * Start range for the download.
  12948. */
  12949. offset: number;
  12950. /**
  12951. * Total length of the download.
  12952. */
  12953. length: number;
  12954. /**
  12955. * Last-Modified header value.
  12956. */
  12957. lastModified?: string;
  12958. /**
  12959. * ETag header value.
  12960. */
  12961. eTag?: string;
  12962. /**
  12963. * Time when download was started in number of seconds since UNIX epoch.
  12964. */
  12965. startTime?: number;
  12966. }
  12967. interface Data {
  12968. text?: string;
  12969. html?: string;
  12970. image?: NativeImage;
  12971. rtf?: string;
  12972. /**
  12973. * The title of the URL at `text`.
  12974. */
  12975. bookmark?: string;
  12976. }
  12977. interface Details {
  12978. /**
  12979. * Process type. One of the following values:
  12980. */
  12981. type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  12982. /**
  12983. * The reason the child process is gone. Possible values:
  12984. */
  12985. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  12986. /**
  12987. * The exit code for the process (e.g. status from waitpid if on posix, from
  12988. * GetExitCodeProcess on Windows).
  12989. */
  12990. exitCode: number;
  12991. /**
  12992. * The non-localized name of the process.
  12993. */
  12994. serviceName?: string;
  12995. /**
  12996. * The name of the process. Examples for utility: `Audio Service`, `Content
  12997. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  12998. */
  12999. name?: string;
  13000. }
  13001. interface DevicePermissionHandlerHandlerDetails {
  13002. /**
  13003. * The type of device that permission is being requested on, can be `hid` or
  13004. * `serial`.
  13005. */
  13006. deviceType: ('hid' | 'serial');
  13007. /**
  13008. * The origin URL of the device permission check.
  13009. */
  13010. origin: string;
  13011. /**
  13012. * the device that permission is being requested for.
  13013. */
  13014. device: (HIDDevice) | (SerialPort);
  13015. /**
  13016. * WebFrameMain checking the device permission.
  13017. */
  13018. frame: WebFrameMain;
  13019. }
  13020. interface DidChangeThemeColorEvent extends Event {
  13021. themeColor: string;
  13022. }
  13023. interface DidCreateWindowDetails {
  13024. /**
  13025. * URL for the created window.
  13026. */
  13027. url: string;
  13028. /**
  13029. * Name given to the created window in the `window.open()` call.
  13030. */
  13031. frameName: string;
  13032. /**
  13033. * The options used to create the BrowserWindow. They are merged in increasing
  13034. * precedence: parsed options from the `features` string from `window.open()`,
  13035. * security-related webPreferences inherited from the parent, and options given by
  13036. * `webContents.setWindowOpenHandler`. Unrecognized options are not filtered out.
  13037. */
  13038. options: BrowserWindowConstructorOptions;
  13039. /**
  13040. * The referrer that will be passed to the new window. May or may not result in the
  13041. * `Referer` header being sent, depending on the referrer policy.
  13042. */
  13043. referrer: Referrer;
  13044. /**
  13045. * The post data that will be sent to the new window, along with the appropriate
  13046. * headers that will be set. If no post data is to be sent, the value will be
  13047. * `null`. Only defined when the window is being created by a form that set
  13048. * `target=_blank`.
  13049. */
  13050. postBody?: PostBody;
  13051. /**
  13052. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  13053. * `save-to-disk` and `other`.
  13054. */
  13055. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  13056. }
  13057. interface DidFailLoadEvent extends Event {
  13058. errorCode: number;
  13059. errorDescription: string;
  13060. validatedURL: string;
  13061. isMainFrame: boolean;
  13062. }
  13063. interface DidFrameFinishLoadEvent extends Event {
  13064. isMainFrame: boolean;
  13065. }
  13066. interface DidFrameNavigateEvent extends Event {
  13067. url: string;
  13068. /**
  13069. * -1 for non HTTP navigations
  13070. */
  13071. httpResponseCode: number;
  13072. /**
  13073. * empty for non HTTP navigations,
  13074. */
  13075. httpStatusText: string;
  13076. isMainFrame: boolean;
  13077. frameProcessId: number;
  13078. frameRoutingId: number;
  13079. }
  13080. interface DidNavigateEvent extends Event {
  13081. url: string;
  13082. }
  13083. interface DidNavigateInPageEvent extends Event {
  13084. isMainFrame: boolean;
  13085. url: string;
  13086. }
  13087. interface DidRedirectNavigationEvent extends Event {
  13088. url: string;
  13089. isInPlace: boolean;
  13090. isMainFrame: boolean;
  13091. frameProcessId: number;
  13092. frameRoutingId: number;
  13093. }
  13094. interface DidStartNavigationEvent extends Event {
  13095. url: string;
  13096. isInPlace: boolean;
  13097. isMainFrame: boolean;
  13098. frameProcessId: number;
  13099. frameRoutingId: number;
  13100. }
  13101. interface DisplayBalloonOptions {
  13102. /**
  13103. * Icon to use when `iconType` is `custom`.
  13104. */
  13105. icon?: (NativeImage) | (string);
  13106. /**
  13107. * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
  13108. */
  13109. iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
  13110. title: string;
  13111. content: string;
  13112. /**
  13113. * The large version of the icon should be used. Default is `true`. Maps to
  13114. * `NIIF_LARGE_ICON`.
  13115. */
  13116. largeIcon?: boolean;
  13117. /**
  13118. * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
  13119. */
  13120. noSound?: boolean;
  13121. /**
  13122. * Do not display the balloon notification if the current user is in "quiet time".
  13123. * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
  13124. */
  13125. respectQuietTime?: boolean;
  13126. }
  13127. interface EnableNetworkEmulationOptions {
  13128. /**
  13129. * Whether to emulate network outage. Defaults to false.
  13130. */
  13131. offline?: boolean;
  13132. /**
  13133. * RTT in ms. Defaults to 0 which will disable latency throttling.
  13134. */
  13135. latency?: number;
  13136. /**
  13137. * Download rate in Bps. Defaults to 0 which will disable download throttling.
  13138. */
  13139. downloadThroughput?: number;
  13140. /**
  13141. * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
  13142. */
  13143. uploadThroughput?: number;
  13144. }
  13145. interface FeedURLOptions {
  13146. url: string;
  13147. /**
  13148. * HTTP request headers.
  13149. *
  13150. * @platform darwin
  13151. */
  13152. headers?: Record<string, string>;
  13153. /**
  13154. * Can be `json` or `default`, see the Squirrel.Mac README for more information.
  13155. *
  13156. * @platform darwin
  13157. */
  13158. serverType?: ('json' | 'default');
  13159. }
  13160. interface FileIconOptions {
  13161. size: ('small' | 'normal' | 'large');
  13162. }
  13163. interface FindInPageOptions {
  13164. /**
  13165. * Whether to search forward or backward, defaults to `true`.
  13166. */
  13167. forward?: boolean;
  13168. /**
  13169. * Whether to begin a new text finding session with this request. Should be `true`
  13170. * for initial requests, and `false` for follow-up requests. Defaults to `false`.
  13171. */
  13172. findNext?: boolean;
  13173. /**
  13174. * Whether search should be case-sensitive, defaults to `false`.
  13175. */
  13176. matchCase?: boolean;
  13177. }
  13178. interface FocusOptions {
  13179. /**
  13180. * Make the receiver the active app even if another app is currently active.
  13181. *
  13182. * @platform darwin
  13183. */
  13184. steal: boolean;
  13185. }
  13186. interface FoundInPageEvent extends Event {
  13187. result: FoundInPageResult;
  13188. }
  13189. interface FrameCreatedDetails {
  13190. frame: WebFrameMain;
  13191. }
  13192. interface FromPartitionOptions {
  13193. /**
  13194. * Whether to enable cache.
  13195. */
  13196. cache: boolean;
  13197. }
  13198. interface HandlerDetails {
  13199. /**
  13200. * The _resolved_ version of the URL passed to `window.open()`. e.g. opening a
  13201. * window with `window.open('foo')` will yield something like
  13202. * `https://the-origin/the/current/path/foo`.
  13203. */
  13204. url: string;
  13205. /**
  13206. * Name of the window provided in `window.open()`
  13207. */
  13208. frameName: string;
  13209. /**
  13210. * Comma separated list of window features provided to `window.open()`.
  13211. */
  13212. features: string;
  13213. /**
  13214. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  13215. * `save-to-disk` or `other`.
  13216. */
  13217. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  13218. /**
  13219. * The referrer that will be passed to the new window. May or may not result in the
  13220. * `Referer` header being sent, depending on the referrer policy.
  13221. */
  13222. referrer: Referrer;
  13223. /**
  13224. * The post data that will be sent to the new window, along with the appropriate
  13225. * headers that will be set. If no post data is to be sent, the value will be
  13226. * `null`. Only defined when the window is being created by a form that set
  13227. * `target=_blank`.
  13228. */
  13229. postBody?: PostBody;
  13230. }
  13231. interface HeadersReceivedResponse {
  13232. cancel?: boolean;
  13233. /**
  13234. * When provided, the server is assumed to have responded with these headers.
  13235. */
  13236. responseHeaders?: Record<string, (string) | (string[])>;
  13237. /**
  13238. * Should be provided when overriding `responseHeaders` to change header status
  13239. * otherwise original response header's status will be used.
  13240. */
  13241. statusLine?: string;
  13242. }
  13243. interface HeapStatistics {
  13244. totalHeapSize: number;
  13245. totalHeapSizeExecutable: number;
  13246. totalPhysicalSize: number;
  13247. totalAvailableSize: number;
  13248. usedHeapSize: number;
  13249. heapSizeLimit: number;
  13250. mallocedMemory: number;
  13251. peakMallocedMemory: number;
  13252. doesZapGarbage: boolean;
  13253. }
  13254. interface HidDeviceAddedDetails {
  13255. device: HIDDevice[];
  13256. frame: WebFrameMain;
  13257. }
  13258. interface HidDeviceRemovedDetails {
  13259. device: HIDDevice[];
  13260. frame: WebFrameMain;
  13261. }
  13262. interface IgnoreMouseEventsOptions {
  13263. /**
  13264. * If true, forwards mouse move messages to Chromium, enabling mouse related events
  13265. * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
  13266. * forwarding is always disabled regardless of this value.
  13267. *
  13268. * @platform darwin,win32
  13269. */
  13270. forward?: boolean;
  13271. }
  13272. interface ImportCertificateOptions {
  13273. /**
  13274. * Path for the pkcs12 file.
  13275. */
  13276. certificate: string;
  13277. /**
  13278. * Passphrase for the certificate.
  13279. */
  13280. password: string;
  13281. }
  13282. interface Info {
  13283. /**
  13284. * Security origin for the isolated world.
  13285. */
  13286. securityOrigin?: string;
  13287. /**
  13288. * Content Security Policy for the isolated world.
  13289. */
  13290. csp?: string;
  13291. /**
  13292. * Name for isolated world. Useful in devtools.
  13293. */
  13294. name?: string;
  13295. }
  13296. interface Input {
  13297. /**
  13298. * Either `keyUp` or `keyDown`.
  13299. */
  13300. type: string;
  13301. /**
  13302. * Equivalent to KeyboardEvent.key.
  13303. */
  13304. key: string;
  13305. /**
  13306. * Equivalent to KeyboardEvent.code.
  13307. */
  13308. code: string;
  13309. /**
  13310. * Equivalent to KeyboardEvent.repeat.
  13311. */
  13312. isAutoRepeat: boolean;
  13313. /**
  13314. * Equivalent to KeyboardEvent.isComposing.
  13315. */
  13316. isComposing: boolean;
  13317. /**
  13318. * Equivalent to KeyboardEvent.shiftKey.
  13319. */
  13320. shift: boolean;
  13321. /**
  13322. * Equivalent to KeyboardEvent.controlKey.
  13323. */
  13324. control: boolean;
  13325. /**
  13326. * Equivalent to KeyboardEvent.altKey.
  13327. */
  13328. alt: boolean;
  13329. /**
  13330. * Equivalent to KeyboardEvent.metaKey.
  13331. */
  13332. meta: boolean;
  13333. /**
  13334. * Equivalent to KeyboardEvent.location.
  13335. */
  13336. location: number;
  13337. /**
  13338. * See InputEvent.modifiers.
  13339. */
  13340. modifiers: string[];
  13341. }
  13342. interface InsertCSSOptions {
  13343. /**
  13344. * Can be either 'user' or 'author'; Specifying 'user' enables you to prevent
  13345. * websites from overriding the CSS you insert. Default is 'author'.
  13346. */
  13347. cssOrigin?: string;
  13348. }
  13349. interface IpcMessageEvent extends Event {
  13350. /**
  13351. * pair of `[processId, frameId]`.
  13352. */
  13353. frameId: [number, number];
  13354. channel: string;
  13355. args: any[];
  13356. }
  13357. interface Item {
  13358. /**
  13359. * The path to the file being dragged.
  13360. */
  13361. file: string;
  13362. /**
  13363. * The paths to the files being dragged. (`files` will override `file` field)
  13364. */
  13365. files?: string[];
  13366. /**
  13367. * The image must be non-empty on macOS.
  13368. */
  13369. icon: (NativeImage) | (string);
  13370. }
  13371. interface JumpListSettings {
  13372. /**
  13373. * The minimum number of items that will be shown in the Jump List (for a more
  13374. * detailed description of this value see the MSDN docs).
  13375. */
  13376. minItems: number;
  13377. /**
  13378. * Array of `JumpListItem` objects that correspond to items that the user has
  13379. * explicitly removed from custom categories in the Jump List. These items must not
  13380. * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
  13381. * Windows will not display any custom category that contains any of the removed
  13382. * items.
  13383. */
  13384. removedItems: JumpListItem[];
  13385. }
  13386. interface LoadCommitEvent extends Event {
  13387. url: string;
  13388. isMainFrame: boolean;
  13389. }
  13390. interface LoadExtensionOptions {
  13391. /**
  13392. * Whether to allow the extension to read local files over `file://` protocol and
  13393. * inject content scripts into `file://` pages. This is required e.g. for loading
  13394. * devtools extensions on `file://` URLs. Defaults to false.
  13395. */
  13396. allowFileAccess: boolean;
  13397. }
  13398. interface LoadFileOptions {
  13399. /**
  13400. * Passed to `url.format()`.
  13401. */
  13402. query?: Record<string, string>;
  13403. /**
  13404. * Passed to `url.format()`.
  13405. */
  13406. search?: string;
  13407. /**
  13408. * Passed to `url.format()`.
  13409. */
  13410. hash?: string;
  13411. }
  13412. interface LoadURLOptions {
  13413. /**
  13414. * An HTTP Referrer url.
  13415. */
  13416. httpReferrer?: (string) | (Referrer);
  13417. /**
  13418. * A user agent originating the request.
  13419. */
  13420. userAgent?: string;
  13421. /**
  13422. * Extra headers separated by "\n"
  13423. */
  13424. extraHeaders?: string;
  13425. postData?: Array<(UploadRawData) | (UploadFile)>;
  13426. /**
  13427. * Base url (with trailing path separator) for files to be loaded by the data url.
  13428. * This is needed only if the specified `url` is a data url and needs to load other
  13429. * files.
  13430. */
  13431. baseURLForDataURL?: string;
  13432. }
  13433. interface LoginItemSettings {
  13434. /**
  13435. * `true` if the app is set to open at login.
  13436. */
  13437. openAtLogin: boolean;
  13438. /**
  13439. * `true` if the app is set to open as hidden at login. This setting is not
  13440. * available on MAS builds.
  13441. *
  13442. * @platform darwin
  13443. */
  13444. openAsHidden: boolean;
  13445. /**
  13446. * `true` if the app was opened at login automatically. This setting is not
  13447. * available on MAS builds.
  13448. *
  13449. * @platform darwin
  13450. */
  13451. wasOpenedAtLogin: boolean;
  13452. /**
  13453. * `true` if the app was opened as a hidden login item. This indicates that the app
  13454. * should not open any windows at startup. This setting is not available on MAS
  13455. * builds.
  13456. *
  13457. * @platform darwin
  13458. */
  13459. wasOpenedAsHidden: boolean;
  13460. /**
  13461. * `true` if the app was opened as a login item that should restore the state from
  13462. * the previous session. This indicates that the app should restore the windows
  13463. * that were open the last time the app was closed. This setting is not available
  13464. * on MAS builds.
  13465. *
  13466. * @platform darwin
  13467. */
  13468. restoreState: boolean;
  13469. /**
  13470. * `true` if app is set to open at login and its run key is not deactivated. This
  13471. * differs from `openAtLogin` as it ignores the `args` option, this property will
  13472. * be true if the given executable would be launched at login with **any**
  13473. * arguments.
  13474. *
  13475. * @platform win32
  13476. */
  13477. executableWillLaunchAtLogin: boolean;
  13478. launchItems: LaunchItems[];
  13479. }
  13480. interface LoginItemSettingsOptions {
  13481. /**
  13482. * The executable path to compare against. Defaults to `process.execPath`.
  13483. *
  13484. * @platform win32
  13485. */
  13486. path?: string;
  13487. /**
  13488. * The command-line arguments to compare against. Defaults to an empty array.
  13489. *
  13490. * @platform win32
  13491. */
  13492. args?: string[];
  13493. }
  13494. interface MenuItemConstructorOptions {
  13495. /**
  13496. * Will be called with `click(menuItem, browserWindow, event)` when the menu item
  13497. * is clicked.
  13498. */
  13499. click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
  13500. /**
  13501. * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
  13502. * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
  13503. * `zoomOut`, `toggleSpellChecker`, `togglefullscreen`, `window`, `minimize`,
  13504. * `close`, `help`, `about`, `services`, `hide`, `hideOthers`, `unhide`, `quit`,
  13505. * `startSpeaking`, `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`,
  13506. * `editMenu`, `viewMenu`, `shareMenu`, `recentDocuments`, `toggleTabBar`,
  13507. * `selectNextTab`, `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`,
  13508. * `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when
  13509. * specified the `click` property will be ignored. See roles.
  13510. */
  13511. 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' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  13512. /**
  13513. * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
  13514. */
  13515. type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  13516. label?: string;
  13517. sublabel?: string;
  13518. /**
  13519. * Hover text for this menu item.
  13520. *
  13521. * @platform darwin
  13522. */
  13523. toolTip?: string;
  13524. accelerator?: Accelerator;
  13525. icon?: (NativeImage) | (string);
  13526. /**
  13527. * If false, the menu item will be greyed out and unclickable.
  13528. */
  13529. enabled?: boolean;
  13530. /**
  13531. * default is `true`, and when `false` will prevent the accelerator from triggering
  13532. * the item if the item is not visible`.
  13533. *
  13534. * @platform darwin
  13535. */
  13536. acceleratorWorksWhenHidden?: boolean;
  13537. /**
  13538. * If false, the menu item will be entirely hidden.
  13539. */
  13540. visible?: boolean;
  13541. /**
  13542. * Should only be specified for `checkbox` or `radio` type menu items.
  13543. */
  13544. checked?: boolean;
  13545. /**
  13546. * If false, the accelerator won't be registered with the system, but it will still
  13547. * be displayed. Defaults to true.
  13548. *
  13549. * @platform linux,win32
  13550. */
  13551. registerAccelerator?: boolean;
  13552. /**
  13553. * The item to share when the `role` is `shareMenu`.
  13554. *
  13555. * @platform darwin
  13556. */
  13557. sharingItem?: SharingItem;
  13558. /**
  13559. * Should be specified for `submenu` type menu items. If `submenu` is specified,
  13560. * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
  13561. * be automatically converted to one using `Menu.buildFromTemplate`.
  13562. */
  13563. submenu?: (MenuItemConstructorOptions[]) | (Menu);
  13564. /**
  13565. * Unique within a single menu. If defined then it can be used as a reference to
  13566. * this item by the position attribute.
  13567. */
  13568. id?: string;
  13569. /**
  13570. * Inserts this item before the item with the specified label. If the referenced
  13571. * item doesn't exist the item will be inserted at the end of the menu. Also
  13572. * implies that the menu item in question should be placed in the same “group” as
  13573. * the item.
  13574. */
  13575. before?: string[];
  13576. /**
  13577. * Inserts this item after the item with the specified label. If the referenced
  13578. * item doesn't exist the item will be inserted at the end of the menu.
  13579. */
  13580. after?: string[];
  13581. /**
  13582. * Provides a means for a single context menu to declare the placement of their
  13583. * containing group before the containing group of the item with the specified
  13584. * label.
  13585. */
  13586. beforeGroupContaining?: string[];
  13587. /**
  13588. * Provides a means for a single context menu to declare the placement of their
  13589. * containing group after the containing group of the item with the specified
  13590. * label.
  13591. */
  13592. afterGroupContaining?: string[];
  13593. }
  13594. interface MessageBoxOptions {
  13595. /**
  13596. * Content of the message box.
  13597. */
  13598. message: string;
  13599. /**
  13600. * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
  13601. * `"question"` displays the same icon as `"info"`, unless you set an icon using
  13602. * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
  13603. * warning icon.
  13604. */
  13605. type?: string;
  13606. /**
  13607. * Array of texts for buttons. On Windows, an empty array will result in one button
  13608. * labeled "OK".
  13609. */
  13610. buttons?: string[];
  13611. /**
  13612. * Index of the button in the buttons array which will be selected by default when
  13613. * the message box opens.
  13614. */
  13615. defaultId?: number;
  13616. /**
  13617. * Pass an instance of AbortSignal to optionally close the message box, the message
  13618. * box will behave as if it was cancelled by the user. On macOS, `signal` does not
  13619. * work with message boxes that do not have a parent window, since those message
  13620. * boxes run synchronously due to platform limitations.
  13621. */
  13622. signal?: AbortSignal;
  13623. /**
  13624. * Title of the message box, some platforms will not show it.
  13625. */
  13626. title?: string;
  13627. /**
  13628. * Extra information of the message.
  13629. */
  13630. detail?: string;
  13631. /**
  13632. * If provided, the message box will include a checkbox with the given label.
  13633. */
  13634. checkboxLabel?: string;
  13635. /**
  13636. * Initial checked state of the checkbox. `false` by default.
  13637. */
  13638. checkboxChecked?: boolean;
  13639. icon?: NativeImage;
  13640. /**
  13641. * Custom width of the text in the message box.
  13642. *
  13643. * @platform darwin
  13644. */
  13645. textWidth?: number;
  13646. /**
  13647. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  13648. * default this is assigned to the first button with "cancel" or "no" as the label.
  13649. * If no such labeled buttons exist and this option is not set, `0` will be used as
  13650. * the return value.
  13651. */
  13652. cancelId?: number;
  13653. /**
  13654. * On Windows Electron will try to figure out which one of the `buttons` are common
  13655. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  13656. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  13657. * you don't like this behavior, you can set `noLink` to `true`.
  13658. */
  13659. noLink?: boolean;
  13660. /**
  13661. * Normalize the keyboard access keys across platforms. Default is `false`.
  13662. * Enabling this assumes `&` is used in the button labels for the placement of the
  13663. * keyboard shortcut access key and labels will be converted so they work correctly
  13664. * on each platform, `&` characters are removed on macOS, converted to `_` on
  13665. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  13666. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  13667. * via `Alt-W` on Windows and Linux.
  13668. */
  13669. normalizeAccessKeys?: boolean;
  13670. }
  13671. interface MessageBoxReturnValue {
  13672. /**
  13673. * The index of the clicked button.
  13674. */
  13675. response: number;
  13676. /**
  13677. * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
  13678. */
  13679. checkboxChecked: boolean;
  13680. }
  13681. interface MessageBoxSyncOptions {
  13682. /**
  13683. * Content of the message box.
  13684. */
  13685. message: string;
  13686. /**
  13687. * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
  13688. * `"question"` displays the same icon as `"info"`, unless you set an icon using
  13689. * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
  13690. * warning icon.
  13691. */
  13692. type?: string;
  13693. /**
  13694. * Array of texts for buttons. On Windows, an empty array will result in one button
  13695. * labeled "OK".
  13696. */
  13697. buttons?: string[];
  13698. /**
  13699. * Index of the button in the buttons array which will be selected by default when
  13700. * the message box opens.
  13701. */
  13702. defaultId?: number;
  13703. /**
  13704. * Title of the message box, some platforms will not show it.
  13705. */
  13706. title?: string;
  13707. /**
  13708. * Extra information of the message.
  13709. */
  13710. detail?: string;
  13711. icon?: (NativeImage) | (string);
  13712. /**
  13713. * Custom width of the text in the message box.
  13714. *
  13715. * @platform darwin
  13716. */
  13717. textWidth?: number;
  13718. /**
  13719. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  13720. * default this is assigned to the first button with "cancel" or "no" as the label.
  13721. * If no such labeled buttons exist and this option is not set, `0` will be used as
  13722. * the return value.
  13723. */
  13724. cancelId?: number;
  13725. /**
  13726. * On Windows Electron will try to figure out which one of the `buttons` are common
  13727. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  13728. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  13729. * you don't like this behavior, you can set `noLink` to `true`.
  13730. */
  13731. noLink?: boolean;
  13732. /**
  13733. * Normalize the keyboard access keys across platforms. Default is `false`.
  13734. * Enabling this assumes `&` is used in the button labels for the placement of the
  13735. * keyboard shortcut access key and labels will be converted so they work correctly
  13736. * on each platform, `&` characters are removed on macOS, converted to `_` on
  13737. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  13738. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  13739. * via `Alt-W` on Windows and Linux.
  13740. */
  13741. normalizeAccessKeys?: boolean;
  13742. }
  13743. interface MessageDetails {
  13744. /**
  13745. * The actual console message
  13746. */
  13747. message: string;
  13748. /**
  13749. * The version ID of the service worker that sent the log message
  13750. */
  13751. versionId: number;
  13752. /**
  13753. * The type of source for this message. Can be `javascript`, `xml`, `network`,
  13754. * `console-api`, `storage`, `app-cache`, `rendering`, `security`, `deprecation`,
  13755. * `worker`, `violation`, `intervention`, `recommendation` or `other`.
  13756. */
  13757. source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'app-cache' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
  13758. /**
  13759. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  13760. * `error`.
  13761. */
  13762. level: number;
  13763. /**
  13764. * The URL the message came from
  13765. */
  13766. sourceUrl: string;
  13767. /**
  13768. * The line number of the source that triggered this console message
  13769. */
  13770. lineNumber: number;
  13771. }
  13772. interface MessageEvent {
  13773. data: any;
  13774. ports: MessagePortMain[];
  13775. }
  13776. interface MoveToApplicationsFolderOptions {
  13777. /**
  13778. * A handler for potential conflict in move failure.
  13779. */
  13780. conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
  13781. }
  13782. interface NewWindowEvent extends Event {
  13783. url: string;
  13784. frameName: string;
  13785. /**
  13786. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  13787. * `save-to-disk` and `other`.
  13788. */
  13789. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  13790. /**
  13791. * The options which should be used for creating the new `BrowserWindow`.
  13792. */
  13793. options: BrowserWindowConstructorOptions;
  13794. }
  13795. interface NotificationConstructorOptions {
  13796. /**
  13797. * A title for the notification, which will be shown at the top of the notification
  13798. * window when it is shown.
  13799. */
  13800. title?: string;
  13801. /**
  13802. * A subtitle for the notification, which will be displayed below the title.
  13803. *
  13804. * @platform darwin
  13805. */
  13806. subtitle?: string;
  13807. /**
  13808. * The body text of the notification, which will be displayed below the title or
  13809. * subtitle.
  13810. */
  13811. body?: string;
  13812. /**
  13813. * Whether or not to emit an OS notification noise when showing the notification.
  13814. */
  13815. silent?: boolean;
  13816. /**
  13817. * An icon to use in the notification.
  13818. */
  13819. icon?: (string) | (NativeImage);
  13820. /**
  13821. * Whether or not to add an inline reply option to the notification.
  13822. *
  13823. * @platform darwin
  13824. */
  13825. hasReply?: boolean;
  13826. /**
  13827. * The timeout duration of the notification. Can be 'default' or 'never'.
  13828. *
  13829. * @platform linux,win32
  13830. */
  13831. timeoutType?: ('default' | 'never');
  13832. /**
  13833. * The placeholder to write in the inline reply input field.
  13834. *
  13835. * @platform darwin
  13836. */
  13837. replyPlaceholder?: string;
  13838. /**
  13839. * The name of the sound file to play when the notification is shown.
  13840. *
  13841. * @platform darwin
  13842. */
  13843. sound?: string;
  13844. /**
  13845. * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
  13846. *
  13847. * @platform linux
  13848. */
  13849. urgency?: ('normal' | 'critical' | 'low');
  13850. /**
  13851. * Actions to add to the notification. Please read the available actions and
  13852. * limitations in the `NotificationAction` documentation.
  13853. *
  13854. * @platform darwin
  13855. */
  13856. actions?: NotificationAction[];
  13857. /**
  13858. * A custom title for the close button of an alert. An empty string will cause the
  13859. * default localized text to be used.
  13860. *
  13861. * @platform darwin
  13862. */
  13863. closeButtonText?: string;
  13864. /**
  13865. * A custom description of the Notification on Windows superseding all properties
  13866. * above. Provides full customization of design and behavior of the notification.
  13867. *
  13868. * @platform win32
  13869. */
  13870. toastXml?: string;
  13871. }
  13872. interface OnBeforeRedirectListenerDetails {
  13873. id: number;
  13874. url: string;
  13875. method: string;
  13876. webContentsId?: number;
  13877. webContents?: WebContents;
  13878. frame?: WebFrameMain;
  13879. /**
  13880. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  13881. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  13882. */
  13883. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  13884. referrer: string;
  13885. timestamp: number;
  13886. redirectURL: string;
  13887. statusCode: number;
  13888. statusLine: string;
  13889. /**
  13890. * The server IP address that the request was actually sent to.
  13891. */
  13892. ip?: string;
  13893. fromCache: boolean;
  13894. responseHeaders?: Record<string, string[]>;
  13895. }
  13896. interface OnBeforeRequestListenerDetails {
  13897. id: number;
  13898. url: string;
  13899. method: string;
  13900. webContentsId?: number;
  13901. webContents?: WebContents;
  13902. frame?: WebFrameMain;
  13903. /**
  13904. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  13905. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  13906. */
  13907. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  13908. referrer: string;
  13909. timestamp: number;
  13910. uploadData: UploadData[];
  13911. }
  13912. interface OnBeforeSendHeadersListenerDetails {
  13913. id: number;
  13914. url: string;
  13915. method: string;
  13916. webContentsId?: number;
  13917. webContents?: WebContents;
  13918. frame?: WebFrameMain;
  13919. /**
  13920. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  13921. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  13922. */
  13923. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  13924. referrer: string;
  13925. timestamp: number;
  13926. requestHeaders: Record<string, string>;
  13927. }
  13928. interface OnCompletedListenerDetails {
  13929. id: number;
  13930. url: string;
  13931. method: string;
  13932. webContentsId?: number;
  13933. webContents?: WebContents;
  13934. frame?: WebFrameMain;
  13935. /**
  13936. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  13937. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  13938. */
  13939. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  13940. referrer: string;
  13941. timestamp: number;
  13942. responseHeaders?: Record<string, string[]>;
  13943. fromCache: boolean;
  13944. statusCode: number;
  13945. statusLine: string;
  13946. error: string;
  13947. }
  13948. interface OnErrorOccurredListenerDetails {
  13949. id: number;
  13950. url: string;
  13951. method: string;
  13952. webContentsId?: number;
  13953. webContents?: WebContents;
  13954. frame?: WebFrameMain;
  13955. /**
  13956. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  13957. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  13958. */
  13959. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  13960. referrer: string;
  13961. timestamp: number;
  13962. fromCache: boolean;
  13963. /**
  13964. * The error description.
  13965. */
  13966. error: string;
  13967. }
  13968. interface OnHeadersReceivedListenerDetails {
  13969. id: number;
  13970. url: string;
  13971. method: string;
  13972. webContentsId?: number;
  13973. webContents?: WebContents;
  13974. frame?: WebFrameMain;
  13975. /**
  13976. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  13977. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  13978. */
  13979. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  13980. referrer: string;
  13981. timestamp: number;
  13982. statusLine: string;
  13983. statusCode: number;
  13984. responseHeaders?: Record<string, string[]>;
  13985. }
  13986. interface OnResponseStartedListenerDetails {
  13987. id: number;
  13988. url: string;
  13989. method: string;
  13990. webContentsId?: number;
  13991. webContents?: WebContents;
  13992. frame?: WebFrameMain;
  13993. /**
  13994. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  13995. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  13996. */
  13997. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  13998. referrer: string;
  13999. timestamp: number;
  14000. responseHeaders?: Record<string, string[]>;
  14001. /**
  14002. * Indicates whether the response was fetched from disk cache.
  14003. */
  14004. fromCache: boolean;
  14005. statusCode: number;
  14006. statusLine: string;
  14007. }
  14008. interface OnSendHeadersListenerDetails {
  14009. id: number;
  14010. url: string;
  14011. method: string;
  14012. webContentsId?: number;
  14013. webContents?: WebContents;
  14014. frame?: WebFrameMain;
  14015. /**
  14016. * Can be `mainFrame`, `subFrame`, `stylesheet`, `script`, `image`, `font`,
  14017. * `object`, `xhr`, `ping`, `cspReport`, `media`, `webSocket` or `other`.
  14018. */
  14019. resourceType: ('mainFrame' | 'subFrame' | 'stylesheet' | 'script' | 'image' | 'font' | 'object' | 'xhr' | 'ping' | 'cspReport' | 'media' | 'webSocket' | 'other');
  14020. referrer: string;
  14021. timestamp: number;
  14022. requestHeaders: Record<string, string>;
  14023. }
  14024. interface OpenDevToolsOptions {
  14025. /**
  14026. * Opens the devtools with specified dock state, can be `right`, `bottom`,
  14027. * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
  14028. * possible to dock back. In `detach` mode it's not.
  14029. */
  14030. mode: ('right' | 'bottom' | 'undocked' | 'detach');
  14031. /**
  14032. * Whether to bring the opened devtools window to the foreground. The default is
  14033. * `true`.
  14034. */
  14035. activate?: boolean;
  14036. }
  14037. interface OpenDialogOptions {
  14038. title?: string;
  14039. defaultPath?: string;
  14040. /**
  14041. * Custom label for the confirmation button, when left empty the default label will
  14042. * be used.
  14043. */
  14044. buttonLabel?: string;
  14045. filters?: FileFilter[];
  14046. /**
  14047. * Contains which features the dialog should use. The following values are
  14048. * supported:
  14049. */
  14050. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  14051. /**
  14052. * Message to display above input boxes.
  14053. *
  14054. * @platform darwin
  14055. */
  14056. message?: string;
  14057. /**
  14058. * Create security scoped bookmarks when packaged for the Mac App Store.
  14059. *
  14060. * @platform darwin,mas
  14061. */
  14062. securityScopedBookmarks?: boolean;
  14063. }
  14064. interface OpenDialogReturnValue {
  14065. /**
  14066. * whether or not the dialog was canceled.
  14067. */
  14068. canceled: boolean;
  14069. /**
  14070. * An array of file paths chosen by the user. If the dialog is cancelled this will
  14071. * be an empty array.
  14072. */
  14073. filePaths: string[];
  14074. /**
  14075. * An array matching the `filePaths` array of base64 encoded strings which contains
  14076. * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
  14077. * this to be populated. (For return values, see table here.)
  14078. *
  14079. * @platform darwin,mas
  14080. */
  14081. bookmarks?: string[];
  14082. }
  14083. interface OpenDialogSyncOptions {
  14084. title?: string;
  14085. defaultPath?: string;
  14086. /**
  14087. * Custom label for the confirmation button, when left empty the default label will
  14088. * be used.
  14089. */
  14090. buttonLabel?: string;
  14091. filters?: FileFilter[];
  14092. /**
  14093. * Contains which features the dialog should use. The following values are
  14094. * supported:
  14095. */
  14096. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  14097. /**
  14098. * Message to display above input boxes.
  14099. *
  14100. * @platform darwin
  14101. */
  14102. message?: string;
  14103. /**
  14104. * Create security scoped bookmarks when packaged for the Mac App Store.
  14105. *
  14106. * @platform darwin,mas
  14107. */
  14108. securityScopedBookmarks?: boolean;
  14109. }
  14110. interface OpenExternalOptions {
  14111. /**
  14112. * `true` to bring the opened application to the foreground. The default is `true`.
  14113. *
  14114. * @platform darwin
  14115. */
  14116. activate?: boolean;
  14117. /**
  14118. * The working directory.
  14119. *
  14120. * @platform win32
  14121. */
  14122. workingDirectory?: string;
  14123. }
  14124. interface Options {
  14125. }
  14126. interface PageFaviconUpdatedEvent extends Event {
  14127. /**
  14128. * Array of URLs.
  14129. */
  14130. favicons: string[];
  14131. }
  14132. interface PageTitleUpdatedEvent extends Event {
  14133. title: string;
  14134. explicitSet: boolean;
  14135. }
  14136. interface Parameters {
  14137. /**
  14138. * Specify the screen type to emulate (default: `desktop`):
  14139. */
  14140. screenPosition: ('desktop' | 'mobile');
  14141. /**
  14142. * Set the emulated screen size (screenPosition == mobile).
  14143. */
  14144. screenSize: Size;
  14145. /**
  14146. * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
  14147. * 0 }`).
  14148. */
  14149. viewPosition: Point;
  14150. /**
  14151. * Set the device scale factor (if zero defaults to original device scale factor)
  14152. * (default: `0`).
  14153. */
  14154. deviceScaleFactor: number;
  14155. /**
  14156. * Set the emulated view size (empty means no override)
  14157. */
  14158. viewSize: Size;
  14159. /**
  14160. * Scale of emulated view inside available space (not in fit to view mode)
  14161. * (default: `1`).
  14162. */
  14163. scale: number;
  14164. }
  14165. interface Payment {
  14166. /**
  14167. * The identifier of the purchased product.
  14168. */
  14169. productIdentifier: string;
  14170. /**
  14171. * The quantity purchased.
  14172. */
  14173. quantity: number;
  14174. }
  14175. interface PermissionCheckHandlerHandlerDetails {
  14176. /**
  14177. * The origin of the frame embedding the frame that made the permission check.
  14178. * Only set for cross-origin sub frames making permission checks.
  14179. */
  14180. embeddingOrigin?: string;
  14181. /**
  14182. * The security origin of the `media` check.
  14183. */
  14184. securityOrigin?: string;
  14185. /**
  14186. * The type of media access being requested, can be `video`, `audio` or `unknown`
  14187. */
  14188. mediaType?: ('video' | 'audio' | 'unknown');
  14189. /**
  14190. * The last URL the requesting frame loaded. This is not provided for cross-origin
  14191. * sub frames making permission checks.
  14192. */
  14193. requestingUrl?: string;
  14194. /**
  14195. * Whether the frame making the request is the main frame
  14196. */
  14197. isMainFrame: boolean;
  14198. }
  14199. interface PermissionRequestHandlerHandlerDetails {
  14200. /**
  14201. * The url of the `openExternal` request.
  14202. */
  14203. externalURL?: string;
  14204. /**
  14205. * The security origin of the `media` request.
  14206. */
  14207. securityOrigin?: string;
  14208. /**
  14209. * The types of media access being requested, elements can be `video` or `audio`
  14210. */
  14211. mediaTypes?: Array<'video' | 'audio'>;
  14212. /**
  14213. * The last URL the requesting frame loaded
  14214. */
  14215. requestingUrl: string;
  14216. /**
  14217. * Whether the frame making the request is the main frame
  14218. */
  14219. isMainFrame: boolean;
  14220. }
  14221. interface PluginCrashedEvent extends Event {
  14222. name: string;
  14223. version: string;
  14224. }
  14225. interface PopupOptions {
  14226. /**
  14227. * Default is the focused window.
  14228. */
  14229. window?: BrowserWindow;
  14230. /**
  14231. * Default is the current mouse cursor position. Must be declared if `y` is
  14232. * declared.
  14233. */
  14234. x?: number;
  14235. /**
  14236. * Default is the current mouse cursor position. Must be declared if `x` is
  14237. * declared.
  14238. */
  14239. y?: number;
  14240. /**
  14241. * The index of the menu item to be positioned under the mouse cursor at the
  14242. * specified coordinates. Default is -1.
  14243. *
  14244. * @platform darwin
  14245. */
  14246. positioningItem?: number;
  14247. /**
  14248. * Called when menu is closed.
  14249. */
  14250. callback?: () => void;
  14251. }
  14252. interface PreconnectOptions {
  14253. /**
  14254. * URL for preconnect. Only the origin is relevant for opening the socket.
  14255. */
  14256. url: string;
  14257. /**
  14258. * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
  14259. */
  14260. numSockets?: number;
  14261. }
  14262. interface PrintToPDFOptions {
  14263. /**
  14264. * the header and footer for the PDF.
  14265. */
  14266. headerFooter?: Record<string, string>;
  14267. /**
  14268. * `true` for landscape, `false` for portrait.
  14269. */
  14270. landscape?: boolean;
  14271. /**
  14272. * Specifies the type of margins to use. Uses 0 for default margin, 1 for no
  14273. * margin, and 2 for minimum margin. and `width` in microns.
  14274. */
  14275. marginsType?: number;
  14276. /**
  14277. * The scale factor of the web page. Can range from 0 to 100.
  14278. */
  14279. scaleFactor?: number;
  14280. /**
  14281. * The page range to print. On macOS, only the first range is honored.
  14282. */
  14283. pageRanges?: Record<string, number>;
  14284. /**
  14285. * Specify page size of the generated PDF. Can be `A3`, `A4`, `A5`, `Legal`,
  14286. * `Letter`, `Tabloid` or an Object containing `height`
  14287. */
  14288. pageSize?: (string) | (Size);
  14289. /**
  14290. * Whether to print CSS backgrounds.
  14291. */
  14292. printBackground?: boolean;
  14293. /**
  14294. * Whether to print selection only.
  14295. */
  14296. printSelectionOnly?: boolean;
  14297. }
  14298. interface Privileges {
  14299. /**
  14300. * Default false.
  14301. */
  14302. standard?: boolean;
  14303. /**
  14304. * Default false.
  14305. */
  14306. secure?: boolean;
  14307. /**
  14308. * Default false.
  14309. */
  14310. bypassCSP?: boolean;
  14311. /**
  14312. * Default false.
  14313. */
  14314. allowServiceWorkers?: boolean;
  14315. /**
  14316. * Default false.
  14317. */
  14318. supportFetchAPI?: boolean;
  14319. /**
  14320. * Default false.
  14321. */
  14322. corsEnabled?: boolean;
  14323. /**
  14324. * Default false.
  14325. */
  14326. stream?: boolean;
  14327. }
  14328. interface ProgressBarOptions {
  14329. /**
  14330. * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
  14331. * `paused`.
  14332. *
  14333. * @platform win32
  14334. */
  14335. mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
  14336. }
  14337. interface Provider {
  14338. spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
  14339. }
  14340. interface ReadBookmark {
  14341. title: string;
  14342. url: string;
  14343. }
  14344. interface RegistrationCompletedDetails {
  14345. /**
  14346. * The base URL that a service worker is registered for
  14347. */
  14348. scope: string;
  14349. }
  14350. interface RelaunchOptions {
  14351. args?: string[];
  14352. execPath?: string;
  14353. }
  14354. interface RenderProcessGoneDetails {
  14355. /**
  14356. * The reason the render process is gone. Possible values:
  14357. */
  14358. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  14359. /**
  14360. * The exit code of the process, unless `reason` is `launch-failed`, in which case
  14361. * `exitCode` will be a platform-specific launch failure error code.
  14362. */
  14363. exitCode: number;
  14364. }
  14365. interface Request {
  14366. hostname: string;
  14367. certificate: Certificate;
  14368. validatedCertificate: Certificate;
  14369. /**
  14370. * `true` if Chromium recognises the root CA as a standard root. If it isn't then
  14371. * it's probably the case that this certificate was generated by a MITM proxy whose
  14372. * root has been installed locally (for example, by a corporate proxy). This should
  14373. * not be trusted if the `verificationResult` is not `OK`.
  14374. */
  14375. isIssuedByKnownRoot: boolean;
  14376. /**
  14377. * `OK` if the certificate is trusted, otherwise an error like `CERT_REVOKED`.
  14378. */
  14379. verificationResult: string;
  14380. /**
  14381. * Error code.
  14382. */
  14383. errorCode: number;
  14384. }
  14385. interface ResizeOptions {
  14386. /**
  14387. * Defaults to the image's width.
  14388. */
  14389. width?: number;
  14390. /**
  14391. * Defaults to the image's height.
  14392. */
  14393. height?: number;
  14394. /**
  14395. * The desired quality of the resize image. Possible values are `good`, `better`,
  14396. * or `best`. The default is `best`. These values express a desired quality/speed
  14397. * tradeoff. They are translated into an algorithm-specific method that depends on
  14398. * the capabilities (CPU, GPU) of the underlying platform. It is possible for all
  14399. * three methods to be mapped to the same algorithm on a given platform.
  14400. */
  14401. quality?: string;
  14402. }
  14403. interface ResourceUsage {
  14404. images: MemoryUsageDetails;
  14405. scripts: MemoryUsageDetails;
  14406. cssStyleSheets: MemoryUsageDetails;
  14407. xslStyleSheets: MemoryUsageDetails;
  14408. fonts: MemoryUsageDetails;
  14409. other: MemoryUsageDetails;
  14410. }
  14411. interface Response {
  14412. cancel?: boolean;
  14413. /**
  14414. * The original request is prevented from being sent or completed and is instead
  14415. * redirected to the given URL.
  14416. */
  14417. redirectURL?: string;
  14418. }
  14419. interface Result {
  14420. requestId: number;
  14421. /**
  14422. * Position of the active match.
  14423. */
  14424. activeMatchOrdinal: number;
  14425. /**
  14426. * Number of Matches.
  14427. */
  14428. matches: number;
  14429. /**
  14430. * Coordinates of first match region.
  14431. */
  14432. selectionArea: Rectangle;
  14433. finalUpdate: boolean;
  14434. }
  14435. interface SaveDialogOptions {
  14436. /**
  14437. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  14438. */
  14439. title?: string;
  14440. /**
  14441. * Absolute directory path, absolute file path, or file name to use by default.
  14442. */
  14443. defaultPath?: string;
  14444. /**
  14445. * Custom label for the confirmation button, when left empty the default label will
  14446. * be used.
  14447. */
  14448. buttonLabel?: string;
  14449. filters?: FileFilter[];
  14450. /**
  14451. * Message to display above text fields.
  14452. *
  14453. * @platform darwin
  14454. */
  14455. message?: string;
  14456. /**
  14457. * Custom label for the text displayed in front of the filename text field.
  14458. *
  14459. * @platform darwin
  14460. */
  14461. nameFieldLabel?: string;
  14462. /**
  14463. * Show the tags input box, defaults to `true`.
  14464. *
  14465. * @platform darwin
  14466. */
  14467. showsTagField?: boolean;
  14468. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  14469. /**
  14470. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  14471. * option is enabled and the file doesn't already exist a blank file will be
  14472. * created at the chosen path.
  14473. *
  14474. * @platform darwin,mas
  14475. */
  14476. securityScopedBookmarks?: boolean;
  14477. }
  14478. interface SaveDialogReturnValue {
  14479. /**
  14480. * whether or not the dialog was canceled.
  14481. */
  14482. canceled: boolean;
  14483. /**
  14484. * If the dialog is canceled, this will be `undefined`.
  14485. */
  14486. filePath?: string;
  14487. /**
  14488. * Base64 encoded string which contains the security scoped bookmark data for the
  14489. * saved file. `securityScopedBookmarks` must be enabled for this to be present.
  14490. * (For return values, see table here.)
  14491. *
  14492. * @platform darwin,mas
  14493. */
  14494. bookmark?: string;
  14495. }
  14496. interface SaveDialogSyncOptions {
  14497. /**
  14498. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  14499. */
  14500. title?: string;
  14501. /**
  14502. * Absolute directory path, absolute file path, or file name to use by default.
  14503. */
  14504. defaultPath?: string;
  14505. /**
  14506. * Custom label for the confirmation button, when left empty the default label will
  14507. * be used.
  14508. */
  14509. buttonLabel?: string;
  14510. filters?: FileFilter[];
  14511. /**
  14512. * Message to display above text fields.
  14513. *
  14514. * @platform darwin
  14515. */
  14516. message?: string;
  14517. /**
  14518. * Custom label for the text displayed in front of the filename text field.
  14519. *
  14520. * @platform darwin
  14521. */
  14522. nameFieldLabel?: string;
  14523. /**
  14524. * Show the tags input box, defaults to `true`.
  14525. *
  14526. * @platform darwin
  14527. */
  14528. showsTagField?: boolean;
  14529. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  14530. /**
  14531. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  14532. * option is enabled and the file doesn't already exist a blank file will be
  14533. * created at the chosen path.
  14534. *
  14535. * @platform darwin,mas
  14536. */
  14537. securityScopedBookmarks?: boolean;
  14538. }
  14539. interface SelectHidDeviceDetails {
  14540. deviceList: HIDDevice[];
  14541. frame: WebFrameMain;
  14542. }
  14543. interface Settings {
  14544. /**
  14545. * `true` to open the app at login, `false` to remove the app as a login item.
  14546. * Defaults to `false`.
  14547. */
  14548. openAtLogin?: boolean;
  14549. /**
  14550. * `true` to open the app as hidden. Defaults to `false`. The user can edit this
  14551. * setting from the System Preferences so
  14552. * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
  14553. * opened to know the current value. This setting is not available on MAS builds.
  14554. *
  14555. * @platform darwin
  14556. */
  14557. openAsHidden?: boolean;
  14558. /**
  14559. * The executable to launch at login. Defaults to `process.execPath`.
  14560. *
  14561. * @platform win32
  14562. */
  14563. path?: string;
  14564. /**
  14565. * The command-line arguments to pass to the executable. Defaults to an empty
  14566. * array. Take care to wrap paths in quotes.
  14567. *
  14568. * @platform win32
  14569. */
  14570. args?: string[];
  14571. /**
  14572. * `true` will change the startup approved registry key and `enable / disable` the
  14573. * App in Task Manager and Windows Settings. Defaults to `true`.
  14574. *
  14575. * @platform win32
  14576. */
  14577. enabled?: boolean;
  14578. /**
  14579. * value name to write into registry. Defaults to the app's AppUserModelId(). Set
  14580. * the app's login item settings.
  14581. *
  14582. * @platform win32
  14583. */
  14584. name?: string;
  14585. }
  14586. interface SourcesOptions {
  14587. /**
  14588. * An array of Strings that lists the types of desktop sources to be captured,
  14589. * available types are `screen` and `window`.
  14590. */
  14591. types: string[];
  14592. /**
  14593. * The size that the media source thumbnail should be scaled to. Default is `150` x
  14594. * `150`. Set width or height to 0 when you do not need the thumbnails. This will
  14595. * save the processing time required for capturing the content of each window and
  14596. * screen.
  14597. */
  14598. thumbnailSize?: Size;
  14599. /**
  14600. * Set to true to enable fetching window icons. The default value is false. When
  14601. * false the appIcon property of the sources return null. Same if a source has the
  14602. * type screen.
  14603. */
  14604. fetchWindowIcons?: boolean;
  14605. }
  14606. interface SSLConfigConfig {
  14607. /**
  14608. * Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. The minimum SSL version to allow
  14609. * when connecting to remote servers. Defaults to `tls1`.
  14610. */
  14611. minVersion?: string;
  14612. /**
  14613. * Can be `tls1.2` or `tls1.3`. The maximum SSL version to allow when connecting to
  14614. * remote servers. Defaults to `tls1.3`.
  14615. */
  14616. maxVersion?: string;
  14617. /**
  14618. * List of cipher suites which should be explicitly prevented from being used in
  14619. * addition to those disabled by the net built-in policy. Supported literal forms:
  14620. * 0xAABB, where AA is `cipher_suite[0]` and BB is `cipher_suite[1]`, as defined in
  14621. * RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form
  14622. * will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify
  14623. * 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note
  14624. * that TLSv1.3 ciphers cannot be disabled using this mechanism.
  14625. */
  14626. disabledCipherSuites?: number[];
  14627. }
  14628. interface StartLoggingOptions {
  14629. /**
  14630. * What kinds of data should be captured. By default, only metadata about requests
  14631. * will be captured. Setting this to `includeSensitive` will include cookies and
  14632. * authentication data. Setting it to `everything` will include all bytes
  14633. * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
  14634. */
  14635. captureMode?: ('default' | 'includeSensitive' | 'everything');
  14636. /**
  14637. * When the log grows beyond this size, logging will automatically stop. Defaults
  14638. * to unlimited.
  14639. */
  14640. maxFileSize?: number;
  14641. }
  14642. interface SystemMemoryInfo {
  14643. /**
  14644. * The total amount of physical memory in Kilobytes available to the system.
  14645. */
  14646. total: number;
  14647. /**
  14648. * The total amount of memory not being used by applications or disk cache.
  14649. */
  14650. free: number;
  14651. /**
  14652. * The total amount of swap memory in Kilobytes available to the system.
  14653. *
  14654. * @platform win32,linux
  14655. */
  14656. swapTotal: number;
  14657. /**
  14658. * The free amount of swap memory in Kilobytes available to the system.
  14659. *
  14660. * @platform win32,linux
  14661. */
  14662. swapFree: number;
  14663. }
  14664. interface TitleOptions {
  14665. /**
  14666. * The font family variant to display, can be `monospaced` or `monospacedDigit`.
  14667. * `monospaced` is available in macOS 10.15+ and `monospacedDigit` is available in
  14668. * macOS 10.11+. When left blank, the title uses the default system font.
  14669. */
  14670. fontType?: ('monospaced' | 'monospacedDigit');
  14671. }
  14672. interface ToBitmapOptions {
  14673. /**
  14674. * Defaults to 1.0.
  14675. */
  14676. scaleFactor?: number;
  14677. }
  14678. interface ToDataURLOptions {
  14679. /**
  14680. * Defaults to 1.0.
  14681. */
  14682. scaleFactor?: number;
  14683. }
  14684. interface ToPNGOptions {
  14685. /**
  14686. * Defaults to 1.0.
  14687. */
  14688. scaleFactor?: number;
  14689. }
  14690. interface TouchBarButtonConstructorOptions {
  14691. /**
  14692. * Button text.
  14693. */
  14694. label?: string;
  14695. /**
  14696. * A short description of the button for use by screenreaders like VoiceOver.
  14697. */
  14698. accessibilityLabel?: string;
  14699. /**
  14700. * Button background color in hex format, i.e `#ABCDEF`.
  14701. */
  14702. backgroundColor?: string;
  14703. /**
  14704. * Button icon.
  14705. */
  14706. icon?: (NativeImage) | (string);
  14707. /**
  14708. * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
  14709. */
  14710. iconPosition?: ('left' | 'right' | 'overlay');
  14711. /**
  14712. * Function to call when the button is clicked.
  14713. */
  14714. click?: () => void;
  14715. /**
  14716. * Whether the button is in an enabled state. Default is `true`.
  14717. */
  14718. enabled?: boolean;
  14719. }
  14720. interface TouchBarColorPickerConstructorOptions {
  14721. /**
  14722. * Array of hex color strings to appear as possible colors to select.
  14723. */
  14724. availableColors?: string[];
  14725. /**
  14726. * The selected hex color in the picker, i.e `#ABCDEF`.
  14727. */
  14728. selectedColor?: string;
  14729. /**
  14730. * Function to call when a color is selected.
  14731. */
  14732. change?: (color: string) => void;
  14733. }
  14734. interface TouchBarConstructorOptions {
  14735. items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
  14736. escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
  14737. }
  14738. interface TouchBarGroupConstructorOptions {
  14739. /**
  14740. * Items to display as a group.
  14741. */
  14742. items: TouchBar;
  14743. }
  14744. interface TouchBarLabelConstructorOptions {
  14745. /**
  14746. * Text to display.
  14747. */
  14748. label?: string;
  14749. /**
  14750. * A short description of the button for use by screenreaders like VoiceOver.
  14751. */
  14752. accessibilityLabel?: string;
  14753. /**
  14754. * Hex color of text, i.e `#ABCDEF`.
  14755. */
  14756. textColor?: string;
  14757. }
  14758. interface TouchBarPopoverConstructorOptions {
  14759. /**
  14760. * Popover button text.
  14761. */
  14762. label?: string;
  14763. /**
  14764. * Popover button icon.
  14765. */
  14766. icon?: NativeImage;
  14767. /**
  14768. * Items to display in the popover.
  14769. */
  14770. items: TouchBar;
  14771. /**
  14772. * `true` to display a close button on the left of the popover, `false` to not show
  14773. * it. Default is `true`.
  14774. */
  14775. showCloseButton?: boolean;
  14776. }
  14777. interface TouchBarScrubberConstructorOptions {
  14778. /**
  14779. * An array of items to place in this scrubber.
  14780. */
  14781. items: ScrubberItem[];
  14782. /**
  14783. * Called when the user taps an item that was not the last tapped item.
  14784. */
  14785. select?: (selectedIndex: number) => void;
  14786. /**
  14787. * Called when the user taps any item.
  14788. */
  14789. highlight?: (highlightedIndex: number) => void;
  14790. /**
  14791. * Selected item style. Can be `background`, `outline` or `none`. Defaults to
  14792. * `none`.
  14793. */
  14794. selectedStyle?: ('background' | 'outline' | 'none');
  14795. /**
  14796. * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
  14797. * to `none`.
  14798. */
  14799. overlayStyle?: ('background' | 'outline' | 'none');
  14800. /**
  14801. * Whether to show arrow buttons. Defaults to `false` and is only shown if `items`
  14802. * is non-empty.
  14803. */
  14804. showArrowButtons?: boolean;
  14805. /**
  14806. * Can be `fixed` or `free`. The default is `free`.
  14807. */
  14808. mode?: ('fixed' | 'free');
  14809. /**
  14810. * Defaults to `true`.
  14811. */
  14812. continuous?: boolean;
  14813. }
  14814. interface TouchBarSegmentedControlConstructorOptions {
  14815. /**
  14816. * Style of the segments:
  14817. */
  14818. segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
  14819. /**
  14820. * The selection mode of the control:
  14821. */
  14822. mode?: ('single' | 'multiple' | 'buttons');
  14823. /**
  14824. * An array of segments to place in this control.
  14825. */
  14826. segments: SegmentedControlSegment[];
  14827. /**
  14828. * The index of the currently selected segment, will update automatically with user
  14829. * interaction. When the mode is `multiple` it will be the last selected item.
  14830. */
  14831. selectedIndex?: number;
  14832. /**
  14833. * Called when the user selects a new segment.
  14834. */
  14835. change?: (selectedIndex: number, isSelected: boolean) => void;
  14836. }
  14837. interface TouchBarSliderConstructorOptions {
  14838. /**
  14839. * Label text.
  14840. */
  14841. label?: string;
  14842. /**
  14843. * Selected value.
  14844. */
  14845. value?: number;
  14846. /**
  14847. * Minimum value.
  14848. */
  14849. minValue?: number;
  14850. /**
  14851. * Maximum value.
  14852. */
  14853. maxValue?: number;
  14854. /**
  14855. * Function to call when the slider is changed.
  14856. */
  14857. change?: (newValue: number) => void;
  14858. }
  14859. interface TouchBarSpacerConstructorOptions {
  14860. /**
  14861. * Size of spacer, possible values are:
  14862. */
  14863. size?: ('small' | 'large' | 'flexible');
  14864. }
  14865. interface TraceBufferUsageReturnValue {
  14866. value: number;
  14867. percentage: number;
  14868. }
  14869. interface UpdateTargetUrlEvent extends Event {
  14870. url: string;
  14871. }
  14872. interface UploadProgress {
  14873. /**
  14874. * Whether the request is currently active. If this is false no other properties
  14875. * will be set
  14876. */
  14877. active: boolean;
  14878. /**
  14879. * Whether the upload has started. If this is false both `current` and `total` will
  14880. * be set to 0.
  14881. */
  14882. started: boolean;
  14883. /**
  14884. * The number of bytes that have been uploaded so far
  14885. */
  14886. current: number;
  14887. /**
  14888. * The number of bytes that will be uploaded this request
  14889. */
  14890. total: number;
  14891. }
  14892. interface VisibleOnAllWorkspacesOptions {
  14893. /**
  14894. * Sets whether the window should be visible above fullscreen windows.
  14895. *
  14896. * @platform darwin
  14897. */
  14898. visibleOnFullScreen?: boolean;
  14899. /**
  14900. * Calling setVisibleOnAllWorkspaces will by default transform the process type
  14901. * between UIElementApplication and ForegroundApplication to ensure the correct
  14902. * behavior. However, this will hide the window and dock for a short time every
  14903. * time it is called. If your window is already of type UIElementApplication, you
  14904. * can bypass this transformation by passing true to skipTransformProcessType.
  14905. *
  14906. * @platform darwin
  14907. */
  14908. skipTransformProcessType?: boolean;
  14909. }
  14910. interface WebContentsPrintOptions {
  14911. /**
  14912. * Don't ask user for print settings. Default is `false`.
  14913. */
  14914. silent?: boolean;
  14915. /**
  14916. * Prints the background color and image of the web page. Default is `false`.
  14917. */
  14918. printBackground?: boolean;
  14919. /**
  14920. * Set the printer device name to use. Must be the system-defined name and not the
  14921. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  14922. */
  14923. deviceName?: string;
  14924. /**
  14925. * Set whether the printed web page will be in color or grayscale. Default is
  14926. * `true`.
  14927. */
  14928. color?: boolean;
  14929. margins?: Margins;
  14930. /**
  14931. * Whether the web page should be printed in landscape mode. Default is `false`.
  14932. */
  14933. landscape?: boolean;
  14934. /**
  14935. * The scale factor of the web page.
  14936. */
  14937. scaleFactor?: number;
  14938. /**
  14939. * The number of pages to print per page sheet.
  14940. */
  14941. pagesPerSheet?: number;
  14942. /**
  14943. * Whether the web page should be collated.
  14944. */
  14945. collate?: boolean;
  14946. /**
  14947. * The number of copies of the web page to print.
  14948. */
  14949. copies?: number;
  14950. /**
  14951. * The page range to print. On macOS, only one range is honored.
  14952. */
  14953. pageRanges?: PageRanges[];
  14954. /**
  14955. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  14956. * `longEdge`.
  14957. */
  14958. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  14959. dpi?: Record<string, number>;
  14960. /**
  14961. * String to be printed as page header.
  14962. */
  14963. header?: string;
  14964. /**
  14965. * String to be printed as page footer.
  14966. */
  14967. footer?: string;
  14968. /**
  14969. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  14970. * `Letter`, `Tabloid` or an Object containing `height`.
  14971. */
  14972. pageSize?: (string) | (Size);
  14973. }
  14974. interface WebviewTagPrintOptions {
  14975. /**
  14976. * Don't ask user for print settings. Default is `false`.
  14977. */
  14978. silent?: boolean;
  14979. /**
  14980. * Prints the background color and image of the web page. Default is `false`.
  14981. */
  14982. printBackground?: boolean;
  14983. /**
  14984. * Set the printer device name to use. Must be the system-defined name and not the
  14985. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  14986. */
  14987. deviceName?: string;
  14988. /**
  14989. * Set whether the printed web page will be in color or grayscale. Default is
  14990. * `true`.
  14991. */
  14992. color?: boolean;
  14993. margins?: Margins;
  14994. /**
  14995. * Whether the web page should be printed in landscape mode. Default is `false`.
  14996. */
  14997. landscape?: boolean;
  14998. /**
  14999. * The scale factor of the web page.
  15000. */
  15001. scaleFactor?: number;
  15002. /**
  15003. * The number of pages to print per page sheet.
  15004. */
  15005. pagesPerSheet?: number;
  15006. /**
  15007. * Whether the web page should be collated.
  15008. */
  15009. collate?: boolean;
  15010. /**
  15011. * The number of copies of the web page to print.
  15012. */
  15013. copies?: number;
  15014. /**
  15015. * The page range to print.
  15016. */
  15017. pageRanges?: PageRanges[];
  15018. /**
  15019. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  15020. * `longEdge`.
  15021. */
  15022. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  15023. dpi?: Record<string, number>;
  15024. /**
  15025. * String to be printed as page header.
  15026. */
  15027. header?: string;
  15028. /**
  15029. * String to be printed as page footer.
  15030. */
  15031. footer?: string;
  15032. /**
  15033. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  15034. * `Letter`, `Tabloid` or an Object containing `height`.
  15035. */
  15036. pageSize?: (string) | (Size);
  15037. }
  15038. interface WillNavigateEvent extends Event {
  15039. url: string;
  15040. }
  15041. interface WillResizeDetails {
  15042. /**
  15043. * The edge of the window being dragged for resizing. Can be `bottom`, `left`,
  15044. * `right`, `top-left`, `top-right`, `bottom-left` or `bottom-right`.
  15045. */
  15046. edge: ('bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right');
  15047. }
  15048. interface EditFlags {
  15049. /**
  15050. * Whether the renderer believes it can undo.
  15051. */
  15052. canUndo: boolean;
  15053. /**
  15054. * Whether the renderer believes it can redo.
  15055. */
  15056. canRedo: boolean;
  15057. /**
  15058. * Whether the renderer believes it can cut.
  15059. */
  15060. canCut: boolean;
  15061. /**
  15062. * Whether the renderer believes it can copy.
  15063. */
  15064. canCopy: boolean;
  15065. /**
  15066. * Whether the renderer believes it can paste.
  15067. */
  15068. canPaste: boolean;
  15069. /**
  15070. * Whether the renderer believes it can delete.
  15071. */
  15072. canDelete: boolean;
  15073. /**
  15074. * Whether the renderer believes it can select all.
  15075. */
  15076. canSelectAll: boolean;
  15077. /**
  15078. * Whether the renderer believes it can edit text richly.
  15079. */
  15080. canEditRichly: boolean;
  15081. }
  15082. interface FoundInPageResult {
  15083. requestId: number;
  15084. /**
  15085. * Position of the active match.
  15086. */
  15087. activeMatchOrdinal: number;
  15088. /**
  15089. * Number of Matches.
  15090. */
  15091. matches: number;
  15092. /**
  15093. * Coordinates of first match region.
  15094. */
  15095. selectionArea: Rectangle;
  15096. finalUpdate: boolean;
  15097. }
  15098. interface LaunchItems {
  15099. /**
  15100. * name value of a registry entry.
  15101. *
  15102. * @platform win32
  15103. */
  15104. name: string;
  15105. /**
  15106. * The executable to an app that corresponds to a registry entry.
  15107. *
  15108. * @platform win32
  15109. */
  15110. path: string;
  15111. /**
  15112. * the command-line arguments to pass to the executable.
  15113. *
  15114. * @platform win32
  15115. */
  15116. args: string[];
  15117. /**
  15118. * one of `user` or `machine`. Indicates whether the registry entry is under
  15119. * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  15120. *
  15121. * @platform win32
  15122. */
  15123. scope: string;
  15124. /**
  15125. * `true` if the app registry key is startup approved and therefore shows as
  15126. * `enabled` in Task Manager and Windows settings.
  15127. *
  15128. * @platform win32
  15129. */
  15130. enabled: boolean;
  15131. }
  15132. interface Margins {
  15133. /**
  15134. * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
  15135. * you will also need to specify `top`, `bottom`, `left`, and `right`.
  15136. */
  15137. marginType?: ('default' | 'none' | 'printableArea' | 'custom');
  15138. /**
  15139. * The top margin of the printed web page, in pixels.
  15140. */
  15141. top?: number;
  15142. /**
  15143. * The bottom margin of the printed web page, in pixels.
  15144. */
  15145. bottom?: number;
  15146. /**
  15147. * The left margin of the printed web page, in pixels.
  15148. */
  15149. left?: number;
  15150. /**
  15151. * The right margin of the printed web page, in pixels.
  15152. */
  15153. right?: number;
  15154. }
  15155. interface MediaFlags {
  15156. /**
  15157. * Whether the media element has crashed.
  15158. */
  15159. inError: boolean;
  15160. /**
  15161. * Whether the media element is paused.
  15162. */
  15163. isPaused: boolean;
  15164. /**
  15165. * Whether the media element is muted.
  15166. */
  15167. isMuted: boolean;
  15168. /**
  15169. * Whether the media element has audio.
  15170. */
  15171. hasAudio: boolean;
  15172. /**
  15173. * Whether the media element is looping.
  15174. */
  15175. isLooping: boolean;
  15176. /**
  15177. * Whether the media element's controls are visible.
  15178. */
  15179. isControlsVisible: boolean;
  15180. /**
  15181. * Whether the media element's controls are toggleable.
  15182. */
  15183. canToggleControls: boolean;
  15184. /**
  15185. * Whether the media element can be printed.
  15186. */
  15187. canPrint: boolean;
  15188. /**
  15189. * Whether or not the media element can be downloaded.
  15190. */
  15191. canSave: boolean;
  15192. /**
  15193. * Whether the media element can show picture-in-picture.
  15194. */
  15195. canShowPictureInPicture: boolean;
  15196. /**
  15197. * Whether the media element is currently showing picture-in-picture.
  15198. */
  15199. isShowingPictureInPicture: boolean;
  15200. /**
  15201. * Whether the media element can be rotated.
  15202. */
  15203. canRotate: boolean;
  15204. /**
  15205. * Whether the media element can be looped.
  15206. */
  15207. canLoop: boolean;
  15208. }
  15209. interface PageRanges {
  15210. /**
  15211. * Index of the first page to print (0-based).
  15212. */
  15213. from: number;
  15214. /**
  15215. * Index of the last page to print (inclusive) (0-based).
  15216. */
  15217. to: number;
  15218. }
  15219. interface Params {
  15220. /**
  15221. * x coordinate.
  15222. */
  15223. x: number;
  15224. /**
  15225. * y coordinate.
  15226. */
  15227. y: number;
  15228. /**
  15229. * URL of the link that encloses the node the context menu was invoked on.
  15230. */
  15231. linkURL: string;
  15232. /**
  15233. * Text associated with the link. May be an empty string if the contents of the
  15234. * link are an image.
  15235. */
  15236. linkText: string;
  15237. /**
  15238. * URL of the top level page that the context menu was invoked on.
  15239. */
  15240. pageURL: string;
  15241. /**
  15242. * URL of the subframe that the context menu was invoked on.
  15243. */
  15244. frameURL: string;
  15245. /**
  15246. * Source URL for the element that the context menu was invoked on. Elements with
  15247. * source URLs are images, audio and video.
  15248. */
  15249. srcURL: string;
  15250. /**
  15251. * Type of the node the context menu was invoked on. Can be `none`, `image`,
  15252. * `audio`, `video`, `canvas`, `file` or `plugin`.
  15253. */
  15254. mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
  15255. /**
  15256. * Whether the context menu was invoked on an image which has non-empty contents.
  15257. */
  15258. hasImageContents: boolean;
  15259. /**
  15260. * Whether the context is editable.
  15261. */
  15262. isEditable: boolean;
  15263. /**
  15264. * Text of the selection that the context menu was invoked on.
  15265. */
  15266. selectionText: string;
  15267. /**
  15268. * Title text of the selection that the context menu was invoked on.
  15269. */
  15270. titleText: string;
  15271. /**
  15272. * Alt text of the selection that the context menu was invoked on.
  15273. */
  15274. altText: string;
  15275. /**
  15276. * Suggested filename to be used when saving file through 'Save Link As' option of
  15277. * context menu.
  15278. */
  15279. suggestedFilename: string;
  15280. /**
  15281. * Rect representing the coordinates in the document space of the selection.
  15282. */
  15283. selectionRect: Rectangle;
  15284. /**
  15285. * Start position of the selection text.
  15286. */
  15287. selectionStartOffset: number;
  15288. /**
  15289. * The referrer policy of the frame on which the menu is invoked.
  15290. */
  15291. referrerPolicy: Referrer;
  15292. /**
  15293. * The misspelled word under the cursor, if any.
  15294. */
  15295. misspelledWord: string;
  15296. /**
  15297. * An array of suggested words to show the user to replace the `misspelledWord`.
  15298. * Only available if there is a misspelled word and spellchecker is enabled.
  15299. */
  15300. dictionarySuggestions: string[];
  15301. /**
  15302. * The character encoding of the frame on which the menu was invoked.
  15303. */
  15304. frameCharset: string;
  15305. /**
  15306. * If the context menu was invoked on an input field, the type of that field.
  15307. * Possible values are `none`, `plainText`, `password`, `other`.
  15308. */
  15309. inputFieldType: string;
  15310. /**
  15311. * If the context is editable, whether or not spellchecking is enabled.
  15312. */
  15313. spellcheckEnabled: boolean;
  15314. /**
  15315. * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
  15316. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  15317. * `adjustSelection`, or `adjustSelectionReset`.
  15318. */
  15319. menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  15320. /**
  15321. * The flags for the media element the context menu was invoked on.
  15322. */
  15323. mediaFlags: MediaFlags;
  15324. /**
  15325. * These flags indicate whether the renderer believes it is able to perform the
  15326. * corresponding action.
  15327. */
  15328. editFlags: EditFlags;
  15329. }
  15330. interface TitleBarOverlay {
  15331. /**
  15332. * The CSS color of the Window Controls Overlay when enabled. Default is the system
  15333. * color.
  15334. *
  15335. * @platform win32
  15336. */
  15337. color?: string;
  15338. /**
  15339. * The CSS color of the symbols on the Window Controls Overlay when enabled.
  15340. * Default is the system color.
  15341. *
  15342. * @platform win32
  15343. */
  15344. symbolColor?: string;
  15345. }
  15346. interface WebPreferences {
  15347. /**
  15348. * Whether to enable DevTools. If it is set to `false`, can not use
  15349. * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
  15350. */
  15351. devTools?: boolean;
  15352. /**
  15353. * Whether node integration is enabled. Default is `false`.
  15354. */
  15355. nodeIntegration?: boolean;
  15356. /**
  15357. * Whether node integration is enabled in web workers. Default is `false`. More
  15358. * about this can be found in Multithreading.
  15359. */
  15360. nodeIntegrationInWorker?: boolean;
  15361. /**
  15362. * Experimental option for enabling Node.js support in sub-frames such as iframes
  15363. * and child windows. All your preloads will load for every iframe, you can use
  15364. * `process.isMainFrame` to determine if you are in the main frame or not.
  15365. */
  15366. nodeIntegrationInSubFrames?: boolean;
  15367. /**
  15368. * Specifies a script that will be loaded before other scripts run in the page.
  15369. * This script will always have access to node APIs no matter whether node
  15370. * integration is turned on or off. The value should be the absolute file path to
  15371. * the script. When node integration is turned off, the preload script can
  15372. * reintroduce Node global symbols back to the global scope. See example here.
  15373. */
  15374. preload?: string;
  15375. /**
  15376. * If set, this will sandbox the renderer associated with the window, making it
  15377. * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
  15378. * This is not the same as the `nodeIntegration` option and the APIs available to
  15379. * the preload script are more limited. Read more about the option here.
  15380. */
  15381. sandbox?: boolean;
  15382. /**
  15383. * Sets the session used by the page. Instead of passing the Session object
  15384. * directly, you can also choose to use the `partition` option instead, which
  15385. * accepts a partition string. When both `session` and `partition` are provided,
  15386. * `session` will be preferred. Default is the default session.
  15387. */
  15388. session?: Session;
  15389. /**
  15390. * Sets the session used by the page according to the session's partition string.
  15391. * If `partition` starts with `persist:`, the page will use a persistent session
  15392. * available to all pages in the app with the same `partition`. If there is no
  15393. * `persist:` prefix, the page will use an in-memory session. By assigning the same
  15394. * `partition`, multiple pages can share the same session. Default is the default
  15395. * session.
  15396. */
  15397. partition?: string;
  15398. /**
  15399. * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
  15400. */
  15401. zoomFactor?: number;
  15402. /**
  15403. * Enables JavaScript support. Default is `true`.
  15404. */
  15405. javascript?: boolean;
  15406. /**
  15407. * When `false`, it will disable the same-origin policy (usually using testing
  15408. * websites by people), and set `allowRunningInsecureContent` to `true` if this
  15409. * options has not been set by user. Default is `true`.
  15410. */
  15411. webSecurity?: boolean;
  15412. /**
  15413. * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
  15414. * `false`.
  15415. */
  15416. allowRunningInsecureContent?: boolean;
  15417. /**
  15418. * Enables image support. Default is `true`.
  15419. */
  15420. images?: boolean;
  15421. /**
  15422. * Specifies how to run image animations (E.g. GIFs). Can be `animate`,
  15423. * `animateOnce` or `noAnimation`. Default is `animate`.
  15424. */
  15425. imageAnimationPolicy?: ('animate' | 'animateOnce' | 'noAnimation');
  15426. /**
  15427. * Make TextArea elements resizable. Default is `true`.
  15428. */
  15429. textAreasAreResizable?: boolean;
  15430. /**
  15431. * Enables WebGL support. Default is `true`.
  15432. */
  15433. webgl?: boolean;
  15434. /**
  15435. * Whether plugins should be enabled. Default is `false`.
  15436. */
  15437. plugins?: boolean;
  15438. /**
  15439. * Enables Chromium's experimental features. Default is `false`.
  15440. */
  15441. experimentalFeatures?: boolean;
  15442. /**
  15443. * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
  15444. */
  15445. scrollBounce?: boolean;
  15446. /**
  15447. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  15448. * to enable. The full list of supported feature strings can be found in the
  15449. * RuntimeEnabledFeatures.json5 file.
  15450. */
  15451. enableBlinkFeatures?: string;
  15452. /**
  15453. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  15454. * to disable. The full list of supported feature strings can be found in the
  15455. * RuntimeEnabledFeatures.json5 file.
  15456. */
  15457. disableBlinkFeatures?: string;
  15458. /**
  15459. * Sets the default font for the font-family.
  15460. */
  15461. defaultFontFamily?: DefaultFontFamily;
  15462. /**
  15463. * Defaults to `16`.
  15464. */
  15465. defaultFontSize?: number;
  15466. /**
  15467. * Defaults to `13`.
  15468. */
  15469. defaultMonospaceFontSize?: number;
  15470. /**
  15471. * Defaults to `0`.
  15472. */
  15473. minimumFontSize?: number;
  15474. /**
  15475. * Defaults to `ISO-8859-1`.
  15476. */
  15477. defaultEncoding?: string;
  15478. /**
  15479. * Whether to throttle animations and timers when the page becomes background. This
  15480. * also affects the Page Visibility API. Defaults to `true`.
  15481. */
  15482. backgroundThrottling?: boolean;
  15483. /**
  15484. * Whether to enable offscreen rendering for the browser window. Defaults to
  15485. * `false`. See the offscreen rendering tutorial for more details.
  15486. */
  15487. offscreen?: boolean;
  15488. /**
  15489. * Whether to run Electron APIs and the specified `preload` script in a separate
  15490. * JavaScript context. Defaults to `true`. The context that the `preload` script
  15491. * runs in will only have access to its own dedicated `document` and `window`
  15492. * globals, as well as its own set of JavaScript builtins (`Array`, `Object`,
  15493. * `JSON`, etc.), which are all invisible to the loaded content. The Electron API
  15494. * will only be available in the `preload` script and not the loaded page. This
  15495. * option should be used when loading potentially untrusted remote content to
  15496. * ensure the loaded content cannot tamper with the `preload` script and any
  15497. * Electron APIs being used. This option uses the same technique used by Chrome
  15498. * Content Scripts. You can access this context in the dev tools by selecting the
  15499. * 'Electron Isolated Context' entry in the combo box at the top of the Console
  15500. * tab.
  15501. */
  15502. contextIsolation?: boolean;
  15503. /**
  15504. * Whether to use native `window.open()`. Defaults to `true`. Child windows will
  15505. * always have node integration disabled unless `nodeIntegrationInSubFrames` is
  15506. * true.
  15507. */
  15508. nativeWindowOpen?: boolean;
  15509. /**
  15510. * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
  15511. * `preload` script configured for the `<webview>` will have node integration
  15512. * enabled when it is executed so you should ensure remote/untrusted content is not
  15513. * able to create a `<webview>` tag with a possibly malicious `preload` script. You
  15514. * can use the `will-attach-webview` event on webContents to strip away the
  15515. * `preload` script and to validate or alter the `<webview>`'s initial settings.
  15516. */
  15517. webviewTag?: boolean;
  15518. /**
  15519. * A list of strings that will be appended to `process.argv` in the renderer
  15520. * process of this app. Useful for passing small bits of data down to renderer
  15521. * process preload scripts.
  15522. */
  15523. additionalArguments?: string[];
  15524. /**
  15525. * Whether to enable browser style consecutive dialog protection. Default is
  15526. * `false`.
  15527. */
  15528. safeDialogs?: boolean;
  15529. /**
  15530. * The message to display when consecutive dialog protection is triggered. If not
  15531. * defined the default message would be used, note that currently the default
  15532. * message is in English and not localized.
  15533. */
  15534. safeDialogsMessage?: string;
  15535. /**
  15536. * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
  15537. * `false`.
  15538. */
  15539. disableDialogs?: boolean;
  15540. /**
  15541. * Whether dragging and dropping a file or link onto the page causes a navigation.
  15542. * Default is `false`.
  15543. */
  15544. navigateOnDragDrop?: boolean;
  15545. /**
  15546. * Autoplay policy to apply to content in the window, can be
  15547. * `no-user-gesture-required`, `user-gesture-required`,
  15548. * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
  15549. */
  15550. autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
  15551. /**
  15552. * Whether to prevent the window from resizing when entering HTML Fullscreen.
  15553. * Default is `false`.
  15554. */
  15555. disableHtmlFullscreenWindowResize?: boolean;
  15556. /**
  15557. * An alternative title string provided only to accessibility tools such as screen
  15558. * readers. This string is not directly visible to users.
  15559. */
  15560. accessibleTitle?: string;
  15561. /**
  15562. * Whether to enable the builtin spellchecker. Default is `true`.
  15563. */
  15564. spellcheck?: boolean;
  15565. /**
  15566. * Whether to enable the WebSQL api. Default is `true`.
  15567. */
  15568. enableWebSQL?: boolean;
  15569. /**
  15570. * Enforces the v8 code caching policy used by blink. Accepted values are
  15571. */
  15572. v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
  15573. /**
  15574. * Whether to enable preferred size mode. The preferred size is the minimum size
  15575. * needed to contain the layout of the document—without requiring scrolling.
  15576. * Enabling this will cause the `preferred-size-changed` event to be emitted on the
  15577. * `WebContents` when the preferred size changes. Default is `false`.
  15578. */
  15579. enablePreferredSizeMode?: boolean;
  15580. }
  15581. interface DefaultFontFamily {
  15582. /**
  15583. * Defaults to `Times New Roman`.
  15584. */
  15585. standard?: string;
  15586. /**
  15587. * Defaults to `Times New Roman`.
  15588. */
  15589. serif?: string;
  15590. /**
  15591. * Defaults to `Arial`.
  15592. */
  15593. sansSerif?: string;
  15594. /**
  15595. * Defaults to `Courier New`.
  15596. */
  15597. monospace?: string;
  15598. /**
  15599. * Defaults to `Script`.
  15600. */
  15601. cursive?: string;
  15602. /**
  15603. * Defaults to `Impact`.
  15604. */
  15605. fantasy?: string;
  15606. }
  15607. interface RemoteMainInterface {
  15608. app: App;
  15609. autoUpdater: AutoUpdater;
  15610. BrowserView: typeof BrowserView;
  15611. BrowserWindow: typeof BrowserWindow;
  15612. clipboard: Clipboard;
  15613. contentTracing: ContentTracing;
  15614. crashReporter: CrashReporter;
  15615. desktopCapturer: DesktopCapturer;
  15616. dialog: Dialog;
  15617. globalShortcut: GlobalShortcut;
  15618. inAppPurchase: InAppPurchase;
  15619. ipcMain: IpcMain;
  15620. Menu: typeof Menu;
  15621. MenuItem: typeof MenuItem;
  15622. MessageChannelMain: typeof MessageChannelMain;
  15623. nativeImage: typeof NativeImage;
  15624. nativeTheme: NativeTheme;
  15625. net: Net;
  15626. netLog: NetLog;
  15627. Notification: typeof Notification;
  15628. powerMonitor: PowerMonitor;
  15629. powerSaveBlocker: PowerSaveBlocker;
  15630. protocol: Protocol;
  15631. safeStorage: SafeStorage;
  15632. screen: Screen;
  15633. session: typeof Session;
  15634. ShareMenu: typeof ShareMenu;
  15635. shell: Shell;
  15636. systemPreferences: SystemPreferences;
  15637. TouchBar: typeof TouchBar;
  15638. Tray: typeof Tray;
  15639. webContents: typeof WebContents;
  15640. webFrameMain: typeof WebFrameMain;
  15641. }
  15642. namespace Common {
  15643. const clipboard: Clipboard;
  15644. type Clipboard = Electron.Clipboard;
  15645. const crashReporter: CrashReporter;
  15646. type CrashReporter = Electron.CrashReporter;
  15647. const desktopCapturer: DesktopCapturer;
  15648. type DesktopCapturer = Electron.DesktopCapturer;
  15649. const nativeImage: typeof NativeImage;
  15650. type NativeImage = Electron.NativeImage;
  15651. const shell: Shell;
  15652. type Shell = Electron.Shell;
  15653. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  15654. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  15655. type AnimationSettings = Electron.AnimationSettings;
  15656. type AppDetailsOptions = Electron.AppDetailsOptions;
  15657. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  15658. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  15659. type AuthInfo = Electron.AuthInfo;
  15660. type AutoResizeOptions = Electron.AutoResizeOptions;
  15661. type BeforeSendResponse = Electron.BeforeSendResponse;
  15662. type BitmapOptions = Electron.BitmapOptions;
  15663. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  15664. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  15665. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  15666. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  15667. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  15668. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  15669. type Config = Electron.Config;
  15670. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  15671. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  15672. type ContextMenuEvent = Electron.ContextMenuEvent;
  15673. type ContextMenuParams = Electron.ContextMenuParams;
  15674. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  15675. type CookiesGetFilter = Electron.CookiesGetFilter;
  15676. type CookiesSetDetails = Electron.CookiesSetDetails;
  15677. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  15678. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  15679. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  15680. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  15681. type Data = Electron.Data;
  15682. type Details = Electron.Details;
  15683. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  15684. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  15685. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  15686. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  15687. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  15688. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  15689. type DidNavigateEvent = Electron.DidNavigateEvent;
  15690. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  15691. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  15692. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  15693. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  15694. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  15695. type FeedURLOptions = Electron.FeedURLOptions;
  15696. type FileIconOptions = Electron.FileIconOptions;
  15697. type FindInPageOptions = Electron.FindInPageOptions;
  15698. type FocusOptions = Electron.FocusOptions;
  15699. type FoundInPageEvent = Electron.FoundInPageEvent;
  15700. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  15701. type FromPartitionOptions = Electron.FromPartitionOptions;
  15702. type HandlerDetails = Electron.HandlerDetails;
  15703. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  15704. type HeapStatistics = Electron.HeapStatistics;
  15705. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  15706. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  15707. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  15708. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  15709. type Info = Electron.Info;
  15710. type Input = Electron.Input;
  15711. type InsertCSSOptions = Electron.InsertCSSOptions;
  15712. type IpcMessageEvent = Electron.IpcMessageEvent;
  15713. type Item = Electron.Item;
  15714. type JumpListSettings = Electron.JumpListSettings;
  15715. type LoadCommitEvent = Electron.LoadCommitEvent;
  15716. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  15717. type LoadFileOptions = Electron.LoadFileOptions;
  15718. type LoadURLOptions = Electron.LoadURLOptions;
  15719. type LoginItemSettings = Electron.LoginItemSettings;
  15720. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  15721. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  15722. type MessageBoxOptions = Electron.MessageBoxOptions;
  15723. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  15724. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  15725. type MessageDetails = Electron.MessageDetails;
  15726. type MessageEvent = Electron.MessageEvent;
  15727. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  15728. type NewWindowEvent = Electron.NewWindowEvent;
  15729. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  15730. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  15731. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  15732. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  15733. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  15734. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  15735. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  15736. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  15737. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  15738. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  15739. type OpenDialogOptions = Electron.OpenDialogOptions;
  15740. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  15741. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  15742. type OpenExternalOptions = Electron.OpenExternalOptions;
  15743. type Options = Electron.Options;
  15744. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  15745. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  15746. type Parameters = Electron.Parameters;
  15747. type Payment = Electron.Payment;
  15748. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  15749. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  15750. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  15751. type PopupOptions = Electron.PopupOptions;
  15752. type PreconnectOptions = Electron.PreconnectOptions;
  15753. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  15754. type Privileges = Electron.Privileges;
  15755. type ProgressBarOptions = Electron.ProgressBarOptions;
  15756. type Provider = Electron.Provider;
  15757. type ReadBookmark = Electron.ReadBookmark;
  15758. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  15759. type RelaunchOptions = Electron.RelaunchOptions;
  15760. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  15761. type Request = Electron.Request;
  15762. type ResizeOptions = Electron.ResizeOptions;
  15763. type ResourceUsage = Electron.ResourceUsage;
  15764. type Response = Electron.Response;
  15765. type Result = Electron.Result;
  15766. type SaveDialogOptions = Electron.SaveDialogOptions;
  15767. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  15768. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  15769. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  15770. type Settings = Electron.Settings;
  15771. type SourcesOptions = Electron.SourcesOptions;
  15772. type SSLConfigConfig = Electron.SSLConfigConfig;
  15773. type StartLoggingOptions = Electron.StartLoggingOptions;
  15774. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  15775. type TitleOptions = Electron.TitleOptions;
  15776. type ToBitmapOptions = Electron.ToBitmapOptions;
  15777. type ToDataURLOptions = Electron.ToDataURLOptions;
  15778. type ToPNGOptions = Electron.ToPNGOptions;
  15779. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  15780. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  15781. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  15782. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  15783. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  15784. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  15785. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  15786. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  15787. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  15788. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  15789. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  15790. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  15791. type UploadProgress = Electron.UploadProgress;
  15792. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  15793. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  15794. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  15795. type WillNavigateEvent = Electron.WillNavigateEvent;
  15796. type WillResizeDetails = Electron.WillResizeDetails;
  15797. type EditFlags = Electron.EditFlags;
  15798. type FoundInPageResult = Electron.FoundInPageResult;
  15799. type LaunchItems = Electron.LaunchItems;
  15800. type Margins = Electron.Margins;
  15801. type MediaFlags = Electron.MediaFlags;
  15802. type PageRanges = Electron.PageRanges;
  15803. type Params = Electron.Params;
  15804. type TitleBarOverlay = Electron.TitleBarOverlay;
  15805. type WebPreferences = Electron.WebPreferences;
  15806. type DefaultFontFamily = Electron.DefaultFontFamily;
  15807. type BluetoothDevice = Electron.BluetoothDevice;
  15808. type Certificate = Electron.Certificate;
  15809. type CertificatePrincipal = Electron.CertificatePrincipal;
  15810. type Cookie = Electron.Cookie;
  15811. type CPUUsage = Electron.CPUUsage;
  15812. type CrashReport = Electron.CrashReport;
  15813. type CustomScheme = Electron.CustomScheme;
  15814. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  15815. type Display = Electron.Display;
  15816. type Event = Electron.Event;
  15817. type Extension = Electron.Extension;
  15818. type ExtensionInfo = Electron.ExtensionInfo;
  15819. type FileFilter = Electron.FileFilter;
  15820. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  15821. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  15822. type HIDDevice = Electron.HIDDevice;
  15823. type InputEvent = Electron.InputEvent;
  15824. type IOCounters = Electron.IOCounters;
  15825. type IpcMainEvent = Electron.IpcMainEvent;
  15826. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  15827. type IpcRendererEvent = Electron.IpcRendererEvent;
  15828. type JumpListCategory = Electron.JumpListCategory;
  15829. type JumpListItem = Electron.JumpListItem;
  15830. type KeyboardEvent = Electron.KeyboardEvent;
  15831. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  15832. type MemoryInfo = Electron.MemoryInfo;
  15833. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  15834. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  15835. type MouseInputEvent = Electron.MouseInputEvent;
  15836. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  15837. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  15838. type NotificationAction = Electron.NotificationAction;
  15839. type NotificationResponse = Electron.NotificationResponse;
  15840. type Point = Electron.Point;
  15841. type PostBody = Electron.PostBody;
  15842. type PrinterInfo = Electron.PrinterInfo;
  15843. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  15844. type ProcessMetric = Electron.ProcessMetric;
  15845. type Product = Electron.Product;
  15846. type ProtocolRequest = Electron.ProtocolRequest;
  15847. type ProtocolResponse = Electron.ProtocolResponse;
  15848. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  15849. type Rectangle = Electron.Rectangle;
  15850. type Referrer = Electron.Referrer;
  15851. type ScrubberItem = Electron.ScrubberItem;
  15852. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  15853. type SerialPort = Electron.SerialPort;
  15854. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  15855. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  15856. type SharingItem = Electron.SharingItem;
  15857. type ShortcutDetails = Electron.ShortcutDetails;
  15858. type Size = Electron.Size;
  15859. type Task = Electron.Task;
  15860. type ThumbarButton = Electron.ThumbarButton;
  15861. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  15862. type TraceConfig = Electron.TraceConfig;
  15863. type Transaction = Electron.Transaction;
  15864. type UploadData = Electron.UploadData;
  15865. type UploadFile = Electron.UploadFile;
  15866. type UploadRawData = Electron.UploadRawData;
  15867. type UserDefaultTypes = Electron.UserDefaultTypes;
  15868. type WebRequestFilter = Electron.WebRequestFilter;
  15869. type WebSource = Electron.WebSource;
  15870. }
  15871. namespace Main {
  15872. const app: App;
  15873. type App = Electron.App;
  15874. const autoUpdater: AutoUpdater;
  15875. type AutoUpdater = Electron.AutoUpdater;
  15876. class BrowserView extends Electron.BrowserView {}
  15877. class BrowserWindow extends Electron.BrowserWindow {}
  15878. type ClientRequest = Electron.ClientRequest;
  15879. type CommandLine = Electron.CommandLine;
  15880. const contentTracing: ContentTracing;
  15881. type ContentTracing = Electron.ContentTracing;
  15882. type Cookies = Electron.Cookies;
  15883. type Debugger = Electron.Debugger;
  15884. const dialog: Dialog;
  15885. type Dialog = Electron.Dialog;
  15886. type Dock = Electron.Dock;
  15887. type DownloadItem = Electron.DownloadItem;
  15888. const globalShortcut: GlobalShortcut;
  15889. type GlobalShortcut = Electron.GlobalShortcut;
  15890. const inAppPurchase: InAppPurchase;
  15891. type InAppPurchase = Electron.InAppPurchase;
  15892. type IncomingMessage = Electron.IncomingMessage;
  15893. const ipcMain: IpcMain;
  15894. type IpcMain = Electron.IpcMain;
  15895. class Menu extends Electron.Menu {}
  15896. class MenuItem extends Electron.MenuItem {}
  15897. class MessageChannelMain extends Electron.MessageChannelMain {}
  15898. type MessagePortMain = Electron.MessagePortMain;
  15899. const nativeTheme: NativeTheme;
  15900. type NativeTheme = Electron.NativeTheme;
  15901. const net: Net;
  15902. type Net = Electron.Net;
  15903. const netLog: NetLog;
  15904. type NetLog = Electron.NetLog;
  15905. class Notification extends Electron.Notification {}
  15906. const powerMonitor: PowerMonitor;
  15907. type PowerMonitor = Electron.PowerMonitor;
  15908. const powerSaveBlocker: PowerSaveBlocker;
  15909. type PowerSaveBlocker = Electron.PowerSaveBlocker;
  15910. const protocol: Protocol;
  15911. type Protocol = Electron.Protocol;
  15912. const safeStorage: SafeStorage;
  15913. type SafeStorage = Electron.SafeStorage;
  15914. const screen: Screen;
  15915. type Screen = Electron.Screen;
  15916. type ServiceWorkers = Electron.ServiceWorkers;
  15917. const session: typeof Session;
  15918. type Session = Electron.Session;
  15919. class ShareMenu extends Electron.ShareMenu {}
  15920. const systemPreferences: SystemPreferences;
  15921. type SystemPreferences = Electron.SystemPreferences;
  15922. class TouchBar extends Electron.TouchBar {}
  15923. type TouchBarButton = Electron.TouchBarButton;
  15924. type TouchBarColorPicker = Electron.TouchBarColorPicker;
  15925. type TouchBarGroup = Electron.TouchBarGroup;
  15926. type TouchBarLabel = Electron.TouchBarLabel;
  15927. type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
  15928. type TouchBarPopover = Electron.TouchBarPopover;
  15929. type TouchBarScrubber = Electron.TouchBarScrubber;
  15930. type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
  15931. type TouchBarSlider = Electron.TouchBarSlider;
  15932. type TouchBarSpacer = Electron.TouchBarSpacer;
  15933. class Tray extends Electron.Tray {}
  15934. const webContents: typeof WebContents;
  15935. type WebContents = Electron.WebContents;
  15936. const webFrameMain: typeof WebFrameMain;
  15937. type WebFrameMain = Electron.WebFrameMain;
  15938. type WebRequest = Electron.WebRequest;
  15939. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  15940. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  15941. type AnimationSettings = Electron.AnimationSettings;
  15942. type AppDetailsOptions = Electron.AppDetailsOptions;
  15943. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  15944. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  15945. type AuthInfo = Electron.AuthInfo;
  15946. type AutoResizeOptions = Electron.AutoResizeOptions;
  15947. type BeforeSendResponse = Electron.BeforeSendResponse;
  15948. type BitmapOptions = Electron.BitmapOptions;
  15949. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  15950. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  15951. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  15952. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  15953. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  15954. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  15955. type Config = Electron.Config;
  15956. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  15957. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  15958. type ContextMenuEvent = Electron.ContextMenuEvent;
  15959. type ContextMenuParams = Electron.ContextMenuParams;
  15960. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  15961. type CookiesGetFilter = Electron.CookiesGetFilter;
  15962. type CookiesSetDetails = Electron.CookiesSetDetails;
  15963. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  15964. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  15965. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  15966. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  15967. type Data = Electron.Data;
  15968. type Details = Electron.Details;
  15969. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  15970. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  15971. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  15972. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  15973. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  15974. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  15975. type DidNavigateEvent = Electron.DidNavigateEvent;
  15976. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  15977. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  15978. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  15979. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  15980. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  15981. type FeedURLOptions = Electron.FeedURLOptions;
  15982. type FileIconOptions = Electron.FileIconOptions;
  15983. type FindInPageOptions = Electron.FindInPageOptions;
  15984. type FocusOptions = Electron.FocusOptions;
  15985. type FoundInPageEvent = Electron.FoundInPageEvent;
  15986. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  15987. type FromPartitionOptions = Electron.FromPartitionOptions;
  15988. type HandlerDetails = Electron.HandlerDetails;
  15989. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  15990. type HeapStatistics = Electron.HeapStatistics;
  15991. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  15992. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  15993. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  15994. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  15995. type Info = Electron.Info;
  15996. type Input = Electron.Input;
  15997. type InsertCSSOptions = Electron.InsertCSSOptions;
  15998. type IpcMessageEvent = Electron.IpcMessageEvent;
  15999. type Item = Electron.Item;
  16000. type JumpListSettings = Electron.JumpListSettings;
  16001. type LoadCommitEvent = Electron.LoadCommitEvent;
  16002. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  16003. type LoadFileOptions = Electron.LoadFileOptions;
  16004. type LoadURLOptions = Electron.LoadURLOptions;
  16005. type LoginItemSettings = Electron.LoginItemSettings;
  16006. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  16007. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  16008. type MessageBoxOptions = Electron.MessageBoxOptions;
  16009. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  16010. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  16011. type MessageDetails = Electron.MessageDetails;
  16012. type MessageEvent = Electron.MessageEvent;
  16013. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  16014. type NewWindowEvent = Electron.NewWindowEvent;
  16015. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  16016. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  16017. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  16018. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  16019. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  16020. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  16021. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  16022. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  16023. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  16024. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  16025. type OpenDialogOptions = Electron.OpenDialogOptions;
  16026. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  16027. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  16028. type OpenExternalOptions = Electron.OpenExternalOptions;
  16029. type Options = Electron.Options;
  16030. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  16031. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  16032. type Parameters = Electron.Parameters;
  16033. type Payment = Electron.Payment;
  16034. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  16035. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  16036. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  16037. type PopupOptions = Electron.PopupOptions;
  16038. type PreconnectOptions = Electron.PreconnectOptions;
  16039. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  16040. type Privileges = Electron.Privileges;
  16041. type ProgressBarOptions = Electron.ProgressBarOptions;
  16042. type Provider = Electron.Provider;
  16043. type ReadBookmark = Electron.ReadBookmark;
  16044. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  16045. type RelaunchOptions = Electron.RelaunchOptions;
  16046. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  16047. type Request = Electron.Request;
  16048. type ResizeOptions = Electron.ResizeOptions;
  16049. type ResourceUsage = Electron.ResourceUsage;
  16050. type Response = Electron.Response;
  16051. type Result = Electron.Result;
  16052. type SaveDialogOptions = Electron.SaveDialogOptions;
  16053. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  16054. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  16055. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  16056. type Settings = Electron.Settings;
  16057. type SourcesOptions = Electron.SourcesOptions;
  16058. type SSLConfigConfig = Electron.SSLConfigConfig;
  16059. type StartLoggingOptions = Electron.StartLoggingOptions;
  16060. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  16061. type TitleOptions = Electron.TitleOptions;
  16062. type ToBitmapOptions = Electron.ToBitmapOptions;
  16063. type ToDataURLOptions = Electron.ToDataURLOptions;
  16064. type ToPNGOptions = Electron.ToPNGOptions;
  16065. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  16066. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  16067. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  16068. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  16069. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  16070. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  16071. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  16072. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  16073. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  16074. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  16075. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  16076. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  16077. type UploadProgress = Electron.UploadProgress;
  16078. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  16079. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  16080. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  16081. type WillNavigateEvent = Electron.WillNavigateEvent;
  16082. type WillResizeDetails = Electron.WillResizeDetails;
  16083. type EditFlags = Electron.EditFlags;
  16084. type FoundInPageResult = Electron.FoundInPageResult;
  16085. type LaunchItems = Electron.LaunchItems;
  16086. type Margins = Electron.Margins;
  16087. type MediaFlags = Electron.MediaFlags;
  16088. type PageRanges = Electron.PageRanges;
  16089. type Params = Electron.Params;
  16090. type TitleBarOverlay = Electron.TitleBarOverlay;
  16091. type WebPreferences = Electron.WebPreferences;
  16092. type DefaultFontFamily = Electron.DefaultFontFamily;
  16093. type BluetoothDevice = Electron.BluetoothDevice;
  16094. type Certificate = Electron.Certificate;
  16095. type CertificatePrincipal = Electron.CertificatePrincipal;
  16096. type Cookie = Electron.Cookie;
  16097. type CPUUsage = Electron.CPUUsage;
  16098. type CrashReport = Electron.CrashReport;
  16099. type CustomScheme = Electron.CustomScheme;
  16100. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  16101. type Display = Electron.Display;
  16102. type Event = Electron.Event;
  16103. type Extension = Electron.Extension;
  16104. type ExtensionInfo = Electron.ExtensionInfo;
  16105. type FileFilter = Electron.FileFilter;
  16106. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  16107. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  16108. type HIDDevice = Electron.HIDDevice;
  16109. type InputEvent = Electron.InputEvent;
  16110. type IOCounters = Electron.IOCounters;
  16111. type IpcMainEvent = Electron.IpcMainEvent;
  16112. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  16113. type IpcRendererEvent = Electron.IpcRendererEvent;
  16114. type JumpListCategory = Electron.JumpListCategory;
  16115. type JumpListItem = Electron.JumpListItem;
  16116. type KeyboardEvent = Electron.KeyboardEvent;
  16117. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  16118. type MemoryInfo = Electron.MemoryInfo;
  16119. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  16120. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  16121. type MouseInputEvent = Electron.MouseInputEvent;
  16122. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  16123. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  16124. type NotificationAction = Electron.NotificationAction;
  16125. type NotificationResponse = Electron.NotificationResponse;
  16126. type Point = Electron.Point;
  16127. type PostBody = Electron.PostBody;
  16128. type PrinterInfo = Electron.PrinterInfo;
  16129. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  16130. type ProcessMetric = Electron.ProcessMetric;
  16131. type Product = Electron.Product;
  16132. type ProtocolRequest = Electron.ProtocolRequest;
  16133. type ProtocolResponse = Electron.ProtocolResponse;
  16134. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  16135. type Rectangle = Electron.Rectangle;
  16136. type Referrer = Electron.Referrer;
  16137. type ScrubberItem = Electron.ScrubberItem;
  16138. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  16139. type SerialPort = Electron.SerialPort;
  16140. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  16141. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  16142. type SharingItem = Electron.SharingItem;
  16143. type ShortcutDetails = Electron.ShortcutDetails;
  16144. type Size = Electron.Size;
  16145. type Task = Electron.Task;
  16146. type ThumbarButton = Electron.ThumbarButton;
  16147. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  16148. type TraceConfig = Electron.TraceConfig;
  16149. type Transaction = Electron.Transaction;
  16150. type UploadData = Electron.UploadData;
  16151. type UploadFile = Electron.UploadFile;
  16152. type UploadRawData = Electron.UploadRawData;
  16153. type UserDefaultTypes = Electron.UserDefaultTypes;
  16154. type WebRequestFilter = Electron.WebRequestFilter;
  16155. type WebSource = Electron.WebSource;
  16156. }
  16157. namespace Renderer {
  16158. type BrowserWindowProxy = Electron.BrowserWindowProxy;
  16159. const contextBridge: ContextBridge;
  16160. type ContextBridge = Electron.ContextBridge;
  16161. const ipcRenderer: IpcRenderer;
  16162. type IpcRenderer = Electron.IpcRenderer;
  16163. const webFrame: WebFrame;
  16164. type WebFrame = Electron.WebFrame;
  16165. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  16166. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  16167. type AnimationSettings = Electron.AnimationSettings;
  16168. type AppDetailsOptions = Electron.AppDetailsOptions;
  16169. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  16170. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  16171. type AuthInfo = Electron.AuthInfo;
  16172. type AutoResizeOptions = Electron.AutoResizeOptions;
  16173. type BeforeSendResponse = Electron.BeforeSendResponse;
  16174. type BitmapOptions = Electron.BitmapOptions;
  16175. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  16176. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  16177. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  16178. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  16179. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  16180. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  16181. type Config = Electron.Config;
  16182. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  16183. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  16184. type ContextMenuEvent = Electron.ContextMenuEvent;
  16185. type ContextMenuParams = Electron.ContextMenuParams;
  16186. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  16187. type CookiesGetFilter = Electron.CookiesGetFilter;
  16188. type CookiesSetDetails = Electron.CookiesSetDetails;
  16189. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  16190. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  16191. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  16192. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  16193. type Data = Electron.Data;
  16194. type Details = Electron.Details;
  16195. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  16196. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  16197. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  16198. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  16199. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  16200. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  16201. type DidNavigateEvent = Electron.DidNavigateEvent;
  16202. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  16203. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  16204. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  16205. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  16206. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  16207. type FeedURLOptions = Electron.FeedURLOptions;
  16208. type FileIconOptions = Electron.FileIconOptions;
  16209. type FindInPageOptions = Electron.FindInPageOptions;
  16210. type FocusOptions = Electron.FocusOptions;
  16211. type FoundInPageEvent = Electron.FoundInPageEvent;
  16212. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  16213. type FromPartitionOptions = Electron.FromPartitionOptions;
  16214. type HandlerDetails = Electron.HandlerDetails;
  16215. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  16216. type HeapStatistics = Electron.HeapStatistics;
  16217. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  16218. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  16219. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  16220. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  16221. type Info = Electron.Info;
  16222. type Input = Electron.Input;
  16223. type InsertCSSOptions = Electron.InsertCSSOptions;
  16224. type IpcMessageEvent = Electron.IpcMessageEvent;
  16225. type Item = Electron.Item;
  16226. type JumpListSettings = Electron.JumpListSettings;
  16227. type LoadCommitEvent = Electron.LoadCommitEvent;
  16228. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  16229. type LoadFileOptions = Electron.LoadFileOptions;
  16230. type LoadURLOptions = Electron.LoadURLOptions;
  16231. type LoginItemSettings = Electron.LoginItemSettings;
  16232. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  16233. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  16234. type MessageBoxOptions = Electron.MessageBoxOptions;
  16235. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  16236. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  16237. type MessageDetails = Electron.MessageDetails;
  16238. type MessageEvent = Electron.MessageEvent;
  16239. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  16240. type NewWindowEvent = Electron.NewWindowEvent;
  16241. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  16242. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  16243. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  16244. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  16245. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  16246. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  16247. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  16248. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  16249. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  16250. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  16251. type OpenDialogOptions = Electron.OpenDialogOptions;
  16252. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  16253. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  16254. type OpenExternalOptions = Electron.OpenExternalOptions;
  16255. type Options = Electron.Options;
  16256. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  16257. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  16258. type Parameters = Electron.Parameters;
  16259. type Payment = Electron.Payment;
  16260. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  16261. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  16262. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  16263. type PopupOptions = Electron.PopupOptions;
  16264. type PreconnectOptions = Electron.PreconnectOptions;
  16265. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  16266. type Privileges = Electron.Privileges;
  16267. type ProgressBarOptions = Electron.ProgressBarOptions;
  16268. type Provider = Electron.Provider;
  16269. type ReadBookmark = Electron.ReadBookmark;
  16270. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  16271. type RelaunchOptions = Electron.RelaunchOptions;
  16272. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  16273. type Request = Electron.Request;
  16274. type ResizeOptions = Electron.ResizeOptions;
  16275. type ResourceUsage = Electron.ResourceUsage;
  16276. type Response = Electron.Response;
  16277. type Result = Electron.Result;
  16278. type SaveDialogOptions = Electron.SaveDialogOptions;
  16279. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  16280. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  16281. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  16282. type Settings = Electron.Settings;
  16283. type SourcesOptions = Electron.SourcesOptions;
  16284. type SSLConfigConfig = Electron.SSLConfigConfig;
  16285. type StartLoggingOptions = Electron.StartLoggingOptions;
  16286. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  16287. type TitleOptions = Electron.TitleOptions;
  16288. type ToBitmapOptions = Electron.ToBitmapOptions;
  16289. type ToDataURLOptions = Electron.ToDataURLOptions;
  16290. type ToPNGOptions = Electron.ToPNGOptions;
  16291. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  16292. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  16293. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  16294. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  16295. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  16296. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  16297. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  16298. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  16299. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  16300. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  16301. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  16302. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  16303. type UploadProgress = Electron.UploadProgress;
  16304. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  16305. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  16306. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  16307. type WillNavigateEvent = Electron.WillNavigateEvent;
  16308. type WillResizeDetails = Electron.WillResizeDetails;
  16309. type EditFlags = Electron.EditFlags;
  16310. type FoundInPageResult = Electron.FoundInPageResult;
  16311. type LaunchItems = Electron.LaunchItems;
  16312. type Margins = Electron.Margins;
  16313. type MediaFlags = Electron.MediaFlags;
  16314. type PageRanges = Electron.PageRanges;
  16315. type Params = Electron.Params;
  16316. type TitleBarOverlay = Electron.TitleBarOverlay;
  16317. type WebPreferences = Electron.WebPreferences;
  16318. type DefaultFontFamily = Electron.DefaultFontFamily;
  16319. type BluetoothDevice = Electron.BluetoothDevice;
  16320. type Certificate = Electron.Certificate;
  16321. type CertificatePrincipal = Electron.CertificatePrincipal;
  16322. type Cookie = Electron.Cookie;
  16323. type CPUUsage = Electron.CPUUsage;
  16324. type CrashReport = Electron.CrashReport;
  16325. type CustomScheme = Electron.CustomScheme;
  16326. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  16327. type Display = Electron.Display;
  16328. type Event = Electron.Event;
  16329. type Extension = Electron.Extension;
  16330. type ExtensionInfo = Electron.ExtensionInfo;
  16331. type FileFilter = Electron.FileFilter;
  16332. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  16333. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  16334. type HIDDevice = Electron.HIDDevice;
  16335. type InputEvent = Electron.InputEvent;
  16336. type IOCounters = Electron.IOCounters;
  16337. type IpcMainEvent = Electron.IpcMainEvent;
  16338. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  16339. type IpcRendererEvent = Electron.IpcRendererEvent;
  16340. type JumpListCategory = Electron.JumpListCategory;
  16341. type JumpListItem = Electron.JumpListItem;
  16342. type KeyboardEvent = Electron.KeyboardEvent;
  16343. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  16344. type MemoryInfo = Electron.MemoryInfo;
  16345. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  16346. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  16347. type MouseInputEvent = Electron.MouseInputEvent;
  16348. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  16349. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  16350. type NotificationAction = Electron.NotificationAction;
  16351. type NotificationResponse = Electron.NotificationResponse;
  16352. type Point = Electron.Point;
  16353. type PostBody = Electron.PostBody;
  16354. type PrinterInfo = Electron.PrinterInfo;
  16355. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  16356. type ProcessMetric = Electron.ProcessMetric;
  16357. type Product = Electron.Product;
  16358. type ProtocolRequest = Electron.ProtocolRequest;
  16359. type ProtocolResponse = Electron.ProtocolResponse;
  16360. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  16361. type Rectangle = Electron.Rectangle;
  16362. type Referrer = Electron.Referrer;
  16363. type ScrubberItem = Electron.ScrubberItem;
  16364. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  16365. type SerialPort = Electron.SerialPort;
  16366. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  16367. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  16368. type SharingItem = Electron.SharingItem;
  16369. type ShortcutDetails = Electron.ShortcutDetails;
  16370. type Size = Electron.Size;
  16371. type Task = Electron.Task;
  16372. type ThumbarButton = Electron.ThumbarButton;
  16373. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  16374. type TraceConfig = Electron.TraceConfig;
  16375. type Transaction = Electron.Transaction;
  16376. type UploadData = Electron.UploadData;
  16377. type UploadFile = Electron.UploadFile;
  16378. type UploadRawData = Electron.UploadRawData;
  16379. type UserDefaultTypes = Electron.UserDefaultTypes;
  16380. type WebRequestFilter = Electron.WebRequestFilter;
  16381. type WebSource = Electron.WebSource;
  16382. }
  16383. namespace CrossProcessExports {
  16384. const app: App;
  16385. type App = Electron.App;
  16386. const autoUpdater: AutoUpdater;
  16387. type AutoUpdater = Electron.AutoUpdater;
  16388. class BrowserView extends Electron.BrowserView {}
  16389. class BrowserWindow extends Electron.BrowserWindow {}
  16390. type BrowserWindowProxy = Electron.BrowserWindowProxy;
  16391. type ClientRequest = Electron.ClientRequest;
  16392. const clipboard: Clipboard;
  16393. type Clipboard = Electron.Clipboard;
  16394. type CommandLine = Electron.CommandLine;
  16395. const contentTracing: ContentTracing;
  16396. type ContentTracing = Electron.ContentTracing;
  16397. const contextBridge: ContextBridge;
  16398. type ContextBridge = Electron.ContextBridge;
  16399. type Cookies = Electron.Cookies;
  16400. const crashReporter: CrashReporter;
  16401. type CrashReporter = Electron.CrashReporter;
  16402. type Debugger = Electron.Debugger;
  16403. const desktopCapturer: DesktopCapturer;
  16404. type DesktopCapturer = Electron.DesktopCapturer;
  16405. const dialog: Dialog;
  16406. type Dialog = Electron.Dialog;
  16407. type Dock = Electron.Dock;
  16408. type DownloadItem = Electron.DownloadItem;
  16409. const globalShortcut: GlobalShortcut;
  16410. type GlobalShortcut = Electron.GlobalShortcut;
  16411. const inAppPurchase: InAppPurchase;
  16412. type InAppPurchase = Electron.InAppPurchase;
  16413. type IncomingMessage = Electron.IncomingMessage;
  16414. const ipcMain: IpcMain;
  16415. type IpcMain = Electron.IpcMain;
  16416. const ipcRenderer: IpcRenderer;
  16417. type IpcRenderer = Electron.IpcRenderer;
  16418. class Menu extends Electron.Menu {}
  16419. class MenuItem extends Electron.MenuItem {}
  16420. class MessageChannelMain extends Electron.MessageChannelMain {}
  16421. type MessagePortMain = Electron.MessagePortMain;
  16422. const nativeImage: typeof NativeImage;
  16423. type NativeImage = Electron.NativeImage;
  16424. const nativeTheme: NativeTheme;
  16425. type NativeTheme = Electron.NativeTheme;
  16426. const net: Net;
  16427. type Net = Electron.Net;
  16428. const netLog: NetLog;
  16429. type NetLog = Electron.NetLog;
  16430. class Notification extends Electron.Notification {}
  16431. const powerMonitor: PowerMonitor;
  16432. type PowerMonitor = Electron.PowerMonitor;
  16433. const powerSaveBlocker: PowerSaveBlocker;
  16434. type PowerSaveBlocker = Electron.PowerSaveBlocker;
  16435. const protocol: Protocol;
  16436. type Protocol = Electron.Protocol;
  16437. const safeStorage: SafeStorage;
  16438. type SafeStorage = Electron.SafeStorage;
  16439. const screen: Screen;
  16440. type Screen = Electron.Screen;
  16441. type ServiceWorkers = Electron.ServiceWorkers;
  16442. const session: typeof Session;
  16443. type Session = Electron.Session;
  16444. class ShareMenu extends Electron.ShareMenu {}
  16445. const shell: Shell;
  16446. type Shell = Electron.Shell;
  16447. const systemPreferences: SystemPreferences;
  16448. type SystemPreferences = Electron.SystemPreferences;
  16449. class TouchBar extends Electron.TouchBar {}
  16450. type TouchBarButton = Electron.TouchBarButton;
  16451. type TouchBarColorPicker = Electron.TouchBarColorPicker;
  16452. type TouchBarGroup = Electron.TouchBarGroup;
  16453. type TouchBarLabel = Electron.TouchBarLabel;
  16454. type TouchBarOtherItemsProxy = Electron.TouchBarOtherItemsProxy;
  16455. type TouchBarPopover = Electron.TouchBarPopover;
  16456. type TouchBarScrubber = Electron.TouchBarScrubber;
  16457. type TouchBarSegmentedControl = Electron.TouchBarSegmentedControl;
  16458. type TouchBarSlider = Electron.TouchBarSlider;
  16459. type TouchBarSpacer = Electron.TouchBarSpacer;
  16460. class Tray extends Electron.Tray {}
  16461. const webContents: typeof WebContents;
  16462. type WebContents = Electron.WebContents;
  16463. const webFrame: WebFrame;
  16464. type WebFrame = Electron.WebFrame;
  16465. const webFrameMain: typeof WebFrameMain;
  16466. type WebFrameMain = Electron.WebFrameMain;
  16467. type WebRequest = Electron.WebRequest;
  16468. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  16469. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  16470. type AnimationSettings = Electron.AnimationSettings;
  16471. type AppDetailsOptions = Electron.AppDetailsOptions;
  16472. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  16473. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  16474. type AuthInfo = Electron.AuthInfo;
  16475. type AutoResizeOptions = Electron.AutoResizeOptions;
  16476. type BeforeSendResponse = Electron.BeforeSendResponse;
  16477. type BitmapOptions = Electron.BitmapOptions;
  16478. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  16479. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  16480. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  16481. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  16482. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  16483. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  16484. type Config = Electron.Config;
  16485. type ConfigureHostResolverOptions = Electron.ConfigureHostResolverOptions;
  16486. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  16487. type ContextMenuEvent = Electron.ContextMenuEvent;
  16488. type ContextMenuParams = Electron.ContextMenuParams;
  16489. type ContinueActivityDetails = Electron.ContinueActivityDetails;
  16490. type CookiesGetFilter = Electron.CookiesGetFilter;
  16491. type CookiesSetDetails = Electron.CookiesSetDetails;
  16492. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  16493. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  16494. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  16495. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  16496. type Data = Electron.Data;
  16497. type Details = Electron.Details;
  16498. type DevicePermissionHandlerHandlerDetails = Electron.DevicePermissionHandlerHandlerDetails;
  16499. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  16500. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  16501. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  16502. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  16503. type DidFrameNavigateEvent = Electron.DidFrameNavigateEvent;
  16504. type DidNavigateEvent = Electron.DidNavigateEvent;
  16505. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  16506. type DidRedirectNavigationEvent = Electron.DidRedirectNavigationEvent;
  16507. type DidStartNavigationEvent = Electron.DidStartNavigationEvent;
  16508. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  16509. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  16510. type FeedURLOptions = Electron.FeedURLOptions;
  16511. type FileIconOptions = Electron.FileIconOptions;
  16512. type FindInPageOptions = Electron.FindInPageOptions;
  16513. type FocusOptions = Electron.FocusOptions;
  16514. type FoundInPageEvent = Electron.FoundInPageEvent;
  16515. type FrameCreatedDetails = Electron.FrameCreatedDetails;
  16516. type FromPartitionOptions = Electron.FromPartitionOptions;
  16517. type HandlerDetails = Electron.HandlerDetails;
  16518. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  16519. type HeapStatistics = Electron.HeapStatistics;
  16520. type HidDeviceAddedDetails = Electron.HidDeviceAddedDetails;
  16521. type HidDeviceRemovedDetails = Electron.HidDeviceRemovedDetails;
  16522. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  16523. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  16524. type Info = Electron.Info;
  16525. type Input = Electron.Input;
  16526. type InsertCSSOptions = Electron.InsertCSSOptions;
  16527. type IpcMessageEvent = Electron.IpcMessageEvent;
  16528. type Item = Electron.Item;
  16529. type JumpListSettings = Electron.JumpListSettings;
  16530. type LoadCommitEvent = Electron.LoadCommitEvent;
  16531. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  16532. type LoadFileOptions = Electron.LoadFileOptions;
  16533. type LoadURLOptions = Electron.LoadURLOptions;
  16534. type LoginItemSettings = Electron.LoginItemSettings;
  16535. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  16536. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  16537. type MessageBoxOptions = Electron.MessageBoxOptions;
  16538. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  16539. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  16540. type MessageDetails = Electron.MessageDetails;
  16541. type MessageEvent = Electron.MessageEvent;
  16542. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  16543. type NewWindowEvent = Electron.NewWindowEvent;
  16544. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  16545. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  16546. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  16547. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  16548. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  16549. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  16550. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  16551. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  16552. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  16553. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  16554. type OpenDialogOptions = Electron.OpenDialogOptions;
  16555. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  16556. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  16557. type OpenExternalOptions = Electron.OpenExternalOptions;
  16558. type Options = Electron.Options;
  16559. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  16560. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  16561. type Parameters = Electron.Parameters;
  16562. type Payment = Electron.Payment;
  16563. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  16564. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  16565. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  16566. type PopupOptions = Electron.PopupOptions;
  16567. type PreconnectOptions = Electron.PreconnectOptions;
  16568. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  16569. type Privileges = Electron.Privileges;
  16570. type ProgressBarOptions = Electron.ProgressBarOptions;
  16571. type Provider = Electron.Provider;
  16572. type ReadBookmark = Electron.ReadBookmark;
  16573. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  16574. type RelaunchOptions = Electron.RelaunchOptions;
  16575. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  16576. type Request = Electron.Request;
  16577. type ResizeOptions = Electron.ResizeOptions;
  16578. type ResourceUsage = Electron.ResourceUsage;
  16579. type Response = Electron.Response;
  16580. type Result = Electron.Result;
  16581. type SaveDialogOptions = Electron.SaveDialogOptions;
  16582. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  16583. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  16584. type SelectHidDeviceDetails = Electron.SelectHidDeviceDetails;
  16585. type Settings = Electron.Settings;
  16586. type SourcesOptions = Electron.SourcesOptions;
  16587. type SSLConfigConfig = Electron.SSLConfigConfig;
  16588. type StartLoggingOptions = Electron.StartLoggingOptions;
  16589. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  16590. type TitleOptions = Electron.TitleOptions;
  16591. type ToBitmapOptions = Electron.ToBitmapOptions;
  16592. type ToDataURLOptions = Electron.ToDataURLOptions;
  16593. type ToPNGOptions = Electron.ToPNGOptions;
  16594. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  16595. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  16596. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  16597. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  16598. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  16599. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  16600. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  16601. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  16602. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  16603. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  16604. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  16605. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  16606. type UploadProgress = Electron.UploadProgress;
  16607. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  16608. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  16609. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  16610. type WillNavigateEvent = Electron.WillNavigateEvent;
  16611. type WillResizeDetails = Electron.WillResizeDetails;
  16612. type EditFlags = Electron.EditFlags;
  16613. type FoundInPageResult = Electron.FoundInPageResult;
  16614. type LaunchItems = Electron.LaunchItems;
  16615. type Margins = Electron.Margins;
  16616. type MediaFlags = Electron.MediaFlags;
  16617. type PageRanges = Electron.PageRanges;
  16618. type Params = Electron.Params;
  16619. type TitleBarOverlay = Electron.TitleBarOverlay;
  16620. type WebPreferences = Electron.WebPreferences;
  16621. type DefaultFontFamily = Electron.DefaultFontFamily;
  16622. type BluetoothDevice = Electron.BluetoothDevice;
  16623. type Certificate = Electron.Certificate;
  16624. type CertificatePrincipal = Electron.CertificatePrincipal;
  16625. type Cookie = Electron.Cookie;
  16626. type CPUUsage = Electron.CPUUsage;
  16627. type CrashReport = Electron.CrashReport;
  16628. type CustomScheme = Electron.CustomScheme;
  16629. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  16630. type Display = Electron.Display;
  16631. type Event = Electron.Event;
  16632. type Extension = Electron.Extension;
  16633. type ExtensionInfo = Electron.ExtensionInfo;
  16634. type FileFilter = Electron.FileFilter;
  16635. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  16636. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  16637. type HIDDevice = Electron.HIDDevice;
  16638. type InputEvent = Electron.InputEvent;
  16639. type IOCounters = Electron.IOCounters;
  16640. type IpcMainEvent = Electron.IpcMainEvent;
  16641. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  16642. type IpcRendererEvent = Electron.IpcRendererEvent;
  16643. type JumpListCategory = Electron.JumpListCategory;
  16644. type JumpListItem = Electron.JumpListItem;
  16645. type KeyboardEvent = Electron.KeyboardEvent;
  16646. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  16647. type MemoryInfo = Electron.MemoryInfo;
  16648. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  16649. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  16650. type MouseInputEvent = Electron.MouseInputEvent;
  16651. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  16652. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  16653. type NotificationAction = Electron.NotificationAction;
  16654. type NotificationResponse = Electron.NotificationResponse;
  16655. type Point = Electron.Point;
  16656. type PostBody = Electron.PostBody;
  16657. type PrinterInfo = Electron.PrinterInfo;
  16658. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  16659. type ProcessMetric = Electron.ProcessMetric;
  16660. type Product = Electron.Product;
  16661. type ProtocolRequest = Electron.ProtocolRequest;
  16662. type ProtocolResponse = Electron.ProtocolResponse;
  16663. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  16664. type Rectangle = Electron.Rectangle;
  16665. type Referrer = Electron.Referrer;
  16666. type ScrubberItem = Electron.ScrubberItem;
  16667. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  16668. type SerialPort = Electron.SerialPort;
  16669. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  16670. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  16671. type SharingItem = Electron.SharingItem;
  16672. type ShortcutDetails = Electron.ShortcutDetails;
  16673. type Size = Electron.Size;
  16674. type Task = Electron.Task;
  16675. type ThumbarButton = Electron.ThumbarButton;
  16676. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  16677. type TraceConfig = Electron.TraceConfig;
  16678. type Transaction = Electron.Transaction;
  16679. type UploadData = Electron.UploadData;
  16680. type UploadFile = Electron.UploadFile;
  16681. type UploadRawData = Electron.UploadRawData;
  16682. type UserDefaultTypes = Electron.UserDefaultTypes;
  16683. type WebRequestFilter = Electron.WebRequestFilter;
  16684. type WebSource = Electron.WebSource;
  16685. }
  16686. const app: App;
  16687. const autoUpdater: AutoUpdater;
  16688. const clipboard: Clipboard;
  16689. const contentTracing: ContentTracing;
  16690. const contextBridge: ContextBridge;
  16691. const crashReporter: CrashReporter;
  16692. const desktopCapturer: DesktopCapturer;
  16693. const dialog: Dialog;
  16694. const globalShortcut: GlobalShortcut;
  16695. const inAppPurchase: InAppPurchase;
  16696. const ipcMain: IpcMain;
  16697. const ipcRenderer: IpcRenderer;
  16698. const nativeImage: typeof NativeImage;
  16699. const nativeTheme: NativeTheme;
  16700. const net: Net;
  16701. const netLog: NetLog;
  16702. const powerMonitor: PowerMonitor;
  16703. const powerSaveBlocker: PowerSaveBlocker;
  16704. const protocol: Protocol;
  16705. const safeStorage: SafeStorage;
  16706. const screen: Screen;
  16707. const session: typeof Session;
  16708. const shell: Shell;
  16709. const systemPreferences: SystemPreferences;
  16710. const webContents: typeof WebContents;
  16711. const webFrame: WebFrame;
  16712. const webFrameMain: typeof WebFrameMain;
  16713. }
  16714. declare module 'electron' {
  16715. export = Electron.CrossProcessExports;
  16716. }
  16717. declare module 'electron/main' {
  16718. export = Electron.Main
  16719. }
  16720. declare module 'electron/common' {
  16721. export = Electron.Common
  16722. }
  16723. declare module 'electron/renderer' {
  16724. export = Electron.Renderer
  16725. }
  16726. interface NodeRequireFunction {
  16727. (moduleName: 'electron'): typeof Electron.CrossProcessExports;
  16728. (moduleName: 'electron/main'): typeof Electron.Main;
  16729. (moduleName: 'electron/common'): typeof Electron.Common;
  16730. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  16731. }
  16732. interface NodeRequire {
  16733. (moduleName: 'electron'): typeof Electron.CrossProcessExports;
  16734. (moduleName: 'electron/main'): typeof Electron.Main;
  16735. (moduleName: 'electron/common'): typeof Electron.Common;
  16736. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  16737. }
  16738. interface File {
  16739. /**
  16740. * The real path to the file on the users filesystem
  16741. */
  16742. path: string;
  16743. }
  16744. declare module 'original-fs' {
  16745. import * as fs from 'fs';
  16746. export = fs;
  16747. }
  16748. interface Document {
  16749. createElement(tagName: 'webview'): Electron.WebviewTag;
  16750. }
  16751. declare namespace NodeJS {
  16752. interface Process extends NodeJS.EventEmitter {
  16753. // Docs: https://electronjs.org/docs/api/process
  16754. /**
  16755. * Emitted when Electron has loaded its internal initialization script and is
  16756. * beginning to load the web page or the main script.
  16757. */
  16758. on(event: 'loaded', listener: Function): this;
  16759. once(event: 'loaded', listener: Function): this;
  16760. addListener(event: 'loaded', listener: Function): this;
  16761. removeListener(event: 'loaded', listener: Function): this;
  16762. /**
  16763. * Causes the main thread of the current process crash.
  16764. */
  16765. crash(): void;
  16766. /**
  16767. * * `allocated` Integer - Size of all allocated objects in Kilobytes.
  16768. * * `marked` Integer - Size of all marked objects in Kilobytes.
  16769. * * `total` Integer - Total allocated space in Kilobytes.
  16770. *
  16771. * Returns an object with Blink memory information. It can be useful for debugging
  16772. * rendering / DOM related memory issues. Note that all values are reported in
  16773. * Kilobytes.
  16774. */
  16775. getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
  16776. getCPUUsage(): Electron.CPUUsage;
  16777. /**
  16778. * The number of milliseconds since epoch, or `null` if the information is
  16779. * unavailable
  16780. *
  16781. * Indicates the creation time of the application. The time is represented as
  16782. * number of milliseconds since epoch. It returns null if it is unable to get the
  16783. * process creation time.
  16784. */
  16785. getCreationTime(): (number) | (null);
  16786. /**
  16787. * * `totalHeapSize` Integer
  16788. * * `totalHeapSizeExecutable` Integer
  16789. * * `totalPhysicalSize` Integer
  16790. * * `totalAvailableSize` Integer
  16791. * * `usedHeapSize` Integer
  16792. * * `heapSizeLimit` Integer
  16793. * * `mallocedMemory` Integer
  16794. * * `peakMallocedMemory` Integer
  16795. * * `doesZapGarbage` Boolean
  16796. *
  16797. * Returns an object with V8 heap statistics. Note that all statistics are reported
  16798. * in Kilobytes.
  16799. */
  16800. getHeapStatistics(): Electron.HeapStatistics;
  16801. getIOCounters(): Electron.IOCounters;
  16802. /**
  16803. * Resolves with a ProcessMemoryInfo
  16804. *
  16805. * Returns an object giving memory usage statistics about the current process. Note
  16806. * that all statistics are reported in Kilobytes. This api should be called after
  16807. * app ready.
  16808. *
  16809. * Chromium does not provide `residentSet` value for macOS. This is because macOS
  16810. * performs in-memory compression of pages that haven't been recently used. As a
  16811. * result the resident set size value is not what one would expect. `private`
  16812. * memory is more representative of the actual pre-compression memory usage of the
  16813. * process on macOS.
  16814. */
  16815. getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
  16816. /**
  16817. * * `total` Integer - The total amount of physical memory in Kilobytes available
  16818. * to the system.
  16819. * * `free` Integer - The total amount of memory not being used by applications or
  16820. * disk cache.
  16821. * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
  16822. * Kilobytes available to the system.
  16823. * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
  16824. * Kilobytes available to the system.
  16825. *
  16826. * Returns an object giving memory usage statistics about the entire system. Note
  16827. * that all statistics are reported in Kilobytes.
  16828. */
  16829. getSystemMemoryInfo(): Electron.SystemMemoryInfo;
  16830. /**
  16831. * The version of the host operating system.
  16832. *
  16833. * Example:
  16834. *
  16835. * **Note:** It returns the actual operating system version instead of kernel
  16836. * version on macOS unlike `os.release()`.
  16837. */
  16838. getSystemVersion(): string;
  16839. /**
  16840. * Causes the main thread of the current process hang.
  16841. */
  16842. hang(): void;
  16843. /**
  16844. * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
  16845. * whichever is lower for the current process.
  16846. *
  16847. * @platform darwin,linux
  16848. */
  16849. setFdLimit(maxDescriptors: number): void;
  16850. /**
  16851. * Indicates whether the snapshot has been created successfully.
  16852. *
  16853. * Takes a V8 heap snapshot and saves it to `filePath`.
  16854. */
  16855. takeHeapSnapshot(filePath: string): boolean;
  16856. /**
  16857. * A `String` representing Chrome's version string.
  16858. *
  16859. */
  16860. readonly chrome: string;
  16861. /**
  16862. * A `String` (optional) representing a globally unique ID of the current
  16863. * JavaScript context. Each frame has its own JavaScript context. When
  16864. * contextIsolation is enabled, the isolated world also has a separate JavaScript
  16865. * context. This property is only available in the renderer process.
  16866. *
  16867. */
  16868. readonly contextId?: string;
  16869. /**
  16870. * A `Boolean` that indicates whether the current renderer context has
  16871. * `contextIsolation` enabled. It is `undefined` in the main process.
  16872. *
  16873. */
  16874. readonly contextIsolated: boolean;
  16875. /**
  16876. * A `Boolean`. When app is started by being passed as parameter to the default
  16877. * app, this property is `true` in the main process, otherwise it is `undefined`.
  16878. *
  16879. */
  16880. readonly defaultApp: boolean;
  16881. /**
  16882. * A `String` representing Electron's version string.
  16883. *
  16884. */
  16885. readonly electron: string;
  16886. /**
  16887. * A `Boolean`, `true` when the current renderer context is the "main" renderer
  16888. * frame. If you want the ID of the current frame you should use
  16889. * `webFrame.routingId`.
  16890. *
  16891. */
  16892. readonly isMainFrame: boolean;
  16893. /**
  16894. * A `Boolean`. For Mac App Store build, this property is `true`, for other builds
  16895. * it is `undefined`.
  16896. *
  16897. */
  16898. readonly mas: boolean;
  16899. /**
  16900. * A `Boolean` that controls ASAR support inside your application. Setting this to
  16901. * `true` will disable the support for `asar` archives in Node's built-in modules.
  16902. */
  16903. noAsar: boolean;
  16904. /**
  16905. * A `Boolean` that controls whether or not deprecation warnings are printed to
  16906. * `stderr`. Setting this to `true` will silence deprecation warnings. This
  16907. * property is used instead of the `--no-deprecation` command line flag.
  16908. */
  16909. noDeprecation: boolean;
  16910. /**
  16911. * A `String` representing the path to the resources directory.
  16912. *
  16913. */
  16914. readonly resourcesPath: string;
  16915. /**
  16916. * A `Boolean`. When the renderer process is sandboxed, this property is `true`,
  16917. * otherwise it is `undefined`.
  16918. *
  16919. */
  16920. readonly sandboxed: boolean;
  16921. /**
  16922. * A `Boolean` that controls whether or not deprecation warnings will be thrown as
  16923. * exceptions. Setting this to `true` will throw errors for deprecations. This
  16924. * property is used instead of the `--throw-deprecation` command line flag.
  16925. */
  16926. throwDeprecation: boolean;
  16927. /**
  16928. * A `Boolean` that controls whether or not deprecations printed to `stderr`
  16929. * include their stack trace. Setting this to `true` will print stack traces for
  16930. * deprecations. This property is instead of the `--trace-deprecation` command line
  16931. * flag.
  16932. */
  16933. traceDeprecation: boolean;
  16934. /**
  16935. * A `Boolean` that controls whether or not process warnings printed to `stderr`
  16936. * include their stack trace. Setting this to `true` will print stack traces for
  16937. * process warnings (including deprecations). This property is instead of the
  16938. * `--trace-warnings` command line flag.
  16939. */
  16940. traceProcessWarnings: boolean;
  16941. /**
  16942. * A `String` representing the current process's type, can be:
  16943. *
  16944. * * `browser` - The main process
  16945. * * `renderer` - A renderer process
  16946. * * `worker` - In a web worker
  16947. *
  16948. */
  16949. readonly type: ('browser' | 'renderer' | 'worker');
  16950. /**
  16951. * A `Boolean`. If the app is running as a Windows Store app (appx), this property
  16952. * is `true`, for otherwise it is `undefined`.
  16953. *
  16954. */
  16955. readonly windowsStore: boolean;
  16956. }
  16957. interface ProcessVersions {
  16958. readonly electron: string;
  16959. readonly chrome: string;
  16960. }
  16961. }