electron.d.ts 652 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092
  1. // Type definitions for Electron 13.1.4
  2. // Project: http://electronjs.org/
  3. // Definitions by: The Electron Team <https://github.com/electron/electron>
  4. // Definitions: https://github.com/electron/electron-typescript-definitions
  5. /// <reference types="node" />
  6. type GlobalEvent = Event & { returnValue: any };
  7. declare namespace Electron {
  8. const NodeEventEmitter: typeof import('events').EventEmitter;
  9. class Accelerator extends String {
  10. }
  11. interface App extends NodeJS.EventEmitter {
  12. // Docs: https://electronjs.org/docs/api/app
  13. /**
  14. * Emitted when Chrome's accessibility support changes. This event fires when
  15. * assistive technologies, such as screen readers, are enabled or disabled. See
  16. * https://www.chromium.org/developers/design-documents/accessibility for more
  17. * details.
  18. *
  19. * @platform darwin,win32
  20. */
  21. on(event: 'accessibility-support-changed', listener: (event: Event,
  22. /**
  23. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  24. */
  25. accessibilitySupportEnabled: boolean) => void): this;
  26. once(event: 'accessibility-support-changed', listener: (event: Event,
  27. /**
  28. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  29. */
  30. accessibilitySupportEnabled: boolean) => void): this;
  31. addListener(event: 'accessibility-support-changed', listener: (event: Event,
  32. /**
  33. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  34. */
  35. accessibilitySupportEnabled: boolean) => void): this;
  36. removeListener(event: 'accessibility-support-changed', listener: (event: Event,
  37. /**
  38. * `true` when Chrome's accessibility support is enabled, `false` otherwise.
  39. */
  40. accessibilitySupportEnabled: boolean) => void): this;
  41. /**
  42. * Emitted when the application is activated. Various actions can trigger this
  43. * event, such as launching the application for the first time, attempting to
  44. * re-launch the application when it's already running, or clicking on the
  45. * application's dock or taskbar icon.
  46. *
  47. * @platform darwin
  48. */
  49. on(event: 'activate', listener: (event: Event,
  50. hasVisibleWindows: boolean) => void): this;
  51. once(event: 'activate', listener: (event: Event,
  52. hasVisibleWindows: boolean) => void): this;
  53. addListener(event: 'activate', listener: (event: Event,
  54. hasVisibleWindows: boolean) => void): this;
  55. removeListener(event: 'activate', listener: (event: Event,
  56. hasVisibleWindows: boolean) => void): this;
  57. /**
  58. * Emitted during Handoff after an activity from this device was successfully
  59. * resumed on another one.
  60. *
  61. * @platform darwin
  62. */
  63. on(event: 'activity-was-continued', listener: (event: Event,
  64. /**
  65. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  66. */
  67. type: string,
  68. /**
  69. * Contains app-specific state stored by the activity.
  70. */
  71. userInfo: unknown) => void): this;
  72. once(event: 'activity-was-continued', listener: (event: Event,
  73. /**
  74. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  75. */
  76. type: string,
  77. /**
  78. * Contains app-specific state stored by the activity.
  79. */
  80. userInfo: unknown) => void): this;
  81. addListener(event: 'activity-was-continued', listener: (event: Event,
  82. /**
  83. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  84. */
  85. type: string,
  86. /**
  87. * Contains app-specific state stored by the activity.
  88. */
  89. userInfo: unknown) => void): this;
  90. removeListener(event: 'activity-was-continued', listener: (event: Event,
  91. /**
  92. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  93. */
  94. type: string,
  95. /**
  96. * Contains app-specific state stored by the activity.
  97. */
  98. userInfo: unknown) => void): this;
  99. /**
  100. * Emitted before the application starts closing its windows. Calling
  101. * `event.preventDefault()` will prevent the default behavior, which is terminating
  102. * the application.
  103. *
  104. * **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
  105. * then `before-quit` is emitted *after* emitting `close` event on all windows and
  106. * closing them.
  107. *
  108. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  109. * a shutdown/restart of the system or a user logout.
  110. */
  111. on(event: 'before-quit', listener: (event: Event) => void): this;
  112. once(event: 'before-quit', listener: (event: Event) => void): this;
  113. addListener(event: 'before-quit', listener: (event: Event) => void): this;
  114. removeListener(event: 'before-quit', listener: (event: Event) => void): this;
  115. /**
  116. * Emitted when a browserWindow gets blurred.
  117. */
  118. on(event: 'browser-window-blur', listener: (event: Event,
  119. window: BrowserWindow) => void): this;
  120. once(event: 'browser-window-blur', listener: (event: Event,
  121. window: BrowserWindow) => void): this;
  122. addListener(event: 'browser-window-blur', listener: (event: Event,
  123. window: BrowserWindow) => void): this;
  124. removeListener(event: 'browser-window-blur', listener: (event: Event,
  125. window: BrowserWindow) => void): this;
  126. /**
  127. * Emitted when a new browserWindow is created.
  128. */
  129. on(event: 'browser-window-created', listener: (event: Event,
  130. window: BrowserWindow) => void): this;
  131. once(event: 'browser-window-created', listener: (event: Event,
  132. window: BrowserWindow) => void): this;
  133. addListener(event: 'browser-window-created', listener: (event: Event,
  134. window: BrowserWindow) => void): this;
  135. removeListener(event: 'browser-window-created', listener: (event: Event,
  136. window: BrowserWindow) => void): this;
  137. /**
  138. * Emitted when a browserWindow gets focused.
  139. */
  140. on(event: 'browser-window-focus', listener: (event: Event,
  141. window: BrowserWindow) => void): this;
  142. once(event: 'browser-window-focus', listener: (event: Event,
  143. window: BrowserWindow) => void): this;
  144. addListener(event: 'browser-window-focus', listener: (event: Event,
  145. window: BrowserWindow) => void): this;
  146. removeListener(event: 'browser-window-focus', listener: (event: Event,
  147. window: BrowserWindow) => void): this;
  148. /**
  149. * Emitted when failed to verify the `certificate` for `url`, to trust the
  150. * certificate you should prevent the default behavior with
  151. * `event.preventDefault()` and call `callback(true)`.
  152. */
  153. on(event: 'certificate-error', listener: (event: Event,
  154. webContents: WebContents,
  155. url: string,
  156. /**
  157. * The error code
  158. */
  159. error: string,
  160. certificate: Certificate,
  161. callback: (isTrusted: boolean) => void) => void): this;
  162. once(event: 'certificate-error', listener: (event: Event,
  163. webContents: WebContents,
  164. url: string,
  165. /**
  166. * The error code
  167. */
  168. error: string,
  169. certificate: Certificate,
  170. callback: (isTrusted: boolean) => void) => void): this;
  171. addListener(event: 'certificate-error', listener: (event: Event,
  172. webContents: WebContents,
  173. url: string,
  174. /**
  175. * The error code
  176. */
  177. error: string,
  178. certificate: Certificate,
  179. callback: (isTrusted: boolean) => void) => void): this;
  180. removeListener(event: 'certificate-error', listener: (event: Event,
  181. webContents: WebContents,
  182. url: string,
  183. /**
  184. * The error code
  185. */
  186. error: string,
  187. certificate: Certificate,
  188. callback: (isTrusted: boolean) => void) => void): this;
  189. /**
  190. * Emitted when the child process unexpectedly disappears. This is normally because
  191. * it was crashed or killed. It does not include renderer processes.
  192. */
  193. on(event: 'child-process-gone', listener: (event: Event,
  194. details: Details) => void): this;
  195. once(event: 'child-process-gone', listener: (event: Event,
  196. details: Details) => void): this;
  197. addListener(event: 'child-process-gone', listener: (event: Event,
  198. details: Details) => void): this;
  199. removeListener(event: 'child-process-gone', listener: (event: Event,
  200. details: Details) => void): this;
  201. /**
  202. * Emitted during Handoff when an activity from a different device wants to be
  203. * resumed. You should call `event.preventDefault()` if you want to handle this
  204. * event.
  205. *
  206. * A user activity can be continued only in an app that has the same developer Team
  207. * ID as the activity's source app and that supports the activity's type. Supported
  208. * activity types are specified in the app's `Info.plist` under the
  209. * `NSUserActivityTypes` key.
  210. *
  211. * @platform darwin
  212. */
  213. on(event: 'continue-activity', listener: (event: Event,
  214. /**
  215. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  216. */
  217. type: string,
  218. /**
  219. * Contains app-specific state stored by the activity on another device.
  220. */
  221. userInfo: unknown) => void): this;
  222. once(event: 'continue-activity', listener: (event: Event,
  223. /**
  224. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  225. */
  226. type: string,
  227. /**
  228. * Contains app-specific state stored by the activity on another device.
  229. */
  230. userInfo: unknown) => void): this;
  231. addListener(event: 'continue-activity', listener: (event: Event,
  232. /**
  233. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  234. */
  235. type: string,
  236. /**
  237. * Contains app-specific state stored by the activity on another device.
  238. */
  239. userInfo: unknown) => void): this;
  240. removeListener(event: 'continue-activity', listener: (event: Event,
  241. /**
  242. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  243. */
  244. type: string,
  245. /**
  246. * Contains app-specific state stored by the activity on another device.
  247. */
  248. userInfo: unknown) => void): this;
  249. /**
  250. * Emitted during Handoff when an activity from a different device fails to be
  251. * resumed.
  252. *
  253. * @platform darwin
  254. */
  255. on(event: 'continue-activity-error', listener: (event: Event,
  256. /**
  257. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  258. */
  259. type: string,
  260. /**
  261. * A string with the error's localized description.
  262. */
  263. error: string) => void): this;
  264. once(event: 'continue-activity-error', listener: (event: Event,
  265. /**
  266. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  267. */
  268. type: string,
  269. /**
  270. * A string with the error's localized description.
  271. */
  272. error: string) => void): this;
  273. addListener(event: 'continue-activity-error', listener: (event: Event,
  274. /**
  275. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  276. */
  277. type: string,
  278. /**
  279. * A string with the error's localized description.
  280. */
  281. error: string) => void): this;
  282. removeListener(event: 'continue-activity-error', listener: (event: Event,
  283. /**
  284. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  285. */
  286. type: string,
  287. /**
  288. * A string with the error's localized description.
  289. */
  290. error: string) => void): this;
  291. /**
  292. * Emitted when `desktopCapturer.getSources()` is called in the renderer process of
  293. * `webContents`. Calling `event.preventDefault()` will make it return empty
  294. * sources.
  295. */
  296. on(event: 'desktop-capturer-get-sources', listener: (event: Event,
  297. webContents: WebContents) => void): this;
  298. once(event: 'desktop-capturer-get-sources', listener: (event: Event,
  299. webContents: WebContents) => void): this;
  300. addListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
  301. webContents: WebContents) => void): this;
  302. removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
  303. webContents: WebContents) => void): this;
  304. /**
  305. * Emitted when mac application become active. Difference from `activate` event is
  306. * that `did-become-active` is emitted every time the app becomes active, not only
  307. * when Dock icon is clicked or application is re-launched.
  308. *
  309. * @platform darwin
  310. */
  311. on(event: 'did-become-active', listener: (event: Event) => void): this;
  312. once(event: 'did-become-active', listener: (event: Event) => void): this;
  313. addListener(event: 'did-become-active', listener: (event: Event) => void): this;
  314. removeListener(event: 'did-become-active', listener: (event: Event) => void): this;
  315. /**
  316. * Emitted whenever there is a GPU info update.
  317. */
  318. on(event: 'gpu-info-update', listener: Function): this;
  319. once(event: 'gpu-info-update', listener: Function): this;
  320. addListener(event: 'gpu-info-update', listener: Function): this;
  321. removeListener(event: 'gpu-info-update', listener: Function): this;
  322. /**
  323. * Emitted when the GPU process crashes or is killed.
  324. *
  325. * **Deprecated:** This event is superceded by the `child-process-gone` event which
  326. * contains more information about why the child process disappeared. It isn't
  327. * always because it crashed. The `killed` boolean can be replaced by checking
  328. * `reason === 'killed'` when you switch to that event.
  329. *
  330. * @deprecated
  331. */
  332. on(event: 'gpu-process-crashed', listener: (event: Event,
  333. killed: boolean) => void): this;
  334. once(event: 'gpu-process-crashed', listener: (event: Event,
  335. killed: boolean) => void): this;
  336. addListener(event: 'gpu-process-crashed', listener: (event: Event,
  337. killed: boolean) => void): this;
  338. removeListener(event: 'gpu-process-crashed', listener: (event: Event,
  339. killed: boolean) => void): this;
  340. /**
  341. * Emitted when `webContents` wants to do basic auth.
  342. *
  343. * The default behavior is to cancel all authentications. To override this you
  344. * should prevent the default behavior with `event.preventDefault()` and call
  345. * `callback(username, password)` with the credentials.
  346. *
  347. * If `callback` is called without a username or password, the authentication
  348. * request will be cancelled and the authentication error will be returned to the
  349. * page.
  350. */
  351. on(event: 'login', listener: (event: Event,
  352. webContents: WebContents,
  353. authenticationResponseDetails: AuthenticationResponseDetails,
  354. authInfo: AuthInfo,
  355. callback: (username?: string, password?: string) => void) => void): this;
  356. once(event: 'login', listener: (event: Event,
  357. webContents: WebContents,
  358. authenticationResponseDetails: AuthenticationResponseDetails,
  359. authInfo: AuthInfo,
  360. callback: (username?: string, password?: string) => void) => void): this;
  361. addListener(event: 'login', listener: (event: Event,
  362. webContents: WebContents,
  363. authenticationResponseDetails: AuthenticationResponseDetails,
  364. authInfo: AuthInfo,
  365. callback: (username?: string, password?: string) => void) => void): this;
  366. removeListener(event: 'login', listener: (event: Event,
  367. webContents: WebContents,
  368. authenticationResponseDetails: AuthenticationResponseDetails,
  369. authInfo: AuthInfo,
  370. callback: (username?: string, password?: string) => void) => void): this;
  371. /**
  372. * Emitted when the user clicks the native macOS new tab button. The new tab button
  373. * is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
  374. *
  375. * @platform darwin
  376. */
  377. on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  378. once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  379. addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  380. removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
  381. /**
  382. * Emitted when the user wants to open a file with the application. The `open-file`
  383. * event is usually emitted when the application is already open and the OS wants
  384. * to reuse the application to open the file. `open-file` is also emitted when a
  385. * file is dropped onto the dock and the application is not yet running. Make sure
  386. * to listen for the `open-file` event very early in your application startup to
  387. * handle this case (even before the `ready` event is emitted).
  388. *
  389. * You should call `event.preventDefault()` if you want to handle this event.
  390. *
  391. * On Windows, you have to parse `process.argv` (in the main process) to get the
  392. * filepath.
  393. *
  394. * @platform darwin
  395. */
  396. on(event: 'open-file', listener: (event: Event,
  397. path: string) => void): this;
  398. once(event: 'open-file', listener: (event: Event,
  399. path: string) => void): this;
  400. addListener(event: 'open-file', listener: (event: Event,
  401. path: string) => void): this;
  402. removeListener(event: 'open-file', listener: (event: Event,
  403. path: string) => void): this;
  404. /**
  405. * Emitted when the user wants to open a URL with the application. Your
  406. * application's `Info.plist` file must define the URL scheme within the
  407. * `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
  408. *
  409. You should call `event.preventDefault()` if you want to handle this event.
  410. *
  411. * @platform darwin
  412. */
  413. on(event: 'open-url', listener: (event: Event,
  414. url: string) => void): this;
  415. once(event: 'open-url', listener: (event: Event,
  416. url: string) => void): this;
  417. addListener(event: 'open-url', listener: (event: Event,
  418. url: string) => void): this;
  419. removeListener(event: 'open-url', listener: (event: Event,
  420. url: string) => void): this;
  421. /**
  422. * Emitted when the application is quitting.
  423. *
  424. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  425. * a shutdown/restart of the system or a user logout.
  426. */
  427. on(event: 'quit', listener: (event: Event,
  428. exitCode: number) => void): this;
  429. once(event: 'quit', listener: (event: Event,
  430. exitCode: number) => void): this;
  431. addListener(event: 'quit', listener: (event: Event,
  432. exitCode: number) => void): this;
  433. removeListener(event: 'quit', listener: (event: Event,
  434. exitCode: number) => void): this;
  435. /**
  436. * Emitted once, when Electron has finished initializing. On macOS, `launchInfo`
  437. * holds the `userInfo` of the `NSUserNotification` or information from
  438. * `UNNotificationResponse` that was used to open the application, if it was
  439. * launched from Notification Center. You can also call `app.isReady()` to check if
  440. * this event has already fired and `app.whenReady()` to get a Promise that is
  441. * fulfilled when Electron is initialized.
  442. */
  443. on(event: 'ready', listener: (event: Event,
  444. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  445. once(event: 'ready', listener: (event: Event,
  446. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  447. addListener(event: 'ready', listener: (event: Event,
  448. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  449. removeListener(event: 'ready', listener: (event: Event,
  450. launchInfo: (Record<string, any>) | (NotificationResponse)) => void): this;
  451. /**
  452. * Emitted when `remote.getBuiltin()` is called in the renderer process of
  453. * `webContents`. Calling `event.preventDefault()` will prevent the module from
  454. * being returned. Custom value can be returned by setting `event.returnValue`.
  455. *
  456. * @deprecated
  457. */
  458. on(event: 'remote-get-builtin', listener: (event: Event,
  459. webContents: WebContents,
  460. moduleName: string) => void): this;
  461. once(event: 'remote-get-builtin', listener: (event: Event,
  462. webContents: WebContents,
  463. moduleName: string) => void): this;
  464. addListener(event: 'remote-get-builtin', listener: (event: Event,
  465. webContents: WebContents,
  466. moduleName: string) => void): this;
  467. removeListener(event: 'remote-get-builtin', listener: (event: Event,
  468. webContents: WebContents,
  469. moduleName: string) => void): this;
  470. /**
  471. * Emitted when `remote.getCurrentWebContents()` is called in the renderer process
  472. * of `webContents`. Calling `event.preventDefault()` will prevent the object from
  473. * being returned. Custom value can be returned by setting `event.returnValue`.
  474. *
  475. * @deprecated
  476. */
  477. on(event: 'remote-get-current-web-contents', listener: (event: Event,
  478. webContents: WebContents) => void): this;
  479. once(event: 'remote-get-current-web-contents', listener: (event: Event,
  480. webContents: WebContents) => void): this;
  481. addListener(event: 'remote-get-current-web-contents', listener: (event: Event,
  482. webContents: WebContents) => void): this;
  483. removeListener(event: 'remote-get-current-web-contents', listener: (event: Event,
  484. webContents: WebContents) => void): this;
  485. /**
  486. * Emitted when `remote.getCurrentWindow()` is called in the renderer process of
  487. * `webContents`. Calling `event.preventDefault()` will prevent the object from
  488. * being returned. Custom value can be returned by setting `event.returnValue`.
  489. *
  490. * @deprecated
  491. */
  492. on(event: 'remote-get-current-window', listener: (event: Event,
  493. webContents: WebContents) => void): this;
  494. once(event: 'remote-get-current-window', listener: (event: Event,
  495. webContents: WebContents) => void): this;
  496. addListener(event: 'remote-get-current-window', listener: (event: Event,
  497. webContents: WebContents) => void): this;
  498. removeListener(event: 'remote-get-current-window', listener: (event: Event,
  499. webContents: WebContents) => void): this;
  500. /**
  501. * Emitted when `remote.getGlobal()` is called in the renderer process of
  502. * `webContents`. Calling `event.preventDefault()` will prevent the global from
  503. * being returned. Custom value can be returned by setting `event.returnValue`.
  504. *
  505. * @deprecated
  506. */
  507. on(event: 'remote-get-global', listener: (event: Event,
  508. webContents: WebContents,
  509. globalName: string) => void): this;
  510. once(event: 'remote-get-global', listener: (event: Event,
  511. webContents: WebContents,
  512. globalName: string) => void): this;
  513. addListener(event: 'remote-get-global', listener: (event: Event,
  514. webContents: WebContents,
  515. globalName: string) => void): this;
  516. removeListener(event: 'remote-get-global', listener: (event: Event,
  517. webContents: WebContents,
  518. globalName: string) => void): this;
  519. /**
  520. * Emitted when `remote.require()` is called in the renderer process of
  521. * `webContents`. Calling `event.preventDefault()` will prevent the module from
  522. * being returned. Custom value can be returned by setting `event.returnValue`.
  523. *
  524. * @deprecated
  525. */
  526. on(event: 'remote-require', listener: (event: Event,
  527. webContents: WebContents,
  528. moduleName: string) => void): this;
  529. once(event: 'remote-require', listener: (event: Event,
  530. webContents: WebContents,
  531. moduleName: string) => void): this;
  532. addListener(event: 'remote-require', listener: (event: Event,
  533. webContents: WebContents,
  534. moduleName: string) => void): this;
  535. removeListener(event: 'remote-require', listener: (event: Event,
  536. webContents: WebContents,
  537. moduleName: string) => void): this;
  538. /**
  539. * Emitted when the renderer process unexpectedly disappears. This is normally
  540. * because it was crashed or killed.
  541. */
  542. on(event: 'render-process-gone', listener: (event: Event,
  543. webContents: WebContents,
  544. details: RenderProcessGoneDetails) => void): this;
  545. once(event: 'render-process-gone', listener: (event: Event,
  546. webContents: WebContents,
  547. details: RenderProcessGoneDetails) => void): this;
  548. addListener(event: 'render-process-gone', listener: (event: Event,
  549. webContents: WebContents,
  550. details: RenderProcessGoneDetails) => void): this;
  551. removeListener(event: 'render-process-gone', listener: (event: Event,
  552. webContents: WebContents,
  553. details: RenderProcessGoneDetails) => void): this;
  554. /**
  555. * Emitted when the renderer process of `webContents` crashes or is killed.
  556. *
  557. * **Deprecated:** This event is superceded by the `render-process-gone` event
  558. * which contains more information about why the render process disappeared. It
  559. * isn't always because it crashed. The `killed` boolean can be replaced by
  560. * checking `reason === 'killed'` when you switch to that event.
  561. *
  562. * @deprecated
  563. */
  564. on(event: 'renderer-process-crashed', listener: (event: Event,
  565. webContents: WebContents,
  566. killed: boolean) => void): this;
  567. once(event: 'renderer-process-crashed', listener: (event: Event,
  568. webContents: WebContents,
  569. killed: boolean) => void): this;
  570. addListener(event: 'renderer-process-crashed', listener: (event: Event,
  571. webContents: WebContents,
  572. killed: boolean) => void): this;
  573. removeListener(event: 'renderer-process-crashed', listener: (event: Event,
  574. webContents: WebContents,
  575. killed: boolean) => void): this;
  576. /**
  577. * This event will be emitted inside the primary instance of your application when
  578. * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
  579. *
  580. * `argv` is an Array of the second instance's command line arguments, and
  581. * `workingDirectory` is its current working directory. Usually applications
  582. * respond to this by making their primary window focused and non-minimized.
  583. *
  584. * **Note:** If the second instance is started by a different user than the first,
  585. * the `argv` array will not include the arguments.
  586. *
  587. * This event is guaranteed to be emitted after the `ready` event of `app` gets
  588. * emitted.
  589. *
  590. * **Note:** Extra command line arguments might be added by Chromium, such as
  591. * `--original-process-start-time`.
  592. */
  593. on(event: 'second-instance', listener: (event: Event,
  594. /**
  595. * An array of the second instance's command line arguments
  596. */
  597. argv: string[],
  598. /**
  599. * The second instance's working directory
  600. */
  601. workingDirectory: string) => void): this;
  602. once(event: 'second-instance', listener: (event: Event,
  603. /**
  604. * An array of the second instance's command line arguments
  605. */
  606. argv: string[],
  607. /**
  608. * The second instance's working directory
  609. */
  610. workingDirectory: string) => void): this;
  611. addListener(event: 'second-instance', listener: (event: Event,
  612. /**
  613. * An array of the second instance's command line arguments
  614. */
  615. argv: string[],
  616. /**
  617. * The second instance's working directory
  618. */
  619. workingDirectory: string) => void): this;
  620. removeListener(event: 'second-instance', listener: (event: Event,
  621. /**
  622. * An array of the second instance's command line arguments
  623. */
  624. argv: string[],
  625. /**
  626. * The second instance's working directory
  627. */
  628. workingDirectory: string) => void): this;
  629. /**
  630. * Emitted when a client certificate is requested.
  631. *
  632. * The `url` corresponds to the navigation entry requesting the client certificate
  633. * and `callback` can be called with an entry filtered from the list. Using
  634. * `event.preventDefault()` prevents the application from using the first
  635. * certificate from the store.
  636. */
  637. on(event: 'select-client-certificate', listener: (event: Event,
  638. webContents: WebContents,
  639. url: string,
  640. certificateList: Certificate[],
  641. callback: (certificate?: Certificate) => void) => void): this;
  642. once(event: 'select-client-certificate', listener: (event: Event,
  643. webContents: WebContents,
  644. url: string,
  645. certificateList: Certificate[],
  646. callback: (certificate?: Certificate) => void) => void): this;
  647. addListener(event: 'select-client-certificate', listener: (event: Event,
  648. webContents: WebContents,
  649. url: string,
  650. certificateList: Certificate[],
  651. callback: (certificate?: Certificate) => void) => void): this;
  652. removeListener(event: 'select-client-certificate', listener: (event: Event,
  653. webContents: WebContents,
  654. url: string,
  655. certificateList: Certificate[],
  656. callback: (certificate?: Certificate) => void) => void): this;
  657. /**
  658. * Emitted when Electron has created a new `session`.
  659. */
  660. on(event: 'session-created', listener: (session: Session) => void): this;
  661. once(event: 'session-created', listener: (session: Session) => void): this;
  662. addListener(event: 'session-created', listener: (session: Session) => void): this;
  663. removeListener(event: 'session-created', listener: (session: Session) => void): this;
  664. /**
  665. * Emitted when Handoff is about to be resumed on another device. If you need to
  666. * update the state to be transferred, you should call `event.preventDefault()`
  667. * immediately, construct a new `userInfo` dictionary and call
  668. * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
  669. * fail and `continue-activity-error` will be called.
  670. *
  671. * @platform darwin
  672. */
  673. on(event: 'update-activity-state', listener: (event: Event,
  674. /**
  675. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  676. */
  677. type: string,
  678. /**
  679. * Contains app-specific state stored by the activity.
  680. */
  681. userInfo: unknown) => void): this;
  682. once(event: 'update-activity-state', listener: (event: Event,
  683. /**
  684. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  685. */
  686. type: string,
  687. /**
  688. * Contains app-specific state stored by the activity.
  689. */
  690. userInfo: unknown) => void): this;
  691. addListener(event: 'update-activity-state', listener: (event: Event,
  692. /**
  693. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  694. */
  695. type: string,
  696. /**
  697. * Contains app-specific state stored by the activity.
  698. */
  699. userInfo: unknown) => void): this;
  700. removeListener(event: 'update-activity-state', listener: (event: Event,
  701. /**
  702. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  703. */
  704. type: string,
  705. /**
  706. * Contains app-specific state stored by the activity.
  707. */
  708. userInfo: unknown) => void): this;
  709. /**
  710. * Emitted when a new webContents is created.
  711. */
  712. on(event: 'web-contents-created', listener: (event: Event,
  713. webContents: WebContents) => void): this;
  714. once(event: 'web-contents-created', listener: (event: Event,
  715. webContents: WebContents) => void): this;
  716. addListener(event: 'web-contents-created', listener: (event: Event,
  717. webContents: WebContents) => void): this;
  718. removeListener(event: 'web-contents-created', listener: (event: Event,
  719. webContents: WebContents) => void): this;
  720. /**
  721. * Emitted during Handoff before an activity from a different device wants to be
  722. * resumed. You should call `event.preventDefault()` if you want to handle this
  723. * event.
  724. *
  725. * @platform darwin
  726. */
  727. on(event: 'will-continue-activity', listener: (event: Event,
  728. /**
  729. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  730. */
  731. type: string) => void): this;
  732. once(event: 'will-continue-activity', listener: (event: Event,
  733. /**
  734. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  735. */
  736. type: string) => void): this;
  737. addListener(event: 'will-continue-activity', listener: (event: Event,
  738. /**
  739. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  740. */
  741. type: string) => void): this;
  742. removeListener(event: 'will-continue-activity', listener: (event: Event,
  743. /**
  744. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  745. */
  746. type: string) => void): this;
  747. /**
  748. * Emitted when the application has finished basic startup. On Windows and Linux,
  749. * the `will-finish-launching` event is the same as the `ready` event; on macOS,
  750. * this event represents the `applicationWillFinishLaunching` notification of
  751. * `NSApplication`. You would usually set up listeners for the `open-file` and
  752. * `open-url` events here, and start the crash reporter and auto updater.
  753. *
  754. In most cases, you should do everything in the `ready` event handler.
  755. */
  756. on(event: 'will-finish-launching', listener: Function): this;
  757. once(event: 'will-finish-launching', listener: Function): this;
  758. addListener(event: 'will-finish-launching', listener: Function): this;
  759. removeListener(event: 'will-finish-launching', listener: Function): this;
  760. /**
  761. * Emitted when all windows have been closed and the application will quit. Calling
  762. * `event.preventDefault()` will prevent the default behavior, which is terminating
  763. * the application.
  764. *
  765. * See the description of the `window-all-closed` event for the differences between
  766. * the `will-quit` and `window-all-closed` events.
  767. *
  768. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  769. * a shutdown/restart of the system or a user logout.
  770. */
  771. on(event: 'will-quit', listener: (event: Event) => void): this;
  772. once(event: 'will-quit', listener: (event: Event) => void): this;
  773. addListener(event: 'will-quit', listener: (event: Event) => void): this;
  774. removeListener(event: 'will-quit', listener: (event: Event) => void): this;
  775. /**
  776. * Emitted when all windows have been closed.
  777. *
  778. * If you do not subscribe to this event and all windows are closed, the default
  779. * behavior is to quit the app; however, if you subscribe, you control whether the
  780. * app quits or not. If the user pressed `Cmd + Q`, or the developer called
  781. * `app.quit()`, Electron will first try to close all the windows and then emit the
  782. * `will-quit` event, and in this case the `window-all-closed` event would not be
  783. * emitted.
  784. */
  785. on(event: 'window-all-closed', listener: Function): this;
  786. once(event: 'window-all-closed', listener: Function): this;
  787. addListener(event: 'window-all-closed', listener: Function): this;
  788. removeListener(event: 'window-all-closed', listener: Function): this;
  789. /**
  790. * Adds `path` to the recent documents list.
  791. *
  792. * This list is managed by the OS. On Windows, you can visit the list from the task
  793. * bar, and on macOS, you can visit it from dock menu.
  794. *
  795. * @platform darwin,win32
  796. */
  797. addRecentDocument(path: string): void;
  798. /**
  799. * Clears the recent documents list.
  800. *
  801. * @platform darwin,win32
  802. */
  803. clearRecentDocuments(): void;
  804. /**
  805. * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
  806. * basis if the GPU processes crashes too frequently. This function disables that
  807. * behavior.
  808. This method can only be called before app is ready.
  809. */
  810. disableDomainBlockingFor3DAPIs(): void;
  811. /**
  812. * Disables hardware acceleration for current app.
  813. *
  814. This method can only be called before app is ready.
  815. */
  816. disableHardwareAcceleration(): void;
  817. /**
  818. * Enables full sandbox mode on the app. This means that all renderers will be
  819. * launched sandboxed, regardless of the value of the `sandbox` flag in
  820. * WebPreferences.
  821. This method can only be called before app is ready.
  822. */
  823. enableSandbox(): void;
  824. /**
  825. * Exits immediately with `exitCode`. `exitCode` defaults to 0.
  826. *
  827. * All windows will be closed immediately without asking the user, and the
  828. * `before-quit` and `will-quit` events will not be emitted.
  829. */
  830. exit(exitCode?: number): void;
  831. /**
  832. * On Linux, focuses on the first visible window. On macOS, makes the application
  833. * the active app. On Windows, focuses on the application's first window.
  834. *
  835. You should seek to use the `steal` option as sparingly as possible.
  836. */
  837. focus(options?: FocusOptions): void;
  838. /**
  839. * Resolve with an object containing the following:
  840. *
  841. * * `icon` NativeImage - the display icon of the app handling the protocol.
  842. * * `path` String - installation path of the app handling the protocol.
  843. * * `name` String - display name of the app handling the protocol.
  844. *
  845. * This method returns a promise that contains the application name, icon and path
  846. * of the default handler for the protocol (aka URI scheme) of a URL.
  847. *
  848. * @platform darwin,win32
  849. */
  850. getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
  851. /**
  852. * Name of the application handling the protocol, or an empty string if there is no
  853. * handler. For instance, if Electron is the default handler of the URL, this could
  854. * be `Electron` on Windows and Mac. However, don't rely on the precise format
  855. * which is not guaranteed to remain unchanged. Expect a different format on Linux,
  856. * possibly with a `.desktop` suffix.
  857. *
  858. * This method returns the application name of the default handler for the protocol
  859. * (aka URI scheme) of a URL.
  860. */
  861. getApplicationNameForProtocol(url: string): string;
  862. /**
  863. * Array of `ProcessMetric` objects that correspond to memory and CPU usage
  864. * statistics of all the processes associated with the app.
  865. */
  866. getAppMetrics(): ProcessMetric[];
  867. /**
  868. * The current application directory.
  869. */
  870. getAppPath(): string;
  871. /**
  872. * The current value displayed in the counter badge.
  873. *
  874. * @platform linux,darwin
  875. */
  876. getBadgeCount(): number;
  877. /**
  878. * The type of the currently running activity.
  879. *
  880. * @platform darwin
  881. */
  882. getCurrentActivityType(): string;
  883. /**
  884. * fulfilled with the app's icon, which is a NativeImage.
  885. *
  886. * Fetches a path's associated icon.
  887. *
  888. * On _Windows_, there a 2 kinds of icons:
  889. *
  890. * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
  891. * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
  892. *
  893. * On _Linux_ and _macOS_, icons depend on the application associated with file
  894. * mime type.
  895. */
  896. getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
  897. /**
  898. * The Graphics Feature Status from `chrome://gpu/`.
  899. *
  900. * **Note:** This information is only usable after the `gpu-info-update` event is
  901. * emitted.
  902. */
  903. getGPUFeatureStatus(): GPUFeatureStatus;
  904. /**
  905. * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
  906. * containing all the GPU Information as in chromium's GPUInfo object. This
  907. * includes the version and driver information that's shown on `chrome://gpu` page.
  908. *
  909. * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
  910. * fewer attributes than when requested with `complete`. Here's an example of basic
  911. * response:
  912. *
  913. * Using `basic` should be preferred if only basic information like `vendorId` or
  914. * `driverId` is needed.
  915. */
  916. getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
  917. /**
  918. * * `minItems` Integer - The minimum number of items that will be shown in the
  919. * Jump List (for a more detailed description of this value see the MSDN docs).
  920. * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
  921. * correspond to items that the user has explicitly removed from custom categories
  922. * in the Jump List. These items must not be re-added to the Jump List in the
  923. * **next** call to `app.setJumpList()`, Windows will not display any custom
  924. * category that contains any of the removed items.
  925. *
  926. * @platform win32
  927. */
  928. getJumpListSettings(): JumpListSettings;
  929. /**
  930. * The current application locale, fetched using Chromium's `l10n_util` library.
  931. * Possible return values are documented here.
  932. *
  933. * To set the locale, you'll want to use a command line switch at app startup,
  934. * which may be found here.
  935. *
  936. * **Note:** When distributing your packaged app, you have to also ship the
  937. * `locales` folder.
  938. *
  939. * **Note:** On Windows, you have to call it after the `ready` events gets emitted.
  940. */
  941. getLocale(): string;
  942. /**
  943. * User operating system's locale two-letter ISO 3166 country code. The value is
  944. * taken from native OS APIs.
  945. *
  946. **Note:** When unable to detect locale country code, it returns empty string.
  947. */
  948. getLocaleCountryCode(): string;
  949. /**
  950. * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
  951. * you need to pass the same arguments here for `openAtLogin` to be set correctly.
  952. *
  953. *
  954. * * `openAtLogin` Boolean - `true` if the app is set to open at login.
  955. * * `openAsHidden` Boolean _macOS_ - `true` if the app is set to open as hidden at
  956. * login. This setting is not available on MAS builds.
  957. * * `wasOpenedAtLogin` Boolean _macOS_ - `true` if the app was opened at login
  958. * automatically. This setting is not available on MAS builds.
  959. * * `wasOpenedAsHidden` Boolean _macOS_ - `true` if the app was opened as a hidden
  960. * login item. This indicates that the app should not open any windows at startup.
  961. * This setting is not available on MAS builds.
  962. * * `restoreState` Boolean _macOS_ - `true` if the app was opened as a login item
  963. * that should restore the state from the previous session. This indicates that the
  964. * app should restore the windows that were open the last time the app was closed.
  965. * This setting is not available on MAS builds.
  966. * * `executableWillLaunchAtLogin` Boolean _Windows_ - `true` if app is set to open
  967. * at login and its run key is not deactivated. This differs from `openAtLogin` as
  968. * it ignores the `args` option, this property will be true if the given executable
  969. * would be launched at login with **any** arguments.
  970. * * `launchItems` Object[] _Windows_
  971. * * `name` String _Windows_ - name value of a registry entry.
  972. * * `path` String _Windows_ - The executable to an app that corresponds to a
  973. * registry entry.
  974. * * `args` String[] _Windows_ - the command-line arguments to pass to the
  975. * executable.
  976. * * `scope` String _Windows_ - one of `user` or `machine`. Indicates whether the
  977. * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  978. * * `enabled` Boolean _Windows_ - `true` if the app registry key is startup
  979. * approved and therefore shows as `enabled` in Task Manager and Windows settings.
  980. *
  981. * @platform darwin,win32
  982. */
  983. getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
  984. /**
  985. * The current application's name, which is the name in the application's
  986. * `package.json` file.
  987. *
  988. * Usually the `name` field of `package.json` is a short lowercase name, according
  989. * to the npm modules spec. You should usually also specify a `productName` field,
  990. * which is your application's full capitalized name, and which will be preferred
  991. * over `name` by Electron.
  992. */
  993. getName(): string;
  994. /**
  995. * A path to a special directory or file associated with `name`. On failure, an
  996. * `Error` is thrown.
  997. *
  998. * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
  999. * called first, a default log directory will be created equivalent to calling
  1000. * `app.setAppLogsPath()` without a `path` parameter.
  1001. */
  1002. getPath(name: 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps'): string;
  1003. /**
  1004. * The version of the loaded application. If no version is found in the
  1005. * application's `package.json` file, the version of the current bundle or
  1006. * executable is returned.
  1007. */
  1008. getVersion(): string;
  1009. /**
  1010. * This method returns whether or not this instance of your app is currently
  1011. * holding the single instance lock. You can request the lock with
  1012. * `app.requestSingleInstanceLock()` and release with
  1013. * `app.releaseSingleInstanceLock()`
  1014. */
  1015. hasSingleInstanceLock(): boolean;
  1016. /**
  1017. * Hides all application windows without minimizing them.
  1018. *
  1019. * @platform darwin
  1020. */
  1021. hide(): void;
  1022. /**
  1023. * Imports the certificate in pkcs12 format into the platform certificate store.
  1024. * `callback` is called with the `result` of import operation, a value of `0`
  1025. * indicates success while any other value indicates failure according to Chromium
  1026. * net_error_list.
  1027. *
  1028. * @platform linux
  1029. */
  1030. importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
  1031. /**
  1032. * Invalidates the current Handoff user activity.
  1033. *
  1034. * @platform darwin
  1035. */
  1036. invalidateCurrentActivity(): void;
  1037. /**
  1038. * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
  1039. * will return `true` if the use of assistive technologies, such as screen readers,
  1040. * has been detected. See
  1041. * https://www.chromium.org/developers/design-documents/accessibility for more
  1042. * details.
  1043. *
  1044. * @platform darwin,win32
  1045. */
  1046. isAccessibilitySupportEnabled(): boolean;
  1047. /**
  1048. * Whether the current executable is the default handler for a protocol (aka URI
  1049. * scheme).
  1050. *
  1051. * **Note:** On macOS, you can use this method to check if the app has been
  1052. * registered as the default protocol handler for a protocol. You can also verify
  1053. * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
  1054. * macOS machine. Please refer to Apple's documentation for details.
  1055. *
  1056. * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
  1057. * internally.
  1058. */
  1059. isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1060. /**
  1061. * whether or not the current OS version allows for native emoji pickers.
  1062. */
  1063. isEmojiPanelSupported(): boolean;
  1064. /**
  1065. * Whether the application is currently running from the systems Application
  1066. * folder. Use in combination with `app.moveToApplicationsFolder()`
  1067. *
  1068. * @platform darwin
  1069. */
  1070. isInApplicationsFolder(): boolean;
  1071. /**
  1072. * `true` if Electron has finished initializing, `false` otherwise. See also
  1073. * `app.whenReady()`.
  1074. */
  1075. isReady(): boolean;
  1076. /**
  1077. * whether `Secure Keyboard Entry` is enabled.
  1078. *
  1079. By default this API will return `false`.
  1080. *
  1081. * @platform darwin
  1082. */
  1083. isSecureKeyboardEntryEnabled(): boolean;
  1084. /**
  1085. * Whether the current desktop environment is Unity launcher.
  1086. *
  1087. * @platform linux
  1088. */
  1089. isUnityRunning(): boolean;
  1090. /**
  1091. * Whether the move was successful. Please note that if the move is successful,
  1092. * your application will quit and relaunch.
  1093. *
  1094. * No confirmation dialog will be presented by default. If you wish to allow the
  1095. * user to confirm the operation, you may do so using the `dialog` API.
  1096. *
  1097. * **NOTE:** This method throws errors if anything other than the user causes the
  1098. * move to fail. For instance if the user cancels the authorization dialog, this
  1099. * method returns false. If we fail to perform the copy, then this method will
  1100. * throw an error. The message in the error should be informative and tell you
  1101. * exactly what went wrong.
  1102. *
  1103. * By default, if an app of the same name as the one being moved exists in the
  1104. * Applications directory and is _not_ running, the existing app will be trashed
  1105. * and the active app moved into its place. If it _is_ running, the pre-existing
  1106. * running app will assume focus and the previously active app will quit itself.
  1107. * This behavior can be changed by providing the optional conflict handler, where
  1108. * the boolean returned by the handler determines whether or not the move conflict
  1109. * is resolved with default behavior. i.e. returning `false` will ensure no
  1110. * further action is taken, returning `true` will result in the default behavior
  1111. * and the method continuing.
  1112. *
  1113. * For example:
  1114. *
  1115. * Would mean that if an app already exists in the user directory, if the user
  1116. * chooses to 'Continue Move' then the function would continue with its default
  1117. * behavior and the existing app will be trashed and the active app moved into its
  1118. * place.
  1119. *
  1120. * @platform darwin
  1121. */
  1122. moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
  1123. /**
  1124. * Try to close all windows. The `before-quit` event will be emitted first. If all
  1125. * windows are successfully closed, the `will-quit` event will be emitted and by
  1126. * default the application will terminate.
  1127. *
  1128. * This method guarantees that all `beforeunload` and `unload` event handlers are
  1129. * correctly executed. It is possible that a window cancels the quitting by
  1130. * returning `false` in the `beforeunload` event handler.
  1131. */
  1132. quit(): void;
  1133. /**
  1134. * Relaunches the app when current instance exits.
  1135. *
  1136. * By default, the new instance will use the same working directory and command
  1137. * line arguments with current instance. When `args` is specified, the `args` will
  1138. * be passed as command line arguments instead. When `execPath` is specified, the
  1139. * `execPath` will be executed for relaunch instead of current app.
  1140. *
  1141. * Note that this method does not quit the app when executed, you have to call
  1142. * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
  1143. *
  1144. * When `app.relaunch` is called for multiple times, multiple instances will be
  1145. * started after current instance exited.
  1146. *
  1147. * An example of restarting current instance immediately and adding a new command
  1148. * line argument to the new instance:
  1149. */
  1150. relaunch(options?: RelaunchOptions): void;
  1151. /**
  1152. * Releases all locks that were created by `requestSingleInstanceLock`. This will
  1153. * allow multiple instances of the application to once again run side by side.
  1154. */
  1155. releaseSingleInstanceLock(): void;
  1156. /**
  1157. * Whether the call succeeded.
  1158. *
  1159. * This method checks if the current executable as the default handler for a
  1160. * protocol (aka URI scheme). If so, it will remove the app as the default handler.
  1161. *
  1162. * @platform darwin,win32
  1163. */
  1164. removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1165. /**
  1166. * The return value of this method indicates whether or not this instance of your
  1167. * application successfully obtained the lock. If it failed to obtain the lock,
  1168. * you can assume that another instance of your application is already running with
  1169. * the lock and exit immediately.
  1170. *
  1171. * I.e. This method returns `true` if your process is the primary instance of your
  1172. * application and your app should continue loading. It returns `false` if your
  1173. * process should immediately quit as it has sent its parameters to another
  1174. * instance that has already acquired the lock.
  1175. *
  1176. * On macOS, the system enforces single instance automatically when users try to
  1177. * open a second instance of your app in Finder, and the `open-file` and `open-url`
  1178. * events will be emitted for that. However when users start your app in command
  1179. * line, the system's single instance mechanism will be bypassed, and you have to
  1180. * use this method to ensure single instance.
  1181. *
  1182. * An example of activating the window of primary instance when a second instance
  1183. * starts:
  1184. */
  1185. requestSingleInstanceLock(): boolean;
  1186. /**
  1187. * Marks the current Handoff user activity as inactive without invalidating it.
  1188. *
  1189. * @platform darwin
  1190. */
  1191. resignCurrentActivity(): void;
  1192. /**
  1193. * Set the about panel options. This will override the values defined in the app's
  1194. * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
  1195. * must be set in order to be shown; there are no defaults.
  1196. *
  1197. * If you do not set `credits` but still wish to surface them in your app, AppKit
  1198. * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
  1199. * that order, in the bundle returned by the NSBundle class method main. The first
  1200. * file found is used, and if none is found, the info area is left blank. See Apple
  1201. * documentation for more information.
  1202. */
  1203. setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
  1204. /**
  1205. * Manually enables Chrome's accessibility support, allowing to expose
  1206. * accessibility switch to users in application settings. See Chromium's
  1207. * accessibility docs for more details. Disabled by default.
  1208. *
  1209. * This API must be called after the `ready` event is emitted.
  1210. *
  1211. * **Note:** Rendering accessibility tree can significantly affect the performance
  1212. * of your app. It should not be enabled by default.
  1213. *
  1214. * @platform darwin,win32
  1215. */
  1216. setAccessibilitySupportEnabled(enabled: boolean): void;
  1217. /**
  1218. * Sets the activation policy for a given app.
  1219. *
  1220. * Activation policy types:
  1221. *
  1222. * * 'regular' - The application is an ordinary app that appears in the Dock and
  1223. * may have a user interface.
  1224. * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
  1225. * menu bar, but it may be activated programmatically or by clicking on one of its
  1226. * windows.
  1227. * * 'prohibited' - The application doesn’t appear in the Dock and may not create
  1228. * windows or be activated.
  1229. *
  1230. * @platform darwin
  1231. */
  1232. setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
  1233. /**
  1234. * Sets or creates a directory your app's logs which can then be manipulated with
  1235. * `app.getPath()` or `app.setPath(pathName, newPath)`.
  1236. *
  1237. * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
  1238. * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
  1239. * `userData` directory on _Linux_ and _Windows_.
  1240. */
  1241. setAppLogsPath(path?: string): void;
  1242. /**
  1243. * Changes the Application User Model ID to `id`.
  1244. *
  1245. * @platform win32
  1246. */
  1247. setAppUserModelId(id: string): void;
  1248. /**
  1249. * Whether the call succeeded.
  1250. *
  1251. * Sets the current executable as the default handler for a protocol (aka URI
  1252. * scheme). It allows you to integrate your app deeper into the operating system.
  1253. * Once registered, all links with `your-protocol://` will be opened with the
  1254. * current executable. The whole link, including protocol, will be passed to your
  1255. * application as a parameter.
  1256. *
  1257. * **Note:** On macOS, you can only register protocols that have been added to your
  1258. * app's `info.plist`, which cannot be modified at runtime. However, you can change
  1259. * the file during build time via Electron Forge, Electron Packager, or by editing
  1260. * `info.plist` with a text editor. Please refer to Apple's documentation for
  1261. * details.
  1262. *
  1263. * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
  1264. * will return `true` for all calls but the registry key it sets won't be
  1265. * accessible by other applications. In order to register your Windows Store
  1266. * application as a default protocol handler you must declare the protocol in your
  1267. * manifest.
  1268. *
  1269. * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
  1270. * internally.
  1271. */
  1272. setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1273. /**
  1274. * Whether the call succeeded.
  1275. *
  1276. * Sets the counter badge for current app. Setting the count to `0` will hide the
  1277. * badge.
  1278. *
  1279. * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
  1280. *
  1281. * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
  1282. * for more information please read Desktop Environment Integration.
  1283. *
  1284. * @platform linux,darwin
  1285. */
  1286. setBadgeCount(count?: number): boolean;
  1287. /**
  1288. * Sets or removes a custom Jump List for the application, and returns one of the
  1289. * following strings:
  1290. *
  1291. * * `ok` - Nothing went wrong.
  1292. * * `error` - One or more errors occurred, enable runtime logging to figure out
  1293. * the likely cause.
  1294. * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
  1295. * category in the Jump List. Separators are only allowed in the standard `Tasks`
  1296. * category.
  1297. * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
  1298. * Jump List for a file type the app isn't registered to handle.
  1299. * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
  1300. * Jump List due to user privacy or group policy settings.
  1301. *
  1302. * If `categories` is `null` the previously set custom Jump List (if any) will be
  1303. * replaced by the standard Jump List for the app (managed by Windows).
  1304. *
  1305. * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
  1306. * property set then its `type` is assumed to be `tasks`. If the `name` property is
  1307. * set but the `type` property is omitted then the `type` is assumed to be
  1308. * `custom`.
  1309. *
  1310. * **Note:** Users can remove items from custom categories, and Windows will not
  1311. * allow a removed item to be added back into a custom category until **after** the
  1312. * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
  1313. * removed item to a custom category earlier than that will result in the entire
  1314. * custom category being omitted from the Jump List. The list of removed items can
  1315. * be obtained using `app.getJumpListSettings()`.
  1316. *
  1317. * **Note:** The maximum length of a Jump List item's `description` property is 260
  1318. * characters. Beyond this limit, the item will not be added to the Jump List, nor
  1319. * will it be displayed.
  1320. *
  1321. Here's a very simple example of creating a custom Jump List:
  1322. *
  1323. * @platform win32
  1324. */
  1325. setJumpList(categories: (JumpListCategory[]) | (null)): void;
  1326. /**
  1327. * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
  1328. * want to set the launch path to Update.exe, and pass arguments that specify your
  1329. * application name. For example:
  1330. *
  1331. * @platform darwin,win32
  1332. */
  1333. setLoginItemSettings(settings: Settings): void;
  1334. /**
  1335. * Overrides the current application's name.
  1336. *
  1337. * **Note:** This function overrides the name used internally by Electron; it does
  1338. * not affect the name that the OS uses.
  1339. */
  1340. setName(name: string): void;
  1341. /**
  1342. * Overrides the `path` to a special directory or file associated with `name`. If
  1343. * the path specifies a directory that does not exist, an `Error` is thrown. In
  1344. * that case, the directory should be created with `fs.mkdirSync` or similar.
  1345. *
  1346. * You can only override paths of a `name` defined in `app.getPath`.
  1347. *
  1348. * By default, web pages' cookies and caches will be stored under the `userData`
  1349. * directory. If you want to change this location, you have to override the
  1350. * `userData` path before the `ready` event of the `app` module is emitted.
  1351. */
  1352. setPath(name: string, path: string): void;
  1353. /**
  1354. * Set the `Secure Keyboard Entry` is enabled in your application.
  1355. *
  1356. * By using this API, important information such as password and other sensitive
  1357. * information can be prevented from being intercepted by other processes.
  1358. *
  1359. * See Apple's documentation for more details.
  1360. *
  1361. * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
  1362. * when it is no longer needed.
  1363. *
  1364. * @platform darwin
  1365. */
  1366. setSecureKeyboardEntryEnabled(enabled: boolean): void;
  1367. /**
  1368. * Creates an `NSUserActivity` and sets it as the current activity. The activity is
  1369. * eligible for Handoff to another device afterward.
  1370. *
  1371. * @platform darwin
  1372. */
  1373. setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
  1374. /**
  1375. * Adds `tasks` to the Tasks category of the Jump List on Windows.
  1376. *
  1377. * `tasks` is an array of `Task` objects.
  1378. *
  1379. * Whether the call succeeded.
  1380. *
  1381. * **Note:** If you'd like to customize the Jump List even more use
  1382. * `app.setJumpList(categories)` instead.
  1383. *
  1384. * @platform win32
  1385. */
  1386. setUserTasks(tasks: Task[]): boolean;
  1387. /**
  1388. * Shows application windows after they were hidden. Does not automatically focus
  1389. * them.
  1390. *
  1391. * @platform darwin
  1392. */
  1393. show(): void;
  1394. /**
  1395. * Show the app's about panel options. These options can be overridden with
  1396. * `app.setAboutPanelOptions(options)`.
  1397. */
  1398. showAboutPanel(): void;
  1399. /**
  1400. * Show the platform's native emoji picker.
  1401. *
  1402. * @platform darwin,win32
  1403. */
  1404. showEmojiPanel(): void;
  1405. /**
  1406. * This function **must** be called once you have finished accessing the security
  1407. * scoped file. If you do not remember to stop accessing the bookmark, kernel
  1408. * resources will be leaked and your app will lose its ability to reach outside the
  1409. * sandbox completely, until your app is restarted.
  1410. *
  1411. * Start accessing a security scoped resource. With this method Electron
  1412. * applications that are packaged for the Mac App Store may reach outside their
  1413. * sandbox to access files chosen by the user. See Apple's documentation for a
  1414. * description of how this system works.
  1415. *
  1416. * @platform mas
  1417. */
  1418. startAccessingSecurityScopedResource(bookmarkData: string): Function;
  1419. /**
  1420. * Updates the current activity if its type matches `type`, merging the entries
  1421. * from `userInfo` into its current `userInfo` dictionary.
  1422. *
  1423. * @platform darwin
  1424. */
  1425. updateCurrentActivity(type: string, userInfo: any): void;
  1426. /**
  1427. * fulfilled when Electron is initialized. May be used as a convenient alternative
  1428. * to checking `app.isReady()` and subscribing to the `ready` event if the app is
  1429. * not ready yet.
  1430. */
  1431. whenReady(): Promise<void>;
  1432. /**
  1433. * A `Boolean` property that's `true` if Chrome's accessibility support is enabled,
  1434. * `false` otherwise. This property will be `true` if the use of assistive
  1435. * technologies, such as screen readers, has been detected. Setting this property
  1436. * to `true` manually enables Chrome's accessibility support, allowing developers
  1437. * to expose accessibility switch to users in application settings.
  1438. *
  1439. * See Chromium's accessibility docs for more details. Disabled by default.
  1440. *
  1441. * This API must be called after the `ready` event is emitted.
  1442. *
  1443. * **Note:** Rendering accessibility tree can significantly affect the performance
  1444. * of your app. It should not be enabled by default.
  1445. *
  1446. * @platform darwin,win32
  1447. */
  1448. accessibilitySupportEnabled: boolean;
  1449. /**
  1450. * A `Boolean` which when `true` disables the overrides that Electron has in place
  1451. * to ensure renderer processes are restarted on every navigation. The current
  1452. * default value for this property is `true`.
  1453. *
  1454. * The intention is for these overrides to become disabled by default and then at
  1455. * some point in the future this property will be removed. This property impacts
  1456. * which native modules you can use in the renderer process. For more information
  1457. * on the direction Electron is going with renderer process restarts and usage of
  1458. * native modules in the renderer process please check out this Tracking Issue.
  1459. */
  1460. allowRendererProcessReuse: boolean;
  1461. /**
  1462. * A `Menu | null` property that returns `Menu` if one has been set and `null`
  1463. * otherwise. Users can pass a Menu to set this property.
  1464. */
  1465. applicationMenu: (Menu) | (null);
  1466. /**
  1467. * An `Integer` property that returns the badge count for current app. Setting the
  1468. * count to `0` will hide the badge.
  1469. *
  1470. * On macOS, setting this with any nonzero integer shows on the dock icon. On
  1471. * Linux, this property only works for Unity launcher.
  1472. *
  1473. * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
  1474. * for more information please read Desktop Environment Integration.
  1475. *
  1476. * **Note:** On macOS, you need to ensure that your application has the permission
  1477. * to display notifications for this property to take effect.
  1478. *
  1479. * @platform linux,darwin
  1480. */
  1481. badgeCount: number;
  1482. /**
  1483. * A `CommandLine` object that allows you to read and manipulate the command line
  1484. * arguments that Chromium uses.
  1485. *
  1486. */
  1487. readonly commandLine: CommandLine;
  1488. /**
  1489. * A `Dock` `| undefined` object that allows you to perform actions on your app
  1490. * icon in the user's dock on macOS.
  1491. *
  1492. * @platform darwin
  1493. */
  1494. readonly dock: Dock;
  1495. /**
  1496. * A `Boolean` property that returns `true` if the app is packaged, `false`
  1497. * otherwise. For many apps, this property can be used to distinguish development
  1498. * and production environments.
  1499. *
  1500. */
  1501. readonly isPackaged: boolean;
  1502. /**
  1503. * A `String` property that indicates the current application's name, which is the
  1504. * name in the application's `package.json` file.
  1505. *
  1506. * Usually the `name` field of `package.json` is a short lowercase name, according
  1507. * to the npm modules spec. You should usually also specify a `productName` field,
  1508. * which is your application's full capitalized name, and which will be preferred
  1509. * over `name` by Electron.
  1510. */
  1511. name: string;
  1512. /**
  1513. * A `Boolean` which when `true` indicates that the app is currently running under
  1514. * the Rosetta Translator Environment.
  1515. *
  1516. * You can use this property to prompt users to download the arm64 version of your
  1517. * application when they are running the x64 version under Rosetta incorrectly.
  1518. *
  1519. * @platform darwin
  1520. */
  1521. readonly runningUnderRosettaTranslation: boolean;
  1522. /**
  1523. * A `String` which is the user agent string Electron will use as a global
  1524. * fallback.
  1525. *
  1526. * This is the user agent that will be used when no user agent is set at the
  1527. * `webContents` or `session` level. It is useful for ensuring that your entire
  1528. * app has the same user agent. Set to a custom value as early as possible in your
  1529. * app's initialization to ensure that your overridden value is used.
  1530. */
  1531. userAgentFallback: string;
  1532. }
  1533. interface AutoUpdater extends NodeJS.EventEmitter {
  1534. // Docs: https://electronjs.org/docs/api/auto-updater
  1535. /**
  1536. * This event is emitted after a user calls `quitAndInstall()`.
  1537. *
  1538. * When this API is called, the `before-quit` event is not emitted before all
  1539. * windows are closed. As a result you should listen to this event if you wish to
  1540. * perform actions before the windows are closed while a process is quitting, as
  1541. * well as listening to `before-quit`.
  1542. */
  1543. on(event: 'before-quit-for-update', listener: Function): this;
  1544. once(event: 'before-quit-for-update', listener: Function): this;
  1545. addListener(event: 'before-quit-for-update', listener: Function): this;
  1546. removeListener(event: 'before-quit-for-update', listener: Function): this;
  1547. /**
  1548. * Emitted when checking if an update has started.
  1549. */
  1550. on(event: 'checking-for-update', listener: Function): this;
  1551. once(event: 'checking-for-update', listener: Function): this;
  1552. addListener(event: 'checking-for-update', listener: Function): this;
  1553. removeListener(event: 'checking-for-update', listener: Function): this;
  1554. /**
  1555. * Emitted when there is an error while updating.
  1556. */
  1557. on(event: 'error', listener: (error: Error) => void): this;
  1558. once(event: 'error', listener: (error: Error) => void): this;
  1559. addListener(event: 'error', listener: (error: Error) => void): this;
  1560. removeListener(event: 'error', listener: (error: Error) => void): this;
  1561. /**
  1562. * Emitted when there is an available update. The update is downloaded
  1563. * automatically.
  1564. */
  1565. on(event: 'update-available', listener: Function): this;
  1566. once(event: 'update-available', listener: Function): this;
  1567. addListener(event: 'update-available', listener: Function): this;
  1568. removeListener(event: 'update-available', listener: Function): this;
  1569. /**
  1570. * Emitted when an update has been downloaded.
  1571. *
  1572. * On Windows only `releaseName` is available.
  1573. *
  1574. * **Note:** It is not strictly necessary to handle this event. A successfully
  1575. * downloaded update will still be applied the next time the application starts.
  1576. */
  1577. on(event: 'update-downloaded', listener: (event: Event,
  1578. releaseNotes: string,
  1579. releaseName: string,
  1580. releaseDate: Date,
  1581. updateURL: string) => void): this;
  1582. once(event: 'update-downloaded', listener: (event: Event,
  1583. releaseNotes: string,
  1584. releaseName: string,
  1585. releaseDate: Date,
  1586. updateURL: string) => void): this;
  1587. addListener(event: 'update-downloaded', listener: (event: Event,
  1588. releaseNotes: string,
  1589. releaseName: string,
  1590. releaseDate: Date,
  1591. updateURL: string) => void): this;
  1592. removeListener(event: 'update-downloaded', listener: (event: Event,
  1593. releaseNotes: string,
  1594. releaseName: string,
  1595. releaseDate: Date,
  1596. updateURL: string) => void): this;
  1597. /**
  1598. * Emitted when there is no available update.
  1599. */
  1600. on(event: 'update-not-available', listener: Function): this;
  1601. once(event: 'update-not-available', listener: Function): this;
  1602. addListener(event: 'update-not-available', listener: Function): this;
  1603. removeListener(event: 'update-not-available', listener: Function): this;
  1604. /**
  1605. * Asks the server whether there is an update. You must call `setFeedURL` before
  1606. * using this API.
  1607. */
  1608. checkForUpdates(): void;
  1609. /**
  1610. * The current update feed URL.
  1611. */
  1612. getFeedURL(): string;
  1613. /**
  1614. * Restarts the app and installs the update after it has been downloaded. It should
  1615. * only be called after `update-downloaded` has been emitted.
  1616. *
  1617. * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
  1618. * windows first, and automatically call `app.quit()` after all windows have been
  1619. * closed.
  1620. *
  1621. * **Note:** It is not strictly necessary to call this function to apply an update,
  1622. * as a successfully downloaded update will always be applied the next time the
  1623. * application starts.
  1624. */
  1625. quitAndInstall(): void;
  1626. /**
  1627. * Sets the `url` and initialize the auto updater.
  1628. */
  1629. setFeedURL(options: FeedURLOptions): void;
  1630. }
  1631. interface BluetoothDevice {
  1632. // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
  1633. deviceId: string;
  1634. deviceName: string;
  1635. }
  1636. class BrowserView {
  1637. // Docs: https://electronjs.org/docs/api/browser-view
  1638. /**
  1639. * BrowserView
  1640. */
  1641. constructor(options?: BrowserViewConstructorOptions);
  1642. /**
  1643. * The `bounds` of this BrowserView instance as `Object`.
  1644. *
  1645. * @experimental
  1646. */
  1647. getBounds(): Rectangle;
  1648. setAutoResize(options: AutoResizeOptions): void;
  1649. setBackgroundColor(color: string): void;
  1650. /**
  1651. * Resizes and moves the view to the supplied bounds relative to the window.
  1652. *
  1653. * @experimental
  1654. */
  1655. setBounds(bounds: Rectangle): void;
  1656. webContents: WebContents;
  1657. }
  1658. class BrowserWindow extends NodeEventEmitter {
  1659. // Docs: https://electronjs.org/docs/api/browser-window
  1660. /**
  1661. * Emitted when the window is set or unset to show always on top of other windows.
  1662. */
  1663. on(event: 'always-on-top-changed', listener: (event: Event,
  1664. isAlwaysOnTop: boolean) => void): this;
  1665. once(event: 'always-on-top-changed', listener: (event: Event,
  1666. isAlwaysOnTop: boolean) => void): this;
  1667. addListener(event: 'always-on-top-changed', listener: (event: Event,
  1668. isAlwaysOnTop: boolean) => void): this;
  1669. removeListener(event: 'always-on-top-changed', listener: (event: Event,
  1670. isAlwaysOnTop: boolean) => void): this;
  1671. /**
  1672. * Emitted when an App Command is invoked. These are typically related to keyboard
  1673. * media keys or browser commands, as well as the "Back" button built into some
  1674. * mice on Windows.
  1675. *
  1676. * Commands are lowercased, underscores are replaced with hyphens, and the
  1677. * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
  1678. * emitted as `browser-backward`.
  1679. *
  1680. * The following app commands are explicitly supported on Linux:
  1681. *
  1682. * `browser-backward`
  1683. * `browser-forward`
  1684. *
  1685. * @platform win32,linux
  1686. */
  1687. on(event: 'app-command', listener: (event: Event,
  1688. command: string) => void): this;
  1689. once(event: 'app-command', listener: (event: Event,
  1690. command: string) => void): this;
  1691. addListener(event: 'app-command', listener: (event: Event,
  1692. command: string) => void): this;
  1693. removeListener(event: 'app-command', listener: (event: Event,
  1694. command: string) => void): this;
  1695. /**
  1696. * Emitted when the window loses focus.
  1697. */
  1698. on(event: 'blur', listener: Function): this;
  1699. once(event: 'blur', listener: Function): this;
  1700. addListener(event: 'blur', listener: Function): this;
  1701. removeListener(event: 'blur', listener: Function): this;
  1702. /**
  1703. * Emitted when the window is going to be closed. It's emitted before the
  1704. * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
  1705. * will cancel the close.
  1706. *
  1707. * Usually you would want to use the `beforeunload` handler to decide whether the
  1708. * window should be closed, which will also be called when the window is reloaded.
  1709. * In Electron, returning any value other than `undefined` would cancel the close.
  1710. * For example:
  1711. *
  1712. * _**Note**: There is a subtle difference between the behaviors of
  1713. * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
  1714. * handler)`. It is recommended to always set the `event.returnValue` explicitly,
  1715. * instead of only returning a value, as the former works more consistently within
  1716. * Electron._
  1717. */
  1718. on(event: 'close', listener: (event: Event) => void): this;
  1719. once(event: 'close', listener: (event: Event) => void): this;
  1720. addListener(event: 'close', listener: (event: Event) => void): this;
  1721. removeListener(event: 'close', listener: (event: Event) => void): this;
  1722. /**
  1723. * Emitted when the window is closed. After you have received this event you should
  1724. * remove the reference to the window and avoid using it any more.
  1725. */
  1726. on(event: 'closed', listener: Function): this;
  1727. once(event: 'closed', listener: Function): this;
  1728. addListener(event: 'closed', listener: Function): this;
  1729. removeListener(event: 'closed', listener: Function): this;
  1730. /**
  1731. * Emitted when the window enters a full-screen state.
  1732. */
  1733. on(event: 'enter-full-screen', listener: Function): this;
  1734. once(event: 'enter-full-screen', listener: Function): this;
  1735. addListener(event: 'enter-full-screen', listener: Function): this;
  1736. removeListener(event: 'enter-full-screen', listener: Function): this;
  1737. /**
  1738. * Emitted when the window enters a full-screen state triggered by HTML API.
  1739. */
  1740. on(event: 'enter-html-full-screen', listener: Function): this;
  1741. once(event: 'enter-html-full-screen', listener: Function): this;
  1742. addListener(event: 'enter-html-full-screen', listener: Function): this;
  1743. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  1744. /**
  1745. * Emitted when the window gains focus.
  1746. */
  1747. on(event: 'focus', listener: Function): this;
  1748. once(event: 'focus', listener: Function): this;
  1749. addListener(event: 'focus', listener: Function): this;
  1750. removeListener(event: 'focus', listener: Function): this;
  1751. /**
  1752. * Emitted when the window is hidden.
  1753. */
  1754. on(event: 'hide', listener: Function): this;
  1755. once(event: 'hide', listener: Function): this;
  1756. addListener(event: 'hide', listener: Function): this;
  1757. removeListener(event: 'hide', listener: Function): this;
  1758. /**
  1759. * Emitted when the window leaves a full-screen state.
  1760. */
  1761. on(event: 'leave-full-screen', listener: Function): this;
  1762. once(event: 'leave-full-screen', listener: Function): this;
  1763. addListener(event: 'leave-full-screen', listener: Function): this;
  1764. removeListener(event: 'leave-full-screen', listener: Function): this;
  1765. /**
  1766. * Emitted when the window leaves a full-screen state triggered by HTML API.
  1767. */
  1768. on(event: 'leave-html-full-screen', listener: Function): this;
  1769. once(event: 'leave-html-full-screen', listener: Function): this;
  1770. addListener(event: 'leave-html-full-screen', listener: Function): this;
  1771. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  1772. /**
  1773. * Emitted when window is maximized.
  1774. */
  1775. on(event: 'maximize', listener: Function): this;
  1776. once(event: 'maximize', listener: Function): this;
  1777. addListener(event: 'maximize', listener: Function): this;
  1778. removeListener(event: 'maximize', listener: Function): this;
  1779. /**
  1780. * Emitted when the window is minimized.
  1781. */
  1782. on(event: 'minimize', listener: Function): this;
  1783. once(event: 'minimize', listener: Function): this;
  1784. addListener(event: 'minimize', listener: Function): this;
  1785. removeListener(event: 'minimize', listener: Function): this;
  1786. /**
  1787. * Emitted when the window is being moved to a new position.
  1788. */
  1789. on(event: 'move', listener: Function): this;
  1790. once(event: 'move', listener: Function): this;
  1791. addListener(event: 'move', listener: Function): this;
  1792. removeListener(event: 'move', listener: Function): this;
  1793. /**
  1794. * Emitted once when the window is moved to a new position.
  1795. *
  1796. __Note__: On macOS this event is an alias of `move`.
  1797. *
  1798. * @platform darwin,win32
  1799. */
  1800. on(event: 'moved', listener: Function): this;
  1801. once(event: 'moved', listener: Function): this;
  1802. addListener(event: 'moved', listener: Function): this;
  1803. removeListener(event: 'moved', listener: Function): this;
  1804. /**
  1805. * Emitted when the native new tab button is clicked.
  1806. *
  1807. * @platform darwin
  1808. */
  1809. on(event: 'new-window-for-tab', listener: Function): this;
  1810. once(event: 'new-window-for-tab', listener: Function): this;
  1811. addListener(event: 'new-window-for-tab', listener: Function): this;
  1812. removeListener(event: 'new-window-for-tab', listener: Function): this;
  1813. /**
  1814. * Emitted when the document changed its title, calling `event.preventDefault()`
  1815. * will prevent the native window's title from changing. `explicitSet` is false
  1816. * when title is synthesized from file URL.
  1817. */
  1818. on(event: 'page-title-updated', listener: (event: Event,
  1819. title: string,
  1820. explicitSet: boolean) => void): this;
  1821. once(event: 'page-title-updated', listener: (event: Event,
  1822. title: string,
  1823. explicitSet: boolean) => void): this;
  1824. addListener(event: 'page-title-updated', listener: (event: Event,
  1825. title: string,
  1826. explicitSet: boolean) => void): this;
  1827. removeListener(event: 'page-title-updated', listener: (event: Event,
  1828. title: string,
  1829. explicitSet: boolean) => void): this;
  1830. /**
  1831. * Emitted when the web page has been rendered (while not being shown) and window
  1832. * can be displayed without a visual flash.
  1833. *
  1834. * Please note that using this event implies that the renderer will be considered
  1835. * "visible" and paint even though `show` is false. This event will never fire if
  1836. * you use `paintWhenInitiallyHidden: false`
  1837. */
  1838. on(event: 'ready-to-show', listener: Function): this;
  1839. once(event: 'ready-to-show', listener: Function): this;
  1840. addListener(event: 'ready-to-show', listener: Function): this;
  1841. removeListener(event: 'ready-to-show', listener: Function): this;
  1842. /**
  1843. * Emitted after the window has been resized.
  1844. */
  1845. on(event: 'resize', listener: Function): this;
  1846. once(event: 'resize', listener: Function): this;
  1847. addListener(event: 'resize', listener: Function): this;
  1848. removeListener(event: 'resize', listener: Function): this;
  1849. /**
  1850. * Emitted once when the window has finished being resized.
  1851. *
  1852. * This is usually emitted when the window has been resized manually. On macOS,
  1853. * resizing the window with `setBounds`/`setSize` and setting the `animate`
  1854. * parameter to `true` will also emit this event once resizing has finished.
  1855. *
  1856. * @platform darwin,win32
  1857. */
  1858. on(event: 'resized', listener: Function): this;
  1859. once(event: 'resized', listener: Function): this;
  1860. addListener(event: 'resized', listener: Function): this;
  1861. removeListener(event: 'resized', listener: Function): this;
  1862. /**
  1863. * Emitted when the unresponsive web page becomes responsive again.
  1864. */
  1865. on(event: 'responsive', listener: Function): this;
  1866. once(event: 'responsive', listener: Function): this;
  1867. addListener(event: 'responsive', listener: Function): this;
  1868. removeListener(event: 'responsive', listener: Function): this;
  1869. /**
  1870. * Emitted when the window is restored from a minimized state.
  1871. */
  1872. on(event: 'restore', listener: Function): this;
  1873. once(event: 'restore', listener: Function): this;
  1874. addListener(event: 'restore', listener: Function): this;
  1875. removeListener(event: 'restore', listener: Function): this;
  1876. /**
  1877. * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
  1878. * is ended. The `rotation` value on each emission is the angle in degrees rotated
  1879. * since the last emission. The last emitted event upon a rotation gesture will
  1880. * always be of value `0`. Counter-clockwise rotation values are positive, while
  1881. * clockwise ones are negative.
  1882. *
  1883. * @platform darwin
  1884. */
  1885. on(event: 'rotate-gesture', listener: (event: Event,
  1886. rotation: number) => void): this;
  1887. once(event: 'rotate-gesture', listener: (event: Event,
  1888. rotation: number) => void): this;
  1889. addListener(event: 'rotate-gesture', listener: (event: Event,
  1890. rotation: number) => void): this;
  1891. removeListener(event: 'rotate-gesture', listener: (event: Event,
  1892. rotation: number) => void): this;
  1893. /**
  1894. * Emitted when scroll wheel event phase has begun.
  1895. *
  1896. * @platform darwin
  1897. */
  1898. on(event: 'scroll-touch-begin', listener: Function): this;
  1899. once(event: 'scroll-touch-begin', listener: Function): this;
  1900. addListener(event: 'scroll-touch-begin', listener: Function): this;
  1901. removeListener(event: 'scroll-touch-begin', listener: Function): this;
  1902. /**
  1903. * Emitted when scroll wheel event phase filed upon reaching the edge of element.
  1904. *
  1905. * @platform darwin
  1906. */
  1907. on(event: 'scroll-touch-edge', listener: Function): this;
  1908. once(event: 'scroll-touch-edge', listener: Function): this;
  1909. addListener(event: 'scroll-touch-edge', listener: Function): this;
  1910. removeListener(event: 'scroll-touch-edge', listener: Function): this;
  1911. /**
  1912. * Emitted when scroll wheel event phase has ended.
  1913. *
  1914. * @platform darwin
  1915. */
  1916. on(event: 'scroll-touch-end', listener: Function): this;
  1917. once(event: 'scroll-touch-end', listener: Function): this;
  1918. addListener(event: 'scroll-touch-end', listener: Function): this;
  1919. removeListener(event: 'scroll-touch-end', listener: Function): this;
  1920. /**
  1921. * Emitted when window session is going to end due to force shutdown or machine
  1922. * restart or session log off.
  1923. *
  1924. * @platform win32
  1925. */
  1926. on(event: 'session-end', listener: Function): this;
  1927. once(event: 'session-end', listener: Function): this;
  1928. addListener(event: 'session-end', listener: Function): this;
  1929. removeListener(event: 'session-end', listener: Function): this;
  1930. /**
  1931. * Emitted when the window opens a sheet.
  1932. *
  1933. * @platform darwin
  1934. */
  1935. on(event: 'sheet-begin', listener: Function): this;
  1936. once(event: 'sheet-begin', listener: Function): this;
  1937. addListener(event: 'sheet-begin', listener: Function): this;
  1938. removeListener(event: 'sheet-begin', listener: Function): this;
  1939. /**
  1940. * Emitted when the window has closed a sheet.
  1941. *
  1942. * @platform darwin
  1943. */
  1944. on(event: 'sheet-end', listener: Function): this;
  1945. once(event: 'sheet-end', listener: Function): this;
  1946. addListener(event: 'sheet-end', listener: Function): this;
  1947. removeListener(event: 'sheet-end', listener: Function): this;
  1948. /**
  1949. * Emitted when the window is shown.
  1950. */
  1951. on(event: 'show', listener: Function): this;
  1952. once(event: 'show', listener: Function): this;
  1953. addListener(event: 'show', listener: Function): this;
  1954. removeListener(event: 'show', listener: Function): this;
  1955. /**
  1956. * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
  1957. * `left`.
  1958. *
  1959. * The method underlying this event is built to handle older macOS-style trackpad
  1960. * swiping, where the content on the screen doesn't move with the swipe. Most macOS
  1961. * trackpads are not configured to allow this kind of swiping anymore, so in order
  1962. * for it to emit properly the 'Swipe between pages' preference in `System
  1963. * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
  1964. * fingers'.
  1965. *
  1966. * @platform darwin
  1967. */
  1968. on(event: 'swipe', listener: (event: Event,
  1969. direction: string) => void): this;
  1970. once(event: 'swipe', listener: (event: Event,
  1971. direction: string) => void): this;
  1972. addListener(event: 'swipe', listener: (event: Event,
  1973. direction: string) => void): this;
  1974. removeListener(event: 'swipe', listener: (event: Event,
  1975. direction: string) => void): this;
  1976. /**
  1977. * Emitted when the system context menu is triggered on the window, this is
  1978. * normally only triggered when the user right clicks on the non-client area of
  1979. * your window. This is the window titlebar or any area you have declared as
  1980. * `-webkit-app-region: drag` in a frameless window.
  1981. *
  1982. Calling `event.preventDefault()` will prevent the menu from being displayed.
  1983. *
  1984. * @platform win32
  1985. */
  1986. on(event: 'system-context-menu', listener: (event: Event,
  1987. /**
  1988. * The screen coordinates the context menu was triggered at
  1989. */
  1990. point: Point) => void): this;
  1991. once(event: 'system-context-menu', listener: (event: Event,
  1992. /**
  1993. * The screen coordinates the context menu was triggered at
  1994. */
  1995. point: Point) => void): this;
  1996. addListener(event: 'system-context-menu', listener: (event: Event,
  1997. /**
  1998. * The screen coordinates the context menu was triggered at
  1999. */
  2000. point: Point) => void): this;
  2001. removeListener(event: 'system-context-menu', listener: (event: Event,
  2002. /**
  2003. * The screen coordinates the context menu was triggered at
  2004. */
  2005. point: Point) => void): this;
  2006. /**
  2007. * Emitted when the window exits from a maximized state.
  2008. */
  2009. on(event: 'unmaximize', listener: Function): this;
  2010. once(event: 'unmaximize', listener: Function): this;
  2011. addListener(event: 'unmaximize', listener: Function): this;
  2012. removeListener(event: 'unmaximize', listener: Function): this;
  2013. /**
  2014. * Emitted when the web page becomes unresponsive.
  2015. */
  2016. on(event: 'unresponsive', listener: Function): this;
  2017. once(event: 'unresponsive', listener: Function): this;
  2018. addListener(event: 'unresponsive', listener: Function): this;
  2019. removeListener(event: 'unresponsive', listener: Function): this;
  2020. /**
  2021. * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
  2022. * will prevent the window from being moved.
  2023. *
  2024. * Note that this is only emitted when the window is being resized manually.
  2025. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2026. *
  2027. * @platform darwin,win32
  2028. */
  2029. on(event: 'will-move', listener: (event: Event,
  2030. /**
  2031. * Location the window is being moved to.
  2032. */
  2033. newBounds: Rectangle) => void): this;
  2034. once(event: 'will-move', listener: (event: Event,
  2035. /**
  2036. * Location the window is being moved to.
  2037. */
  2038. newBounds: Rectangle) => void): this;
  2039. addListener(event: 'will-move', listener: (event: Event,
  2040. /**
  2041. * Location the window is being moved to.
  2042. */
  2043. newBounds: Rectangle) => void): this;
  2044. removeListener(event: 'will-move', listener: (event: Event,
  2045. /**
  2046. * Location the window is being moved to.
  2047. */
  2048. newBounds: Rectangle) => void): this;
  2049. /**
  2050. * Emitted before the window is resized. Calling `event.preventDefault()` will
  2051. * prevent the window from being resized.
  2052. *
  2053. * Note that this is only emitted when the window is being resized manually.
  2054. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2055. *
  2056. * @platform darwin,win32
  2057. */
  2058. on(event: 'will-resize', listener: (event: Event,
  2059. /**
  2060. * Size the window is being resized to.
  2061. */
  2062. newBounds: Rectangle) => void): this;
  2063. once(event: 'will-resize', listener: (event: Event,
  2064. /**
  2065. * Size the window is being resized to.
  2066. */
  2067. newBounds: Rectangle) => void): this;
  2068. addListener(event: 'will-resize', listener: (event: Event,
  2069. /**
  2070. * Size the window is being resized to.
  2071. */
  2072. newBounds: Rectangle) => void): this;
  2073. removeListener(event: 'will-resize', listener: (event: Event,
  2074. /**
  2075. * Size the window is being resized to.
  2076. */
  2077. newBounds: Rectangle) => void): this;
  2078. /**
  2079. * BrowserWindow
  2080. */
  2081. constructor(options?: BrowserWindowConstructorOptions);
  2082. /**
  2083. * The window that owns the given `browserView`. If the given view is not attached
  2084. * to any window, returns `null`.
  2085. */
  2086. static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
  2087. /**
  2088. * The window with the given `id`.
  2089. */
  2090. static fromId(id: number): (BrowserWindow) | (null);
  2091. /**
  2092. * The window that owns the given `webContents` or `null` if the contents are not
  2093. * owned by a window.
  2094. */
  2095. static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
  2096. /**
  2097. * An array of all opened browser windows.
  2098. */
  2099. static getAllWindows(): BrowserWindow[];
  2100. /**
  2101. * The window that is focused in this application, otherwise returns `null`.
  2102. */
  2103. static getFocusedWindow(): (BrowserWindow) | (null);
  2104. /**
  2105. * Replacement API for setBrowserView supporting work with multi browser views.
  2106. *
  2107. * @experimental
  2108. */
  2109. addBrowserView(browserView: BrowserView): void;
  2110. /**
  2111. * Adds a window as a tab on this window, after the tab for the window instance.
  2112. *
  2113. * @platform darwin
  2114. */
  2115. addTabbedWindow(browserWindow: BrowserWindow): void;
  2116. /**
  2117. * Removes focus from the window.
  2118. */
  2119. blur(): void;
  2120. blurWebView(): void;
  2121. /**
  2122. * Resolves with a NativeImage
  2123. *
  2124. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  2125. * whole visible page. If the page is not visible, `rect` may be empty.
  2126. */
  2127. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  2128. /**
  2129. * Moves window to the center of the screen.
  2130. */
  2131. center(): void;
  2132. /**
  2133. * Try to close the window. This has the same effect as a user manually clicking
  2134. * the close button of the window. The web page may cancel the close though. See
  2135. * the close event.
  2136. */
  2137. close(): void;
  2138. /**
  2139. * Closes the currently open Quick Look panel.
  2140. *
  2141. * @platform darwin
  2142. */
  2143. closeFilePreview(): void;
  2144. /**
  2145. * Force closing the window, the `unload` and `beforeunload` event won't be emitted
  2146. * for the web page, and `close` event will also not be emitted for this window,
  2147. * but it guarantees the `closed` event will be emitted.
  2148. */
  2149. destroy(): void;
  2150. /**
  2151. * Starts or stops flashing the window to attract user's attention.
  2152. */
  2153. flashFrame(flag: boolean): void;
  2154. /**
  2155. * Focuses on the window.
  2156. */
  2157. focus(): void;
  2158. focusOnWebView(): void;
  2159. /**
  2160. * Gets the background color of the window. See Setting `backgroundColor`.
  2161. */
  2162. getBackgroundColor(): string;
  2163. /**
  2164. * The `bounds` of the window as `Object`.
  2165. */
  2166. getBounds(): Rectangle;
  2167. /**
  2168. * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
  2169. * Throws an error if multiple `BrowserView`s are attached.
  2170. *
  2171. * @experimental
  2172. */
  2173. getBrowserView(): (BrowserView) | (null);
  2174. /**
  2175. * an array of all BrowserViews that have been attached with `addBrowserView` or
  2176. * `setBrowserView`.
  2177. *
  2178. * **Note:** The BrowserView API is currently experimental and may change or be
  2179. * removed in future Electron releases.
  2180. *
  2181. * @experimental
  2182. */
  2183. getBrowserViews(): BrowserView[];
  2184. /**
  2185. * All child windows.
  2186. */
  2187. getChildWindows(): BrowserWindow[];
  2188. /**
  2189. * The `bounds` of the window's client area as `Object`.
  2190. */
  2191. getContentBounds(): Rectangle;
  2192. /**
  2193. * Contains the window's client area's width and height.
  2194. */
  2195. getContentSize(): number[];
  2196. /**
  2197. * Contains the window's maximum width and height.
  2198. */
  2199. getMaximumSize(): number[];
  2200. /**
  2201. * Window id in the format of DesktopCapturerSource's id. For example
  2202. * "window:1324:0".
  2203. *
  2204. * More precisely the format is `window:id:other_id` where `id` is `HWND` on
  2205. * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
  2206. * Linux. `other_id` is used to identify web contents (tabs) so within the same top
  2207. * level window.
  2208. */
  2209. getMediaSourceId(): string;
  2210. /**
  2211. * Contains the window's minimum width and height.
  2212. */
  2213. getMinimumSize(): number[];
  2214. /**
  2215. * The platform-specific handle of the window.
  2216. *
  2217. * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
  2218. * `Window` (`unsigned long`) on Linux.
  2219. */
  2220. getNativeWindowHandle(): Buffer;
  2221. /**
  2222. * Contains the window bounds of the normal state
  2223. *
  2224. * **Note:** whatever the current state of the window : maximized, minimized or in
  2225. * fullscreen, this function always returns the position and size of the window in
  2226. * normal state. In normal state, getBounds and getNormalBounds returns the same
  2227. * `Rectangle`.
  2228. */
  2229. getNormalBounds(): Rectangle;
  2230. /**
  2231. * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
  2232. * 1.
  2233. */
  2234. getOpacity(): number;
  2235. /**
  2236. * The parent window.
  2237. */
  2238. getParentWindow(): BrowserWindow;
  2239. /**
  2240. * Contains the window's current position.
  2241. */
  2242. getPosition(): number[];
  2243. /**
  2244. * The pathname of the file the window represents.
  2245. *
  2246. * @platform darwin
  2247. */
  2248. getRepresentedFilename(): string;
  2249. /**
  2250. * Contains the window's width and height.
  2251. */
  2252. getSize(): number[];
  2253. /**
  2254. * The title of the native window.
  2255. *
  2256. * **Note:** The title of the web page can be different from the title of the
  2257. * native window.
  2258. */
  2259. getTitle(): string;
  2260. /**
  2261. * The custom position for the traffic light buttons in frameless window.
  2262. *
  2263. * @platform darwin
  2264. */
  2265. getTrafficLightPosition(): Point;
  2266. /**
  2267. * Whether the window has a shadow.
  2268. */
  2269. hasShadow(): boolean;
  2270. /**
  2271. * Hides the window.
  2272. */
  2273. hide(): void;
  2274. /**
  2275. * Hooks a windows message. The `callback` is called when the message is received
  2276. * in the WndProc.
  2277. *
  2278. * @platform win32
  2279. */
  2280. hookWindowMessage(message: number, callback: (wParam: any, lParam: any) => void): void;
  2281. /**
  2282. * Whether the window is always on top of other windows.
  2283. */
  2284. isAlwaysOnTop(): boolean;
  2285. /**
  2286. * Whether the window can be manually closed by user.
  2287. *
  2288. On Linux always returns `true`.
  2289. *
  2290. * @platform darwin,win32
  2291. */
  2292. isClosable(): boolean;
  2293. /**
  2294. * Whether the window is destroyed.
  2295. */
  2296. isDestroyed(): boolean;
  2297. /**
  2298. * Whether the window's document has been edited.
  2299. *
  2300. * @platform darwin
  2301. */
  2302. isDocumentEdited(): boolean;
  2303. /**
  2304. * whether the window is enabled.
  2305. */
  2306. isEnabled(): boolean;
  2307. /**
  2308. * Whether the window is focused.
  2309. */
  2310. isFocused(): boolean;
  2311. /**
  2312. * Whether the window is in fullscreen mode.
  2313. */
  2314. isFullScreen(): boolean;
  2315. /**
  2316. * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
  2317. * window.
  2318. */
  2319. isFullScreenable(): boolean;
  2320. /**
  2321. * Whether the window is in kiosk mode.
  2322. */
  2323. isKiosk(): boolean;
  2324. /**
  2325. * Whether the window can be manually maximized by user.
  2326. *
  2327. On Linux always returns `true`.
  2328. *
  2329. * @platform darwin,win32
  2330. */
  2331. isMaximizable(): boolean;
  2332. /**
  2333. * Whether the window is maximized.
  2334. */
  2335. isMaximized(): boolean;
  2336. /**
  2337. * Whether menu bar automatically hides itself.
  2338. */
  2339. isMenuBarAutoHide(): boolean;
  2340. /**
  2341. * Whether the menu bar is visible.
  2342. */
  2343. isMenuBarVisible(): boolean;
  2344. /**
  2345. * Whether the window can be manually minimized by the user.
  2346. *
  2347. On Linux always returns `true`.
  2348. *
  2349. * @platform darwin,win32
  2350. */
  2351. isMinimizable(): boolean;
  2352. /**
  2353. * Whether the window is minimized.
  2354. */
  2355. isMinimized(): boolean;
  2356. /**
  2357. * Whether current window is a modal window.
  2358. */
  2359. isModal(): boolean;
  2360. /**
  2361. * Whether the window can be moved by user.
  2362. On Linux always returns `true`.
  2363. *
  2364. * @platform darwin,win32
  2365. */
  2366. isMovable(): boolean;
  2367. /**
  2368. * Whether the window is in normal state (not maximized, not minimized, not in
  2369. * fullscreen mode).
  2370. */
  2371. isNormal(): boolean;
  2372. /**
  2373. * Whether the window can be manually resized by the user.
  2374. */
  2375. isResizable(): boolean;
  2376. /**
  2377. * Whether the window is in simple (pre-Lion) fullscreen mode.
  2378. *
  2379. * @platform darwin
  2380. */
  2381. isSimpleFullScreen(): boolean;
  2382. /**
  2383. * Whether the window is in Windows 10 tablet mode.
  2384. *
  2385. * Since Windows 10 users can use their PC as tablet, under this mode apps can
  2386. * choose to optimize their UI for tablets, such as enlarging the titlebar and
  2387. * hiding titlebar buttons.
  2388. *
  2389. * This API returns whether the window is in tablet mode, and the `resize` event
  2390. * can be be used to listen to changes to tablet mode.
  2391. *
  2392. * @platform win32
  2393. */
  2394. isTabletMode(): boolean;
  2395. /**
  2396. * Whether the window is visible to the user.
  2397. */
  2398. isVisible(): boolean;
  2399. /**
  2400. * Whether the window is visible on all workspaces.
  2401. *
  2402. **Note:** This API always returns false on Windows.
  2403. */
  2404. isVisibleOnAllWorkspaces(): boolean;
  2405. /**
  2406. * `true` or `false` depending on whether the message is hooked.
  2407. *
  2408. * @platform win32
  2409. */
  2410. isWindowMessageHooked(message: number): boolean;
  2411. /**
  2412. * the promise will resolve when the page has finished loading (see
  2413. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  2414. *
  2415. * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
  2416. * relative to the root of your application. See the `webContents` docs for more
  2417. * information.
  2418. */
  2419. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  2420. /**
  2421. * the promise will resolve when the page has finished loading (see
  2422. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  2423. *
  2424. * Same as `webContents.loadURL(url[, options])`.
  2425. *
  2426. * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
  2427. * file using the `file://` protocol.
  2428. *
  2429. * To ensure that file URLs are properly formatted, it is recommended to use Node's
  2430. * `url.format` method:
  2431. *
  2432. * You can load a URL using a `POST` request with URL-encoded data by doing the
  2433. * following:
  2434. */
  2435. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  2436. /**
  2437. * Maximizes the window. This will also show (but not focus) the window if it isn't
  2438. * being displayed already.
  2439. */
  2440. maximize(): void;
  2441. /**
  2442. * Merges all windows into one window with multiple tabs when native tabs are
  2443. * enabled and there is more than one open window.
  2444. *
  2445. * @platform darwin
  2446. */
  2447. mergeAllWindows(): void;
  2448. /**
  2449. * Minimizes the window. On some platforms the minimized window will be shown in
  2450. * the Dock.
  2451. */
  2452. minimize(): void;
  2453. /**
  2454. * Moves window above the source window in the sense of z-order. If the
  2455. * `mediaSourceId` is not of type window or if the window does not exist then this
  2456. * method throws an error.
  2457. */
  2458. moveAbove(mediaSourceId: string): void;
  2459. /**
  2460. * Moves the current tab into a new window if native tabs are enabled and there is
  2461. * more than one tab in the current window.
  2462. *
  2463. * @platform darwin
  2464. */
  2465. moveTabToNewWindow(): void;
  2466. /**
  2467. * Moves window to top(z-order) regardless of focus
  2468. */
  2469. moveTop(): void;
  2470. /**
  2471. * Uses Quick Look to preview a file at a given path.
  2472. *
  2473. * @platform darwin
  2474. */
  2475. previewFile(path: string, displayName?: string): void;
  2476. /**
  2477. * Same as `webContents.reload`.
  2478. */
  2479. reload(): void;
  2480. removeBrowserView(browserView: BrowserView): void;
  2481. /**
  2482. * Remove the window's menu bar.
  2483. *
  2484. * @platform linux,win32
  2485. */
  2486. removeMenu(): void;
  2487. /**
  2488. * Restores the window from minimized state to its previous state.
  2489. */
  2490. restore(): void;
  2491. /**
  2492. * Selects the next tab when native tabs are enabled and there are other tabs in
  2493. * the window.
  2494. *
  2495. * @platform darwin
  2496. */
  2497. selectNextTab(): void;
  2498. /**
  2499. * Selects the previous tab when native tabs are enabled and there are other tabs
  2500. * in the window.
  2501. *
  2502. * @platform darwin
  2503. */
  2504. selectPreviousTab(): void;
  2505. /**
  2506. * Sets whether the window should show always on top of other windows. After
  2507. * setting this, the window is still a normal window, not a toolbox window which
  2508. * can not be focused on.
  2509. */
  2510. setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
  2511. /**
  2512. * Sets the properties for the window's taskbar button.
  2513. *
  2514. * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
  2515. * together. If one of those properties is not set, then neither will be used.
  2516. *
  2517. * @platform win32
  2518. */
  2519. setAppDetails(options: AppDetailsOptions): void;
  2520. /**
  2521. * This will make a window maintain an aspect ratio. The extra size allows a
  2522. * developer to have space, specified in pixels, not included within the aspect
  2523. * ratio calculations. This API already takes into account the difference between a
  2524. * window's size and its content size.
  2525. *
  2526. * Consider a normal window with an HD video player and associated controls.
  2527. * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
  2528. * on the right edge and 50 pixels of controls below the player. In order to
  2529. * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
  2530. * the player itself we would call this function with arguments of 16/9 and {
  2531. * width: 40, height: 50 }. The second argument doesn't care where the extra width
  2532. * and height are within the content view--only that they exist. Sum any extra
  2533. * width and height areas you have within the overall content view.
  2534. *
  2535. * The aspect ratio is not respected when window is resized programmingly with APIs
  2536. * like `win.setSize`.
  2537. */
  2538. setAspectRatio(aspectRatio: number, extraSize?: Size): void;
  2539. /**
  2540. * Controls whether to hide cursor when typing.
  2541. *
  2542. * @platform darwin
  2543. */
  2544. setAutoHideCursor(autoHide: boolean): void;
  2545. /**
  2546. * Sets whether the window menu bar should hide itself automatically. Once set the
  2547. * menu bar will only show when users press the single `Alt` key.
  2548. *
  2549. * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
  2550. * hide it immediately.
  2551. */
  2552. setAutoHideMenuBar(hide: boolean): void;
  2553. /**
  2554. * Sets the background color of the window. See Setting `backgroundColor`.
  2555. */
  2556. setBackgroundColor(backgroundColor: string): void;
  2557. /**
  2558. * Resizes and moves the window to the supplied bounds. Any properties that are not
  2559. * supplied will default to their current values.
  2560. */
  2561. setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
  2562. setBrowserView(browserView: (BrowserView) | (null)): void;
  2563. /**
  2564. * Sets whether the window can be manually closed by user. On Linux does nothing.
  2565. *
  2566. * @platform darwin,win32
  2567. */
  2568. setClosable(closable: boolean): void;
  2569. /**
  2570. * Resizes and moves the window's client area (e.g. the web page) to the supplied
  2571. * bounds.
  2572. */
  2573. setContentBounds(bounds: Rectangle, animate?: boolean): void;
  2574. /**
  2575. * Prevents the window contents from being captured by other apps.
  2576. *
  2577. * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
  2578. * it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10
  2579. * version 2004 and up the window will be removed from capture entirely, older
  2580. * Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
  2581. *
  2582. * @platform darwin,win32
  2583. */
  2584. setContentProtection(enable: boolean): void;
  2585. /**
  2586. * Resizes the window's client area (e.g. the web page) to `width` and `height`.
  2587. */
  2588. setContentSize(width: number, height: number, animate?: boolean): void;
  2589. /**
  2590. * Specifies whether the window’s document has been edited, and the icon in title
  2591. * bar will become gray when set to `true`.
  2592. *
  2593. * @platform darwin
  2594. */
  2595. setDocumentEdited(edited: boolean): void;
  2596. /**
  2597. * Disable or enable the window.
  2598. */
  2599. setEnabled(enable: boolean): void;
  2600. /**
  2601. * Changes whether the window can be focused.
  2602. *
  2603. On macOS it does not remove the focus from the window.
  2604. *
  2605. * @platform darwin,win32
  2606. */
  2607. setFocusable(focusable: boolean): void;
  2608. /**
  2609. * Sets whether the window should be in fullscreen mode.
  2610. */
  2611. setFullScreen(flag: boolean): void;
  2612. /**
  2613. * Sets whether the maximize/zoom window button toggles fullscreen mode or
  2614. * maximizes the window.
  2615. */
  2616. setFullScreenable(fullscreenable: boolean): void;
  2617. /**
  2618. * Sets whether the window should have a shadow.
  2619. */
  2620. setHasShadow(hasShadow: boolean): void;
  2621. /**
  2622. * Changes window icon.
  2623. *
  2624. * @platform win32,linux
  2625. */
  2626. setIcon(icon: (NativeImage) | (string)): void;
  2627. /**
  2628. * Makes the window ignore all mouse events.
  2629. *
  2630. * All mouse events happened in this window will be passed to the window below this
  2631. * window, but if this window has focus, it will still receive keyboard events.
  2632. */
  2633. setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
  2634. /**
  2635. * Enters or leaves kiosk mode.
  2636. */
  2637. setKiosk(flag: boolean): void;
  2638. /**
  2639. * Sets whether the window can be manually maximized by user. On Linux does
  2640. * nothing.
  2641. *
  2642. * @platform darwin,win32
  2643. */
  2644. setMaximizable(maximizable: boolean): void;
  2645. /**
  2646. * Sets the maximum size of window to `width` and `height`.
  2647. */
  2648. setMaximumSize(width: number, height: number): void;
  2649. /**
  2650. * Sets the `menu` as the window's menu bar.
  2651. *
  2652. * @platform linux,win32
  2653. */
  2654. setMenu(menu: (Menu) | (null)): void;
  2655. /**
  2656. * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
  2657. * can still bring up the menu bar by pressing the single `Alt` key.
  2658. *
  2659. * @platform win32,linux
  2660. */
  2661. setMenuBarVisibility(visible: boolean): void;
  2662. /**
  2663. * Sets whether the window can be manually minimized by user. On Linux does
  2664. * nothing.
  2665. *
  2666. * @platform darwin,win32
  2667. */
  2668. setMinimizable(minimizable: boolean): void;
  2669. /**
  2670. * Sets the minimum size of window to `width` and `height`.
  2671. */
  2672. setMinimumSize(width: number, height: number): void;
  2673. /**
  2674. * Sets whether the window can be moved by user. On Linux does nothing.
  2675. *
  2676. * @platform darwin,win32
  2677. */
  2678. setMovable(movable: boolean): void;
  2679. /**
  2680. * Sets the opacity of the window. On Linux, does nothing. Out of bound number
  2681. * values are clamped to the [0, 1] range.
  2682. *
  2683. * @platform win32,darwin
  2684. */
  2685. setOpacity(opacity: number): void;
  2686. /**
  2687. * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
  2688. * convey some sort of application status or to passively notify the user.
  2689. *
  2690. * @platform win32
  2691. */
  2692. setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
  2693. /**
  2694. * Sets `parent` as current window's parent window, passing `null` will turn
  2695. * current window into a top-level window.
  2696. */
  2697. setParentWindow(parent: (BrowserWindow) | (null)): void;
  2698. /**
  2699. * Moves window to `x` and `y`.
  2700. */
  2701. setPosition(x: number, y: number, animate?: boolean): void;
  2702. /**
  2703. * Sets progress value in progress bar. Valid range is [0, 1.0].
  2704. *
  2705. * Remove progress bar when progress < 0; Change to indeterminate mode when
  2706. * progress > 1.
  2707. *
  2708. * On Linux platform, only supports Unity desktop environment, you need to specify
  2709. * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
  2710. * it will assume `{app.name}.desktop`.
  2711. *
  2712. * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
  2713. * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
  2714. * mode set (but with a value within the valid range), `normal` will be assumed.
  2715. */
  2716. setProgressBar(progress: number, options?: ProgressBarOptions): void;
  2717. /**
  2718. * Sets the pathname of the file the window represents, and the icon of the file
  2719. * will show in window's title bar.
  2720. *
  2721. * @platform darwin
  2722. */
  2723. setRepresentedFilename(filename: string): void;
  2724. /**
  2725. * Sets whether the window can be manually resized by the user.
  2726. */
  2727. setResizable(resizable: boolean): void;
  2728. /**
  2729. * Setting a window shape determines the area within the window where the system
  2730. * permits drawing and user interaction. Outside of the given region, no pixels
  2731. * will be drawn and no mouse events will be registered. Mouse events outside of
  2732. * the region will not be received by that window, but will fall through to
  2733. * whatever is behind the window.
  2734. *
  2735. * @experimental
  2736. * @platform win32,linux
  2737. */
  2738. setShape(rects: Rectangle[]): void;
  2739. /**
  2740. * Changes the attachment point for sheets on macOS. By default, sheets are
  2741. * attached just below the window frame, but you may want to display them beneath a
  2742. * HTML-rendered toolbar. For example:
  2743. *
  2744. * @platform darwin
  2745. */
  2746. setSheetOffset(offsetY: number, offsetX?: number): void;
  2747. /**
  2748. * Enters or leaves simple fullscreen mode.
  2749. *
  2750. * Simple fullscreen mode emulates the native fullscreen behavior found in versions
  2751. * of macOS prior to Lion (10.7).
  2752. *
  2753. * @platform darwin
  2754. */
  2755. setSimpleFullScreen(flag: boolean): void;
  2756. /**
  2757. * Resizes the window to `width` and `height`. If `width` or `height` are below any
  2758. * set minimum size constraints the window will snap to its minimum size.
  2759. */
  2760. setSize(width: number, height: number, animate?: boolean): void;
  2761. /**
  2762. * Makes the window not show in the taskbar.
  2763. */
  2764. setSkipTaskbar(skip: boolean): void;
  2765. /**
  2766. * Whether the buttons were added successfully
  2767. *
  2768. * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
  2769. * of a window in a taskbar button layout. Returns a `Boolean` object indicates
  2770. * whether the thumbnail has been added successfully.
  2771. *
  2772. * The number of buttons in thumbnail toolbar should be no greater than 7 due to
  2773. * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
  2774. * removed due to the platform's limitation. But you can call the API with an empty
  2775. * array to clean the buttons.
  2776. *
  2777. * The `buttons` is an array of `Button` objects:
  2778. *
  2779. * * `Button` Object
  2780. * * `icon` NativeImage - The icon showing in thumbnail toolbar.
  2781. * * `click` Function
  2782. * * `tooltip` String (optional) - The text of the button's tooltip.
  2783. * * `flags` String[] (optional) - Control specific states and behaviors of the
  2784. * button. By default, it is `['enabled']`.
  2785. *
  2786. * The `flags` is an array that can include following `String`s:
  2787. *
  2788. * * `enabled` - The button is active and available to the user.
  2789. * * `disabled` - The button is disabled. It is present, but has a visual state
  2790. * indicating it will not respond to user action.
  2791. * * `dismissonclick` - When the button is clicked, the thumbnail window closes
  2792. * immediately.
  2793. * * `nobackground` - Do not draw a button border, use only the image.
  2794. * * `hidden` - The button is not shown to the user.
  2795. * * `noninteractive` - The button is enabled but not interactive; no pressed
  2796. * button state is drawn. This value is intended for instances where the button is
  2797. * used in a notification.
  2798. *
  2799. * @platform win32
  2800. */
  2801. setThumbarButtons(buttons: ThumbarButton[]): boolean;
  2802. /**
  2803. * Sets the region of the window to show as the thumbnail image displayed when
  2804. * hovering over the window in the taskbar. You can reset the thumbnail to be the
  2805. * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
  2806. * }`.
  2807. *
  2808. * @platform win32
  2809. */
  2810. setThumbnailClip(region: Rectangle): void;
  2811. /**
  2812. * Sets the toolTip that is displayed when hovering over the window thumbnail in
  2813. * the taskbar.
  2814. *
  2815. * @platform win32
  2816. */
  2817. setThumbnailToolTip(toolTip: string): void;
  2818. /**
  2819. * Changes the title of native window to `title`.
  2820. */
  2821. setTitle(title: string): void;
  2822. /**
  2823. * Raises `browserView` above other `BrowserView`s attached to `win`. Throws an
  2824. * error if `browserView` is not attached to `win`.
  2825. *
  2826. * @experimental
  2827. */
  2828. setTopBrowserView(browserView: BrowserView): void;
  2829. /**
  2830. * Sets the touchBar layout for the current window. Specifying `null` or
  2831. * `undefined` clears the touch bar. This method only has an effect if the machine
  2832. * has a touch bar and is running on macOS 10.12.1+.
  2833. *
  2834. * **Note:** The TouchBar API is currently experimental and may change or be
  2835. * removed in future Electron releases.
  2836. *
  2837. * @platform darwin
  2838. */
  2839. setTouchBar(touchBar: (TouchBar) | (null)): void;
  2840. /**
  2841. * Set a custom position for the traffic light buttons in frameless window.
  2842. *
  2843. * @platform darwin
  2844. */
  2845. setTrafficLightPosition(position: Point): void;
  2846. /**
  2847. * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
  2848. * will remove the vibrancy effect on the window.
  2849. *
  2850. * Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
  2851. * have been deprecated and will be removed in an upcoming version of macOS.
  2852. *
  2853. * @platform darwin
  2854. */
  2855. setVibrancy(type: (('appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark' | 'header' | 'sheet' | 'window' | 'hud' | 'fullscreen-ui' | 'tooltip' | 'content' | 'under-window' | 'under-page')) | (null)): void;
  2856. /**
  2857. * Sets whether the window should be visible on all workspaces.
  2858. *
  2859. **Note:** This API does nothing on Windows.
  2860. */
  2861. setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
  2862. /**
  2863. * Sets whether the window traffic light buttons should be visible.
  2864. *
  2865. * @platform darwin
  2866. */
  2867. setWindowButtonVisibility(visible: boolean): void;
  2868. /**
  2869. * Shows and gives focus to the window.
  2870. */
  2871. show(): void;
  2872. /**
  2873. * Same as `webContents.showDefinitionForSelection()`.
  2874. *
  2875. * @platform darwin
  2876. */
  2877. showDefinitionForSelection(): void;
  2878. /**
  2879. * Shows the window but doesn't focus on it.
  2880. */
  2881. showInactive(): void;
  2882. /**
  2883. * Toggles the visibility of the tab bar if native tabs are enabled and there is
  2884. * only one tab in the current window.
  2885. *
  2886. * @platform darwin
  2887. */
  2888. toggleTabBar(): void;
  2889. /**
  2890. * Unhooks all of the window messages.
  2891. *
  2892. * @platform win32
  2893. */
  2894. unhookAllWindowMessages(): void;
  2895. /**
  2896. * Unhook the window message.
  2897. *
  2898. * @platform win32
  2899. */
  2900. unhookWindowMessage(message: number): void;
  2901. /**
  2902. * Unmaximizes the window.
  2903. */
  2904. unmaximize(): void;
  2905. accessibleTitle: string;
  2906. autoHideMenuBar: boolean;
  2907. closable: boolean;
  2908. documentEdited: boolean;
  2909. excludedFromShownWindowsMenu: boolean;
  2910. fullScreen: boolean;
  2911. fullScreenable: boolean;
  2912. readonly id: number;
  2913. kiosk: boolean;
  2914. maximizable: boolean;
  2915. menuBarVisible: boolean;
  2916. minimizable: boolean;
  2917. movable: boolean;
  2918. representedFilename: string;
  2919. resizable: boolean;
  2920. shadow: boolean;
  2921. simpleFullScreen: boolean;
  2922. title: string;
  2923. visibleOnAllWorkspaces: boolean;
  2924. readonly webContents: WebContents;
  2925. }
  2926. class BrowserWindowProxy {
  2927. // Docs: https://electronjs.org/docs/api/browser-window-proxy
  2928. /**
  2929. * Removes focus from the child window.
  2930. */
  2931. blur(): void;
  2932. /**
  2933. * Forcefully closes the child window without calling its unload event.
  2934. */
  2935. close(): void;
  2936. /**
  2937. * Evaluates the code in the child window.
  2938. */
  2939. eval(code: string): void;
  2940. /**
  2941. * Focuses the child window (brings the window to front).
  2942. */
  2943. focus(): void;
  2944. /**
  2945. * Sends a message to the child window with the specified origin or `*` for no
  2946. * origin preference.
  2947. *
  2948. * In addition to these methods, the child window implements `window.opener` object
  2949. * with no properties and a single method.
  2950. */
  2951. postMessage(message: any, targetOrigin: string): void;
  2952. /**
  2953. * Invokes the print dialog on the child window.
  2954. */
  2955. print(): void;
  2956. closed: boolean;
  2957. }
  2958. interface Certificate {
  2959. // Docs: https://electronjs.org/docs/api/structures/certificate
  2960. /**
  2961. * PEM encoded data
  2962. */
  2963. data: string;
  2964. /**
  2965. * Fingerprint of the certificate
  2966. */
  2967. fingerprint: string;
  2968. /**
  2969. * Issuer principal
  2970. */
  2971. issuer: CertificatePrincipal;
  2972. /**
  2973. * Issuer certificate (if not self-signed)
  2974. */
  2975. issuerCert: Certificate;
  2976. /**
  2977. * Issuer's Common Name
  2978. */
  2979. issuerName: string;
  2980. /**
  2981. * Hex value represented string
  2982. */
  2983. serialNumber: string;
  2984. /**
  2985. * Subject principal
  2986. */
  2987. subject: CertificatePrincipal;
  2988. /**
  2989. * Subject's Common Name
  2990. */
  2991. subjectName: string;
  2992. /**
  2993. * End date of the certificate being valid in seconds
  2994. */
  2995. validExpiry: number;
  2996. /**
  2997. * Start date of the certificate being valid in seconds
  2998. */
  2999. validStart: number;
  3000. }
  3001. interface CertificatePrincipal {
  3002. // Docs: https://electronjs.org/docs/api/structures/certificate-principal
  3003. /**
  3004. * Common Name.
  3005. */
  3006. commonName: string;
  3007. /**
  3008. * Country or region.
  3009. */
  3010. country: string;
  3011. /**
  3012. * Locality.
  3013. */
  3014. locality: string;
  3015. /**
  3016. * Organization names.
  3017. */
  3018. organizations: string[];
  3019. /**
  3020. * Organization Unit names.
  3021. */
  3022. organizationUnits: string[];
  3023. /**
  3024. * State or province.
  3025. */
  3026. state: string;
  3027. }
  3028. class ClientRequest extends NodeEventEmitter {
  3029. // Docs: https://electronjs.org/docs/api/client-request
  3030. /**
  3031. * Emitted when the `request` is aborted. The `abort` event will not be fired if
  3032. * the `request` is already closed.
  3033. */
  3034. on(event: 'abort', listener: Function): this;
  3035. once(event: 'abort', listener: Function): this;
  3036. addListener(event: 'abort', listener: Function): this;
  3037. removeListener(event: 'abort', listener: Function): this;
  3038. /**
  3039. * Emitted as the last event in the HTTP request-response transaction. The `close`
  3040. * event indicates that no more events will be emitted on either the `request` or
  3041. * `response` objects.
  3042. */
  3043. on(event: 'close', listener: Function): this;
  3044. once(event: 'close', listener: Function): this;
  3045. addListener(event: 'close', listener: Function): this;
  3046. removeListener(event: 'close', listener: Function): this;
  3047. /**
  3048. * Emitted when the `net` module fails to issue a network request. Typically when
  3049. * the `request` object emits an `error` event, a `close` event will subsequently
  3050. * follow and no response object will be provided.
  3051. */
  3052. on(event: 'error', listener: (
  3053. /**
  3054. * an error object providing some information about the failure.
  3055. */
  3056. error: Error) => void): this;
  3057. once(event: 'error', listener: (
  3058. /**
  3059. * an error object providing some information about the failure.
  3060. */
  3061. error: Error) => void): this;
  3062. addListener(event: 'error', listener: (
  3063. /**
  3064. * an error object providing some information about the failure.
  3065. */
  3066. error: Error) => void): this;
  3067. removeListener(event: 'error', listener: (
  3068. /**
  3069. * an error object providing some information about the failure.
  3070. */
  3071. error: Error) => void): this;
  3072. /**
  3073. * Emitted just after the last chunk of the `request`'s data has been written into
  3074. * the `request` object.
  3075. */
  3076. on(event: 'finish', listener: Function): this;
  3077. once(event: 'finish', listener: Function): this;
  3078. addListener(event: 'finish', listener: Function): this;
  3079. removeListener(event: 'finish', listener: Function): this;
  3080. /**
  3081. * Emitted when an authenticating proxy is asking for user credentials.
  3082. *
  3083. * The `callback` function is expected to be called back with user credentials:
  3084. *
  3085. * * `username` String
  3086. * * `password` String
  3087. *
  3088. * Providing empty credentials will cancel the request and report an authentication
  3089. * error on the response object:
  3090. */
  3091. on(event: 'login', listener: (authInfo: AuthInfo,
  3092. callback: (username?: string, password?: string) => void) => void): this;
  3093. once(event: 'login', listener: (authInfo: AuthInfo,
  3094. callback: (username?: string, password?: string) => void) => void): this;
  3095. addListener(event: 'login', listener: (authInfo: AuthInfo,
  3096. callback: (username?: string, password?: string) => void) => void): this;
  3097. removeListener(event: 'login', listener: (authInfo: AuthInfo,
  3098. callback: (username?: string, password?: string) => void) => void): this;
  3099. /**
  3100. * Emitted when the server returns a redirect response (e.g. 301 Moved
  3101. * Permanently). Calling `request.followRedirect` will continue with the
  3102. * redirection. If this event is handled, `request.followRedirect` must be called
  3103. * **synchronously**, otherwise the request will be cancelled.
  3104. */
  3105. on(event: 'redirect', listener: (statusCode: number,
  3106. method: string,
  3107. redirectUrl: string,
  3108. responseHeaders: Record<string, string[]>) => void): this;
  3109. once(event: 'redirect', listener: (statusCode: number,
  3110. method: string,
  3111. redirectUrl: string,
  3112. responseHeaders: Record<string, string[]>) => void): this;
  3113. addListener(event: 'redirect', listener: (statusCode: number,
  3114. method: string,
  3115. redirectUrl: string,
  3116. responseHeaders: Record<string, string[]>) => void): this;
  3117. removeListener(event: 'redirect', listener: (statusCode: number,
  3118. method: string,
  3119. redirectUrl: string,
  3120. responseHeaders: Record<string, string[]>) => void): this;
  3121. on(event: 'response', listener: (
  3122. /**
  3123. * An object representing the HTTP response message.
  3124. */
  3125. response: IncomingMessage) => void): this;
  3126. once(event: 'response', listener: (
  3127. /**
  3128. * An object representing the HTTP response message.
  3129. */
  3130. response: IncomingMessage) => void): this;
  3131. addListener(event: 'response', listener: (
  3132. /**
  3133. * An object representing the HTTP response message.
  3134. */
  3135. response: IncomingMessage) => void): this;
  3136. removeListener(event: 'response', listener: (
  3137. /**
  3138. * An object representing the HTTP response message.
  3139. */
  3140. response: IncomingMessage) => void): this;
  3141. /**
  3142. * ClientRequest
  3143. */
  3144. constructor(options: (ClientRequestConstructorOptions) | (string));
  3145. /**
  3146. * Cancels an ongoing HTTP transaction. If the request has already emitted the
  3147. * `close` event, the abort operation will have no effect. Otherwise an ongoing
  3148. * event will emit `abort` and `close` events. Additionally, if there is an ongoing
  3149. * response object,it will emit the `aborted` event.
  3150. */
  3151. abort(): void;
  3152. /**
  3153. * Sends the last chunk of the request data. Subsequent write or end operations
  3154. * will not be allowed. The `finish` event is emitted just after the end operation.
  3155. */
  3156. end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  3157. /**
  3158. * Continues any pending redirection. Can only be called during a `'redirect'`
  3159. * event.
  3160. */
  3161. followRedirect(): void;
  3162. /**
  3163. * The value of a previously set extra header name.
  3164. */
  3165. getHeader(name: string): string;
  3166. /**
  3167. * * `active` Boolean - Whether the request is currently active. If this is false
  3168. * no other properties will be set
  3169. * * `started` Boolean - Whether the upload has started. If this is false both
  3170. * `current` and `total` will be set to 0.
  3171. * * `current` Integer - The number of bytes that have been uploaded so far
  3172. * * `total` Integer - The number of bytes that will be uploaded this request
  3173. *
  3174. * You can use this method in conjunction with `POST` requests to get the progress
  3175. * of a file upload or other data transfer.
  3176. */
  3177. getUploadProgress(): UploadProgress;
  3178. /**
  3179. * Removes a previously set extra header name. This method can be called only
  3180. * before first write. Trying to call it after the first write will throw an error.
  3181. */
  3182. removeHeader(name: string): void;
  3183. /**
  3184. * Adds an extra HTTP header. The header name will be issued as-is without
  3185. * lowercasing. It can be called only before first write. Calling this method after
  3186. * the first write will throw an error. If the passed value is not a `String`, its
  3187. * `toString()` method will be called to obtain the final value.
  3188. *
  3189. * Certain headers are restricted from being set by apps. These headers are listed
  3190. * below. More information on restricted headers can be found in Chromium's header
  3191. * utils.
  3192. *
  3193. * * `Content-Length`
  3194. * * `Host`
  3195. * * `Trailer` or `Te`
  3196. * * `Upgrade`
  3197. * * `Cookie2`
  3198. * * `Keep-Alive`
  3199. * * `Transfer-Encoding`
  3200. *
  3201. * Additionally, setting the `Connection` header to the value `upgrade` is also
  3202. * disallowed.
  3203. */
  3204. setHeader(name: string, value: string): void;
  3205. /**
  3206. * `callback` is essentially a dummy function introduced in the purpose of keeping
  3207. * similarity with the Node.js API. It is called asynchronously in the next tick
  3208. * after `chunk` content have been delivered to the Chromium networking layer.
  3209. * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
  3210. * content have been flushed on the wire before `callback` is called.
  3211. *
  3212. * Adds a chunk of data to the request body. The first write operation may cause
  3213. * the request headers to be issued on the wire. After the first write operation,
  3214. * it is not allowed to add or remove a custom header.
  3215. */
  3216. write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  3217. chunkedEncoding: boolean;
  3218. }
  3219. interface Clipboard {
  3220. // Docs: https://electronjs.org/docs/api/clipboard
  3221. /**
  3222. * An array of supported formats for the clipboard `type`.
  3223. */
  3224. availableFormats(type?: 'selection' | 'clipboard'): string[];
  3225. /**
  3226. * Clears the clipboard content.
  3227. */
  3228. clear(type?: 'selection' | 'clipboard'): void;
  3229. /**
  3230. * Whether the clipboard supports the specified `format`.
  3231. *
  3232. * @experimental
  3233. */
  3234. has(format: string, type?: 'selection' | 'clipboard'): boolean;
  3235. /**
  3236. * Reads `format` type from the clipboard.
  3237. *
  3238. * @experimental
  3239. */
  3240. read(format: string): string;
  3241. /**
  3242. * * `title` String
  3243. * * `url` String
  3244. *
  3245. * Returns an Object containing `title` and `url` keys representing the bookmark in
  3246. * the clipboard. The `title` and `url` values will be empty strings when the
  3247. * bookmark is unavailable.
  3248. *
  3249. * @platform darwin,win32
  3250. */
  3251. readBookmark(): ReadBookmark;
  3252. /**
  3253. * Reads `format` type from the clipboard.
  3254. *
  3255. * @experimental
  3256. */
  3257. readBuffer(format: string): Buffer;
  3258. /**
  3259. * The text on the find pasteboard, which is the pasteboard that holds information
  3260. * about the current state of the active application’s find panel.
  3261. *
  3262. * This method uses synchronous IPC when called from the renderer process. The
  3263. * cached value is reread from the find pasteboard whenever the application is
  3264. * activated.
  3265. *
  3266. * @platform darwin
  3267. */
  3268. readFindText(): string;
  3269. /**
  3270. * The content in the clipboard as markup.
  3271. */
  3272. readHTML(type?: 'selection' | 'clipboard'): string;
  3273. /**
  3274. * The image content in the clipboard.
  3275. */
  3276. readImage(type?: 'selection' | 'clipboard'): NativeImage;
  3277. /**
  3278. * The content in the clipboard as RTF.
  3279. */
  3280. readRTF(type?: 'selection' | 'clipboard'): string;
  3281. /**
  3282. * The content in the clipboard as plain text.
  3283. */
  3284. readText(type?: 'selection' | 'clipboard'): string;
  3285. /**
  3286. * Writes `data` to the clipboard.
  3287. */
  3288. write(data: Data, type?: 'selection' | 'clipboard'): void;
  3289. /**
  3290. * Writes the `title` and `url` into the clipboard as a bookmark.
  3291. *
  3292. * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
  3293. * can use `clipboard.write` to write both a bookmark and fallback text to the
  3294. * clipboard.
  3295. *
  3296. * @platform darwin,win32
  3297. */
  3298. writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
  3299. /**
  3300. * Writes the `buffer` into the clipboard as `format`.
  3301. *
  3302. * @experimental
  3303. */
  3304. writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
  3305. /**
  3306. * Writes the `text` into the find pasteboard (the pasteboard that holds
  3307. * information about the current state of the active application’s find panel) as
  3308. * plain text. This method uses synchronous IPC when called from the renderer
  3309. * process.
  3310. *
  3311. * @platform darwin
  3312. */
  3313. writeFindText(text: string): void;
  3314. /**
  3315. * Writes `markup` to the clipboard.
  3316. */
  3317. writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
  3318. /**
  3319. * Writes `image` to the clipboard.
  3320. */
  3321. writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
  3322. /**
  3323. * Writes the `text` into the clipboard in RTF.
  3324. */
  3325. writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
  3326. /**
  3327. * Writes the `text` into the clipboard as plain text.
  3328. */
  3329. writeText(text: string, type?: 'selection' | 'clipboard'): void;
  3330. }
  3331. class CommandLine {
  3332. // Docs: https://electronjs.org/docs/api/command-line
  3333. /**
  3334. * Append an argument to Chromium's command line. The argument will be quoted
  3335. * correctly. Switches will precede arguments regardless of appending order.
  3336. *
  3337. * If you're appending an argument like `--switch=value`, consider using
  3338. * `appendSwitch('switch', 'value')` instead.
  3339. *
  3340. * **Note:** This will not affect `process.argv`. The intended usage of this
  3341. * function is to control Chromium's behavior.
  3342. */
  3343. appendArgument(value: string): void;
  3344. /**
  3345. * Append a switch (with optional `value`) to Chromium's command line.
  3346. *
  3347. * **Note:** This will not affect `process.argv`. The intended usage of this
  3348. * function is to control Chromium's behavior.
  3349. */
  3350. appendSwitch(the_switch: string, value?: string): void;
  3351. /**
  3352. * The command-line switch value.
  3353. *
  3354. * **Note:** When the switch is not present or has no value, it returns empty
  3355. * string.
  3356. */
  3357. getSwitchValue(the_switch: string): string;
  3358. /**
  3359. * Whether the command-line switch is present.
  3360. */
  3361. hasSwitch(the_switch: string): boolean;
  3362. }
  3363. interface ContentTracing {
  3364. // Docs: https://electronjs.org/docs/api/content-tracing
  3365. /**
  3366. * resolves with an array of category groups once all child processes have
  3367. * acknowledged the `getCategories` request
  3368. *
  3369. * Get a set of category groups. The category groups can change as new code paths
  3370. * are reached. See also the list of built-in tracing categories.
  3371. *
  3372. * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
  3373. * This category can be used to capture Electron-specific tracing events.
  3374. */
  3375. getCategories(): Promise<string[]>;
  3376. /**
  3377. * Resolves with an object containing the `value` and `percentage` of trace buffer
  3378. * maximum usage
  3379. *
  3380. * * `value` Number
  3381. * * `percentage` Number
  3382. *
  3383. * Get the maximum usage across processes of trace buffer as a percentage of the
  3384. * full state.
  3385. */
  3386. getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
  3387. /**
  3388. * resolved once all child processes have acknowledged the `startRecording`
  3389. * request.
  3390. *
  3391. * Start recording on all processes.
  3392. *
  3393. * Recording begins immediately locally and asynchronously on child processes as
  3394. * soon as they receive the EnableRecording request.
  3395. *
  3396. * If a recording is already running, the promise will be immediately resolved, as
  3397. * only one trace operation can be in progress at a time.
  3398. */
  3399. startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
  3400. /**
  3401. * resolves with a path to a file that contains the traced data once all child
  3402. * processes have acknowledged the `stopRecording` request
  3403. *
  3404. * Stop recording on all processes.
  3405. *
  3406. * Child processes typically cache trace data and only rarely flush and send trace
  3407. * data back to the main process. This helps to minimize the runtime overhead of
  3408. * tracing since sending trace data over IPC can be an expensive operation. So, to
  3409. * end tracing, Chromium asynchronously asks all child processes to flush any
  3410. * pending trace data.
  3411. *
  3412. * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
  3413. * or not provided, trace data will be written to a temporary file, and the path
  3414. * will be returned in the promise.
  3415. */
  3416. stopRecording(resultFilePath?: string): Promise<string>;
  3417. }
  3418. interface ContextBridge {
  3419. // Docs: https://electronjs.org/docs/api/context-bridge
  3420. exposeInMainWorld(apiKey: string, api: any): void;
  3421. }
  3422. interface Cookie {
  3423. // Docs: https://electronjs.org/docs/api/structures/cookie
  3424. /**
  3425. * The domain of the cookie; this will be normalized with a preceding dot so that
  3426. * it's also valid for subdomains.
  3427. */
  3428. domain?: string;
  3429. /**
  3430. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  3431. * Not provided for session cookies.
  3432. */
  3433. expirationDate?: number;
  3434. /**
  3435. * Whether the cookie is a host-only cookie; this will only be `true` if no domain
  3436. * was passed.
  3437. */
  3438. hostOnly?: boolean;
  3439. /**
  3440. * Whether the cookie is marked as HTTP only.
  3441. */
  3442. httpOnly?: boolean;
  3443. /**
  3444. * The name of the cookie.
  3445. */
  3446. name: string;
  3447. /**
  3448. * The path of the cookie.
  3449. */
  3450. path?: string;
  3451. /**
  3452. * The Same Site policy applied to this cookie. Can be `unspecified`,
  3453. * `no_restriction`, `lax` or `strict`.
  3454. */
  3455. sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  3456. /**
  3457. * Whether the cookie is marked as secure.
  3458. */
  3459. secure?: boolean;
  3460. /**
  3461. * Whether the cookie is a session cookie or a persistent cookie with an expiration
  3462. * date.
  3463. */
  3464. session?: boolean;
  3465. /**
  3466. * The value of the cookie.
  3467. */
  3468. value: string;
  3469. }
  3470. class Cookies extends NodeEventEmitter {
  3471. // Docs: https://electronjs.org/docs/api/cookies
  3472. /**
  3473. * Emitted when a cookie is changed because it was added, edited, removed, or
  3474. * expired.
  3475. */
  3476. on(event: 'changed', listener: (event: Event,
  3477. /**
  3478. * The cookie that was changed.
  3479. */
  3480. cookie: Cookie,
  3481. /**
  3482. * The cause of the change with one of the following values:
  3483. */
  3484. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3485. /**
  3486. * `true` if the cookie was removed, `false` otherwise.
  3487. */
  3488. removed: boolean) => void): this;
  3489. once(event: 'changed', listener: (event: Event,
  3490. /**
  3491. * The cookie that was changed.
  3492. */
  3493. cookie: Cookie,
  3494. /**
  3495. * The cause of the change with one of the following values:
  3496. */
  3497. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3498. /**
  3499. * `true` if the cookie was removed, `false` otherwise.
  3500. */
  3501. removed: boolean) => void): this;
  3502. addListener(event: 'changed', listener: (event: Event,
  3503. /**
  3504. * The cookie that was changed.
  3505. */
  3506. cookie: Cookie,
  3507. /**
  3508. * The cause of the change with one of the following values:
  3509. */
  3510. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3511. /**
  3512. * `true` if the cookie was removed, `false` otherwise.
  3513. */
  3514. removed: boolean) => void): this;
  3515. removeListener(event: 'changed', listener: (event: Event,
  3516. /**
  3517. * The cookie that was changed.
  3518. */
  3519. cookie: Cookie,
  3520. /**
  3521. * The cause of the change with one of the following values:
  3522. */
  3523. cause: ('explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'),
  3524. /**
  3525. * `true` if the cookie was removed, `false` otherwise.
  3526. */
  3527. removed: boolean) => void): this;
  3528. /**
  3529. * A promise which resolves when the cookie store has been flushed
  3530. *
  3531. Writes any unwritten cookies data to disk.
  3532. */
  3533. flushStore(): Promise<void>;
  3534. /**
  3535. * A promise which resolves an array of cookie objects.
  3536. *
  3537. * Sends a request to get all cookies matching `filter`, and resolves a promise
  3538. * with the response.
  3539. */
  3540. get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
  3541. /**
  3542. * A promise which resolves when the cookie has been removed
  3543. *
  3544. Removes the cookies matching `url` and `name`
  3545. */
  3546. remove(url: string, name: string): Promise<void>;
  3547. /**
  3548. * A promise which resolves when the cookie has been set
  3549. *
  3550. Sets a cookie with `details`.
  3551. */
  3552. set(details: CookiesSetDetails): Promise<void>;
  3553. }
  3554. interface CPUUsage {
  3555. // Docs: https://electronjs.org/docs/api/structures/cpu-usage
  3556. /**
  3557. * The number of average idle CPU wakeups per second since the last call to
  3558. * getCPUUsage. First call returns 0. Will always return 0 on Windows.
  3559. */
  3560. idleWakeupsPerSecond: number;
  3561. /**
  3562. * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
  3563. */
  3564. percentCPUUsage: number;
  3565. }
  3566. interface CrashReport {
  3567. // Docs: https://electronjs.org/docs/api/structures/crash-report
  3568. date: Date;
  3569. id: string;
  3570. }
  3571. interface CrashReporter {
  3572. // Docs: https://electronjs.org/docs/api/crash-reporter
  3573. /**
  3574. * Set an extra parameter to be sent with the crash report. The values specified
  3575. * here will be sent in addition to any values set via the `extra` option when
  3576. * `start` was called.
  3577. *
  3578. * Parameters added in this fashion (or via the `extra` parameter to
  3579. * `crashReporter.start`) are specific to the calling process. Adding extra
  3580. * parameters in the main process will not cause those parameters to be sent along
  3581. * with crashes from renderer or other child processes. Similarly, adding extra
  3582. * parameters in a renderer process will not result in those parameters being sent
  3583. * with crashes that occur in other renderer processes or in the main process.
  3584. *
  3585. * **Note:** Parameters have limits on the length of the keys and values. Key names
  3586. * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
  3587. * Keys with names longer than the maximum will be silently ignored. Key values
  3588. * longer than the maximum length will be truncated.
  3589. *
  3590. * **Note:** On linux values that are longer than 127 bytes will be chunked into
  3591. * multiple keys, each 127 bytes in length. E.g. `addExtraParameter('foo',
  3592. * 'a'.repeat(130))` will result in two chunked keys `foo__1` and `foo__2`, the
  3593. * first will contain the first 127 bytes and the second will contain the remaining
  3594. * 3 bytes. On your crash reporting backend you should stitch together keys in
  3595. * this format.
  3596. */
  3597. addExtraParameter(key: string, value: string): void;
  3598. /**
  3599. * The date and ID of the last crash report. Only crash reports that have been
  3600. * uploaded will be returned; even if a crash report is present on disk it will not
  3601. * be returned until it is uploaded. In the case that there are no uploaded
  3602. * reports, `null` is returned.
  3603. *
  3604. **Note:** This method is only available in the main process.
  3605. */
  3606. getLastCrashReport(): CrashReport;
  3607. /**
  3608. * The current 'extra' parameters of the crash reporter.
  3609. */
  3610. getParameters(): Record<string, string>;
  3611. /**
  3612. * Returns all uploaded crash reports. Each report contains the date and uploaded
  3613. * ID.
  3614. **Note:** This method is only available in the main process.
  3615. */
  3616. getUploadedReports(): CrashReport[];
  3617. /**
  3618. * Whether reports should be submitted to the server. Set through the `start`
  3619. * method or `setUploadToServer`.
  3620. *
  3621. **Note:** This method is only available in the main process.
  3622. */
  3623. getUploadToServer(): boolean;
  3624. /**
  3625. * Remove an extra parameter from the current set of parameters. Future crashes
  3626. * will not include this parameter.
  3627. */
  3628. removeExtraParameter(key: string): void;
  3629. /**
  3630. * This would normally be controlled by user preferences. This has no effect if
  3631. * called before `start` is called.
  3632. *
  3633. **Note:** This method is only available in the main process.
  3634. */
  3635. setUploadToServer(uploadToServer: boolean): void;
  3636. /**
  3637. * This method must be called before using any other `crashReporter` APIs. Once
  3638. * initialized this way, the crashpad handler collects crashes from all
  3639. * subsequently created processes. The crash reporter cannot be disabled once
  3640. * started.
  3641. *
  3642. * This method should be called as early as possible in app startup, preferably
  3643. * before `app.on('ready')`. If the crash reporter is not initialized at the time a
  3644. * renderer process is created, then that renderer process will not be monitored by
  3645. * the crash reporter.
  3646. *
  3647. * **Note:** You can test out the crash reporter by generating a crash using
  3648. * `process.crash()`.
  3649. *
  3650. * **Note:** If you need to send additional/updated `extra` parameters after your
  3651. * first call `start` you can call `addExtraParameter`.
  3652. *
  3653. * **Note:** Parameters passed in `extra`, `globalExtra` or set with
  3654. * `addExtraParameter` have limits on the length of the keys and values. Key names
  3655. * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
  3656. * with names longer than the maximum will be silently ignored. Key values longer
  3657. * than the maximum length will be truncated.
  3658. *
  3659. **Note:** This method is only available in the main process.
  3660. */
  3661. start(options: CrashReporterStartOptions): void;
  3662. }
  3663. interface CustomScheme {
  3664. // Docs: https://electronjs.org/docs/api/structures/custom-scheme
  3665. privileges?: Privileges;
  3666. /**
  3667. * Custom schemes to be registered with options.
  3668. */
  3669. scheme: string;
  3670. }
  3671. class Debugger extends NodeEventEmitter {
  3672. // Docs: https://electronjs.org/docs/api/debugger
  3673. /**
  3674. * Emitted when the debugging session is terminated. This happens either when
  3675. * `webContents` is closed or devtools is invoked for the attached `webContents`.
  3676. */
  3677. on(event: 'detach', listener: (event: Event,
  3678. /**
  3679. * Reason for detaching debugger.
  3680. */
  3681. reason: string) => void): this;
  3682. once(event: 'detach', listener: (event: Event,
  3683. /**
  3684. * Reason for detaching debugger.
  3685. */
  3686. reason: string) => void): this;
  3687. addListener(event: 'detach', listener: (event: Event,
  3688. /**
  3689. * Reason for detaching debugger.
  3690. */
  3691. reason: string) => void): this;
  3692. removeListener(event: 'detach', listener: (event: Event,
  3693. /**
  3694. * Reason for detaching debugger.
  3695. */
  3696. reason: string) => void): this;
  3697. /**
  3698. * Emitted whenever the debugging target issues an instrumentation event.
  3699. */
  3700. on(event: 'message', listener: (event: Event,
  3701. /**
  3702. * Method name.
  3703. */
  3704. method: string,
  3705. /**
  3706. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3707. * protocol.
  3708. */
  3709. params: any,
  3710. /**
  3711. * Unique identifier of attached debugging session, will match the value sent from
  3712. * `debugger.sendCommand`.
  3713. */
  3714. sessionId: string) => void): this;
  3715. once(event: 'message', listener: (event: Event,
  3716. /**
  3717. * Method name.
  3718. */
  3719. method: string,
  3720. /**
  3721. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3722. * protocol.
  3723. */
  3724. params: any,
  3725. /**
  3726. * Unique identifier of attached debugging session, will match the value sent from
  3727. * `debugger.sendCommand`.
  3728. */
  3729. sessionId: string) => void): this;
  3730. addListener(event: 'message', listener: (event: Event,
  3731. /**
  3732. * Method name.
  3733. */
  3734. method: string,
  3735. /**
  3736. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3737. * protocol.
  3738. */
  3739. params: any,
  3740. /**
  3741. * Unique identifier of attached debugging session, will match the value sent from
  3742. * `debugger.sendCommand`.
  3743. */
  3744. sessionId: string) => void): this;
  3745. removeListener(event: 'message', listener: (event: Event,
  3746. /**
  3747. * Method name.
  3748. */
  3749. method: string,
  3750. /**
  3751. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3752. * protocol.
  3753. */
  3754. params: any,
  3755. /**
  3756. * Unique identifier of attached debugging session, will match the value sent from
  3757. * `debugger.sendCommand`.
  3758. */
  3759. sessionId: string) => void): this;
  3760. /**
  3761. * Attaches the debugger to the `webContents`.
  3762. */
  3763. attach(protocolVersion?: string): void;
  3764. /**
  3765. * Detaches the debugger from the `webContents`.
  3766. */
  3767. detach(): void;
  3768. /**
  3769. * Whether a debugger is attached to the `webContents`.
  3770. */
  3771. isAttached(): boolean;
  3772. /**
  3773. * A promise that resolves with the response defined by the 'returns' attribute of
  3774. * the command description in the remote debugging protocol or is rejected
  3775. * indicating the failure of the command.
  3776. *
  3777. Send given command to the debugging target.
  3778. */
  3779. sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
  3780. }
  3781. interface DesktopCapturer {
  3782. // Docs: https://electronjs.org/docs/api/desktop-capturer
  3783. /**
  3784. * Resolves with an array of `DesktopCapturerSource` objects, each
  3785. * `DesktopCapturerSource` represents a screen or an individual window that can be
  3786. * captured.
  3787. *
  3788. * **Note** Capturing the screen contents requires user consent on macOS 10.15
  3789. * Catalina or higher, which can detected by
  3790. * `systemPreferences.getMediaAccessStatus`.
  3791. */
  3792. getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
  3793. }
  3794. interface DesktopCapturerSource {
  3795. // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
  3796. /**
  3797. * An icon image of the application that owns the window or null if the source has
  3798. * a type screen. The size of the icon is not known in advance and depends on what
  3799. * the application provides.
  3800. */
  3801. appIcon: NativeImage;
  3802. /**
  3803. * A unique identifier that will correspond to the `id` of the matching Display
  3804. * returned by the Screen API. On some platforms, this is equivalent to the `XX`
  3805. * portion of the `id` field above and on others it will differ. It will be an
  3806. * empty string if not available.
  3807. */
  3808. display_id: string;
  3809. /**
  3810. * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
  3811. * constraint when calling [`navigator.webkitGetUserMedia`]. The format of the
  3812. * identifier will be `window:XX:YY` or `screen:ZZ:0`. XX is the windowID/handle.
  3813. * YY is 1 for the current process, and 0 for all others. ZZ is a sequential number
  3814. * that represents the screen, and it does not equal to the index in the source's
  3815. * name.
  3816. */
  3817. id: string;
  3818. /**
  3819. * A screen source will be named either `Entire Screen` or `Screen <index>`, while
  3820. * the name of a window source will match the window title.
  3821. */
  3822. name: string;
  3823. /**
  3824. * A thumbnail image. **Note:** There is no guarantee that the size of the
  3825. * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
  3826. * to `desktopCapturer.getSources`. The actual size depends on the scale of the
  3827. * screen or window.
  3828. */
  3829. thumbnail: NativeImage;
  3830. }
  3831. interface Dialog {
  3832. // Docs: https://electronjs.org/docs/api/dialog
  3833. /**
  3834. * resolves when the certificate trust dialog is shown.
  3835. *
  3836. * On macOS, this displays a modal dialog that shows a message and certificate
  3837. * information, and gives the user the option of trusting/importing the
  3838. * certificate. If you provide a `browserWindow` argument the dialog will be
  3839. * attached to the parent window, making it modal.
  3840. *
  3841. * On Windows the options are more limited, due to the Win32 APIs used:
  3842. *
  3843. * * The `message` argument is not used, as the OS provides its own confirmation
  3844. * dialog.
  3845. * * The `browserWindow` argument is ignored since it is not possible to make this
  3846. * confirmation dialog modal.
  3847. *
  3848. * @platform darwin,win32
  3849. */
  3850. showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
  3851. /**
  3852. * resolves when the certificate trust dialog is shown.
  3853. *
  3854. * On macOS, this displays a modal dialog that shows a message and certificate
  3855. * information, and gives the user the option of trusting/importing the
  3856. * certificate. If you provide a `browserWindow` argument the dialog will be
  3857. * attached to the parent window, making it modal.
  3858. *
  3859. * On Windows the options are more limited, due to the Win32 APIs used:
  3860. *
  3861. * * The `message` argument is not used, as the OS provides its own confirmation
  3862. * dialog.
  3863. * * The `browserWindow` argument is ignored since it is not possible to make this
  3864. * confirmation dialog modal.
  3865. *
  3866. * @platform darwin,win32
  3867. */
  3868. showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
  3869. /**
  3870. * Displays a modal dialog that shows an error message.
  3871. *
  3872. * This API can be called safely before the `ready` event the `app` module emits,
  3873. * it is usually used to report errors in early stage of startup. If called before
  3874. * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
  3875. * dialog will appear.
  3876. */
  3877. showErrorBox(title: string, content: string): void;
  3878. /**
  3879. * resolves with a promise containing the following properties:
  3880. *
  3881. * * `response` Number - The index of the clicked button.
  3882. * * `checkboxChecked` Boolean - The checked state of the checkbox if
  3883. * `checkboxLabel` was set. Otherwise `false`.
  3884. *
  3885. * Shows a message box.
  3886. *
  3887. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3888. * window, making it modal.
  3889. */
  3890. showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  3891. /**
  3892. * resolves with a promise containing the following properties:
  3893. *
  3894. * * `response` Number - The index of the clicked button.
  3895. * * `checkboxChecked` Boolean - The checked state of the checkbox if
  3896. * `checkboxLabel` was set. Otherwise `false`.
  3897. *
  3898. * Shows a message box.
  3899. *
  3900. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3901. * window, making it modal.
  3902. */
  3903. showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  3904. /**
  3905. * the index of the clicked button.
  3906. *
  3907. * Shows a message box, it will block the process until the message box is closed.
  3908. * It returns the index of the clicked button.
  3909. *
  3910. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3911. * window, making it modal. If `browserWindow` is not shown dialog will not be
  3912. * attached to it. In such case it will be displayed as an independent window.
  3913. */
  3914. showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
  3915. /**
  3916. * the index of the clicked button.
  3917. *
  3918. * Shows a message box, it will block the process until the message box is closed.
  3919. * It returns the index of the clicked button.
  3920. *
  3921. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3922. * window, making it modal. If `browserWindow` is not shown dialog will not be
  3923. * attached to it. In such case it will be displayed as an independent window.
  3924. */
  3925. showMessageBoxSync(options: MessageBoxSyncOptions): number;
  3926. /**
  3927. * Resolve with an object containing the following:
  3928. *
  3929. * * `canceled` Boolean - whether or not the dialog was canceled.
  3930. * * `filePaths` String[] - An array of file paths chosen by the user. If the
  3931. * dialog is cancelled this will be an empty array.
  3932. * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
  3933. * `filePaths` array of base64 encoded strings which contains security scoped
  3934. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  3935. * populated. (For return values, see table here.)
  3936. *
  3937. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3938. * window, making it modal.
  3939. *
  3940. * The `filters` specifies an array of file types that can be displayed or selected
  3941. * when you want to limit the user to a specific type. For example:
  3942. *
  3943. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  3944. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  3945. * `'*'` wildcard (no other wildcard is supported).
  3946. *
  3947. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  3948. * and a directory selector, so if you set `properties` to `['openFile',
  3949. * 'openDirectory']` on these platforms, a directory selector will be shown.
  3950. */
  3951. showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  3952. /**
  3953. * Resolve with an object containing the following:
  3954. *
  3955. * * `canceled` Boolean - whether or not the dialog was canceled.
  3956. * * `filePaths` String[] - An array of file paths chosen by the user. If the
  3957. * dialog is cancelled this will be an empty array.
  3958. * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
  3959. * `filePaths` array of base64 encoded strings which contains security scoped
  3960. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  3961. * populated. (For return values, see table here.)
  3962. *
  3963. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3964. * window, making it modal.
  3965. *
  3966. * The `filters` specifies an array of file types that can be displayed or selected
  3967. * when you want to limit the user to a specific type. For example:
  3968. *
  3969. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  3970. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  3971. * `'*'` wildcard (no other wildcard is supported).
  3972. *
  3973. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  3974. * and a directory selector, so if you set `properties` to `['openFile',
  3975. * 'openDirectory']` on these platforms, a directory selector will be shown.
  3976. */
  3977. showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  3978. /**
  3979. * the file paths chosen by the user; if the dialog is cancelled it returns
  3980. * `undefined`.
  3981. *
  3982. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3983. * window, making it modal.
  3984. *
  3985. * The `filters` specifies an array of file types that can be displayed or selected
  3986. * when you want to limit the user to a specific type. For example:
  3987. *
  3988. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  3989. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  3990. * `'*'` wildcard (no other wildcard is supported).
  3991. *
  3992. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  3993. * and a directory selector, so if you set `properties` to `['openFile',
  3994. * 'openDirectory']` on these platforms, a directory selector will be shown.
  3995. */
  3996. showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
  3997. /**
  3998. * the file paths chosen by the user; if the dialog is cancelled it returns
  3999. * `undefined`.
  4000. *
  4001. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4002. * window, making it modal.
  4003. *
  4004. * The `filters` specifies an array of file types that can be displayed or selected
  4005. * when you want to limit the user to a specific type. For example:
  4006. *
  4007. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  4008. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  4009. * `'*'` wildcard (no other wildcard is supported).
  4010. *
  4011. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  4012. * and a directory selector, so if you set `properties` to `['openFile',
  4013. * 'openDirectory']` on these platforms, a directory selector will be shown.
  4014. */
  4015. showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
  4016. /**
  4017. * Resolve with an object containing the following:
  4018. *
  4019. * * `canceled` Boolean - whether or not the dialog was canceled.
  4020. * * `filePath` String (optional) - If the dialog is canceled, this will be
  4021. * `undefined`.
  4022. * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
  4023. * contains the security scoped bookmark data for the saved file.
  4024. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  4025. * values, see table here.)
  4026. *
  4027. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4028. * window, making it modal.
  4029. *
  4030. * The `filters` specifies an array of file types that can be displayed, see
  4031. * `dialog.showOpenDialog` for an example.
  4032. *
  4033. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  4034. * issues when expanding and collapsing the dialog.
  4035. */
  4036. showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  4037. /**
  4038. * Resolve with an object containing the following:
  4039. *
  4040. * * `canceled` Boolean - whether or not the dialog was canceled.
  4041. * * `filePath` String (optional) - If the dialog is canceled, this will be
  4042. * `undefined`.
  4043. * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
  4044. * contains the security scoped bookmark data for the saved file.
  4045. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  4046. * values, see table here.)
  4047. *
  4048. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4049. * window, making it modal.
  4050. *
  4051. * The `filters` specifies an array of file types that can be displayed, see
  4052. * `dialog.showOpenDialog` for an example.
  4053. *
  4054. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  4055. * issues when expanding and collapsing the dialog.
  4056. */
  4057. showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  4058. /**
  4059. * the path of the file chosen by the user; if the dialog is cancelled it returns
  4060. * `undefined`.
  4061. *
  4062. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4063. * window, making it modal.
  4064. *
  4065. * The `filters` specifies an array of file types that can be displayed, see
  4066. * `dialog.showOpenDialog` for an example.
  4067. */
  4068. showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
  4069. /**
  4070. * the path of the file chosen by the user; if the dialog is cancelled it returns
  4071. * `undefined`.
  4072. *
  4073. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4074. * window, making it modal.
  4075. *
  4076. * The `filters` specifies an array of file types that can be displayed, see
  4077. * `dialog.showOpenDialog` for an example.
  4078. */
  4079. showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
  4080. }
  4081. interface Display {
  4082. // Docs: https://electronjs.org/docs/api/structures/display
  4083. /**
  4084. * Can be `available`, `unavailable`, `unknown`.
  4085. */
  4086. accelerometerSupport: ('available' | 'unavailable' | 'unknown');
  4087. /**
  4088. * the bounds of the display in DIP points.
  4089. */
  4090. bounds: Rectangle;
  4091. /**
  4092. * The number of bits per pixel.
  4093. */
  4094. colorDepth: number;
  4095. /**
  4096. * represent a color space (three-dimensional object which contains all realizable
  4097. * color combinations) for the purpose of color conversions
  4098. */
  4099. colorSpace: string;
  4100. /**
  4101. * The number of bits per color component.
  4102. */
  4103. depthPerComponent: number;
  4104. /**
  4105. * The display refresh rate.
  4106. */
  4107. displayFrequency: number;
  4108. /**
  4109. * Unique identifier associated with the display.
  4110. */
  4111. id: number;
  4112. /**
  4113. * `true` for an internal display and `false` for an external display
  4114. */
  4115. internal: boolean;
  4116. /**
  4117. * Whether or not the display is a monochrome display.
  4118. */
  4119. monochrome: boolean;
  4120. /**
  4121. * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
  4122. */
  4123. rotation: number;
  4124. /**
  4125. * Output device's pixel scale factor.
  4126. */
  4127. scaleFactor: number;
  4128. size: Size;
  4129. /**
  4130. * Can be `available`, `unavailable`, `unknown`.
  4131. */
  4132. touchSupport: ('available' | 'unavailable' | 'unknown');
  4133. /**
  4134. * the work area of the display in DIP points.
  4135. */
  4136. workArea: Rectangle;
  4137. workAreaSize: Size;
  4138. }
  4139. class Dock {
  4140. // Docs: https://electronjs.org/docs/api/dock
  4141. /**
  4142. * an ID representing the request.
  4143. *
  4144. * When `critical` is passed, the dock icon will bounce until either the
  4145. * application becomes active or the request is canceled.
  4146. *
  4147. * When `informational` is passed, the dock icon will bounce for one second.
  4148. * However, the request remains active until either the application becomes active
  4149. * or the request is canceled.
  4150. *
  4151. * **Nota Bene:** This method can only be used while the app is not focused; when
  4152. * the app is focused it will return -1.
  4153. *
  4154. * @platform darwin
  4155. */
  4156. bounce(type?: 'critical' | 'informational'): number;
  4157. /**
  4158. * Cancel the bounce of `id`.
  4159. *
  4160. * @platform darwin
  4161. */
  4162. cancelBounce(id: number): void;
  4163. /**
  4164. * Bounces the Downloads stack if the filePath is inside the Downloads folder.
  4165. *
  4166. * @platform darwin
  4167. */
  4168. downloadFinished(filePath: string): void;
  4169. /**
  4170. * The badge string of the dock.
  4171. *
  4172. * @platform darwin
  4173. */
  4174. getBadge(): string;
  4175. /**
  4176. * The application's [dock menu][dock-menu].
  4177. *
  4178. * @platform darwin
  4179. */
  4180. getMenu(): (Menu) | (null);
  4181. /**
  4182. * Hides the dock icon.
  4183. *
  4184. * @platform darwin
  4185. */
  4186. hide(): void;
  4187. /**
  4188. * Whether the dock icon is visible.
  4189. *
  4190. * @platform darwin
  4191. */
  4192. isVisible(): boolean;
  4193. /**
  4194. * Sets the string to be displayed in the dock’s badging area.
  4195. *
  4196. * @platform darwin
  4197. */
  4198. setBadge(text: string): void;
  4199. /**
  4200. * Sets the `image` associated with this dock icon.
  4201. *
  4202. * @platform darwin
  4203. */
  4204. setIcon(image: (NativeImage) | (string)): void;
  4205. /**
  4206. * Sets the application's [dock menu][dock-menu].
  4207. *
  4208. * @platform darwin
  4209. */
  4210. setMenu(menu: Menu): void;
  4211. /**
  4212. * Resolves when the dock icon is shown.
  4213. *
  4214. * @platform darwin
  4215. */
  4216. show(): Promise<void>;
  4217. }
  4218. class DownloadItem extends NodeEventEmitter {
  4219. // Docs: https://electronjs.org/docs/api/download-item
  4220. /**
  4221. * Emitted when the download is in a terminal state. This includes a completed
  4222. * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
  4223. * download that can't be resumed.
  4224. *
  4225. * The `state` can be one of following:
  4226. *
  4227. * * `completed` - The download completed successfully.
  4228. * * `cancelled` - The download has been cancelled.
  4229. * * `interrupted` - The download has interrupted and can not resume.
  4230. */
  4231. on(event: 'done', listener: (event: Event,
  4232. /**
  4233. * Can be `completed`, `cancelled` or `interrupted`.
  4234. */
  4235. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4236. once(event: 'done', listener: (event: Event,
  4237. /**
  4238. * Can be `completed`, `cancelled` or `interrupted`.
  4239. */
  4240. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4241. addListener(event: 'done', listener: (event: Event,
  4242. /**
  4243. * Can be `completed`, `cancelled` or `interrupted`.
  4244. */
  4245. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4246. removeListener(event: 'done', listener: (event: Event,
  4247. /**
  4248. * Can be `completed`, `cancelled` or `interrupted`.
  4249. */
  4250. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4251. /**
  4252. * Emitted when the download has been updated and is not done.
  4253. *
  4254. * The `state` can be one of following:
  4255. *
  4256. * * `progressing` - The download is in-progress.
  4257. * * `interrupted` - The download has interrupted and can be resumed.
  4258. */
  4259. on(event: 'updated', listener: (event: Event,
  4260. /**
  4261. * Can be `progressing` or `interrupted`.
  4262. */
  4263. state: ('progressing' | 'interrupted')) => void): this;
  4264. once(event: 'updated', listener: (event: Event,
  4265. /**
  4266. * Can be `progressing` or `interrupted`.
  4267. */
  4268. state: ('progressing' | 'interrupted')) => void): this;
  4269. addListener(event: 'updated', listener: (event: Event,
  4270. /**
  4271. * Can be `progressing` or `interrupted`.
  4272. */
  4273. state: ('progressing' | 'interrupted')) => void): this;
  4274. removeListener(event: 'updated', listener: (event: Event,
  4275. /**
  4276. * Can be `progressing` or `interrupted`.
  4277. */
  4278. state: ('progressing' | 'interrupted')) => void): this;
  4279. /**
  4280. * Cancels the download operation.
  4281. */
  4282. cancel(): void;
  4283. /**
  4284. * Whether the download can resume.
  4285. */
  4286. canResume(): boolean;
  4287. /**
  4288. * The Content-Disposition field from the response header.
  4289. */
  4290. getContentDisposition(): string;
  4291. /**
  4292. * ETag header value.
  4293. */
  4294. getETag(): string;
  4295. /**
  4296. * The file name of the download item.
  4297. *
  4298. * **Note:** The file name is not always the same as the actual one saved in local
  4299. * disk. If user changes the file name in a prompted download saving dialog, the
  4300. * actual name of saved file will be different.
  4301. */
  4302. getFilename(): string;
  4303. /**
  4304. * Last-Modified header value.
  4305. */
  4306. getLastModifiedTime(): string;
  4307. /**
  4308. * The files mime type.
  4309. */
  4310. getMimeType(): string;
  4311. /**
  4312. * The received bytes of the download item.
  4313. */
  4314. getReceivedBytes(): number;
  4315. /**
  4316. * Returns the object previously set by
  4317. * `downloadItem.setSaveDialogOptions(options)`.
  4318. */
  4319. getSaveDialogOptions(): SaveDialogOptions;
  4320. /**
  4321. * The save path of the download item. This will be either the path set via
  4322. * `downloadItem.setSavePath(path)` or the path selected from the shown save
  4323. * dialog.
  4324. */
  4325. getSavePath(): string;
  4326. /**
  4327. * Number of seconds since the UNIX epoch when the download was started.
  4328. */
  4329. getStartTime(): number;
  4330. /**
  4331. * The current state. Can be `progressing`, `completed`, `cancelled` or
  4332. * `interrupted`.
  4333. *
  4334. * **Note:** The following methods are useful specifically to resume a `cancelled`
  4335. * item when session is restarted.
  4336. */
  4337. getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
  4338. /**
  4339. * The total size in bytes of the download item.
  4340. *
  4341. If the size is unknown, it returns 0.
  4342. */
  4343. getTotalBytes(): number;
  4344. /**
  4345. * The origin URL where the item is downloaded from.
  4346. */
  4347. getURL(): string;
  4348. /**
  4349. * The complete URL chain of the item including any redirects.
  4350. */
  4351. getURLChain(): string[];
  4352. /**
  4353. * Whether the download has user gesture.
  4354. */
  4355. hasUserGesture(): boolean;
  4356. /**
  4357. * Whether the download is paused.
  4358. */
  4359. isPaused(): boolean;
  4360. /**
  4361. * Pauses the download.
  4362. */
  4363. pause(): void;
  4364. /**
  4365. * Resumes the download that has been paused.
  4366. *
  4367. * **Note:** To enable resumable downloads the server you are downloading from must
  4368. * support range requests and provide both `Last-Modified` and `ETag` header
  4369. * values. Otherwise `resume()` will dismiss previously received bytes and restart
  4370. * the download from the beginning.
  4371. */
  4372. resume(): void;
  4373. /**
  4374. * This API allows the user to set custom options for the save dialog that opens
  4375. * for the download item by default. The API is only available in session's
  4376. * `will-download` callback function.
  4377. */
  4378. setSaveDialogOptions(options: SaveDialogOptions): void;
  4379. /**
  4380. * The API is only available in session's `will-download` callback function. If
  4381. * `path` doesn't exist, Electron will try to make the directory recursively. If
  4382. * user doesn't set the save path via the API, Electron will use the original
  4383. * routine to determine the save path; this usually prompts a save dialog.
  4384. */
  4385. setSavePath(path: string): void;
  4386. savePath: string;
  4387. }
  4388. interface Event extends GlobalEvent {
  4389. // Docs: https://electronjs.org/docs/api/structures/event
  4390. preventDefault: (() => void);
  4391. }
  4392. interface Extension {
  4393. // Docs: https://electronjs.org/docs/api/structures/extension
  4394. id: string;
  4395. /**
  4396. * Copy of the extension's manifest data.
  4397. */
  4398. manifest: any;
  4399. name: string;
  4400. /**
  4401. * The extension's file path.
  4402. */
  4403. path: string;
  4404. /**
  4405. * The extension's `chrome-extension://` URL.
  4406. */
  4407. url: string;
  4408. version: string;
  4409. }
  4410. interface ExtensionInfo {
  4411. // Docs: https://electronjs.org/docs/api/structures/extension-info
  4412. name: string;
  4413. version: string;
  4414. }
  4415. interface FileFilter {
  4416. // Docs: https://electronjs.org/docs/api/structures/file-filter
  4417. extensions: string[];
  4418. name: string;
  4419. }
  4420. interface FilePathWithHeaders {
  4421. // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
  4422. /**
  4423. * Additional headers to be sent.
  4424. */
  4425. headers?: Record<string, string>;
  4426. /**
  4427. * The path to the file to send.
  4428. */
  4429. path: string;
  4430. }
  4431. interface GlobalShortcut {
  4432. // Docs: https://electronjs.org/docs/api/global-shortcut
  4433. /**
  4434. * Whether this application has registered `accelerator`.
  4435. *
  4436. * When the accelerator is already taken by other applications, this call will
  4437. * still return `false`. This behavior is intended by operating systems, since they
  4438. * don't want applications to fight for global shortcuts.
  4439. */
  4440. isRegistered(accelerator: Accelerator): boolean;
  4441. /**
  4442. * Whether or not the shortcut was registered successfully.
  4443. *
  4444. * Registers a global shortcut of `accelerator`. The `callback` is called when the
  4445. * registered shortcut is pressed by the user.
  4446. *
  4447. * When the accelerator is already taken by other applications, this call will
  4448. * silently fail. This behavior is intended by operating systems, since they don't
  4449. * want applications to fight for global shortcuts.
  4450. *
  4451. * The following accelerators will not be registered successfully on macOS 10.14
  4452. * Mojave unless the app has been authorized as a trusted accessibility client:
  4453. *
  4454. * * "Media Play/Pause"
  4455. * * "Media Next Track"
  4456. * "Media Previous Track"
  4457. * "Media Stop"
  4458. */
  4459. register(accelerator: Accelerator, callback: () => void): boolean;
  4460. /**
  4461. * Registers a global shortcut of all `accelerator` items in `accelerators`. The
  4462. * `callback` is called when any of the registered shortcuts are pressed by the
  4463. * user.
  4464. *
  4465. * When a given accelerator is already taken by other applications, this call will
  4466. * silently fail. This behavior is intended by operating systems, since they don't
  4467. * want applications to fight for global shortcuts.
  4468. *
  4469. * The following accelerators will not be registered successfully on macOS 10.14
  4470. * Mojave unless the app has been authorized as a trusted accessibility client:
  4471. *
  4472. * * "Media Play/Pause"
  4473. * * "Media Next Track"
  4474. * "Media Previous Track"
  4475. * "Media Stop"
  4476. */
  4477. registerAll(accelerators: string[], callback: () => void): void;
  4478. /**
  4479. * Unregisters the global shortcut of `accelerator`.
  4480. */
  4481. unregister(accelerator: Accelerator): void;
  4482. /**
  4483. * Unregisters all of the global shortcuts.
  4484. */
  4485. unregisterAll(): void;
  4486. }
  4487. interface GPUFeatureStatus {
  4488. // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
  4489. /**
  4490. * Canvas.
  4491. */
  4492. '2d_canvas': string;
  4493. /**
  4494. * Flash.
  4495. */
  4496. flash_3d: string;
  4497. /**
  4498. * Flash Stage3D.
  4499. */
  4500. flash_stage3d: string;
  4501. /**
  4502. * Flash Stage3D Baseline profile.
  4503. */
  4504. flash_stage3d_baseline: string;
  4505. /**
  4506. * Compositing.
  4507. */
  4508. gpu_compositing: string;
  4509. /**
  4510. * Multiple Raster Threads.
  4511. */
  4512. multiple_raster_threads: string;
  4513. /**
  4514. * Native GpuMemoryBuffers.
  4515. */
  4516. native_gpu_memory_buffers: string;
  4517. /**
  4518. * Rasterization.
  4519. */
  4520. rasterization: string;
  4521. /**
  4522. * Video Decode.
  4523. */
  4524. video_decode: string;
  4525. /**
  4526. * Video Encode.
  4527. */
  4528. video_encode: string;
  4529. /**
  4530. * VPx Video Decode.
  4531. */
  4532. vpx_decode: string;
  4533. /**
  4534. * WebGL.
  4535. */
  4536. webgl: string;
  4537. /**
  4538. * WebGL2.
  4539. */
  4540. webgl2: string;
  4541. }
  4542. interface InAppPurchase extends NodeJS.EventEmitter {
  4543. // Docs: https://electronjs.org/docs/api/in-app-purchase
  4544. on(event: 'transactions-updated', listener: Function): this;
  4545. once(event: 'transactions-updated', listener: Function): this;
  4546. addListener(event: 'transactions-updated', listener: Function): this;
  4547. removeListener(event: 'transactions-updated', listener: Function): this;
  4548. /**
  4549. * whether a user can make a payment.
  4550. */
  4551. canMakePayments(): boolean;
  4552. /**
  4553. * Completes all pending transactions.
  4554. */
  4555. finishAllTransactions(): void;
  4556. /**
  4557. * Completes the pending transactions corresponding to the date.
  4558. */
  4559. finishTransactionByDate(date: string): void;
  4560. /**
  4561. * Resolves with an array of `Product` objects.
  4562. *
  4563. Retrieves the product descriptions.
  4564. */
  4565. getProducts(productIDs: string[]): Promise<Electron.Product[]>;
  4566. /**
  4567. * the path to the receipt.
  4568. */
  4569. getReceiptURL(): string;
  4570. /**
  4571. * Returns `true` if the product is valid and added to the payment queue.
  4572. *
  4573. * You should listen for the `transactions-updated` event as soon as possible and
  4574. * certainly before you call `purchaseProduct`.
  4575. */
  4576. purchaseProduct(productID: string, quantity?: number): Promise<boolean>;
  4577. /**
  4578. * Restores finished transactions. This method can be called either to install
  4579. * purchases on additional devices, or to restore purchases for an application that
  4580. * the user deleted and reinstalled.
  4581. *
  4582. * The payment queue delivers a new transaction for each previously completed
  4583. * transaction that can be restored. Each transaction includes a copy of the
  4584. * original transaction.
  4585. */
  4586. restoreCompletedTransactions(): void;
  4587. }
  4588. class IncomingMessage extends NodeEventEmitter {
  4589. // Docs: https://electronjs.org/docs/api/incoming-message
  4590. /**
  4591. * Emitted when a request has been canceled during an ongoing HTTP transaction.
  4592. */
  4593. on(event: 'aborted', listener: Function): this;
  4594. once(event: 'aborted', listener: Function): this;
  4595. addListener(event: 'aborted', listener: Function): this;
  4596. removeListener(event: 'aborted', listener: Function): this;
  4597. /**
  4598. * The `data` event is the usual method of transferring response data into
  4599. * applicative code.
  4600. */
  4601. on(event: 'data', listener: (
  4602. /**
  4603. * A chunk of response body's data.
  4604. */
  4605. chunk: Buffer) => void): this;
  4606. once(event: 'data', listener: (
  4607. /**
  4608. * A chunk of response body's data.
  4609. */
  4610. chunk: Buffer) => void): this;
  4611. addListener(event: 'data', listener: (
  4612. /**
  4613. * A chunk of response body's data.
  4614. */
  4615. chunk: Buffer) => void): this;
  4616. removeListener(event: 'data', listener: (
  4617. /**
  4618. * A chunk of response body's data.
  4619. */
  4620. chunk: Buffer) => void): this;
  4621. /**
  4622. * Indicates that response body has ended. Must be placed before 'data' event.
  4623. */
  4624. on(event: 'end', listener: Function): this;
  4625. once(event: 'end', listener: Function): this;
  4626. addListener(event: 'end', listener: Function): this;
  4627. removeListener(event: 'end', listener: Function): this;
  4628. /**
  4629. * Returns:
  4630. *
  4631. * `error` Error - Typically holds an error string identifying failure root cause.
  4632. *
  4633. * Emitted when an error was encountered while streaming response data events. For
  4634. * instance, if the server closes the underlying while the response is still
  4635. * streaming, an `error` event will be emitted on the response object and a `close`
  4636. * event will subsequently follow on the request object.
  4637. */
  4638. on(event: 'error', listener: Function): this;
  4639. once(event: 'error', listener: Function): this;
  4640. addListener(event: 'error', listener: Function): this;
  4641. removeListener(event: 'error', listener: Function): this;
  4642. headers: Record<string, (string) | (string[])>;
  4643. httpVersion: string;
  4644. httpVersionMajor: number;
  4645. httpVersionMinor: number;
  4646. statusCode: number;
  4647. statusMessage: string;
  4648. }
  4649. interface InputEvent {
  4650. // Docs: https://electronjs.org/docs/api/structures/input-event
  4651. /**
  4652. * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
  4653. * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
  4654. * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
  4655. */
  4656. modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
  4657. }
  4658. interface IOCounters {
  4659. // Docs: https://electronjs.org/docs/api/structures/io-counters
  4660. /**
  4661. * Then number of I/O other operations.
  4662. */
  4663. otherOperationCount: number;
  4664. /**
  4665. * Then number of I/O other transfers.
  4666. */
  4667. otherTransferCount: number;
  4668. /**
  4669. * The number of I/O read operations.
  4670. */
  4671. readOperationCount: number;
  4672. /**
  4673. * The number of I/O read transfers.
  4674. */
  4675. readTransferCount: number;
  4676. /**
  4677. * The number of I/O write operations.
  4678. */
  4679. writeOperationCount: number;
  4680. /**
  4681. * The number of I/O write transfers.
  4682. */
  4683. writeTransferCount: number;
  4684. }
  4685. interface IpcMain extends NodeJS.EventEmitter {
  4686. // Docs: https://electronjs.org/docs/api/ipc-main
  4687. /**
  4688. * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
  4689. * renderer calls `ipcRenderer.invoke(channel, ...args)`.
  4690. *
  4691. * If `listener` returns a Promise, the eventual result of the promise will be
  4692. * returned as a reply to the remote caller. Otherwise, the return value of the
  4693. * listener will be used as the value of the reply.
  4694. *
  4695. * The `event` that is passed as the first argument to the handler is the same as
  4696. * that passed to a regular event listener. It includes information about which
  4697. * WebContents is the source of the invoke request.
  4698. *
  4699. * Errors thrown through `handle` in the main process are not transparent as they
  4700. * are serialized and only the `message` property from the original error is
  4701. * provided to the renderer process. Please refer to #24427 for details.
  4702. */
  4703. handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
  4704. /**
  4705. * Handles a single `invoke`able IPC message, then removes the listener. See
  4706. * `ipcMain.handle(channel, listener)`.
  4707. */
  4708. handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
  4709. /**
  4710. * Listens to `channel`, when a new message arrives `listener` would be called with
  4711. * `listener(event, args...)`.
  4712. */
  4713. on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  4714. /**
  4715. * Adds a one time `listener` function for the event. This `listener` is invoked
  4716. * only the next time a message is sent to `channel`, after which it is removed.
  4717. */
  4718. once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  4719. /**
  4720. * Removes listeners of the specified `channel`.
  4721. */
  4722. removeAllListeners(channel?: string): this;
  4723. /**
  4724. * Removes any handler for `channel`, if present.
  4725. */
  4726. removeHandler(channel: string): void;
  4727. /**
  4728. * Removes the specified `listener` from the listener array for the specified
  4729. * `channel`.
  4730. */
  4731. removeListener(channel: string, listener: (...args: any[]) => void): this;
  4732. }
  4733. interface IpcMainEvent extends Event {
  4734. // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
  4735. /**
  4736. * The ID of the renderer frame that sent this message
  4737. */
  4738. frameId: number;
  4739. /**
  4740. * A list of MessagePorts that were transferred with this message
  4741. */
  4742. ports: MessagePortMain[];
  4743. /**
  4744. * The internal ID of the renderer process that sent this message
  4745. */
  4746. processId: number;
  4747. /**
  4748. * A function that will send an IPC message to the renderer frame that sent the
  4749. * original message that you are currently handling. You should use this method to
  4750. * "reply" to the sent message in order to guarantee the reply will go to the
  4751. * correct process and frame.
  4752. */
  4753. reply: Function;
  4754. /**
  4755. * Set this to the value to be returned in a synchronous message
  4756. */
  4757. returnValue: any;
  4758. /**
  4759. * Returns the `webContents` that sent the message
  4760. */
  4761. sender: WebContents;
  4762. /**
  4763. * The frame that sent this message
  4764. *
  4765. */
  4766. readonly senderFrame: WebFrameMain;
  4767. }
  4768. interface IpcMainInvokeEvent extends Event {
  4769. // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
  4770. /**
  4771. * The ID of the renderer frame that sent this message
  4772. */
  4773. frameId: number;
  4774. /**
  4775. * The internal ID of the renderer process that sent this message
  4776. */
  4777. processId: number;
  4778. /**
  4779. * Returns the `webContents` that sent the message
  4780. */
  4781. sender: WebContents;
  4782. /**
  4783. * The frame that sent this message
  4784. *
  4785. */
  4786. readonly senderFrame: WebFrameMain;
  4787. }
  4788. interface IpcRenderer extends NodeJS.EventEmitter {
  4789. // Docs: https://electronjs.org/docs/api/ipc-renderer
  4790. /**
  4791. * Resolves with the response from the main process.
  4792. *
  4793. * Send a message to the main process via `channel` and expect a result
  4794. * asynchronously. Arguments will be serialized with the Structured Clone
  4795. * Algorithm, just like `window.postMessage`, so prototype chains will not be
  4796. * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
  4797. * an exception.
  4798. *
  4799. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  4800. * Electron objects will throw an exception.
  4801. *
  4802. * Since the main process does not have support for DOM objects such as
  4803. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  4804. * Electron's IPC to the main process, as the main process would have no way to
  4805. * decode them. Attempting to send such objects over IPC will result in an error.
  4806. *
  4807. * The main process should listen for `channel` with `ipcMain.handle()`.
  4808. *
  4809. * For example:
  4810. *
  4811. * If you need to transfer a `MessagePort` to the main process, use
  4812. * `ipcRenderer.postMessage`.
  4813. *
  4814. * If you do not need a response to the message, consider using `ipcRenderer.send`.
  4815. */
  4816. invoke(channel: string, ...args: any[]): Promise<any>;
  4817. /**
  4818. * Listens to `channel`, when a new message arrives `listener` would be called with
  4819. * `listener(event, args...)`.
  4820. */
  4821. on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  4822. /**
  4823. * Adds a one time `listener` function for the event. This `listener` is invoked
  4824. * only the next time a message is sent to `channel`, after which it is removed.
  4825. */
  4826. once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  4827. /**
  4828. * Send a message to the main process, optionally transferring ownership of zero or
  4829. * more `MessagePort` objects.
  4830. *
  4831. * The transferred `MessagePort` objects will be available in the main process as
  4832. * `MessagePortMain` objects by accessing the `ports` property of the emitted
  4833. * event.
  4834. *
  4835. * For example:
  4836. *
  4837. * For more information on using `MessagePort` and `MessageChannel`, see the MDN
  4838. * documentation.
  4839. */
  4840. postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
  4841. /**
  4842. * Removes all listeners, or those of the specified `channel`.
  4843. */
  4844. removeAllListeners(channel: string): this;
  4845. /**
  4846. * Removes the specified `listener` from the listener array for the specified
  4847. * `channel`.
  4848. */
  4849. removeListener(channel: string, listener: (...args: any[]) => void): this;
  4850. /**
  4851. * Send an asynchronous message to the main process via `channel`, along with
  4852. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  4853. * just like `window.postMessage`, so prototype chains will not be included.
  4854. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  4855. * exception.
  4856. *
  4857. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  4858. * Electron objects will throw an exception.
  4859. *
  4860. * Since the main process does not have support for DOM objects such as
  4861. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  4862. * Electron's IPC to the main process, as the main process would have no way to
  4863. * decode them. Attempting to send such objects over IPC will result in an error.
  4864. *
  4865. * The main process handles it by listening for `channel` with the `ipcMain`
  4866. * module.
  4867. *
  4868. * If you need to transfer a `MessagePort` to the main process, use
  4869. * `ipcRenderer.postMessage`.
  4870. *
  4871. * If you want to receive a single response from the main process, like the result
  4872. * of a method call, consider using `ipcRenderer.invoke`.
  4873. */
  4874. send(channel: string, ...args: any[]): void;
  4875. /**
  4876. * The value sent back by the `ipcMain` handler.
  4877. *
  4878. * Send a message to the main process via `channel` and expect a result
  4879. * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
  4880. * just like `window.postMessage`, so prototype chains will not be included.
  4881. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  4882. * exception.
  4883. *
  4884. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  4885. * Electron objects will throw an exception.
  4886. *
  4887. * Since the main process does not have support for DOM objects such as
  4888. * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
  4889. * Electron's IPC to the main process, as the main process would have no way to
  4890. * decode them. Attempting to send such objects over IPC will result in an error.
  4891. *
  4892. * The main process handles it by listening for `channel` with `ipcMain` module,
  4893. * and replies by setting `event.returnValue`.
  4894. *
  4895. * > :warning: **WARNING**: Sending a synchronous message will block the whole
  4896. * renderer process until the reply is received, so use this method only as a last
  4897. * resort. It's much better to use the asynchronous version, `invoke()`.
  4898. */
  4899. sendSync(channel: string, ...args: any[]): any;
  4900. /**
  4901. * Sends a message to a window with `webContentsId` via `channel`.
  4902. */
  4903. sendTo(webContentsId: number, channel: string, ...args: any[]): void;
  4904. /**
  4905. * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
  4906. * the host page instead of the main process.
  4907. */
  4908. sendToHost(channel: string, ...args: any[]): void;
  4909. }
  4910. interface IpcRendererEvent extends Event {
  4911. // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
  4912. /**
  4913. * A list of MessagePorts that were transferred with this message
  4914. */
  4915. ports: MessagePort[];
  4916. /**
  4917. * The `IpcRenderer` instance that emitted the event originally
  4918. */
  4919. sender: IpcRenderer;
  4920. /**
  4921. * The `webContents.id` that sent the message, you can call
  4922. * `event.sender.sendTo(event.senderId, ...)` to reply to the message, see
  4923. * ipcRenderer.sendTo for more information. This only applies to messages sent from
  4924. * a different renderer. Messages sent directly from the main process set
  4925. * `event.senderId` to `0`.
  4926. */
  4927. senderId: number;
  4928. }
  4929. interface JumpListCategory {
  4930. // Docs: https://electronjs.org/docs/api/structures/jump-list-category
  4931. /**
  4932. * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
  4933. * should be omitted.
  4934. */
  4935. items?: JumpListItem[];
  4936. /**
  4937. * Must be set if `type` is `custom`, otherwise it should be omitted.
  4938. */
  4939. name?: string;
  4940. /**
  4941. * One of the following:
  4942. */
  4943. type?: ('tasks' | 'frequent' | 'recent' | 'custom');
  4944. }
  4945. interface JumpListItem {
  4946. // Docs: https://electronjs.org/docs/api/structures/jump-list-item
  4947. /**
  4948. * The command line arguments when `program` is executed. Should only be set if
  4949. * `type` is `task`.
  4950. */
  4951. args?: string;
  4952. /**
  4953. * Description of the task (displayed in a tooltip). Should only be set if `type`
  4954. * is `task`. Maximum length 260 characters.
  4955. */
  4956. description?: string;
  4957. /**
  4958. * The index of the icon in the resource file. If a resource file contains multiple
  4959. * icons this value can be used to specify the zero-based index of the icon that
  4960. * should be displayed for this task. If a resource file contains only one icon,
  4961. * this property should be set to zero.
  4962. */
  4963. iconIndex?: number;
  4964. /**
  4965. * The absolute path to an icon to be displayed in a Jump List, which can be an
  4966. * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
  4967. * can usually specify `process.execPath` to show the program icon.
  4968. */
  4969. iconPath?: string;
  4970. /**
  4971. * Path of the file to open, should only be set if `type` is `file`.
  4972. */
  4973. path?: string;
  4974. /**
  4975. * Path of the program to execute, usually you should specify `process.execPath`
  4976. * which opens the current program. Should only be set if `type` is `task`.
  4977. */
  4978. program?: string;
  4979. /**
  4980. * The text to be displayed for the item in the Jump List. Should only be set if
  4981. * `type` is `task`.
  4982. */
  4983. title?: string;
  4984. /**
  4985. * One of the following:
  4986. */
  4987. type?: ('task' | 'separator' | 'file');
  4988. /**
  4989. * The working directory. Default is empty.
  4990. */
  4991. workingDirectory?: string;
  4992. }
  4993. interface KeyboardEvent {
  4994. // Docs: https://electronjs.org/docs/api/structures/keyboard-event
  4995. /**
  4996. * whether an Alt key was used in an accelerator to trigger the Event
  4997. */
  4998. altKey?: boolean;
  4999. /**
  5000. * whether the Control key was used in an accelerator to trigger the Event
  5001. */
  5002. ctrlKey?: boolean;
  5003. /**
  5004. * whether a meta key was used in an accelerator to trigger the Event
  5005. */
  5006. metaKey?: boolean;
  5007. /**
  5008. * whether a Shift key was used in an accelerator to trigger the Event
  5009. */
  5010. shiftKey?: boolean;
  5011. /**
  5012. * whether an accelerator was used to trigger the event as opposed to another user
  5013. * gesture like mouse click
  5014. */
  5015. triggeredByAccelerator?: boolean;
  5016. }
  5017. interface KeyboardInputEvent extends InputEvent {
  5018. // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
  5019. /**
  5020. * The character that will be sent as the keyboard event. Should only use the valid
  5021. * key codes in Accelerator.
  5022. */
  5023. keyCode: string;
  5024. /**
  5025. * The type of the event, can be `keyDown`, `keyUp` or `char`.
  5026. */
  5027. type: ('keyDown' | 'keyUp' | 'char');
  5028. }
  5029. interface MemoryInfo {
  5030. // Docs: https://electronjs.org/docs/api/structures/memory-info
  5031. /**
  5032. * The maximum amount of memory that has ever been pinned to actual physical RAM.
  5033. */
  5034. peakWorkingSetSize: number;
  5035. /**
  5036. * The amount of memory not shared by other processes, such as JS heap or HTML
  5037. * content.
  5038. *
  5039. * @platform win32
  5040. */
  5041. privateBytes?: number;
  5042. /**
  5043. * The amount of memory currently pinned to actual physical RAM.
  5044. */
  5045. workingSetSize: number;
  5046. }
  5047. interface MemoryUsageDetails {
  5048. // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
  5049. count: number;
  5050. liveSize: number;
  5051. size: number;
  5052. }
  5053. class Menu {
  5054. // Docs: https://electronjs.org/docs/api/menu
  5055. /**
  5056. * Emitted when a popup is closed either manually or with `menu.closePopup()`.
  5057. */
  5058. on(event: 'menu-will-close', listener: (event: Event) => void): this;
  5059. once(event: 'menu-will-close', listener: (event: Event) => void): this;
  5060. addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  5061. removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  5062. /**
  5063. * Emitted when `menu.popup()` is called.
  5064. */
  5065. on(event: 'menu-will-show', listener: (event: Event) => void): this;
  5066. once(event: 'menu-will-show', listener: (event: Event) => void): this;
  5067. addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  5068. removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  5069. /**
  5070. * Menu
  5071. */
  5072. constructor();
  5073. /**
  5074. * Generally, the `template` is an array of `options` for constructing a MenuItem.
  5075. * The usage can be referenced above.
  5076. *
  5077. * You can also attach other fields to the element of the `template` and they will
  5078. * become properties of the constructed menu items.
  5079. */
  5080. static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
  5081. /**
  5082. * The application menu, if set, or `null`, if not set.
  5083. *
  5084. * **Note:** The returned `Menu` instance doesn't support dynamic addition or
  5085. * removal of menu items. Instance properties can still be dynamically modified.
  5086. */
  5087. static getApplicationMenu(): (Menu) | (null);
  5088. /**
  5089. * Sends the `action` to the first responder of application. This is used for
  5090. * emulating default macOS menu behaviors. Usually you would use the `role`
  5091. * property of a `MenuItem`.
  5092. *
  5093. * See the macOS Cocoa Event Handling Guide for more information on macOS' native
  5094. * actions.
  5095. *
  5096. * @platform darwin
  5097. */
  5098. static sendActionToFirstResponder(action: string): void;
  5099. /**
  5100. * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
  5101. * will be set as each window's top menu.
  5102. *
  5103. * Also on Windows and Linux, you can use a `&` in the top-level item name to
  5104. * indicate which letter should get a generated accelerator. For example, using
  5105. * `&File` for the file menu would result in a generated `Alt-F` accelerator that
  5106. * opens the associated menu. The indicated character in the button label then gets
  5107. * an underline, and the `&` character is not displayed on the button label.
  5108. *
  5109. * In order to escape the `&` character in an item name, add a proceeding `&`. For
  5110. * example, `&&File` would result in `&File` displayed on the button label.
  5111. *
  5112. * Passing `null` will suppress the default menu. On Windows and Linux, this has
  5113. * the additional effect of removing the menu bar from the window.
  5114. *
  5115. * **Note:** The default menu will be created automatically if the app does not set
  5116. * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
  5117. * `Help`.
  5118. */
  5119. static setApplicationMenu(menu: (Menu) | (null)): void;
  5120. /**
  5121. * Appends the `menuItem` to the menu.
  5122. */
  5123. append(menuItem: MenuItem): void;
  5124. /**
  5125. * Closes the context menu in the `browserWindow`.
  5126. */
  5127. closePopup(browserWindow?: BrowserWindow): void;
  5128. /**
  5129. * the item with the specified `id`
  5130. */
  5131. getMenuItemById(id: string): (MenuItem) | (null);
  5132. /**
  5133. * Inserts the `menuItem` to the `pos` position of the menu.
  5134. */
  5135. insert(pos: number, menuItem: MenuItem): void;
  5136. /**
  5137. * Pops up this menu as a context menu in the `BrowserWindow`.
  5138. */
  5139. popup(options?: PopupOptions): void;
  5140. items: MenuItem[];
  5141. }
  5142. class MenuItem {
  5143. // Docs: https://electronjs.org/docs/api/menu-item
  5144. /**
  5145. * MenuItem
  5146. */
  5147. constructor(options: MenuItemConstructorOptions);
  5148. accelerator?: Accelerator;
  5149. checked: boolean;
  5150. click: Function;
  5151. commandId: number;
  5152. enabled: boolean;
  5153. icon?: (NativeImage) | (string);
  5154. id: string;
  5155. label: string;
  5156. menu: Menu;
  5157. registerAccelerator: boolean;
  5158. role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  5159. sharingItem: SharingItem;
  5160. sublabel: string;
  5161. submenu?: Menu;
  5162. toolTip: string;
  5163. type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  5164. visible: boolean;
  5165. }
  5166. class MessageChannelMain extends NodeEventEmitter {
  5167. // Docs: https://electronjs.org/docs/api/message-channel-main
  5168. port1: MessagePortMain;
  5169. port2: MessagePortMain;
  5170. }
  5171. class MessagePortMain extends NodeEventEmitter {
  5172. // Docs: https://electronjs.org/docs/api/message-port-main
  5173. /**
  5174. * Emitted when the remote end of a MessagePortMain object becomes disconnected.
  5175. */
  5176. on(event: 'close', listener: Function): this;
  5177. once(event: 'close', listener: Function): this;
  5178. addListener(event: 'close', listener: Function): this;
  5179. removeListener(event: 'close', listener: Function): this;
  5180. /**
  5181. * Emitted when a MessagePortMain object receives a message.
  5182. */
  5183. on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5184. once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5185. addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5186. removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5187. /**
  5188. * Disconnects the port, so it is no longer active.
  5189. */
  5190. close(): void;
  5191. /**
  5192. * Sends a message from the port, and optionally, transfers ownership of objects to
  5193. * other browsing contexts.
  5194. */
  5195. postMessage(message: any, transfer?: MessagePortMain[]): void;
  5196. /**
  5197. * Starts the sending of messages queued on the port. Messages will be queued until
  5198. * this method is called.
  5199. */
  5200. start(): void;
  5201. }
  5202. interface MimeTypedBuffer {
  5203. // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
  5204. /**
  5205. * Charset of the buffer.
  5206. */
  5207. charset?: string;
  5208. /**
  5209. * The actual Buffer content.
  5210. */
  5211. data: Buffer;
  5212. /**
  5213. * MIME type of the buffer.
  5214. */
  5215. mimeType?: string;
  5216. }
  5217. interface MouseInputEvent extends InputEvent {
  5218. // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
  5219. /**
  5220. * The button pressed, can be `left`, `middle`, `right`.
  5221. */
  5222. button?: ('left' | 'middle' | 'right');
  5223. clickCount?: number;
  5224. globalX?: number;
  5225. globalY?: number;
  5226. movementX?: number;
  5227. movementY?: number;
  5228. /**
  5229. * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
  5230. * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
  5231. */
  5232. type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
  5233. x: number;
  5234. y: number;
  5235. }
  5236. interface MouseWheelInputEvent extends MouseInputEvent {
  5237. // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
  5238. accelerationRatioX?: number;
  5239. accelerationRatioY?: number;
  5240. canScroll?: boolean;
  5241. deltaX?: number;
  5242. deltaY?: number;
  5243. hasPreciseScrollingDeltas?: boolean;
  5244. /**
  5245. * The type of the event, can be `mouseWheel`.
  5246. */
  5247. type: ('mouseWheel');
  5248. wheelTicksX?: number;
  5249. wheelTicksY?: number;
  5250. }
  5251. class NativeImage {
  5252. // Docs: https://electronjs.org/docs/api/native-image
  5253. /**
  5254. * Creates an empty `NativeImage` instance.
  5255. */
  5256. static createEmpty(): NativeImage;
  5257. /**
  5258. * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
  5259. * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
  5260. */
  5261. static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
  5262. /**
  5263. * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
  5264. * JPEG first.
  5265. */
  5266. static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
  5267. /**
  5268. * Creates a new `NativeImage` instance from `dataURL`.
  5269. */
  5270. static createFromDataURL(dataURL: string): NativeImage;
  5271. /**
  5272. * Creates a new `NativeImage` instance from the NSImage that maps to the given
  5273. * image name. See `System Icons` for a list of possible values.
  5274. *
  5275. * The `hslShift` is applied to the image with the following rules:
  5276. *
  5277. * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
  5278. * and 360 on the hue color wheel (red).
  5279. * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
  5280. * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
  5281. * saturate the image.
  5282. * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
  5283. * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
  5284. * leave unchanged. 1 = full lightness (make all pixels white).
  5285. *
  5286. * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
  5287. * 0]` will make the image completely black.
  5288. *
  5289. * In some cases, the `NSImageName` doesn't match its string representation; one
  5290. * example of this is `NSFolderImageName`, whose string representation would
  5291. * actually be `NSFolder`. Therefore, you'll need to determine the correct string
  5292. * representation for your image before passing it in. This can be done with the
  5293. * following:
  5294. *
  5295. * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
  5296. * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
  5297. *
  5298. where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
  5299. *
  5300. * @platform darwin
  5301. */
  5302. static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
  5303. /**
  5304. * Creates a new `NativeImage` instance from a file located at `path`. This method
  5305. * returns an empty image if the `path` does not exist, cannot be read, or is not a
  5306. * valid image.
  5307. */
  5308. static createFromPath(path: string): NativeImage;
  5309. /**
  5310. * fulfilled with the file's thumbnail preview image, which is a NativeImage.
  5311. *
  5312. * @platform darwin,win32
  5313. */
  5314. static createThumbnailFromPath(path: string, maxSize: Size): Promise<Electron.NativeImage>;
  5315. /**
  5316. * Add an image representation for a specific scale factor. This can be used to
  5317. * explicitly add different scale factor representations to an image. This can be
  5318. * called on empty images.
  5319. */
  5320. addRepresentation(options: AddRepresentationOptions): void;
  5321. /**
  5322. * The cropped image.
  5323. */
  5324. crop(rect: Rectangle): NativeImage;
  5325. /**
  5326. * The image's aspect ratio.
  5327. *
  5328. * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
  5329. * the image representation most closely matching the passed value.
  5330. */
  5331. getAspectRatio(scaleFactor?: number): number;
  5332. /**
  5333. * A Buffer that contains the image's raw bitmap pixel data.
  5334. *
  5335. * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
  5336. * not copy the bitmap data, so you have to use the returned Buffer immediately in
  5337. * current event loop tick; otherwise the data might be changed or destroyed.
  5338. */
  5339. getBitmap(options?: BitmapOptions): Buffer;
  5340. /**
  5341. * A Buffer that stores C pointer to underlying native handle of the image. On
  5342. * macOS, a pointer to `NSImage` instance would be returned.
  5343. *
  5344. * Notice that the returned pointer is a weak pointer to the underlying native
  5345. * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
  5346. * instance is kept around.
  5347. *
  5348. * @platform darwin
  5349. */
  5350. getNativeHandle(): Buffer;
  5351. /**
  5352. * An array of all scale factors corresponding to representations for a given
  5353. * nativeImage.
  5354. */
  5355. getScaleFactors(): number[];
  5356. /**
  5357. * If `scaleFactor` is passed, this will return the size corresponding to the image
  5358. * representation most closely matching the passed value.
  5359. */
  5360. getSize(scaleFactor?: number): Size;
  5361. /**
  5362. * Whether the image is empty.
  5363. */
  5364. isEmpty(): boolean;
  5365. /**
  5366. * Whether the image is a template image.
  5367. */
  5368. isTemplateImage(): boolean;
  5369. /**
  5370. * The resized image.
  5371. *
  5372. * If only the `height` or the `width` are specified then the current aspect ratio
  5373. * will be preserved in the resized image.
  5374. */
  5375. resize(options: ResizeOptions): NativeImage;
  5376. /**
  5377. * Marks the image as a template image.
  5378. */
  5379. setTemplateImage(option: boolean): void;
  5380. /**
  5381. * A Buffer that contains a copy of the image's raw bitmap pixel data.
  5382. */
  5383. toBitmap(options?: ToBitmapOptions): Buffer;
  5384. /**
  5385. * The data URL of the image.
  5386. */
  5387. toDataURL(options?: ToDataURLOptions): string;
  5388. /**
  5389. * A Buffer that contains the image's `JPEG` encoded data.
  5390. */
  5391. toJPEG(quality: number): Buffer;
  5392. /**
  5393. * A Buffer that contains the image's `PNG` encoded data.
  5394. */
  5395. toPNG(options?: ToPNGOptions): Buffer;
  5396. isMacTemplateImage: boolean;
  5397. }
  5398. interface NativeTheme extends NodeJS.EventEmitter {
  5399. // Docs: https://electronjs.org/docs/api/native-theme
  5400. /**
  5401. * Emitted when something in the underlying NativeTheme has changed. This normally
  5402. * means that either the value of `shouldUseDarkColors`,
  5403. * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
  5404. * will have to check them to determine which one has changed.
  5405. */
  5406. on(event: 'updated', listener: Function): this;
  5407. once(event: 'updated', listener: Function): this;
  5408. addListener(event: 'updated', listener: Function): this;
  5409. removeListener(event: 'updated', listener: Function): this;
  5410. /**
  5411. * A `Boolean` for if the OS / Chromium currently has a dark mode enabled or is
  5412. * being instructed to show a dark-style UI. If you want to modify this value you
  5413. * should use `themeSource` below.
  5414. *
  5415. */
  5416. readonly shouldUseDarkColors: boolean;
  5417. /**
  5418. * A `Boolean` for if the OS / Chromium currently has high-contrast mode enabled or
  5419. * is being instructed to show a high-contrast UI.
  5420. *
  5421. * @platform darwin,win32
  5422. */
  5423. readonly shouldUseHighContrastColors: boolean;
  5424. /**
  5425. * A `Boolean` for if the OS / Chromium currently has an inverted color scheme or
  5426. * is being instructed to use an inverted color scheme.
  5427. *
  5428. * @platform darwin,win32
  5429. */
  5430. readonly shouldUseInvertedColorScheme: boolean;
  5431. /**
  5432. * A `String` property that can be `system`, `light` or `dark`. It is used to
  5433. * override and supersede the value that Chromium has chosen to use internally.
  5434. *
  5435. * Setting this property to `system` will remove the override and everything will
  5436. * be reset to the OS default. By default `themeSource` is `system`.
  5437. *
  5438. * Settings this property to `dark` will have the following effects:
  5439. *
  5440. * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
  5441. * * Any UI Electron renders on Linux and Windows including context menus,
  5442. * devtools, etc. will use the dark UI.
  5443. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  5444. * the dark UI.
  5445. * * The `prefers-color-scheme` CSS query will match `dark` mode.
  5446. * * The `updated` event will be emitted
  5447. *
  5448. * Settings this property to `light` will have the following effects:
  5449. *
  5450. * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
  5451. * * Any UI Electron renders on Linux and Windows including context menus,
  5452. * devtools, etc. will use the light UI.
  5453. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  5454. * the light UI.
  5455. * * The `prefers-color-scheme` CSS query will match `light` mode.
  5456. * * The `updated` event will be emitted
  5457. *
  5458. * The usage of this property should align with a classic "dark mode" state machine
  5459. * in your application where the user has three options.
  5460. *
  5461. * * `Follow OS` --> `themeSource = 'system'`
  5462. * * `Dark Mode` --> `themeSource = 'dark'`
  5463. * * `Light Mode` --> `themeSource = 'light'`
  5464. *
  5465. * Your application should then always use `shouldUseDarkColors` to determine what
  5466. * CSS to apply.
  5467. */
  5468. themeSource: ('system' | 'light' | 'dark');
  5469. }
  5470. interface Net {
  5471. // Docs: https://electronjs.org/docs/api/net
  5472. /**
  5473. * Whether there is currently internet connection.
  5474. *
  5475. * A return value of `false` is a pretty strong indicator that the user won't be
  5476. * able to connect to remote sites. However, a return value of `true` is
  5477. * inconclusive; even if some link is up, it is uncertain whether a particular
  5478. * connection attempt to a particular remote site will be successful.
  5479. */
  5480. isOnline(): boolean;
  5481. /**
  5482. * Creates a `ClientRequest` instance using the provided `options` which are
  5483. * directly forwarded to the `ClientRequest` constructor. The `net.request` method
  5484. * would be used to issue both secure and insecure HTTP requests according to the
  5485. * specified protocol scheme in the `options` object.
  5486. */
  5487. request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
  5488. /**
  5489. * A `Boolean` property. Whether there is currently internet connection.
  5490. *
  5491. * A return value of `false` is a pretty strong indicator that the user won't be
  5492. * able to connect to remote sites. However, a return value of `true` is
  5493. * inconclusive; even if some link is up, it is uncertain whether a particular
  5494. * connection attempt to a particular remote site will be successful.
  5495. *
  5496. */
  5497. readonly online: boolean;
  5498. }
  5499. interface NetLog {
  5500. // Docs: https://electronjs.org/docs/api/net-log
  5501. /**
  5502. * resolves when the net log has begun recording.
  5503. *
  5504. Starts recording network events to `path`.
  5505. */
  5506. startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
  5507. /**
  5508. * resolves when the net log has been flushed to disk.
  5509. *
  5510. * Stops recording network events. If not called, net logging will automatically
  5511. * end when app quits.
  5512. */
  5513. stopLogging(): Promise<void>;
  5514. /**
  5515. * A `Boolean` property that indicates whether network logs are currently being
  5516. * recorded.
  5517. *
  5518. */
  5519. readonly currentlyLogging: boolean;
  5520. }
  5521. interface NewWindowWebContentsEvent extends Event {
  5522. // Docs: https://electronjs.org/docs/api/structures/new-window-web-contents-event
  5523. newGuest?: BrowserWindow;
  5524. }
  5525. class Notification extends NodeEventEmitter {
  5526. // Docs: https://electronjs.org/docs/api/notification
  5527. on(event: 'action', listener: (event: Event,
  5528. /**
  5529. * The index of the action that was activated.
  5530. */
  5531. index: number) => void): this;
  5532. once(event: 'action', listener: (event: Event,
  5533. /**
  5534. * The index of the action that was activated.
  5535. */
  5536. index: number) => void): this;
  5537. addListener(event: 'action', listener: (event: Event,
  5538. /**
  5539. * The index of the action that was activated.
  5540. */
  5541. index: number) => void): this;
  5542. removeListener(event: 'action', listener: (event: Event,
  5543. /**
  5544. * The index of the action that was activated.
  5545. */
  5546. index: number) => void): this;
  5547. /**
  5548. * Emitted when the notification is clicked by the user.
  5549. */
  5550. on(event: 'click', listener: (event: Event) => void): this;
  5551. once(event: 'click', listener: (event: Event) => void): this;
  5552. addListener(event: 'click', listener: (event: Event) => void): this;
  5553. removeListener(event: 'click', listener: (event: Event) => void): this;
  5554. /**
  5555. * Emitted when the notification is closed by manual intervention from the user.
  5556. *
  5557. * This event is not guaranteed to be emitted in all cases where the notification
  5558. * is closed.
  5559. */
  5560. on(event: 'close', listener: (event: Event) => void): this;
  5561. once(event: 'close', listener: (event: Event) => void): this;
  5562. addListener(event: 'close', listener: (event: Event) => void): this;
  5563. removeListener(event: 'close', listener: (event: Event) => void): this;
  5564. /**
  5565. * Emitted when an error is encountered while creating and showing the native
  5566. * notification.
  5567. *
  5568. * @platform win32
  5569. */
  5570. on(event: 'failed', listener: (event: Event,
  5571. /**
  5572. * The error encountered during execution of the `show()` method.
  5573. */
  5574. error: string) => void): this;
  5575. once(event: 'failed', listener: (event: Event,
  5576. /**
  5577. * The error encountered during execution of the `show()` method.
  5578. */
  5579. error: string) => void): this;
  5580. addListener(event: 'failed', listener: (event: Event,
  5581. /**
  5582. * The error encountered during execution of the `show()` method.
  5583. */
  5584. error: string) => void): this;
  5585. removeListener(event: 'failed', listener: (event: Event,
  5586. /**
  5587. * The error encountered during execution of the `show()` method.
  5588. */
  5589. error: string) => void): this;
  5590. /**
  5591. * Emitted when the user clicks the "Reply" button on a notification with
  5592. * `hasReply: true`.
  5593. *
  5594. * @platform darwin
  5595. */
  5596. on(event: 'reply', listener: (event: Event,
  5597. /**
  5598. * The string the user entered into the inline reply field.
  5599. */
  5600. reply: string) => void): this;
  5601. once(event: 'reply', listener: (event: Event,
  5602. /**
  5603. * The string the user entered into the inline reply field.
  5604. */
  5605. reply: string) => void): this;
  5606. addListener(event: 'reply', listener: (event: Event,
  5607. /**
  5608. * The string the user entered into the inline reply field.
  5609. */
  5610. reply: string) => void): this;
  5611. removeListener(event: 'reply', listener: (event: Event,
  5612. /**
  5613. * The string the user entered into the inline reply field.
  5614. */
  5615. reply: string) => void): this;
  5616. /**
  5617. * Emitted when the notification is shown to the user, note this could be fired
  5618. * multiple times as a notification can be shown multiple times through the
  5619. * `show()` method.
  5620. */
  5621. on(event: 'show', listener: (event: Event) => void): this;
  5622. once(event: 'show', listener: (event: Event) => void): this;
  5623. addListener(event: 'show', listener: (event: Event) => void): this;
  5624. removeListener(event: 'show', listener: (event: Event) => void): this;
  5625. /**
  5626. * Notification
  5627. */
  5628. constructor(options?: NotificationConstructorOptions);
  5629. /**
  5630. * Whether or not desktop notifications are supported on the current system
  5631. */
  5632. static isSupported(): boolean;
  5633. /**
  5634. * Dismisses the notification.
  5635. */
  5636. close(): void;
  5637. /**
  5638. * Immediately shows the notification to the user, please note this means unlike
  5639. * the HTML5 Notification implementation, instantiating a `new Notification` does
  5640. * not immediately show it to the user, you need to call this method before the OS
  5641. * will display it.
  5642. *
  5643. * If the notification has been shown before, this method will dismiss the
  5644. * previously shown notification and create a new one with identical properties.
  5645. */
  5646. show(): void;
  5647. actions: NotificationAction[];
  5648. body: string;
  5649. closeButtonText: string;
  5650. hasReply: boolean;
  5651. replyPlaceholder: string;
  5652. silent: boolean;
  5653. sound: string;
  5654. subtitle: string;
  5655. timeoutType: ('default' | 'never');
  5656. title: string;
  5657. toastXml: string;
  5658. urgency: ('normal' | 'critical' | 'low');
  5659. }
  5660. interface NotificationAction {
  5661. // Docs: https://electronjs.org/docs/api/structures/notification-action
  5662. /**
  5663. * The label for the given action.
  5664. */
  5665. text?: string;
  5666. /**
  5667. * The type of action, can be `button`.
  5668. */
  5669. type: ('button');
  5670. }
  5671. interface NotificationResponse {
  5672. // Docs: https://electronjs.org/docs/api/structures/notification-response
  5673. /**
  5674. * The identifier string of the action that the user selected.
  5675. */
  5676. actionIdentifier: string;
  5677. /**
  5678. * The delivery date of the notification.
  5679. */
  5680. date: number;
  5681. /**
  5682. * The unique identifier for this notification request.
  5683. */
  5684. identifier: string;
  5685. /**
  5686. * A dictionary of custom information associated with the notification.
  5687. */
  5688. userInfo: Record<string, any>;
  5689. /**
  5690. * The text entered or chosen by the user.
  5691. */
  5692. userText?: string;
  5693. }
  5694. interface Point {
  5695. // Docs: https://electronjs.org/docs/api/structures/point
  5696. x: number;
  5697. y: number;
  5698. }
  5699. interface PostBody {
  5700. // Docs: https://electronjs.org/docs/api/structures/post-body
  5701. /**
  5702. * The boundary used to separate multiple parts of the message. Only valid when
  5703. * `contentType` is `multipart/form-data`.
  5704. */
  5705. boundary?: string;
  5706. /**
  5707. * The `content-type` header used for the data. One of
  5708. * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
  5709. * `enctype` attribute of the submitted HTML form.
  5710. */
  5711. contentType: string;
  5712. /**
  5713. * The post data to be sent to the new window.
  5714. */
  5715. data: Array<(UploadRawData) | (UploadFile)>;
  5716. }
  5717. interface PowerMonitor extends NodeJS.EventEmitter {
  5718. // Docs: https://electronjs.org/docs/api/power-monitor
  5719. /**
  5720. * Emitted when the system is about to lock the screen.
  5721. *
  5722. * @platform darwin,win32
  5723. */
  5724. on(event: 'lock-screen', listener: Function): this;
  5725. once(event: 'lock-screen', listener: Function): this;
  5726. addListener(event: 'lock-screen', listener: Function): this;
  5727. removeListener(event: 'lock-screen', listener: Function): this;
  5728. /**
  5729. * Emitted when the system changes to AC power.
  5730. *
  5731. * @platform darwin,win32
  5732. */
  5733. on(event: 'on-ac', listener: Function): this;
  5734. once(event: 'on-ac', listener: Function): this;
  5735. addListener(event: 'on-ac', listener: Function): this;
  5736. removeListener(event: 'on-ac', listener: Function): this;
  5737. /**
  5738. * Emitted when system changes to battery power.
  5739. *
  5740. * @platform darwin
  5741. */
  5742. on(event: 'on-battery', listener: Function): this;
  5743. once(event: 'on-battery', listener: Function): this;
  5744. addListener(event: 'on-battery', listener: Function): this;
  5745. removeListener(event: 'on-battery', listener: Function): this;
  5746. /**
  5747. * Emitted when system is resuming.
  5748. *
  5749. * @platform darwin,win32
  5750. */
  5751. on(event: 'resume', listener: Function): this;
  5752. once(event: 'resume', listener: Function): this;
  5753. addListener(event: 'resume', listener: Function): this;
  5754. removeListener(event: 'resume', listener: Function): this;
  5755. /**
  5756. * Emitted when the system is about to reboot or shut down. If the event handler
  5757. * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
  5758. * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
  5759. * should exit as soon as possible by calling something like `app.quit()`.
  5760. *
  5761. * @platform linux,darwin
  5762. */
  5763. on(event: 'shutdown', listener: Function): this;
  5764. once(event: 'shutdown', listener: Function): this;
  5765. addListener(event: 'shutdown', listener: Function): this;
  5766. removeListener(event: 'shutdown', listener: Function): this;
  5767. /**
  5768. * Emitted when the system is suspending.
  5769. *
  5770. * @platform darwin,win32
  5771. */
  5772. on(event: 'suspend', listener: Function): this;
  5773. once(event: 'suspend', listener: Function): this;
  5774. addListener(event: 'suspend', listener: Function): this;
  5775. removeListener(event: 'suspend', listener: Function): this;
  5776. /**
  5777. * Emitted as soon as the systems screen is unlocked.
  5778. *
  5779. * @platform darwin,win32
  5780. */
  5781. on(event: 'unlock-screen', listener: Function): this;
  5782. once(event: 'unlock-screen', listener: Function): this;
  5783. addListener(event: 'unlock-screen', listener: Function): this;
  5784. removeListener(event: 'unlock-screen', listener: Function): this;
  5785. /**
  5786. * Emitted when a login session is activated. See documentation for more
  5787. * information.
  5788. *
  5789. * @platform darwin
  5790. */
  5791. on(event: 'user-did-become-active', listener: Function): this;
  5792. once(event: 'user-did-become-active', listener: Function): this;
  5793. addListener(event: 'user-did-become-active', listener: Function): this;
  5794. removeListener(event: 'user-did-become-active', listener: Function): this;
  5795. /**
  5796. * Emitted when a login session is deactivated. See documentation for more
  5797. * information.
  5798. *
  5799. * @platform darwin
  5800. */
  5801. on(event: 'user-did-resign-active', listener: Function): this;
  5802. once(event: 'user-did-resign-active', listener: Function): this;
  5803. addListener(event: 'user-did-resign-active', listener: Function): this;
  5804. removeListener(event: 'user-did-resign-active', listener: Function): this;
  5805. /**
  5806. * The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
  5807. *
  5808. * Calculate the system idle state. `idleThreshold` is the amount of time (in
  5809. * seconds) before considered idle. `locked` is available on supported systems
  5810. * only.
  5811. */
  5812. getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
  5813. /**
  5814. * Idle time in seconds
  5815. Calculate system idle time in seconds.
  5816. */
  5817. getSystemIdleTime(): number;
  5818. /**
  5819. * Whether the system is on battery power.
  5820. *
  5821. * To monitor for changes in this property, use the `on-battery` and `on-ac`
  5822. * events.
  5823. */
  5824. isOnBatteryPower(): boolean;
  5825. /**
  5826. * A `Boolean` property. True if the system is on battery power.
  5827. *
  5828. See `powerMonitor.isOnBatteryPower()`.
  5829. */
  5830. onBatteryPower: boolean;
  5831. }
  5832. interface PowerSaveBlocker {
  5833. // Docs: https://electronjs.org/docs/api/power-save-blocker
  5834. /**
  5835. * Whether the corresponding `powerSaveBlocker` has started.
  5836. */
  5837. isStarted(id: number): boolean;
  5838. /**
  5839. * The blocker ID that is assigned to this power blocker.
  5840. *
  5841. * Starts preventing the system from entering lower-power mode. Returns an integer
  5842. * identifying the power save blocker.
  5843. *
  5844. * **Note:** `prevent-display-sleep` has higher precedence over
  5845. * `prevent-app-suspension`. Only the highest precedence type takes effect. In
  5846. * other words, `prevent-display-sleep` always takes precedence over
  5847. * `prevent-app-suspension`.
  5848. *
  5849. * For example, an API calling A requests for `prevent-app-suspension`, and another
  5850. * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
  5851. * used until B stops its request. After that, `prevent-app-suspension` is used.
  5852. */
  5853. start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
  5854. /**
  5855. * Stops the specified power save blocker.
  5856. */
  5857. stop(id: number): void;
  5858. }
  5859. interface PrinterInfo {
  5860. // Docs: https://electronjs.org/docs/api/structures/printer-info
  5861. /**
  5862. * a longer description of the printer's type.
  5863. */
  5864. description: string;
  5865. /**
  5866. * the name of the printer as shown in Print Preview.
  5867. */
  5868. displayName: string;
  5869. /**
  5870. * whether or not a given printer is set as the default printer on the OS.
  5871. */
  5872. isDefault: boolean;
  5873. /**
  5874. * the name of the printer as understood by the OS.
  5875. */
  5876. name: string;
  5877. /**
  5878. * an object containing a variable number of platform-specific printer information.
  5879. */
  5880. options: Options;
  5881. /**
  5882. * the current status of the printer.
  5883. */
  5884. status: number;
  5885. }
  5886. interface ProcessMemoryInfo {
  5887. // Docs: https://electronjs.org/docs/api/structures/process-memory-info
  5888. /**
  5889. * The amount of memory not shared by other processes, such as JS heap or HTML
  5890. * content in Kilobytes.
  5891. */
  5892. private: number;
  5893. /**
  5894. * The amount of memory currently pinned to actual physical RAM in Kilobytes.
  5895. *
  5896. * @platform linux,win32
  5897. */
  5898. residentSet: number;
  5899. /**
  5900. * The amount of memory shared between processes, typically memory consumed by the
  5901. * Electron code itself in Kilobytes.
  5902. */
  5903. shared: number;
  5904. }
  5905. interface ProcessMetric {
  5906. // Docs: https://electronjs.org/docs/api/structures/process-metric
  5907. /**
  5908. * CPU usage of the process.
  5909. */
  5910. cpu: CPUUsage;
  5911. /**
  5912. * Creation time for this process. The time is represented as number of
  5913. * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
  5914. * is useful to use both the `pid` and the `creationTime` to uniquely identify a
  5915. * process.
  5916. */
  5917. creationTime: number;
  5918. /**
  5919. * One of the following values:
  5920. *
  5921. * @platform win32
  5922. */
  5923. integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
  5924. /**
  5925. * Memory information for the process.
  5926. */
  5927. memory: MemoryInfo;
  5928. /**
  5929. * The name of the process. Examples for utility: `Audio Service`, `Content
  5930. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  5931. */
  5932. name?: string;
  5933. /**
  5934. * Process id of the process.
  5935. */
  5936. pid: number;
  5937. /**
  5938. * Whether the process is sandboxed on OS level.
  5939. *
  5940. * @platform darwin,win32
  5941. */
  5942. sandboxed?: boolean;
  5943. /**
  5944. * The non-localized name of the process.
  5945. */
  5946. serviceName?: string;
  5947. /**
  5948. * Process type. One of the following values:
  5949. */
  5950. type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  5951. }
  5952. interface Product {
  5953. // Docs: https://electronjs.org/docs/api/structures/product
  5954. /**
  5955. * The total size of the content, in bytes.
  5956. */
  5957. contentLengths: number[];
  5958. /**
  5959. * A string that identifies the version of the content.
  5960. */
  5961. contentVersion: string;
  5962. /**
  5963. * 3 character code presenting a product's currency based on the ISO 4217 standard.
  5964. */
  5965. currencyCode: string;
  5966. /**
  5967. * The locale formatted price of the product.
  5968. */
  5969. formattedPrice: string;
  5970. /**
  5971. * A Boolean value that indicates whether the App Store has downloadable content
  5972. * for this product. `true` if at least one file has been associated with the
  5973. * product.
  5974. */
  5975. isDownloadable: boolean;
  5976. /**
  5977. * A description of the product.
  5978. */
  5979. localizedDescription: string;
  5980. /**
  5981. * The name of the product.
  5982. */
  5983. localizedTitle: string;
  5984. /**
  5985. * The cost of the product in the local currency.
  5986. */
  5987. price: number;
  5988. /**
  5989. * The string that identifies the product to the Apple App Store.
  5990. */
  5991. productIdentifier: string;
  5992. }
  5993. interface Protocol {
  5994. // Docs: https://electronjs.org/docs/api/protocol
  5995. /**
  5996. * Whether the protocol was successfully intercepted
  5997. *
  5998. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  5999. * which sends a `Buffer` as a response.
  6000. */
  6001. interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  6002. /**
  6003. * Whether the protocol was successfully intercepted
  6004. *
  6005. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6006. * which sends a file as a response.
  6007. */
  6008. interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6009. /**
  6010. * Whether the protocol was successfully intercepted
  6011. *
  6012. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6013. * which sends a new HTTP request as a response.
  6014. */
  6015. interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  6016. /**
  6017. * Whether the protocol was successfully intercepted
  6018. *
  6019. * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
  6020. * protocol handler.
  6021. */
  6022. interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  6023. /**
  6024. * Whether the protocol was successfully intercepted
  6025. *
  6026. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  6027. * which sends a `String` as a response.
  6028. */
  6029. interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6030. /**
  6031. * Whether `scheme` is already intercepted.
  6032. */
  6033. isProtocolIntercepted(scheme: string): boolean;
  6034. /**
  6035. * Whether `scheme` is already registered.
  6036. */
  6037. isProtocolRegistered(scheme: string): boolean;
  6038. /**
  6039. * Whether the protocol was successfully registered
  6040. *
  6041. * Registers a protocol of `scheme` that will send a `Buffer` as a response.
  6042. *
  6043. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6044. * should be called with either a `Buffer` object or an object that has the `data`
  6045. * property.
  6046. Example:
  6047. */
  6048. registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  6049. /**
  6050. * Whether the protocol was successfully registered
  6051. *
  6052. * Registers a protocol of `scheme` that will send a file as the response. The
  6053. * `handler` will be called with `request` and `callback` where `request` is an
  6054. * incoming request for the `scheme`.
  6055. *
  6056. * To handle the `request`, the `callback` should be called with either the file's
  6057. * path or an object that has a `path` property, e.g. `callback(filePath)` or
  6058. * `callback({ path: filePath })`. The `filePath` must be an absolute path.
  6059. *
  6060. * By default the `scheme` is treated like `http:`, which is parsed differently
  6061. * from protocols that follow the "generic URI syntax" like `file:`.
  6062. */
  6063. registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6064. /**
  6065. * Whether the protocol was successfully registered
  6066. *
  6067. * Registers a protocol of `scheme` that will send an HTTP request as a response.
  6068. *
  6069. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6070. * should be called with an object that has the `url` property.
  6071. */
  6072. registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  6073. /**
  6074. * **Note:** This method can only be used before the `ready` event of the `app`
  6075. * module gets emitted and can be called only once.
  6076. *
  6077. * Registers the `scheme` as standard, secure, bypasses content security policy for
  6078. * resources, allows registering ServiceWorker, supports fetch API, and streaming
  6079. * video/audio. Specify a privilege with the value of `true` to enable the
  6080. * capability.
  6081. *
  6082. * An example of registering a privileged scheme, that bypasses Content Security
  6083. * Policy:
  6084. *
  6085. * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
  6086. * `http` and `https` are standard schemes, while `file` is not.
  6087. *
  6088. * Registering a scheme as standard allows relative and absolute resources to be
  6089. * resolved correctly when served. Otherwise the scheme will behave like the `file`
  6090. * protocol, but without the ability to resolve relative URLs.
  6091. *
  6092. * For example when you load following page with custom protocol without
  6093. * registering it as standard scheme, the image will not be loaded because
  6094. * non-standard schemes can not recognize relative URLs:
  6095. *
  6096. * Registering a scheme as standard will allow access to files through the
  6097. * FileSystem API. Otherwise the renderer will throw a security error for the
  6098. * scheme.
  6099. *
  6100. * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
  6101. * cookies) are disabled for non standard schemes. So in general if you want to
  6102. * register a custom protocol to replace the `http` protocol, you have to register
  6103. * it as a standard scheme.
  6104. *
  6105. * Protocols that use streams (http and stream protocols) should set `stream:
  6106. * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
  6107. * their responses by default. The `stream` flag configures those elements to
  6108. * correctly expect streaming responses.
  6109. */
  6110. registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
  6111. /**
  6112. * Whether the protocol was successfully registered
  6113. *
  6114. * Registers a protocol of `scheme` that will send a stream as a response.
  6115. *
  6116. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6117. * should be called with either a `ReadableStream` object or an object that has the
  6118. * `data` property.
  6119. *
  6120. * Example:
  6121. *
  6122. * It is possible to pass any object that implements the readable stream API (emits
  6123. * `data`/`end`/`error` events). For example, here's how a file could be returned:
  6124. */
  6125. registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  6126. /**
  6127. * Whether the protocol was successfully registered
  6128. *
  6129. * Registers a protocol of `scheme` that will send a `String` as a response.
  6130. *
  6131. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6132. * should be called with either a `String` or an object that has the `data`
  6133. * property.
  6134. */
  6135. registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6136. /**
  6137. * Whether the protocol was successfully unintercepted
  6138. *
  6139. Remove the interceptor installed for `scheme` and restore its original handler.
  6140. */
  6141. uninterceptProtocol(scheme: string): boolean;
  6142. /**
  6143. * Whether the protocol was successfully unregistered
  6144. *
  6145. Unregisters the custom protocol of `scheme`.
  6146. */
  6147. unregisterProtocol(scheme: string): boolean;
  6148. }
  6149. interface ProtocolRequest {
  6150. // Docs: https://electronjs.org/docs/api/structures/protocol-request
  6151. headers: Record<string, string>;
  6152. method: string;
  6153. referrer: string;
  6154. uploadData?: UploadData[];
  6155. url: string;
  6156. }
  6157. interface ProtocolResponse {
  6158. // Docs: https://electronjs.org/docs/api/structures/protocol-response
  6159. /**
  6160. * The charset of response body, default is `"utf-8"`.
  6161. */
  6162. charset?: string;
  6163. /**
  6164. * The response body. When returning stream as response, this is a Node.js readable
  6165. * stream representing the response body. When returning `Buffer` as response, this
  6166. * is a `Buffer`. When returning `String` as response, this is a `String`. This is
  6167. * ignored for other types of responses.
  6168. */
  6169. data?: (Buffer) | (string) | (NodeJS.ReadableStream);
  6170. /**
  6171. * When assigned, the `request` will fail with the `error` number . For the
  6172. * available error numbers you can use, please see the net error list.
  6173. */
  6174. error?: number;
  6175. /**
  6176. * An object containing the response headers. The keys must be String, and values
  6177. * must be either String or Array of String.
  6178. */
  6179. headers?: Record<string, (string) | (string[])>;
  6180. /**
  6181. * The HTTP `method`. This is only used for file and URL responses.
  6182. */
  6183. method?: string;
  6184. /**
  6185. * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
  6186. * would implicitly set the `content-type` header in response, but if
  6187. * `content-type` is already set in `headers`, the `mimeType` would be ignored.
  6188. */
  6189. mimeType?: string;
  6190. /**
  6191. * Path to the file which would be sent as response body. This is only used for
  6192. * file responses.
  6193. */
  6194. path?: string;
  6195. /**
  6196. * The `referrer` URL. This is only used for file and URL responses.
  6197. */
  6198. referrer?: string;
  6199. /**
  6200. * The session used for requesting URL, by default the HTTP request will reuse the
  6201. * current session. Setting `session` to `null` would use a random independent
  6202. * session. This is only used for URL responses.
  6203. */
  6204. session?: Session;
  6205. /**
  6206. * The HTTP response code, default is 200.
  6207. */
  6208. statusCode?: number;
  6209. /**
  6210. * The data used as upload data. This is only used for URL responses when `method`
  6211. * is `"POST"`.
  6212. */
  6213. uploadData?: ProtocolResponseUploadData;
  6214. /**
  6215. * Download the `url` and pipe the result as response body. This is only used for
  6216. * URL responses.
  6217. */
  6218. url?: string;
  6219. }
  6220. interface ProtocolResponseUploadData {
  6221. // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
  6222. /**
  6223. * MIME type of the content.
  6224. */
  6225. contentType: string;
  6226. /**
  6227. * Content to be sent.
  6228. */
  6229. data: (string) | (Buffer);
  6230. }
  6231. interface Rectangle {
  6232. // Docs: https://electronjs.org/docs/api/structures/rectangle
  6233. /**
  6234. * The height of the rectangle (must be an integer).
  6235. */
  6236. height: number;
  6237. /**
  6238. * The width of the rectangle (must be an integer).
  6239. */
  6240. width: number;
  6241. /**
  6242. * The x coordinate of the origin of the rectangle (must be an integer).
  6243. */
  6244. x: number;
  6245. /**
  6246. * The y coordinate of the origin of the rectangle (must be an integer).
  6247. */
  6248. y: number;
  6249. }
  6250. interface Referrer {
  6251. // Docs: https://electronjs.org/docs/api/structures/referrer
  6252. /**
  6253. * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
  6254. * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
  6255. * See the Referrer-Policy spec for more details on the meaning of these values.
  6256. */
  6257. policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
  6258. /**
  6259. * HTTP Referrer URL.
  6260. */
  6261. url: string;
  6262. }
  6263. interface Remote extends RemoteMainInterface {
  6264. // Docs: https://electronjs.org/docs/api/remote
  6265. /**
  6266. * The web contents of this web page.
  6267. */
  6268. getCurrentWebContents(): WebContents;
  6269. /**
  6270. * The window to which this web page belongs.
  6271. *
  6272. * **Note:** Do not use `removeAllListeners` on `BrowserWindow`. Use of this can
  6273. * remove all `blur` listeners, disable click events on touch bar buttons, and
  6274. * other unintended consequences.
  6275. */
  6276. getCurrentWindow(): BrowserWindow;
  6277. /**
  6278. * The global variable of `name` (e.g. `global[name]`) in the main process.
  6279. */
  6280. getGlobal(name: string): any;
  6281. /**
  6282. * A `NodeJS.Process` object. The `process` object in the main process. This is
  6283. * the same as `remote.getGlobal('process')` but is cached.
  6284. *
  6285. */
  6286. readonly process: NodeJS.Process;
  6287. /**
  6288. * A `NodeJS.Require` function equivalent to `require(module)` in the main process.
  6289. * Modules specified by their relative path will resolve relative to the entrypoint
  6290. * of the main process.
  6291. e.g.
  6292. */
  6293. require: NodeJS.Require;
  6294. }
  6295. interface Screen extends NodeJS.EventEmitter {
  6296. // Docs: https://electronjs.org/docs/api/screen
  6297. /**
  6298. * Emitted when `newDisplay` has been added.
  6299. */
  6300. on(event: 'display-added', listener: (event: Event,
  6301. newDisplay: Display) => void): this;
  6302. once(event: 'display-added', listener: (event: Event,
  6303. newDisplay: Display) => void): this;
  6304. addListener(event: 'display-added', listener: (event: Event,
  6305. newDisplay: Display) => void): this;
  6306. removeListener(event: 'display-added', listener: (event: Event,
  6307. newDisplay: Display) => void): this;
  6308. /**
  6309. * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
  6310. * an array of strings that describe the changes. Possible changes are `bounds`,
  6311. * `workArea`, `scaleFactor` and `rotation`.
  6312. */
  6313. on(event: 'display-metrics-changed', listener: (event: Event,
  6314. display: Display,
  6315. changedMetrics: string[]) => void): this;
  6316. once(event: 'display-metrics-changed', listener: (event: Event,
  6317. display: Display,
  6318. changedMetrics: string[]) => void): this;
  6319. addListener(event: 'display-metrics-changed', listener: (event: Event,
  6320. display: Display,
  6321. changedMetrics: string[]) => void): this;
  6322. removeListener(event: 'display-metrics-changed', listener: (event: Event,
  6323. display: Display,
  6324. changedMetrics: string[]) => void): this;
  6325. /**
  6326. * Emitted when `oldDisplay` has been removed.
  6327. */
  6328. on(event: 'display-removed', listener: (event: Event,
  6329. oldDisplay: Display) => void): this;
  6330. once(event: 'display-removed', listener: (event: Event,
  6331. oldDisplay: Display) => void): this;
  6332. addListener(event: 'display-removed', listener: (event: Event,
  6333. oldDisplay: Display) => void): this;
  6334. removeListener(event: 'display-removed', listener: (event: Event,
  6335. oldDisplay: Display) => void): this;
  6336. /**
  6337. * Converts a screen DIP point to a screen physical point. The DPI scale is
  6338. * performed relative to the display containing the DIP point.
  6339. *
  6340. * @platform win32
  6341. */
  6342. dipToScreenPoint(point: Point): Point;
  6343. /**
  6344. * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
  6345. * relative to the display nearest to `window`. If `window` is null, scaling will
  6346. * be performed to the display nearest to `rect`.
  6347. *
  6348. * @platform win32
  6349. */
  6350. dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  6351. /**
  6352. * An array of displays that are currently available.
  6353. */
  6354. getAllDisplays(): Display[];
  6355. /**
  6356. * The current absolute position of the mouse pointer.
  6357. *
  6358. **Note:** The return value is a DIP point, not a screen physical point.
  6359. */
  6360. getCursorScreenPoint(): Point;
  6361. /**
  6362. * The display that most closely intersects the provided bounds.
  6363. */
  6364. getDisplayMatching(rect: Rectangle): Display;
  6365. /**
  6366. * The display nearest the specified point.
  6367. */
  6368. getDisplayNearestPoint(point: Point): Display;
  6369. /**
  6370. * The primary display.
  6371. */
  6372. getPrimaryDisplay(): Display;
  6373. /**
  6374. * Converts a screen physical point to a screen DIP point. The DPI scale is
  6375. * performed relative to the display containing the physical point.
  6376. *
  6377. * @platform win32
  6378. */
  6379. screenToDipPoint(point: Point): Point;
  6380. /**
  6381. * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
  6382. * relative to the display nearest to `window`. If `window` is null, scaling will
  6383. * be performed to the display nearest to `rect`.
  6384. *
  6385. * @platform win32
  6386. */
  6387. screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  6388. }
  6389. interface ScrubberItem {
  6390. // Docs: https://electronjs.org/docs/api/structures/scrubber-item
  6391. /**
  6392. * The image to appear in this item.
  6393. */
  6394. icon?: NativeImage;
  6395. /**
  6396. * The text to appear in this item.
  6397. */
  6398. label?: string;
  6399. }
  6400. interface SegmentedControlSegment {
  6401. // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
  6402. /**
  6403. * Whether this segment is selectable. Default: true.
  6404. */
  6405. enabled?: boolean;
  6406. /**
  6407. * The image to appear in this segment.
  6408. */
  6409. icon?: NativeImage;
  6410. /**
  6411. * The text to appear in this segment.
  6412. */
  6413. label?: string;
  6414. }
  6415. interface SerialPort {
  6416. // Docs: https://electronjs.org/docs/api/structures/serial-port
  6417. /**
  6418. * A stable identifier on Windows that can be used for device permissions.
  6419. */
  6420. deviceInstanceId?: string;
  6421. /**
  6422. * A string suitable for display to the user for describing this device.
  6423. */
  6424. displayName: string;
  6425. /**
  6426. * Unique identifier for the port.
  6427. */
  6428. portId: string;
  6429. /**
  6430. * Name of the port.
  6431. */
  6432. portName: string;
  6433. /**
  6434. * Optional USB product ID.
  6435. */
  6436. productId: string;
  6437. /**
  6438. * The USB device serial number.
  6439. */
  6440. serialNumber: string;
  6441. /**
  6442. * Represents a single serial port on macOS can be enumerated by multiple drivers.
  6443. */
  6444. usbDriverName?: string;
  6445. /**
  6446. * Optional USB vendor ID.
  6447. */
  6448. vendorId: string;
  6449. }
  6450. interface ServiceWorkerInfo {
  6451. // Docs: https://electronjs.org/docs/api/structures/service-worker-info
  6452. /**
  6453. * The virtual ID of the process that this service worker is running in. This is
  6454. * not an OS level PID. This aligns with the ID set used for
  6455. * `webContents.getProcessId()`.
  6456. */
  6457. renderProcessId: number;
  6458. /**
  6459. * The base URL that this service worker is active for.
  6460. */
  6461. scope: string;
  6462. /**
  6463. * The full URL to the script that this service worker runs
  6464. */
  6465. scriptUrl: string;
  6466. }
  6467. class ServiceWorkers extends NodeEventEmitter {
  6468. // Docs: https://electronjs.org/docs/api/service-workers
  6469. /**
  6470. * Emitted when a service worker logs something to the console.
  6471. */
  6472. on(event: 'console-message', listener: (event: Event,
  6473. /**
  6474. * Information about the console message
  6475. */
  6476. messageDetails: MessageDetails) => void): this;
  6477. once(event: 'console-message', listener: (event: Event,
  6478. /**
  6479. * Information about the console message
  6480. */
  6481. messageDetails: MessageDetails) => void): this;
  6482. addListener(event: 'console-message', listener: (event: Event,
  6483. /**
  6484. * Information about the console message
  6485. */
  6486. messageDetails: MessageDetails) => void): this;
  6487. removeListener(event: 'console-message', listener: (event: Event,
  6488. /**
  6489. * Information about the console message
  6490. */
  6491. messageDetails: MessageDetails) => void): this;
  6492. /**
  6493. * Emitted when a service worker has been registered. Can occur after a call to
  6494. * `navigator.serviceWorker.register('/sw.js')` successfully resolves or when a
  6495. * Chrome extension is loaded.
  6496. */
  6497. on(event: 'registration-completed', listener: (event: Event,
  6498. /**
  6499. * Information about the registered service worker
  6500. */
  6501. details: RegistrationCompletedDetails) => void): this;
  6502. once(event: 'registration-completed', listener: (event: Event,
  6503. /**
  6504. * Information about the registered service worker
  6505. */
  6506. details: RegistrationCompletedDetails) => void): this;
  6507. addListener(event: 'registration-completed', listener: (event: Event,
  6508. /**
  6509. * Information about the registered service worker
  6510. */
  6511. details: RegistrationCompletedDetails) => void): this;
  6512. removeListener(event: 'registration-completed', listener: (event: Event,
  6513. /**
  6514. * Information about the registered service worker
  6515. */
  6516. details: RegistrationCompletedDetails) => void): this;
  6517. /**
  6518. * A ServiceWorkerInfo object where the keys are the service worker version ID and
  6519. * the values are the information about that service worker.
  6520. */
  6521. getAllRunning(): Record<number, ServiceWorkerInfo>;
  6522. /**
  6523. * Information about this service worker
  6524. *
  6525. * If the service worker does not exist or is not running this method will throw an
  6526. * exception.
  6527. */
  6528. getFromVersionID(versionId: number): ServiceWorkerInfo;
  6529. }
  6530. class Session extends NodeEventEmitter {
  6531. // Docs: https://electronjs.org/docs/api/session
  6532. /**
  6533. * A session instance from `partition` string. When there is an existing `Session`
  6534. * with the same `partition`, it will be returned; otherwise a new `Session`
  6535. * instance will be created with `options`.
  6536. *
  6537. * If `partition` starts with `persist:`, the page will use a persistent session
  6538. * available to all pages in the app with the same `partition`. if there is no
  6539. * `persist:` prefix, the page will use an in-memory session. If the `partition` is
  6540. * empty then default session of the app will be returned.
  6541. *
  6542. * To create a `Session` with `options`, you have to ensure the `Session` with the
  6543. * `partition` has never been used before. There is no way to change the `options`
  6544. * of an existing `Session` object.
  6545. */
  6546. static fromPartition(partition: string, options?: FromPartitionOptions): Session;
  6547. /**
  6548. * A `Session` object, the default session object of the app.
  6549. */
  6550. static defaultSession: Session;
  6551. /**
  6552. * Emitted after an extension is loaded. This occurs whenever an extension is added
  6553. * to the "enabled" set of extensions. This includes:
  6554. *
  6555. * * Extensions being loaded from `Session.loadExtension`.
  6556. * * Extensions being reloaded:
  6557. * * from a crash.
  6558. * if the extension requested it (`chrome.runtime.reload()`).
  6559. */
  6560. on(event: 'extension-loaded', listener: (event: Event,
  6561. extension: Extension) => void): this;
  6562. once(event: 'extension-loaded', listener: (event: Event,
  6563. extension: Extension) => void): this;
  6564. addListener(event: 'extension-loaded', listener: (event: Event,
  6565. extension: Extension) => void): this;
  6566. removeListener(event: 'extension-loaded', listener: (event: Event,
  6567. extension: Extension) => void): this;
  6568. /**
  6569. * Emitted after an extension is loaded and all necessary browser state is
  6570. * initialized to support the start of the extension's background page.
  6571. */
  6572. on(event: 'extension-ready', listener: (event: Event,
  6573. extension: Extension) => void): this;
  6574. once(event: 'extension-ready', listener: (event: Event,
  6575. extension: Extension) => void): this;
  6576. addListener(event: 'extension-ready', listener: (event: Event,
  6577. extension: Extension) => void): this;
  6578. removeListener(event: 'extension-ready', listener: (event: Event,
  6579. extension: Extension) => void): this;
  6580. /**
  6581. * Emitted after an extension is unloaded. This occurs when
  6582. * `Session.removeExtension` is called.
  6583. */
  6584. on(event: 'extension-unloaded', listener: (event: Event,
  6585. extension: Extension) => void): this;
  6586. once(event: 'extension-unloaded', listener: (event: Event,
  6587. extension: Extension) => void): this;
  6588. addListener(event: 'extension-unloaded', listener: (event: Event,
  6589. extension: Extension) => void): this;
  6590. removeListener(event: 'extension-unloaded', listener: (event: Event,
  6591. extension: Extension) => void): this;
  6592. /**
  6593. * Emitted when a render process requests preconnection to a URL, generally due to
  6594. * a resource hint.
  6595. */
  6596. on(event: 'preconnect', listener: (event: Event,
  6597. /**
  6598. * The URL being requested for preconnection by the renderer.
  6599. */
  6600. preconnectUrl: string,
  6601. /**
  6602. * True if the renderer is requesting that the connection include credentials (see
  6603. * the spec for more details.)
  6604. */
  6605. allowCredentials: boolean) => void): this;
  6606. once(event: 'preconnect', listener: (event: Event,
  6607. /**
  6608. * The URL being requested for preconnection by the renderer.
  6609. */
  6610. preconnectUrl: string,
  6611. /**
  6612. * True if the renderer is requesting that the connection include credentials (see
  6613. * the spec for more details.)
  6614. */
  6615. allowCredentials: boolean) => void): this;
  6616. addListener(event: 'preconnect', listener: (event: Event,
  6617. /**
  6618. * The URL being requested for preconnection by the renderer.
  6619. */
  6620. preconnectUrl: string,
  6621. /**
  6622. * True if the renderer is requesting that the connection include credentials (see
  6623. * the spec for more details.)
  6624. */
  6625. allowCredentials: boolean) => void): this;
  6626. removeListener(event: 'preconnect', listener: (event: Event,
  6627. /**
  6628. * The URL being requested for preconnection by the renderer.
  6629. */
  6630. preconnectUrl: string,
  6631. /**
  6632. * True if the renderer is requesting that the connection include credentials (see
  6633. * the spec for more details.)
  6634. */
  6635. allowCredentials: boolean) => void): this;
  6636. /**
  6637. * Emitted when a serial port needs to be selected when a call to
  6638. * `navigator.serial.requestPort` is made. `callback` should be called with
  6639. * `portId` to be selected, passing an empty string to `callback` will cancel the
  6640. * request. Additionally, permissioning on `navigator.serial` can be managed by
  6641. * using ses.setPermissionCheckHandler(handler) with the `serial` permission.
  6642. *
  6643. * Because this is an experimental feature it is disabled by default. To enable
  6644. * this feature, you will need to use the `--enable-features=ElectronSerialChooser`
  6645. * command line switch. Additionally because this is an experimental Chromium
  6646. * feature you will need to set `enableBlinkFeatures: 'Serial'` on the
  6647. * `webPreferences` property when opening a BrowserWindow.
  6648. *
  6649. * @experimental
  6650. */
  6651. on(event: 'select-serial-port', listener: (event: Event,
  6652. portList: SerialPort[],
  6653. webContents: WebContents,
  6654. callback: (portId: string) => void) => void): this;
  6655. once(event: 'select-serial-port', listener: (event: Event,
  6656. portList: SerialPort[],
  6657. webContents: WebContents,
  6658. callback: (portId: string) => void) => void): this;
  6659. addListener(event: 'select-serial-port', listener: (event: Event,
  6660. portList: SerialPort[],
  6661. webContents: WebContents,
  6662. callback: (portId: string) => void) => void): this;
  6663. removeListener(event: 'select-serial-port', listener: (event: Event,
  6664. portList: SerialPort[],
  6665. webContents: WebContents,
  6666. callback: (portId: string) => void) => void): this;
  6667. /**
  6668. * Emitted after `navigator.serial.requestPort` has been called and
  6669. * `select-serial-port` has fired if a new serial port becomes available. For
  6670. * example, this event will fire when a new USB device is plugged in.
  6671. *
  6672. * @experimental
  6673. */
  6674. on(event: 'serial-port-added', listener: (event: Event,
  6675. port: SerialPort,
  6676. webContents: WebContents) => void): this;
  6677. once(event: 'serial-port-added', listener: (event: Event,
  6678. port: SerialPort,
  6679. webContents: WebContents) => void): this;
  6680. addListener(event: 'serial-port-added', listener: (event: Event,
  6681. port: SerialPort,
  6682. webContents: WebContents) => void): this;
  6683. removeListener(event: 'serial-port-added', listener: (event: Event,
  6684. port: SerialPort,
  6685. webContents: WebContents) => void): this;
  6686. /**
  6687. * Emitted after `navigator.serial.requestPort` has been called and
  6688. * `select-serial-port` has fired if a serial port has been removed. For example,
  6689. * this event will fire when a USB device is unplugged.
  6690. *
  6691. * @experimental
  6692. */
  6693. on(event: 'serial-port-removed', listener: (event: Event,
  6694. port: SerialPort,
  6695. webContents: WebContents) => void): this;
  6696. once(event: 'serial-port-removed', listener: (event: Event,
  6697. port: SerialPort,
  6698. webContents: WebContents) => void): this;
  6699. addListener(event: 'serial-port-removed', listener: (event: Event,
  6700. port: SerialPort,
  6701. webContents: WebContents) => void): this;
  6702. removeListener(event: 'serial-port-removed', listener: (event: Event,
  6703. port: SerialPort,
  6704. webContents: WebContents) => void): this;
  6705. /**
  6706. * Emitted when a hunspell dictionary file starts downloading
  6707. */
  6708. on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6709. /**
  6710. * The language code of the dictionary file
  6711. */
  6712. languageCode: string) => void): this;
  6713. once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6714. /**
  6715. * The language code of the dictionary file
  6716. */
  6717. languageCode: string) => void): this;
  6718. addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6719. /**
  6720. * The language code of the dictionary file
  6721. */
  6722. languageCode: string) => void): this;
  6723. removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6724. /**
  6725. * The language code of the dictionary file
  6726. */
  6727. languageCode: string) => void): this;
  6728. /**
  6729. * Emitted when a hunspell dictionary file download fails. For details on the
  6730. * failure you should collect a netlog and inspect the download request.
  6731. */
  6732. on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6733. /**
  6734. * The language code of the dictionary file
  6735. */
  6736. languageCode: string) => void): this;
  6737. once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6738. /**
  6739. * The language code of the dictionary file
  6740. */
  6741. languageCode: string) => void): this;
  6742. addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6743. /**
  6744. * The language code of the dictionary file
  6745. */
  6746. languageCode: string) => void): this;
  6747. removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6748. /**
  6749. * The language code of the dictionary file
  6750. */
  6751. languageCode: string) => void): this;
  6752. /**
  6753. * Emitted when a hunspell dictionary file has been successfully downloaded
  6754. */
  6755. on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6756. /**
  6757. * The language code of the dictionary file
  6758. */
  6759. languageCode: string) => void): this;
  6760. once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6761. /**
  6762. * The language code of the dictionary file
  6763. */
  6764. languageCode: string) => void): this;
  6765. addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6766. /**
  6767. * The language code of the dictionary file
  6768. */
  6769. languageCode: string) => void): this;
  6770. removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6771. /**
  6772. * The language code of the dictionary file
  6773. */
  6774. languageCode: string) => void): this;
  6775. /**
  6776. * Emitted when a hunspell dictionary file has been successfully initialized. This
  6777. * occurs after the file has been downloaded.
  6778. */
  6779. on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6780. /**
  6781. * The language code of the dictionary file
  6782. */
  6783. languageCode: string) => void): this;
  6784. once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6785. /**
  6786. * The language code of the dictionary file
  6787. */
  6788. languageCode: string) => void): this;
  6789. addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6790. /**
  6791. * The language code of the dictionary file
  6792. */
  6793. languageCode: string) => void): this;
  6794. removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6795. /**
  6796. * The language code of the dictionary file
  6797. */
  6798. languageCode: string) => void): this;
  6799. /**
  6800. * Emitted when Electron is about to download `item` in `webContents`.
  6801. *
  6802. * Calling `event.preventDefault()` will cancel the download and `item` will not be
  6803. * available from next tick of the process.
  6804. */
  6805. on(event: 'will-download', listener: (event: Event,
  6806. item: DownloadItem,
  6807. webContents: WebContents) => void): this;
  6808. once(event: 'will-download', listener: (event: Event,
  6809. item: DownloadItem,
  6810. webContents: WebContents) => void): this;
  6811. addListener(event: 'will-download', listener: (event: Event,
  6812. item: DownloadItem,
  6813. webContents: WebContents) => void): this;
  6814. removeListener(event: 'will-download', listener: (event: Event,
  6815. item: DownloadItem,
  6816. webContents: WebContents) => void): this;
  6817. /**
  6818. * Whether the word was successfully written to the custom dictionary. This API
  6819. * will not work on non-persistent (in-memory) sessions.
  6820. *
  6821. * **Note:** On macOS and Windows 10 this word will be written to the OS custom
  6822. * dictionary as well
  6823. */
  6824. addWordToSpellCheckerDictionary(word: string): boolean;
  6825. /**
  6826. * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
  6827. * authentication.
  6828. */
  6829. allowNTLMCredentialsForDomains(domains: string): void;
  6830. /**
  6831. * resolves when the session’s HTTP authentication cache has been cleared.
  6832. */
  6833. clearAuthCache(): Promise<void>;
  6834. /**
  6835. * resolves when the cache clear operation is complete.
  6836. *
  6837. Clears the session’s HTTP cache.
  6838. */
  6839. clearCache(): Promise<void>;
  6840. /**
  6841. * Resolves when the operation is complete.
  6842. Clears the host resolver cache.
  6843. */
  6844. clearHostResolverCache(): Promise<void>;
  6845. /**
  6846. * resolves when the storage data has been cleared.
  6847. */
  6848. clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
  6849. /**
  6850. * Resolves when all connections are closed.
  6851. *
  6852. **Note:** It will terminate / fail all requests currently in flight.
  6853. */
  6854. closeAllConnections(): Promise<void>;
  6855. /**
  6856. * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
  6857. * The API will generate a DownloadItem that can be accessed with the will-download
  6858. * event. The DownloadItem will not have any `WebContents` associated with it and
  6859. * the initial state will be `interrupted`. The download will start only when the
  6860. * `resume` API is called on the DownloadItem.
  6861. */
  6862. createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
  6863. /**
  6864. * Disables any network emulation already active for the `session`. Resets to the
  6865. * original network configuration.
  6866. */
  6867. disableNetworkEmulation(): void;
  6868. /**
  6869. * Initiates a download of the resource at `url`. The API will generate a
  6870. * DownloadItem that can be accessed with the will-download event.
  6871. *
  6872. * **Note:** This does not perform any security checks that relate to a page's
  6873. * origin, unlike `webContents.downloadURL`.
  6874. */
  6875. downloadURL(url: string): void;
  6876. /**
  6877. * Emulates network with the given configuration for the `session`.
  6878. */
  6879. enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
  6880. /**
  6881. * Writes any unwritten DOMStorage data to disk.
  6882. */
  6883. flushStorageData(): void;
  6884. /**
  6885. * Resolves when the all internal states of proxy service is reset and the latest
  6886. * proxy configuration is reapplied if it's already available. The pac script will
  6887. * be fetched from `pacScript` again if the proxy mode is `pac_script`.
  6888. */
  6889. forceReloadProxyConfig(): Promise<void>;
  6890. /**
  6891. * A list of all loaded extensions.
  6892. *
  6893. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6894. * is emitted.
  6895. */
  6896. getAllExtensions(): Extension[];
  6897. /**
  6898. * resolves with blob data.
  6899. */
  6900. getBlobData(identifier: string): Promise<Buffer>;
  6901. /**
  6902. * the session's current cache size, in bytes.
  6903. */
  6904. getCacheSize(): Promise<number>;
  6905. /**
  6906. * | `null` - The loaded extension with the given ID.
  6907. *
  6908. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6909. * is emitted.
  6910. */
  6911. getExtension(extensionId: string): Extension;
  6912. /**
  6913. * an array of paths to preload scripts that have been registered.
  6914. */
  6915. getPreloads(): string[];
  6916. /**
  6917. * An array of language codes the spellchecker is enabled for. If this list is
  6918. * empty the spellchecker will fallback to using `en-US`. By default on launch if
  6919. * this setting is an empty list Electron will try to populate this setting with
  6920. * the current OS locale. This setting is persisted across restarts.
  6921. *
  6922. * **Note:** On macOS the OS spellchecker is used and has its own list of
  6923. * languages. This API is a no-op on macOS.
  6924. */
  6925. getSpellCheckerLanguages(): string[];
  6926. /**
  6927. * A `String | null` indicating the absolute file system path where data for this
  6928. * session is persisted on disk. For in memory sessions this returns `null`.
  6929. */
  6930. getStoragePath(): void;
  6931. /**
  6932. * The user agent for this session.
  6933. */
  6934. getUserAgent(): string;
  6935. /**
  6936. * Whether or not this session is a persistent one. The default `webContents`
  6937. * session of a `BrowserWindow` is persistent. When creating a session from a
  6938. * partition, session prefixed with `persist:` will be persistent, while others
  6939. * will be temporary.
  6940. */
  6941. isPersistent(): boolean;
  6942. /**
  6943. * Whether the builtin spell checker is enabled.
  6944. */
  6945. isSpellCheckerEnabled(): boolean;
  6946. /**
  6947. * An array of all words in app's custom dictionary. Resolves when the full
  6948. * dictionary is loaded from disk.
  6949. */
  6950. listWordsInSpellCheckerDictionary(): Promise<string[]>;
  6951. /**
  6952. * resolves when the extension is loaded.
  6953. *
  6954. * This method will raise an exception if the extension could not be loaded. If
  6955. * there are warnings when installing the extension (e.g. if the extension requests
  6956. * an API that Electron does not support) then they will be logged to the console.
  6957. *
  6958. * Note that Electron does not support the full range of Chrome extensions APIs.
  6959. * See Supported Extensions APIs for more details on what is supported.
  6960. *
  6961. * Note that in previous versions of Electron, extensions that were loaded would be
  6962. * remembered for future runs of the application. This is no longer the case:
  6963. * `loadExtension` must be called on every boot of your app if you want the
  6964. * extension to be loaded.
  6965. *
  6966. * This API does not support loading packed (.crx) extensions.
  6967. *
  6968. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6969. * is emitted.
  6970. *
  6971. * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
  6972. * supported and will throw an error.
  6973. */
  6974. loadExtension(path: string, options?: LoadExtensionOptions): Promise<Electron.Extension>;
  6975. /**
  6976. * Preconnects the given number of sockets to an origin.
  6977. */
  6978. preconnect(options: PreconnectOptions): void;
  6979. /**
  6980. * Unloads an extension.
  6981. *
  6982. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6983. * is emitted.
  6984. */
  6985. removeExtension(extensionId: string): void;
  6986. /**
  6987. * Whether the word was successfully removed from the custom dictionary. This API
  6988. * will not work on non-persistent (in-memory) sessions.
  6989. *
  6990. * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
  6991. * dictionary as well
  6992. */
  6993. removeWordFromSpellCheckerDictionary(word: string): boolean;
  6994. /**
  6995. * Resolves with the proxy information for `url`.
  6996. */
  6997. resolveProxy(url: string): Promise<string>;
  6998. /**
  6999. * Sets the certificate verify proc for `session`, the `proc` will be called with
  7000. * `proc(request, callback)` whenever a server certificate verification is
  7001. * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
  7002. * rejects it.
  7003. *
  7004. * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
  7005. * verify proc.
  7006. *
  7007. > **NOTE:** The result of this procedure is cached by the network service.
  7008. */
  7009. setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
  7010. /**
  7011. * Sets download saving directory. By default, the download directory will be the
  7012. * `Downloads` under the respective app folder.
  7013. */
  7014. setDownloadPath(path: string): void;
  7015. /**
  7016. * Sets the handler which can be used to respond to permission checks for the
  7017. * `session`. Returning `true` will allow the permission and `false` will reject
  7018. * it. Please note that you must also implement `setPermissionRequestHandler` to
  7019. * get complete permission handling. Most web APIs do a permission check and then
  7020. * make a permission request if the check is denied. To clear the handler, call
  7021. * `setPermissionCheckHandler(null)`.
  7022. */
  7023. setPermissionCheckHandler(handler: ((webContents: (WebContents) | (null), permission: string, requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
  7024. /**
  7025. * Sets the handler which can be used to respond to permission requests for the
  7026. * `session`. Calling `callback(true)` will allow the permission and
  7027. * `callback(false)` will reject it. To clear the handler, call
  7028. * `setPermissionRequestHandler(null)`. Please note that you must also implement
  7029. * `setPermissionCheckHandler` to get complete permission handling. Most web APIs
  7030. * do a permission check and then make a permission request if the check is denied.
  7031. */
  7032. 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;
  7033. /**
  7034. * Adds scripts that will be executed on ALL web contents that are associated with
  7035. * this session just before normal `preload` scripts run.
  7036. */
  7037. setPreloads(preloads: string[]): void;
  7038. /**
  7039. * Resolves when the proxy setting process is complete.
  7040. *
  7041. * Sets the proxy settings.
  7042. *
  7043. * When `mode` is unspecified, `pacScript` and `proxyRules` are provided together,
  7044. * the `proxyRules` option is ignored and `pacScript` configuration is applied.
  7045. *
  7046. * You may need `ses.closeAllConnections` to close currently in flight connections
  7047. * to prevent pooled sockets using previous proxy from being reused by future
  7048. * requests.
  7049. *
  7050. * The `proxyRules` has to follow the rules below:
  7051. *
  7052. * For example:
  7053. *
  7054. * * `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
  7055. * HTTP proxy `foopy2:80` for `ftp://` URLs.
  7056. * * `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
  7057. * * `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
  7058. * over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
  7059. * * `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
  7060. * * `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
  7061. * over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
  7062. * * `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
  7063. * proxy if `foopy` is unavailable.
  7064. * * `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
  7065. * `socks4://foopy2` for all other URLs.
  7066. *
  7067. * The `proxyBypassRules` is a comma separated list of rules described below:
  7068. *
  7069. * * `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
  7070. *
  7071. * Match all hostnames that match the pattern HOSTNAME_PATTERN.
  7072. *
  7073. * Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
  7074. * "https://x.*.y.com:99"
  7075. * * `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
  7076. *
  7077. * Match a particular domain suffix.
  7078. *
  7079. * Examples: ".google.com", ".com", "http://.google.com"
  7080. * * `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
  7081. *
  7082. * Match URLs which are IP address literals.
  7083. *
  7084. * Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
  7085. * * `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
  7086. *
  7087. * Match any URL that is to an IP literal that falls between the given range. IP
  7088. * range is specified using CIDR notation.
  7089. *
  7090. * Examples: "192.168.1.1/16", "fefe:13::abc/33".
  7091. * * `<local>`
  7092. *
  7093. * Match local addresses. The meaning of `<local>` is whether the host matches one
  7094. * of: "127.0.0.1", "::1", "localhost".
  7095. */
  7096. setProxy(config: Config): Promise<void>;
  7097. /**
  7098. * By default Electron will download hunspell dictionaries from the Chromium CDN.
  7099. * If you want to override this behavior you can use this API to point the
  7100. * dictionary downloader at your own hosted version of the hunspell dictionaries.
  7101. * We publish a `hunspell_dictionaries.zip` file with each release which contains
  7102. * the files you need to host here, the file server must be **case insensitive**
  7103. * you must upload each file twice, once with the case it has in the ZIP file and
  7104. * once with the filename as all lower case.
  7105. *
  7106. * If the files present in `hunspell_dictionaries.zip` are available at
  7107. * `https://example.com/dictionaries/language-code.bdic` then you should call this
  7108. * api with
  7109. * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
  7110. * Please note the trailing slash. The URL to the dictionaries is formed as
  7111. * `${url}${filename}`.
  7112. *
  7113. * **Note:** On macOS the OS spellchecker is used and therefore we do not download
  7114. * any dictionary files. This API is a no-op on macOS.
  7115. */
  7116. setSpellCheckerDictionaryDownloadURL(url: string): void;
  7117. /**
  7118. * Sets whether to enable the builtin spell checker.
  7119. */
  7120. setSpellCheckerEnabled(enable: boolean): void;
  7121. /**
  7122. * The built in spellchecker does not automatically detect what language a user is
  7123. * typing in. In order for the spell checker to correctly check their words you
  7124. * must call this API with an array of language codes. You can get the list of
  7125. * supported language codes with the `ses.availableSpellCheckerLanguages` property.
  7126. *
  7127. * **Note:** On macOS the OS spellchecker is used and will detect your language
  7128. * automatically. This API is a no-op on macOS.
  7129. */
  7130. setSpellCheckerLanguages(languages: string[]): void;
  7131. /**
  7132. * Sets the SSL configuration for the session. All subsequent network requests will
  7133. * use the new configuration. Existing network connections (such as WebSocket
  7134. * connections) will not be terminated, but old sockets in the pool will not be
  7135. * reused for new connections.
  7136. */
  7137. setSSLConfig(config: SSLConfigConfig): void;
  7138. /**
  7139. * Overrides the `userAgent` and `acceptLanguages` for this session.
  7140. *
  7141. * The `acceptLanguages` must a comma separated ordered list of language codes, for
  7142. * example `"en-US,fr,de,ko,zh-CN,ja"`.
  7143. *
  7144. * This doesn't affect existing `WebContents`, and each `WebContents` can use
  7145. * `webContents.setUserAgent` to override the session-wide user agent.
  7146. */
  7147. setUserAgent(userAgent: string, acceptLanguages?: string): void;
  7148. readonly availableSpellCheckerLanguages: string[];
  7149. readonly cookies: Cookies;
  7150. readonly netLog: NetLog;
  7151. readonly protocol: Protocol;
  7152. readonly serviceWorkers: ServiceWorkers;
  7153. spellCheckerEnabled: boolean;
  7154. readonly storagePath: (string) | (null);
  7155. readonly webRequest: WebRequest;
  7156. }
  7157. interface SharedWorkerInfo {
  7158. // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
  7159. /**
  7160. * The unique id of the shared worker.
  7161. */
  7162. id: string;
  7163. /**
  7164. * The url of the shared worker.
  7165. */
  7166. url: string;
  7167. }
  7168. class ShareMenu extends NodeEventEmitter {
  7169. // Docs: https://electronjs.org/docs/api/share-menu
  7170. /**
  7171. * ShareMenu
  7172. */
  7173. constructor(sharingItem: SharingItem);
  7174. /**
  7175. * Closes the context menu in the `browserWindow`.
  7176. */
  7177. closePopup(browserWindow?: BrowserWindow): void;
  7178. /**
  7179. * Pops up this menu as a context menu in the `BrowserWindow`.
  7180. */
  7181. popup(options?: PopupOptions): void;
  7182. }
  7183. interface SharingItem {
  7184. // Docs: https://electronjs.org/docs/api/structures/sharing-item
  7185. /**
  7186. * An array of files to share.
  7187. */
  7188. filePaths?: string[];
  7189. /**
  7190. * An array of text to share.
  7191. */
  7192. texts?: string[];
  7193. /**
  7194. * An array of URLs to share.
  7195. */
  7196. urls?: string[];
  7197. }
  7198. interface Shell {
  7199. // Docs: https://electronjs.org/docs/api/shell
  7200. /**
  7201. * Play the beep sound.
  7202. */
  7203. beep(): void;
  7204. /**
  7205. * Open the given external protocol URL in the desktop's default manner. (For
  7206. * example, mailto: URLs in the user's default mail agent).
  7207. */
  7208. openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
  7209. /**
  7210. * Resolves with a string containing the error message corresponding to the failure
  7211. * if a failure occurred, otherwise "".
  7212. *
  7213. Open the given file in the desktop's default manner.
  7214. */
  7215. openPath(path: string): Promise<string>;
  7216. /**
  7217. * Resolves the shortcut link at `shortcutPath`.
  7218. *
  7219. An exception will be thrown when any error happens.
  7220. *
  7221. * @platform win32
  7222. */
  7223. readShortcutLink(shortcutPath: string): ShortcutDetails;
  7224. /**
  7225. * Show the given file in a file manager. If possible, select the file.
  7226. */
  7227. showItemInFolder(fullPath: string): void;
  7228. /**
  7229. * Resolves when the operation has been completed. Rejects if there was an error
  7230. * while deleting the requested item.
  7231. *
  7232. * This moves a path to the OS-specific trash location (Trash on macOS, Recycle Bin
  7233. * on Windows, and a desktop-environment-specific location on Linux).
  7234. */
  7235. trashItem(path: string): Promise<void>;
  7236. /**
  7237. * Whether the shortcut was created successfully.
  7238. *
  7239. Creates or updates a shortcut link at `shortcutPath`.
  7240. *
  7241. * @platform win32
  7242. */
  7243. writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
  7244. /**
  7245. * Whether the shortcut was created successfully.
  7246. *
  7247. Creates or updates a shortcut link at `shortcutPath`.
  7248. *
  7249. * @platform win32
  7250. */
  7251. writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
  7252. }
  7253. interface ShortcutDetails {
  7254. // Docs: https://electronjs.org/docs/api/structures/shortcut-details
  7255. /**
  7256. * The Application User Model ID. Default is empty.
  7257. */
  7258. appUserModelId?: string;
  7259. /**
  7260. * The arguments to be applied to `target` when launching from this shortcut.
  7261. * Default is empty.
  7262. */
  7263. args?: string;
  7264. /**
  7265. * The working directory. Default is empty.
  7266. */
  7267. cwd?: string;
  7268. /**
  7269. * The description of the shortcut. Default is empty.
  7270. */
  7271. description?: string;
  7272. /**
  7273. * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
  7274. * together. Default is empty, which uses the target's icon.
  7275. */
  7276. icon?: string;
  7277. /**
  7278. * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
  7279. */
  7280. iconIndex?: number;
  7281. /**
  7282. * The target to launch from this shortcut.
  7283. */
  7284. target: string;
  7285. /**
  7286. * The Application Toast Activator CLSID. Needed for participating in Action
  7287. * Center.
  7288. */
  7289. toastActivatorClsid?: string;
  7290. }
  7291. interface Size {
  7292. // Docs: https://electronjs.org/docs/api/structures/size
  7293. height: number;
  7294. width: number;
  7295. }
  7296. interface SystemPreferences extends NodeJS.EventEmitter {
  7297. // Docs: https://electronjs.org/docs/api/system-preferences
  7298. on(event: 'accent-color-changed', listener: (event: Event,
  7299. /**
  7300. * The new RGBA color the user assigned to be their system accent color.
  7301. */
  7302. newColor: string) => void): this;
  7303. once(event: 'accent-color-changed', listener: (event: Event,
  7304. /**
  7305. * The new RGBA color the user assigned to be their system accent color.
  7306. */
  7307. newColor: string) => void): this;
  7308. addListener(event: 'accent-color-changed', listener: (event: Event,
  7309. /**
  7310. * The new RGBA color the user assigned to be their system accent color.
  7311. */
  7312. newColor: string) => void): this;
  7313. removeListener(event: 'accent-color-changed', listener: (event: Event,
  7314. /**
  7315. * The new RGBA color the user assigned to be their system accent color.
  7316. */
  7317. newColor: string) => void): this;
  7318. on(event: 'color-changed', listener: (event: Event) => void): this;
  7319. once(event: 'color-changed', listener: (event: Event) => void): this;
  7320. addListener(event: 'color-changed', listener: (event: Event) => void): this;
  7321. removeListener(event: 'color-changed', listener: (event: Event) => void): this;
  7322. /**
  7323. * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
  7324. *
  7325. * @deprecated
  7326. * @platform win32
  7327. */
  7328. on(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7329. /**
  7330. * `true` if a high contrast theme is being used, `false` otherwise.
  7331. */
  7332. highContrastColorScheme: boolean) => void): this;
  7333. once(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7334. /**
  7335. * `true` if a high contrast theme is being used, `false` otherwise.
  7336. */
  7337. highContrastColorScheme: boolean) => void): this;
  7338. addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7339. /**
  7340. * `true` if a high contrast theme is being used, `false` otherwise.
  7341. */
  7342. highContrastColorScheme: boolean) => void): this;
  7343. removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  7344. /**
  7345. * `true` if a high contrast theme is being used, `false` otherwise.
  7346. */
  7347. highContrastColorScheme: boolean) => void): this;
  7348. /**
  7349. * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
  7350. *
  7351. * @deprecated
  7352. * @platform win32
  7353. */
  7354. on(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7355. /**
  7356. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7357. * and dark backgrounds) is being used, `false` otherwise.
  7358. */
  7359. invertedColorScheme: boolean) => void): this;
  7360. once(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7361. /**
  7362. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7363. * and dark backgrounds) is being used, `false` otherwise.
  7364. */
  7365. invertedColorScheme: boolean) => void): this;
  7366. addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7367. /**
  7368. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7369. * and dark backgrounds) is being used, `false` otherwise.
  7370. */
  7371. invertedColorScheme: boolean) => void): this;
  7372. removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7373. /**
  7374. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7375. * and dark backgrounds) is being used, `false` otherwise.
  7376. */
  7377. invertedColorScheme: boolean) => void): this;
  7378. /**
  7379. * A promise that resolves with `true` if consent was granted and `false` if it was
  7380. * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
  7381. * access request was denied and later is changed through the System Preferences
  7382. * pane, a restart of the app will be required for the new permissions to take
  7383. * effect. If access has already been requested and denied, it _must_ be changed
  7384. * through the preference pane; an alert will not pop up and the promise will
  7385. * resolve with the existing access status.
  7386. *
  7387. * **Important:** In order to properly leverage this API, you must set the
  7388. * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
  7389. * app's `Info.plist` file. The values for these keys will be used to populate the
  7390. * permission dialogs so that the user will be properly informed as to the purpose
  7391. * of the permission request. See Electron Application Distribution for more
  7392. * information about how to set these in the context of Electron.
  7393. *
  7394. * This user consent was not required until macOS 10.14 Mojave, so this method will
  7395. * always return `true` if your system is running 10.13 High Sierra or lower.
  7396. *
  7397. * @platform darwin
  7398. */
  7399. askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
  7400. /**
  7401. * whether or not this device has the ability to use Touch ID.
  7402. *
  7403. * **NOTE:** This API will return `false` on macOS systems older than Sierra
  7404. * 10.12.2.
  7405. *
  7406. * @platform darwin
  7407. */
  7408. canPromptTouchID(): boolean;
  7409. /**
  7410. * The users current system wide accent color preference in RGBA hexadecimal form.
  7411. *
  7412. This API is only available on macOS 10.14 Mojave or newer.
  7413. *
  7414. * @platform win32,darwin
  7415. */
  7416. getAccentColor(): string;
  7417. /**
  7418. * * `shouldRenderRichAnimation` Boolean - Returns true if rich animations should
  7419. * be rendered. Looks at session type (e.g. remote desktop) and accessibility
  7420. * settings to give guidance for heavy animations.
  7421. * * `scrollAnimationsEnabledBySystem` Boolean - Determines on a per-platform basis
  7422. * whether scroll animations (e.g. produced by home/end key) should be enabled.
  7423. * * `prefersReducedMotion` Boolean - Determines whether the user desires reduced
  7424. * motion based on platform APIs.
  7425. *
  7426. Returns an object with system animation settings.
  7427. */
  7428. getAnimationSettings(): AnimationSettings;
  7429. /**
  7430. * | `null` - Can be `dark`, `light` or `unknown`.
  7431. *
  7432. * Gets the macOS appearance setting that you have declared you want for your
  7433. * application, maps to NSApplication.appearance. You can use the
  7434. * `setAppLevelAppearance` API to set this value.
  7435. *
  7436. * @deprecated
  7437. * @platform darwin
  7438. */
  7439. getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
  7440. /**
  7441. * The system color setting in RGB hexadecimal form (`#ABCDEF`). See the Windows
  7442. * docs and the macOS docs for more details.
  7443. *
  7444. * The following colors are only available on macOS 10.14: `find-highlight`,
  7445. * `selected-content-background`, `separator`,
  7446. * `unemphasized-selected-content-background`,
  7447. * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
  7448. *
  7449. * @platform win32,darwin
  7450. */
  7451. 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;
  7452. /**
  7453. * Can be `dark`, `light` or `unknown`.
  7454. *
  7455. * Gets the macOS appearance setting that is currently applied to your application,
  7456. * maps to NSApplication.effectiveAppearance
  7457. *
  7458. * @platform darwin
  7459. */
  7460. getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
  7461. /**
  7462. * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
  7463. *
  7464. * This user consent was not required on macOS 10.13 High Sierra or lower so this
  7465. * method will always return `granted`. macOS 10.14 Mojave or higher requires
  7466. * consent for `microphone` and `camera` access. macOS 10.15 Catalina or higher
  7467. * requires consent for `screen` access.
  7468. *
  7469. * Windows 10 has a global setting controlling `microphone` and `camera` access for
  7470. * all win32 applications. It will always return `granted` for `screen` and for all
  7471. * media types on older versions of Windows.
  7472. *
  7473. * @platform win32,darwin
  7474. */
  7475. getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
  7476. /**
  7477. * The standard system color formatted as `#RRGGBBAA`.
  7478. *
  7479. * Returns one of several standard system colors that automatically adapt to
  7480. * vibrancy and changes in accessibility settings like 'Increase contrast' and
  7481. * 'Reduce transparency'. See Apple Documentation for more details.
  7482. *
  7483. * @platform darwin
  7484. */
  7485. getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
  7486. /**
  7487. * The value of `key` in `NSUserDefaults`.
  7488. *
  7489. * Some popular `key` and `type`s are:
  7490. *
  7491. * * `AppleInterfaceStyle`: `string`
  7492. * * `AppleAquaColorVariant`: `integer`
  7493. * * `AppleHighlightColor`: `string`
  7494. * * `AppleShowScrollBars`: `string`
  7495. * * `NSNavRecentPlaces`: `array`
  7496. * * `NSPreferredWebServices`: `dictionary`
  7497. * * `NSUserDictionaryReplacementItems`: `array`
  7498. *
  7499. * @platform darwin
  7500. */
  7501. getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
  7502. /**
  7503. * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
  7504. *
  7505. * An example of using it to determine if you should create a transparent window or
  7506. * not (transparent windows won't work correctly when DWM composition is disabled):
  7507. *
  7508. * @platform win32
  7509. */
  7510. isAeroGlassEnabled(): boolean;
  7511. /**
  7512. * Whether the system is in Dark Mode.
  7513. *
  7514. **Deprecated:** Should use the new `nativeTheme.shouldUseDarkColors` API.
  7515. *
  7516. * @deprecated
  7517. * @platform darwin,win32
  7518. */
  7519. isDarkMode(): boolean;
  7520. /**
  7521. * `true` if a high contrast theme is active, `false` otherwise.
  7522. *
  7523. * **Deprecated:** Should use the new `nativeTheme.shouldUseHighContrastColors`
  7524. * API.
  7525. *
  7526. * @deprecated
  7527. * @platform darwin,win32
  7528. */
  7529. isHighContrastColorScheme(): boolean;
  7530. /**
  7531. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7532. * and dark backgrounds) is active, `false` otherwise.
  7533. *
  7534. * **Deprecated:** Should use the new `nativeTheme.shouldUseInvertedColorScheme`
  7535. * API.
  7536. *
  7537. * @deprecated
  7538. * @platform win32
  7539. */
  7540. isInvertedColorScheme(): boolean;
  7541. /**
  7542. * Whether the Swipe between pages setting is on.
  7543. *
  7544. * @platform darwin
  7545. */
  7546. isSwipeTrackingFromScrollEventsEnabled(): boolean;
  7547. /**
  7548. * `true` if the current process is a trusted accessibility client and `false` if
  7549. * it is not.
  7550. *
  7551. * @platform darwin
  7552. */
  7553. isTrustedAccessibilityClient(prompt: boolean): boolean;
  7554. /**
  7555. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7556. * contains the user information dictionary sent along with the notification.
  7557. *
  7558. * @platform darwin
  7559. */
  7560. postLocalNotification(event: string, userInfo: Record<string, any>): void;
  7561. /**
  7562. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7563. * contains the user information dictionary sent along with the notification.
  7564. *
  7565. * @platform darwin
  7566. */
  7567. postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
  7568. /**
  7569. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7570. * contains the user information dictionary sent along with the notification.
  7571. *
  7572. * @platform darwin
  7573. */
  7574. postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
  7575. /**
  7576. * resolves if the user has successfully authenticated with Touch ID.
  7577. *
  7578. * This API itself will not protect your user data; rather, it is a mechanism to
  7579. * allow you to do so. Native apps will need to set Access Control Constants like
  7580. * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
  7581. * auto-prompt for Touch ID biometric consent. This could be done with
  7582. * `node-keytar`, such that one would store an encryption key with `node-keytar`
  7583. * and only fetch it if `promptTouchID()` resolves.
  7584. *
  7585. * **NOTE:** This API will return a rejected Promise on macOS systems older than
  7586. * Sierra 10.12.2.
  7587. *
  7588. * @platform darwin
  7589. */
  7590. promptTouchID(reason: string): Promise<void>;
  7591. /**
  7592. * Add the specified defaults to your application's `NSUserDefaults`.
  7593. *
  7594. * @platform darwin
  7595. */
  7596. registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
  7597. /**
  7598. * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
  7599. * or global value of a `key` previously set with `setUserDefault`.
  7600. *
  7601. * @platform darwin
  7602. */
  7603. removeUserDefault(key: string): void;
  7604. /**
  7605. * Sets the appearance setting for your application, this should override the
  7606. * system default and override the value of `getEffectiveAppearance`.
  7607. *
  7608. * @deprecated
  7609. * @platform darwin
  7610. */
  7611. setAppLevelAppearance(appearance: (('dark' | 'light')) | (null)): void;
  7612. /**
  7613. * Set the value of `key` in `NSUserDefaults`.
  7614. *
  7615. * Note that `type` should match actual type of `value`. An exception is thrown if
  7616. * they don't.
  7617. *
  7618. Some popular `key` and `type`s are:
  7619. * `ApplePressAndHoldEnabled`: `boolean`
  7620. *
  7621. * @platform darwin
  7622. */
  7623. setUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary', value: string): void;
  7624. /**
  7625. * The ID of this subscription
  7626. *
  7627. * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
  7628. * defaults. This is necessary for events such as
  7629. * `NSUserDefaultsDidChangeNotification`.
  7630. *
  7631. * @platform darwin
  7632. */
  7633. subscribeLocalNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  7634. /**
  7635. * The ID of this subscription
  7636. *
  7637. * Subscribes to native notifications of macOS, `callback` will be called with
  7638. * `callback(event, userInfo)` when the corresponding `event` happens. The
  7639. * `userInfo` is an Object that contains the user information dictionary sent along
  7640. * with the notification. The `object` is the sender of the notification, and only
  7641. * supports `NSString` values for now.
  7642. *
  7643. * The `id` of the subscriber is returned, which can be used to unsubscribe the
  7644. * `event`.
  7645. *
  7646. * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
  7647. * values of `event` are:
  7648. *
  7649. * * `AppleInterfaceThemeChangedNotification`
  7650. * * `AppleAquaColorVariantChanged`
  7651. * * `AppleColorPreferencesChangedNotification`
  7652. * * `AppleShowScrollBarsSettingChanged`
  7653. *
  7654. * @platform darwin
  7655. */
  7656. subscribeNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  7657. /**
  7658. * The ID of this subscription
  7659. *
  7660. * Same as `subscribeNotification`, but uses
  7661. * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
  7662. * such as `NSWorkspaceDidActivateApplicationNotification`.
  7663. *
  7664. * @platform darwin
  7665. */
  7666. subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  7667. /**
  7668. * Same as `unsubscribeNotification`, but removes the subscriber from
  7669. * `NSNotificationCenter`.
  7670. *
  7671. * @platform darwin
  7672. */
  7673. unsubscribeLocalNotification(id: number): void;
  7674. /**
  7675. * Removes the subscriber with `id`.
  7676. *
  7677. * @platform darwin
  7678. */
  7679. unsubscribeNotification(id: number): void;
  7680. /**
  7681. * Same as `unsubscribeNotification`, but removes the subscriber from
  7682. * `NSWorkspace.sharedWorkspace.notificationCenter`.
  7683. *
  7684. * @platform darwin
  7685. */
  7686. unsubscribeWorkspaceNotification(id: number): void;
  7687. /**
  7688. * A `String` property that can be `dark`, `light` or `unknown`. It determines the
  7689. * macOS appearance setting for your application. This maps to values in:
  7690. * NSApplication.appearance. Setting this will override the system default as well
  7691. * as the value of `getEffectiveAppearance`.
  7692. *
  7693. * Possible values that can be set are `dark` and `light`, and possible return
  7694. * values are `dark`, `light`, and `unknown`.
  7695. *
  7696. This property is only available on macOS 10.14 Mojave or newer.
  7697. *
  7698. * @platform darwin
  7699. */
  7700. appLevelAppearance: ('dark' | 'light' | 'unknown');
  7701. /**
  7702. * A `String` property that can be `dark`, `light` or `unknown`.
  7703. *
  7704. * Returns the macOS appearance setting that is currently applied to your
  7705. * application, maps to NSApplication.effectiveAppearance
  7706. *
  7707. * @platform darwin
  7708. */
  7709. readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
  7710. }
  7711. interface Task {
  7712. // Docs: https://electronjs.org/docs/api/structures/task
  7713. /**
  7714. * The command line arguments when `program` is executed.
  7715. */
  7716. arguments: string;
  7717. /**
  7718. * Description of this task.
  7719. */
  7720. description: string;
  7721. /**
  7722. * The icon index in the icon file. If an icon file consists of two or more icons,
  7723. * set this value to identify the icon. If an icon file consists of one icon, this
  7724. * value is 0.
  7725. */
  7726. iconIndex: number;
  7727. /**
  7728. * The absolute path to an icon to be displayed in a JumpList, which can be an
  7729. * arbitrary resource file that contains an icon. You can usually specify
  7730. * `process.execPath` to show the icon of the program.
  7731. */
  7732. iconPath: string;
  7733. /**
  7734. * Path of the program to execute, usually you should specify `process.execPath`
  7735. * which opens the current program.
  7736. */
  7737. program: string;
  7738. /**
  7739. * The string to be displayed in a JumpList.
  7740. */
  7741. title: string;
  7742. /**
  7743. * The working directory. Default is empty.
  7744. */
  7745. workingDirectory?: string;
  7746. }
  7747. interface ThumbarButton {
  7748. // Docs: https://electronjs.org/docs/api/structures/thumbar-button
  7749. click: Function;
  7750. /**
  7751. * Control specific states and behaviors of the button. By default, it is
  7752. * `['enabled']`.
  7753. */
  7754. flags?: string[];
  7755. /**
  7756. * The icon showing in thumbnail toolbar.
  7757. */
  7758. icon: NativeImage;
  7759. /**
  7760. * The text of the button's tooltip.
  7761. */
  7762. tooltip?: string;
  7763. }
  7764. class TouchBar {
  7765. // Docs: https://electronjs.org/docs/api/touch-bar
  7766. /**
  7767. * TouchBar
  7768. */
  7769. constructor(options: TouchBarConstructorOptions);
  7770. escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
  7771. static TouchBarButton: typeof TouchBarButton;
  7772. static TouchBarColorPicker: typeof TouchBarColorPicker;
  7773. static TouchBarGroup: typeof TouchBarGroup;
  7774. static TouchBarLabel: typeof TouchBarLabel;
  7775. static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
  7776. static TouchBarPopover: typeof TouchBarPopover;
  7777. static TouchBarScrubber: typeof TouchBarScrubber;
  7778. static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
  7779. static TouchBarSlider: typeof TouchBarSlider;
  7780. static TouchBarSpacer: typeof TouchBarSpacer;
  7781. }
  7782. class TouchBarButton {
  7783. // Docs: https://electronjs.org/docs/api/touch-bar-button
  7784. /**
  7785. * TouchBarButton
  7786. */
  7787. constructor(options: TouchBarButtonConstructorOptions);
  7788. accessibilityLabel: string;
  7789. backgroundColor: string;
  7790. enabled: boolean;
  7791. icon: NativeImage;
  7792. iconPosition: ('left' | 'right' | 'overlay');
  7793. label: string;
  7794. }
  7795. class TouchBarColorPicker extends NodeEventEmitter {
  7796. // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
  7797. /**
  7798. * TouchBarColorPicker
  7799. */
  7800. constructor(options: TouchBarColorPickerConstructorOptions);
  7801. availableColors: string[];
  7802. selectedColor: string;
  7803. }
  7804. class TouchBarGroup extends NodeEventEmitter {
  7805. // Docs: https://electronjs.org/docs/api/touch-bar-group
  7806. /**
  7807. * TouchBarGroup
  7808. */
  7809. constructor(options: TouchBarGroupConstructorOptions);
  7810. }
  7811. class TouchBarLabel extends NodeEventEmitter {
  7812. // Docs: https://electronjs.org/docs/api/touch-bar-label
  7813. /**
  7814. * TouchBarLabel
  7815. */
  7816. constructor(options: TouchBarLabelConstructorOptions);
  7817. accessibilityLabel: string;
  7818. label: string;
  7819. textColor: string;
  7820. }
  7821. class TouchBarOtherItemsProxy extends NodeEventEmitter {
  7822. // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
  7823. /**
  7824. * TouchBarOtherItemsProxy
  7825. */
  7826. constructor();
  7827. }
  7828. class TouchBarPopover extends NodeEventEmitter {
  7829. // Docs: https://electronjs.org/docs/api/touch-bar-popover
  7830. /**
  7831. * TouchBarPopover
  7832. */
  7833. constructor(options: TouchBarPopoverConstructorOptions);
  7834. icon: NativeImage;
  7835. label: string;
  7836. }
  7837. class TouchBarScrubber extends NodeEventEmitter {
  7838. // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
  7839. /**
  7840. * TouchBarScrubber
  7841. */
  7842. constructor(options: TouchBarScrubberConstructorOptions);
  7843. continuous: boolean;
  7844. items: ScrubberItem[];
  7845. mode: ('fixed' | 'free');
  7846. overlayStyle: ('background' | 'outline' | 'none');
  7847. selectedStyle: ('background' | 'outline' | 'none');
  7848. showArrowButtons: boolean;
  7849. }
  7850. class TouchBarSegmentedControl extends NodeEventEmitter {
  7851. // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
  7852. /**
  7853. * TouchBarSegmentedControl
  7854. */
  7855. constructor(options: TouchBarSegmentedControlConstructorOptions);
  7856. mode: ('single' | 'multiple' | 'buttons');
  7857. segments: SegmentedControlSegment[];
  7858. segmentStyle: string;
  7859. selectedIndex: number;
  7860. }
  7861. class TouchBarSlider extends NodeEventEmitter {
  7862. // Docs: https://electronjs.org/docs/api/touch-bar-slider
  7863. /**
  7864. * TouchBarSlider
  7865. */
  7866. constructor(options: TouchBarSliderConstructorOptions);
  7867. label: string;
  7868. maxValue: number;
  7869. minValue: number;
  7870. value: number;
  7871. }
  7872. class TouchBarSpacer extends NodeEventEmitter {
  7873. // Docs: https://electronjs.org/docs/api/touch-bar-spacer
  7874. /**
  7875. * TouchBarSpacer
  7876. */
  7877. constructor(options: TouchBarSpacerConstructorOptions);
  7878. size: ('small' | 'large' | 'flexible');
  7879. }
  7880. interface TraceCategoriesAndOptions {
  7881. // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
  7882. /**
  7883. * A filter to control what category groups should be traced. A filter can have an
  7884. * optional '-' prefix to exclude category groups that contain a matching category.
  7885. * Having both included and excluded category patterns in the same list is not
  7886. * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
  7887. * `-excluded_category1,-excluded_category2`.
  7888. */
  7889. categoryFilter: string;
  7890. /**
  7891. * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
  7892. * the following strings: `record-until-full`, `record-continuously`,
  7893. * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
  7894. * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
  7895. * modes and hence mutually exclusive. If more than one trace recording modes
  7896. * appear in the `traceOptions` string, the last one takes precedence. If none of
  7897. * the trace recording modes are specified, recording mode is `record-until-full`.
  7898. * The trace option will first be reset to the default option (`record_mode` set to
  7899. * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
  7900. * before options parsed from `traceOptions` are applied on it.
  7901. */
  7902. traceOptions: string;
  7903. }
  7904. interface TraceConfig {
  7905. // Docs: https://electronjs.org/docs/api/structures/trace-config
  7906. /**
  7907. * if true, filter event data according to a specific list of events that have been
  7908. * manually vetted to not include any PII. See the implementation in Chromium for
  7909. * specifics.
  7910. */
  7911. enable_argument_filter?: boolean;
  7912. /**
  7913. * a list of tracing categories to exclude. Can include glob-like patterns using
  7914. * `*` at the end of the category name. See tracing categories for the list of
  7915. * categories.
  7916. */
  7917. excluded_categories?: string[];
  7918. /**
  7919. * a list of histogram names to report with the trace.
  7920. */
  7921. histogram_names?: string[];
  7922. /**
  7923. * a list of tracing categories to include. Can include glob-like patterns using
  7924. * `*` at the end of the category name. See tracing categories for the list of
  7925. * categories.
  7926. */
  7927. included_categories?: string[];
  7928. /**
  7929. * a list of process IDs to include in the trace. If not specified, trace all
  7930. * processes.
  7931. */
  7932. included_process_ids?: number[];
  7933. /**
  7934. * if the `disabled-by-default-memory-infra` category is enabled, this contains
  7935. * optional additional configuration for data collection. See the Chromium
  7936. * memory-infra docs for more information.
  7937. */
  7938. memory_dump_config?: Record<string, any>;
  7939. /**
  7940. * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
  7941. * or `trace-to-console`. Defaults to `record-until-full`.
  7942. */
  7943. recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
  7944. /**
  7945. * maximum size of the trace recording buffer in events.
  7946. */
  7947. trace_buffer_size_in_events?: number;
  7948. /**
  7949. * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
  7950. */
  7951. trace_buffer_size_in_kb?: number;
  7952. }
  7953. interface Transaction {
  7954. // Docs: https://electronjs.org/docs/api/structures/transaction
  7955. /**
  7956. * The error code if an error occurred while processing the transaction.
  7957. */
  7958. errorCode: number;
  7959. /**
  7960. * The error message if an error occurred while processing the transaction.
  7961. */
  7962. errorMessage: string;
  7963. /**
  7964. * The identifier of the restored transaction by the App Store.
  7965. */
  7966. originalTransactionIdentifier: string;
  7967. payment: Payment;
  7968. /**
  7969. * The date the transaction was added to the App Store’s payment queue.
  7970. */
  7971. transactionDate: string;
  7972. /**
  7973. * A string that uniquely identifies a successful payment transaction.
  7974. */
  7975. transactionIdentifier: string;
  7976. /**
  7977. * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
  7978. * `deferred`.
  7979. */
  7980. transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
  7981. }
  7982. class Tray extends NodeEventEmitter {
  7983. // Docs: https://electronjs.org/docs/api/tray
  7984. /**
  7985. * Emitted when the tray balloon is clicked.
  7986. *
  7987. * @platform win32
  7988. */
  7989. on(event: 'balloon-click', listener: Function): this;
  7990. once(event: 'balloon-click', listener: Function): this;
  7991. addListener(event: 'balloon-click', listener: Function): this;
  7992. removeListener(event: 'balloon-click', listener: Function): this;
  7993. /**
  7994. * Emitted when the tray balloon is closed because of timeout or user manually
  7995. * closes it.
  7996. *
  7997. * @platform win32
  7998. */
  7999. on(event: 'balloon-closed', listener: Function): this;
  8000. once(event: 'balloon-closed', listener: Function): this;
  8001. addListener(event: 'balloon-closed', listener: Function): this;
  8002. removeListener(event: 'balloon-closed', listener: Function): this;
  8003. /**
  8004. * Emitted when the tray balloon shows.
  8005. *
  8006. * @platform win32
  8007. */
  8008. on(event: 'balloon-show', listener: Function): this;
  8009. once(event: 'balloon-show', listener: Function): this;
  8010. addListener(event: 'balloon-show', listener: Function): this;
  8011. removeListener(event: 'balloon-show', listener: Function): this;
  8012. /**
  8013. * Emitted when the tray icon is clicked.
  8014. */
  8015. on(event: 'click', listener: (event: KeyboardEvent,
  8016. /**
  8017. * The bounds of tray icon.
  8018. */
  8019. bounds: Rectangle,
  8020. /**
  8021. * The position of the event.
  8022. */
  8023. position: Point) => void): this;
  8024. once(event: 'click', listener: (event: KeyboardEvent,
  8025. /**
  8026. * The bounds of tray icon.
  8027. */
  8028. bounds: Rectangle,
  8029. /**
  8030. * The position of the event.
  8031. */
  8032. position: Point) => void): this;
  8033. addListener(event: 'click', listener: (event: KeyboardEvent,
  8034. /**
  8035. * The bounds of tray icon.
  8036. */
  8037. bounds: Rectangle,
  8038. /**
  8039. * The position of the event.
  8040. */
  8041. position: Point) => void): this;
  8042. removeListener(event: 'click', listener: (event: KeyboardEvent,
  8043. /**
  8044. * The bounds of tray icon.
  8045. */
  8046. bounds: Rectangle,
  8047. /**
  8048. * The position of the event.
  8049. */
  8050. position: Point) => void): this;
  8051. /**
  8052. * Emitted when the tray icon is double clicked.
  8053. *
  8054. * @platform darwin,win32
  8055. */
  8056. on(event: 'double-click', listener: (event: KeyboardEvent,
  8057. /**
  8058. * The bounds of tray icon.
  8059. */
  8060. bounds: Rectangle) => void): this;
  8061. once(event: 'double-click', listener: (event: KeyboardEvent,
  8062. /**
  8063. * The bounds of tray icon.
  8064. */
  8065. bounds: Rectangle) => void): this;
  8066. addListener(event: 'double-click', listener: (event: KeyboardEvent,
  8067. /**
  8068. * The bounds of tray icon.
  8069. */
  8070. bounds: Rectangle) => void): this;
  8071. removeListener(event: 'double-click', listener: (event: KeyboardEvent,
  8072. /**
  8073. * The bounds of tray icon.
  8074. */
  8075. bounds: Rectangle) => void): this;
  8076. /**
  8077. * Emitted when a drag operation ends on the tray or ends at another location.
  8078. *
  8079. * @platform darwin
  8080. */
  8081. on(event: 'drag-end', listener: Function): this;
  8082. once(event: 'drag-end', listener: Function): this;
  8083. addListener(event: 'drag-end', listener: Function): this;
  8084. removeListener(event: 'drag-end', listener: Function): this;
  8085. /**
  8086. * Emitted when a drag operation enters the tray icon.
  8087. *
  8088. * @platform darwin
  8089. */
  8090. on(event: 'drag-enter', listener: Function): this;
  8091. once(event: 'drag-enter', listener: Function): this;
  8092. addListener(event: 'drag-enter', listener: Function): this;
  8093. removeListener(event: 'drag-enter', listener: Function): this;
  8094. /**
  8095. * Emitted when a drag operation exits the tray icon.
  8096. *
  8097. * @platform darwin
  8098. */
  8099. on(event: 'drag-leave', listener: Function): this;
  8100. once(event: 'drag-leave', listener: Function): this;
  8101. addListener(event: 'drag-leave', listener: Function): this;
  8102. removeListener(event: 'drag-leave', listener: Function): this;
  8103. /**
  8104. * Emitted when any dragged items are dropped on the tray icon.
  8105. *
  8106. * @platform darwin
  8107. */
  8108. on(event: 'drop', listener: Function): this;
  8109. once(event: 'drop', listener: Function): this;
  8110. addListener(event: 'drop', listener: Function): this;
  8111. removeListener(event: 'drop', listener: Function): this;
  8112. /**
  8113. * Emitted when dragged files are dropped in the tray icon.
  8114. *
  8115. * @platform darwin
  8116. */
  8117. on(event: 'drop-files', listener: (event: Event,
  8118. /**
  8119. * The paths of the dropped files.
  8120. */
  8121. files: string[]) => void): this;
  8122. once(event: 'drop-files', listener: (event: Event,
  8123. /**
  8124. * The paths of the dropped files.
  8125. */
  8126. files: string[]) => void): this;
  8127. addListener(event: 'drop-files', listener: (event: Event,
  8128. /**
  8129. * The paths of the dropped files.
  8130. */
  8131. files: string[]) => void): this;
  8132. removeListener(event: 'drop-files', listener: (event: Event,
  8133. /**
  8134. * The paths of the dropped files.
  8135. */
  8136. files: string[]) => void): this;
  8137. /**
  8138. * Emitted when dragged text is dropped in the tray icon.
  8139. *
  8140. * @platform darwin
  8141. */
  8142. on(event: 'drop-text', listener: (event: Event,
  8143. /**
  8144. * the dropped text string.
  8145. */
  8146. text: string) => void): this;
  8147. once(event: 'drop-text', listener: (event: Event,
  8148. /**
  8149. * the dropped text string.
  8150. */
  8151. text: string) => void): this;
  8152. addListener(event: 'drop-text', listener: (event: Event,
  8153. /**
  8154. * the dropped text string.
  8155. */
  8156. text: string) => void): this;
  8157. removeListener(event: 'drop-text', listener: (event: Event,
  8158. /**
  8159. * the dropped text string.
  8160. */
  8161. text: string) => void): this;
  8162. /**
  8163. * Emitted when the mouse clicks the tray icon.
  8164. *
  8165. * @platform darwin
  8166. */
  8167. on(event: 'mouse-down', listener: (event: KeyboardEvent,
  8168. /**
  8169. * The position of the event.
  8170. */
  8171. position: Point) => void): this;
  8172. once(event: 'mouse-down', listener: (event: KeyboardEvent,
  8173. /**
  8174. * The position of the event.
  8175. */
  8176. position: Point) => void): this;
  8177. addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  8178. /**
  8179. * The position of the event.
  8180. */
  8181. position: Point) => void): this;
  8182. removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  8183. /**
  8184. * The position of the event.
  8185. */
  8186. position: Point) => void): this;
  8187. /**
  8188. * Emitted when the mouse enters the tray icon.
  8189. *
  8190. * @platform darwin
  8191. */
  8192. on(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8193. /**
  8194. * The position of the event.
  8195. */
  8196. position: Point) => void): this;
  8197. once(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8198. /**
  8199. * The position of the event.
  8200. */
  8201. position: Point) => void): this;
  8202. addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8203. /**
  8204. * The position of the event.
  8205. */
  8206. position: Point) => void): this;
  8207. removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  8208. /**
  8209. * The position of the event.
  8210. */
  8211. position: Point) => void): this;
  8212. /**
  8213. * Emitted when the mouse exits the tray icon.
  8214. *
  8215. * @platform darwin
  8216. */
  8217. on(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8218. /**
  8219. * The position of the event.
  8220. */
  8221. position: Point) => void): this;
  8222. once(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8223. /**
  8224. * The position of the event.
  8225. */
  8226. position: Point) => void): this;
  8227. addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8228. /**
  8229. * The position of the event.
  8230. */
  8231. position: Point) => void): this;
  8232. removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  8233. /**
  8234. * The position of the event.
  8235. */
  8236. position: Point) => void): this;
  8237. /**
  8238. * Emitted when the mouse moves in the tray icon.
  8239. *
  8240. * @platform darwin,win32
  8241. */
  8242. on(event: 'mouse-move', listener: (event: KeyboardEvent,
  8243. /**
  8244. * The position of the event.
  8245. */
  8246. position: Point) => void): this;
  8247. once(event: 'mouse-move', listener: (event: KeyboardEvent,
  8248. /**
  8249. * The position of the event.
  8250. */
  8251. position: Point) => void): this;
  8252. addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  8253. /**
  8254. * The position of the event.
  8255. */
  8256. position: Point) => void): this;
  8257. removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  8258. /**
  8259. * The position of the event.
  8260. */
  8261. position: Point) => void): this;
  8262. /**
  8263. * Emitted when the mouse is released from clicking the tray icon.
  8264. *
  8265. * Note: This will not be emitted if you have set a context menu for your Tray
  8266. * using `tray.setContextMenu`, as a result of macOS-level constraints.
  8267. *
  8268. * @platform darwin
  8269. */
  8270. on(event: 'mouse-up', listener: (event: KeyboardEvent,
  8271. /**
  8272. * The position of the event.
  8273. */
  8274. position: Point) => void): this;
  8275. once(event: 'mouse-up', listener: (event: KeyboardEvent,
  8276. /**
  8277. * The position of the event.
  8278. */
  8279. position: Point) => void): this;
  8280. addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  8281. /**
  8282. * The position of the event.
  8283. */
  8284. position: Point) => void): this;
  8285. removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  8286. /**
  8287. * The position of the event.
  8288. */
  8289. position: Point) => void): this;
  8290. /**
  8291. * Emitted when the tray icon is right clicked.
  8292. *
  8293. * @platform darwin,win32
  8294. */
  8295. on(event: 'right-click', listener: (event: KeyboardEvent,
  8296. /**
  8297. * The bounds of tray icon.
  8298. */
  8299. bounds: Rectangle) => void): this;
  8300. once(event: 'right-click', listener: (event: KeyboardEvent,
  8301. /**
  8302. * The bounds of tray icon.
  8303. */
  8304. bounds: Rectangle) => void): this;
  8305. addListener(event: 'right-click', listener: (event: KeyboardEvent,
  8306. /**
  8307. * The bounds of tray icon.
  8308. */
  8309. bounds: Rectangle) => void): this;
  8310. removeListener(event: 'right-click', listener: (event: KeyboardEvent,
  8311. /**
  8312. * The bounds of tray icon.
  8313. */
  8314. bounds: Rectangle) => void): this;
  8315. /**
  8316. * Tray
  8317. */
  8318. constructor(image: (NativeImage) | (string), guid?: string);
  8319. /**
  8320. * Closes an open context menu, as set by `tray.setContextMenu()`.
  8321. *
  8322. * @platform darwin,win32
  8323. */
  8324. closeContextMenu(): void;
  8325. /**
  8326. * Destroys the tray icon immediately.
  8327. */
  8328. destroy(): void;
  8329. /**
  8330. * Displays a tray balloon.
  8331. *
  8332. * @platform win32
  8333. */
  8334. displayBalloon(options: DisplayBalloonOptions): void;
  8335. /**
  8336. * Returns focus to the taskbar notification area. Notification area icons should
  8337. * use this message when they have completed their UI operation. For example, if
  8338. * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
  8339. * `tray.focus()` to return focus to the notification area.
  8340. *
  8341. * @platform win32
  8342. */
  8343. focus(): void;
  8344. /**
  8345. * The `bounds` of this tray icon as `Object`.
  8346. *
  8347. * @platform darwin,win32
  8348. */
  8349. getBounds(): Rectangle;
  8350. /**
  8351. * Whether double click events will be ignored.
  8352. *
  8353. * @platform darwin
  8354. */
  8355. getIgnoreDoubleClickEvents(): boolean;
  8356. /**
  8357. * the title displayed next to the tray icon in the status bar
  8358. *
  8359. * @platform darwin
  8360. */
  8361. getTitle(): string;
  8362. /**
  8363. * Whether the tray icon is destroyed.
  8364. */
  8365. isDestroyed(): boolean;
  8366. /**
  8367. * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
  8368. * will be shown instead of the tray icon's context menu.
  8369. *
  8370. The `position` is only available on Windows, and it is (0, 0) by default.
  8371. *
  8372. * @platform darwin,win32
  8373. */
  8374. popUpContextMenu(menu?: Menu, position?: Point): void;
  8375. /**
  8376. * Removes a tray balloon.
  8377. *
  8378. * @platform win32
  8379. */
  8380. removeBalloon(): void;
  8381. /**
  8382. * Sets the context menu for this icon.
  8383. */
  8384. setContextMenu(menu: (Menu) | (null)): void;
  8385. /**
  8386. * Sets the option to ignore double click events. Ignoring these events allows you
  8387. * to detect every individual click of the tray icon.
  8388. *
  8389. This value is set to false by default.
  8390. *
  8391. * @platform darwin
  8392. */
  8393. setIgnoreDoubleClickEvents(ignore: boolean): void;
  8394. /**
  8395. * Sets the `image` associated with this tray icon.
  8396. */
  8397. setImage(image: (NativeImage) | (string)): void;
  8398. /**
  8399. * Sets the `image` associated with this tray icon when pressed on macOS.
  8400. *
  8401. * @platform darwin
  8402. */
  8403. setPressedImage(image: (NativeImage) | (string)): void;
  8404. /**
  8405. * Sets the title displayed next to the tray icon in the status bar (Support ANSI
  8406. * colors).
  8407. *
  8408. * @platform darwin
  8409. */
  8410. setTitle(title: string, options?: TitleOptions): void;
  8411. /**
  8412. * Sets the hover text for this tray icon.
  8413. */
  8414. setToolTip(toolTip: string): void;
  8415. }
  8416. interface UploadData {
  8417. // Docs: https://electronjs.org/docs/api/structures/upload-data
  8418. /**
  8419. * UUID of blob data. Use ses.getBlobData method to retrieve the data.
  8420. */
  8421. blobUUID?: string;
  8422. /**
  8423. * Content being sent.
  8424. */
  8425. bytes: Buffer;
  8426. /**
  8427. * Path of file being uploaded.
  8428. */
  8429. file?: string;
  8430. }
  8431. interface UploadFile {
  8432. // Docs: https://electronjs.org/docs/api/structures/upload-file
  8433. /**
  8434. * Path of file to be uploaded.
  8435. */
  8436. filePath: string;
  8437. /**
  8438. * Number of bytes to read from `offset`. Defaults to `0`.
  8439. */
  8440. length: number;
  8441. /**
  8442. * Last Modification time in number of seconds since the UNIX epoch.
  8443. */
  8444. modificationTime: number;
  8445. /**
  8446. * Defaults to `0`.
  8447. */
  8448. offset: number;
  8449. /**
  8450. * `file`.
  8451. */
  8452. type: 'file';
  8453. }
  8454. interface UploadRawData {
  8455. // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
  8456. /**
  8457. * Data to be uploaded.
  8458. */
  8459. bytes: Buffer;
  8460. /**
  8461. * `rawData`.
  8462. */
  8463. type: 'rawData';
  8464. }
  8465. class WebContents extends NodeEventEmitter {
  8466. // Docs: https://electronjs.org/docs/api/web-contents
  8467. /**
  8468. * | undefined - A WebContents instance with the given ID, or `undefined` if there
  8469. * is no WebContents associated with the given ID.
  8470. */
  8471. static fromId(id: number): WebContents;
  8472. /**
  8473. * An array of all `WebContents` instances. This will contain web contents for all
  8474. * windows, webviews, opened devtools, and devtools extension background pages.
  8475. */
  8476. static getAllWebContents(): WebContents[];
  8477. /**
  8478. * The web contents that is focused in this application, otherwise returns `null`.
  8479. */
  8480. static getFocusedWebContents(): WebContents;
  8481. /**
  8482. * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
  8483. * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
  8484. * menu shortcuts.
  8485. *
  8486. To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
  8487. */
  8488. on(event: 'before-input-event', listener: (event: Event,
  8489. /**
  8490. * Input properties.
  8491. */
  8492. input: Input) => void): this;
  8493. once(event: 'before-input-event', listener: (event: Event,
  8494. /**
  8495. * Input properties.
  8496. */
  8497. input: Input) => void): this;
  8498. addListener(event: 'before-input-event', listener: (event: Event,
  8499. /**
  8500. * Input properties.
  8501. */
  8502. input: Input) => void): this;
  8503. removeListener(event: 'before-input-event', listener: (event: Event,
  8504. /**
  8505. * Input properties.
  8506. */
  8507. input: Input) => void): this;
  8508. /**
  8509. * Emitted when failed to verify the `certificate` for `url`.
  8510. *
  8511. The usage is the same with the `certificate-error` event of `app`.
  8512. */
  8513. on(event: 'certificate-error', listener: (event: Event,
  8514. url: string,
  8515. /**
  8516. * The error code.
  8517. */
  8518. error: string,
  8519. certificate: Certificate,
  8520. callback: (isTrusted: boolean) => void) => void): this;
  8521. once(event: 'certificate-error', listener: (event: Event,
  8522. url: string,
  8523. /**
  8524. * The error code.
  8525. */
  8526. error: string,
  8527. certificate: Certificate,
  8528. callback: (isTrusted: boolean) => void) => void): this;
  8529. addListener(event: 'certificate-error', listener: (event: Event,
  8530. url: string,
  8531. /**
  8532. * The error code.
  8533. */
  8534. error: string,
  8535. certificate: Certificate,
  8536. callback: (isTrusted: boolean) => void) => void): this;
  8537. removeListener(event: 'certificate-error', listener: (event: Event,
  8538. url: string,
  8539. /**
  8540. * The error code.
  8541. */
  8542. error: string,
  8543. certificate: Certificate,
  8544. callback: (isTrusted: boolean) => void) => void): this;
  8545. /**
  8546. * Emitted when the associated window logs a console message.
  8547. */
  8548. on(event: 'console-message', listener: (event: Event,
  8549. /**
  8550. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8551. * `error`.
  8552. */
  8553. level: number,
  8554. /**
  8555. * The actual console message
  8556. */
  8557. message: string,
  8558. /**
  8559. * The line number of the source that triggered this console message
  8560. */
  8561. line: number,
  8562. sourceId: string) => void): this;
  8563. once(event: 'console-message', listener: (event: Event,
  8564. /**
  8565. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8566. * `error`.
  8567. */
  8568. level: number,
  8569. /**
  8570. * The actual console message
  8571. */
  8572. message: string,
  8573. /**
  8574. * The line number of the source that triggered this console message
  8575. */
  8576. line: number,
  8577. sourceId: string) => void): this;
  8578. addListener(event: 'console-message', listener: (event: Event,
  8579. /**
  8580. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8581. * `error`.
  8582. */
  8583. level: number,
  8584. /**
  8585. * The actual console message
  8586. */
  8587. message: string,
  8588. /**
  8589. * The line number of the source that triggered this console message
  8590. */
  8591. line: number,
  8592. sourceId: string) => void): this;
  8593. removeListener(event: 'console-message', listener: (event: Event,
  8594. /**
  8595. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8596. * `error`.
  8597. */
  8598. level: number,
  8599. /**
  8600. * The actual console message
  8601. */
  8602. message: string,
  8603. /**
  8604. * The line number of the source that triggered this console message
  8605. */
  8606. line: number,
  8607. sourceId: string) => void): this;
  8608. /**
  8609. * Emitted when there is a new context menu that needs to be handled.
  8610. */
  8611. on(event: 'context-menu', listener: (event: Event,
  8612. params: ContextMenuParams) => void): this;
  8613. once(event: 'context-menu', listener: (event: Event,
  8614. params: ContextMenuParams) => void): this;
  8615. addListener(event: 'context-menu', listener: (event: Event,
  8616. params: ContextMenuParams) => void): this;
  8617. removeListener(event: 'context-menu', listener: (event: Event,
  8618. params: ContextMenuParams) => void): this;
  8619. /**
  8620. * Emitted when the renderer process crashes or is killed.
  8621. *
  8622. * **Deprecated:** This event is superceded by the `render-process-gone` event
  8623. * which contains more information about why the render process disappeared. It
  8624. * isn't always because it crashed. The `killed` boolean can be replaced by
  8625. * checking `reason === 'killed'` when you switch to that event.
  8626. *
  8627. * @deprecated
  8628. */
  8629. on(event: 'crashed', listener: (event: Event,
  8630. killed: boolean) => void): this;
  8631. once(event: 'crashed', listener: (event: Event,
  8632. killed: boolean) => void): this;
  8633. addListener(event: 'crashed', listener: (event: Event,
  8634. killed: boolean) => void): this;
  8635. removeListener(event: 'crashed', listener: (event: Event,
  8636. killed: boolean) => void): this;
  8637. /**
  8638. * Emitted when the cursor's type changes. The `type` parameter can be `default`,
  8639. * `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
  8640. * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
  8641. * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
  8642. * `row-resize`, `m-panning`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`,
  8643. * `s-panning`, `se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`,
  8644. * `cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`, `none`,
  8645. * `not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing` or `custom`.
  8646. *
  8647. * If the `type` parameter is `custom`, the `image` parameter will hold the custom
  8648. * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
  8649. * additional information about the custom cursor.
  8650. */
  8651. on(event: 'cursor-changed', listener: (event: Event,
  8652. type: string,
  8653. image: NativeImage,
  8654. /**
  8655. * scaling factor for the custom cursor.
  8656. */
  8657. scale: number,
  8658. /**
  8659. * the size of the `image`.
  8660. */
  8661. size: Size,
  8662. /**
  8663. * coordinates of the custom cursor's hotspot.
  8664. */
  8665. hotspot: Point) => void): this;
  8666. once(event: 'cursor-changed', listener: (event: Event,
  8667. type: string,
  8668. image: NativeImage,
  8669. /**
  8670. * scaling factor for the custom cursor.
  8671. */
  8672. scale: number,
  8673. /**
  8674. * the size of the `image`.
  8675. */
  8676. size: Size,
  8677. /**
  8678. * coordinates of the custom cursor's hotspot.
  8679. */
  8680. hotspot: Point) => void): this;
  8681. addListener(event: 'cursor-changed', listener: (event: Event,
  8682. type: string,
  8683. image: NativeImage,
  8684. /**
  8685. * scaling factor for the custom cursor.
  8686. */
  8687. scale: number,
  8688. /**
  8689. * the size of the `image`.
  8690. */
  8691. size: Size,
  8692. /**
  8693. * coordinates of the custom cursor's hotspot.
  8694. */
  8695. hotspot: Point) => void): this;
  8696. removeListener(event: 'cursor-changed', listener: (event: Event,
  8697. type: string,
  8698. image: NativeImage,
  8699. /**
  8700. * scaling factor for the custom cursor.
  8701. */
  8702. scale: number,
  8703. /**
  8704. * the size of the `image`.
  8705. */
  8706. size: Size,
  8707. /**
  8708. * coordinates of the custom cursor's hotspot.
  8709. */
  8710. hotspot: Point) => void): this;
  8711. /**
  8712. * Emitted when `desktopCapturer.getSources()` is called in the renderer process.
  8713. * Calling `event.preventDefault()` will make it return empty sources.
  8714. */
  8715. on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8716. once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8717. addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8718. removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8719. /**
  8720. * Emitted when `webContents` is destroyed.
  8721. */
  8722. on(event: 'destroyed', listener: Function): this;
  8723. once(event: 'destroyed', listener: Function): this;
  8724. addListener(event: 'destroyed', listener: Function): this;
  8725. removeListener(event: 'destroyed', listener: Function): this;
  8726. /**
  8727. * Emitted when DevTools is closed.
  8728. */
  8729. on(event: 'devtools-closed', listener: Function): this;
  8730. once(event: 'devtools-closed', listener: Function): this;
  8731. addListener(event: 'devtools-closed', listener: Function): this;
  8732. removeListener(event: 'devtools-closed', listener: Function): this;
  8733. /**
  8734. * Emitted when DevTools is focused / opened.
  8735. */
  8736. on(event: 'devtools-focused', listener: Function): this;
  8737. once(event: 'devtools-focused', listener: Function): this;
  8738. addListener(event: 'devtools-focused', listener: Function): this;
  8739. removeListener(event: 'devtools-focused', listener: Function): this;
  8740. /**
  8741. * Emitted when DevTools is opened.
  8742. */
  8743. on(event: 'devtools-opened', listener: Function): this;
  8744. once(event: 'devtools-opened', listener: Function): this;
  8745. addListener(event: 'devtools-opened', listener: Function): this;
  8746. removeListener(event: 'devtools-opened', listener: Function): this;
  8747. /**
  8748. * Emitted when the devtools window instructs the webContents to reload
  8749. */
  8750. on(event: 'devtools-reload-page', listener: Function): this;
  8751. once(event: 'devtools-reload-page', listener: Function): this;
  8752. addListener(event: 'devtools-reload-page', listener: Function): this;
  8753. removeListener(event: 'devtools-reload-page', listener: Function): this;
  8754. /**
  8755. * Emitted when a `<webview>` has been attached to this web contents.
  8756. */
  8757. on(event: 'did-attach-webview', listener: (event: Event,
  8758. /**
  8759. * The guest web contents that is used by the `<webview>`.
  8760. */
  8761. webContents: WebContents) => void): this;
  8762. once(event: 'did-attach-webview', listener: (event: Event,
  8763. /**
  8764. * The guest web contents that is used by the `<webview>`.
  8765. */
  8766. webContents: WebContents) => void): this;
  8767. addListener(event: 'did-attach-webview', listener: (event: Event,
  8768. /**
  8769. * The guest web contents that is used by the `<webview>`.
  8770. */
  8771. webContents: WebContents) => void): this;
  8772. removeListener(event: 'did-attach-webview', listener: (event: Event,
  8773. /**
  8774. * The guest web contents that is used by the `<webview>`.
  8775. */
  8776. webContents: WebContents) => void): this;
  8777. /**
  8778. * Emitted when a page's theme color changes. This is usually due to encountering a
  8779. * meta tag:
  8780. */
  8781. on(event: 'did-change-theme-color', listener: (event: Event,
  8782. /**
  8783. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8784. */
  8785. color: (string) | (null)) => void): this;
  8786. once(event: 'did-change-theme-color', listener: (event: Event,
  8787. /**
  8788. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8789. */
  8790. color: (string) | (null)) => void): this;
  8791. addListener(event: 'did-change-theme-color', listener: (event: Event,
  8792. /**
  8793. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8794. */
  8795. color: (string) | (null)) => void): this;
  8796. removeListener(event: 'did-change-theme-color', listener: (event: Event,
  8797. /**
  8798. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8799. */
  8800. color: (string) | (null)) => void): this;
  8801. /**
  8802. * Emitted _after_ successful creation of a window via `window.open` in the
  8803. * renderer. Not emitted if the creation of the window is canceled from
  8804. * `webContents.setWindowOpenHandler`.
  8805. *
  8806. * See `window.open()` for more details and how to use this in conjunction with
  8807. * `webContents.setWindowOpenHandler`.
  8808. */
  8809. on(event: 'did-create-window', listener: (window: BrowserWindow,
  8810. details: DidCreateWindowDetails) => void): this;
  8811. once(event: 'did-create-window', listener: (window: BrowserWindow,
  8812. details: DidCreateWindowDetails) => void): this;
  8813. addListener(event: 'did-create-window', listener: (window: BrowserWindow,
  8814. details: DidCreateWindowDetails) => void): this;
  8815. removeListener(event: 'did-create-window', listener: (window: BrowserWindow,
  8816. details: DidCreateWindowDetails) => void): this;
  8817. /**
  8818. * This event is like `did-finish-load` but emitted when the load failed. The full
  8819. * list of error codes and their meaning is available here.
  8820. */
  8821. on(event: 'did-fail-load', listener: (event: Event,
  8822. errorCode: number,
  8823. errorDescription: string,
  8824. validatedURL: string,
  8825. isMainFrame: boolean,
  8826. frameProcessId: number,
  8827. frameRoutingId: number) => void): this;
  8828. once(event: 'did-fail-load', listener: (event: Event,
  8829. errorCode: number,
  8830. errorDescription: string,
  8831. validatedURL: string,
  8832. isMainFrame: boolean,
  8833. frameProcessId: number,
  8834. frameRoutingId: number) => void): this;
  8835. addListener(event: 'did-fail-load', listener: (event: Event,
  8836. errorCode: number,
  8837. errorDescription: string,
  8838. validatedURL: string,
  8839. isMainFrame: boolean,
  8840. frameProcessId: number,
  8841. frameRoutingId: number) => void): this;
  8842. removeListener(event: 'did-fail-load', listener: (event: Event,
  8843. errorCode: number,
  8844. errorDescription: string,
  8845. validatedURL: string,
  8846. isMainFrame: boolean,
  8847. frameProcessId: number,
  8848. frameRoutingId: number) => void): this;
  8849. /**
  8850. * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
  8851. * `window.stop()` was invoked).
  8852. */
  8853. on(event: 'did-fail-provisional-load', listener: (event: Event,
  8854. errorCode: number,
  8855. errorDescription: string,
  8856. validatedURL: string,
  8857. isMainFrame: boolean,
  8858. frameProcessId: number,
  8859. frameRoutingId: number) => void): this;
  8860. once(event: 'did-fail-provisional-load', listener: (event: Event,
  8861. errorCode: number,
  8862. errorDescription: string,
  8863. validatedURL: string,
  8864. isMainFrame: boolean,
  8865. frameProcessId: number,
  8866. frameRoutingId: number) => void): this;
  8867. addListener(event: 'did-fail-provisional-load', listener: (event: Event,
  8868. errorCode: number,
  8869. errorDescription: string,
  8870. validatedURL: string,
  8871. isMainFrame: boolean,
  8872. frameProcessId: number,
  8873. frameRoutingId: number) => void): this;
  8874. removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
  8875. errorCode: number,
  8876. errorDescription: string,
  8877. validatedURL: string,
  8878. isMainFrame: boolean,
  8879. frameProcessId: number,
  8880. frameRoutingId: number) => void): this;
  8881. /**
  8882. * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
  8883. * spinning, and the `onload` event was dispatched.
  8884. */
  8885. on(event: 'did-finish-load', listener: Function): this;
  8886. once(event: 'did-finish-load', listener: Function): this;
  8887. addListener(event: 'did-finish-load', listener: Function): this;
  8888. removeListener(event: 'did-finish-load', listener: Function): this;
  8889. /**
  8890. * Emitted when a frame has done navigation.
  8891. */
  8892. on(event: 'did-frame-finish-load', listener: (event: Event,
  8893. isMainFrame: boolean,
  8894. frameProcessId: number,
  8895. frameRoutingId: number) => void): this;
  8896. once(event: 'did-frame-finish-load', listener: (event: Event,
  8897. isMainFrame: boolean,
  8898. frameProcessId: number,
  8899. frameRoutingId: number) => void): this;
  8900. addListener(event: 'did-frame-finish-load', listener: (event: Event,
  8901. isMainFrame: boolean,
  8902. frameProcessId: number,
  8903. frameRoutingId: number) => void): this;
  8904. removeListener(event: 'did-frame-finish-load', listener: (event: Event,
  8905. isMainFrame: boolean,
  8906. frameProcessId: number,
  8907. frameRoutingId: number) => void): this;
  8908. /**
  8909. * Emitted when any frame navigation is done.
  8910. *
  8911. * This event is not emitted for in-page navigations, such as clicking anchor links
  8912. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  8913. * this purpose.
  8914. */
  8915. on(event: 'did-frame-navigate', listener: (event: Event,
  8916. url: string,
  8917. /**
  8918. * -1 for non HTTP navigations
  8919. */
  8920. httpResponseCode: number,
  8921. /**
  8922. * empty for non HTTP navigations,
  8923. */
  8924. httpStatusText: string,
  8925. isMainFrame: boolean,
  8926. frameProcessId: number,
  8927. frameRoutingId: number) => void): this;
  8928. once(event: 'did-frame-navigate', listener: (event: Event,
  8929. url: string,
  8930. /**
  8931. * -1 for non HTTP navigations
  8932. */
  8933. httpResponseCode: number,
  8934. /**
  8935. * empty for non HTTP navigations,
  8936. */
  8937. httpStatusText: string,
  8938. isMainFrame: boolean,
  8939. frameProcessId: number,
  8940. frameRoutingId: number) => void): this;
  8941. addListener(event: 'did-frame-navigate', listener: (event: Event,
  8942. url: string,
  8943. /**
  8944. * -1 for non HTTP navigations
  8945. */
  8946. httpResponseCode: number,
  8947. /**
  8948. * empty for non HTTP navigations,
  8949. */
  8950. httpStatusText: string,
  8951. isMainFrame: boolean,
  8952. frameProcessId: number,
  8953. frameRoutingId: number) => void): this;
  8954. removeListener(event: 'did-frame-navigate', listener: (event: Event,
  8955. url: string,
  8956. /**
  8957. * -1 for non HTTP navigations
  8958. */
  8959. httpResponseCode: number,
  8960. /**
  8961. * empty for non HTTP navigations,
  8962. */
  8963. httpStatusText: string,
  8964. isMainFrame: boolean,
  8965. frameProcessId: number,
  8966. frameRoutingId: number) => void): this;
  8967. /**
  8968. * Emitted when a main frame navigation is done.
  8969. *
  8970. * This event is not emitted for in-page navigations, such as clicking anchor links
  8971. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  8972. * this purpose.
  8973. */
  8974. on(event: 'did-navigate', listener: (event: Event,
  8975. url: string,
  8976. /**
  8977. * -1 for non HTTP navigations
  8978. */
  8979. httpResponseCode: number,
  8980. /**
  8981. * empty for non HTTP navigations
  8982. */
  8983. httpStatusText: string) => void): this;
  8984. once(event: 'did-navigate', listener: (event: Event,
  8985. url: string,
  8986. /**
  8987. * -1 for non HTTP navigations
  8988. */
  8989. httpResponseCode: number,
  8990. /**
  8991. * empty for non HTTP navigations
  8992. */
  8993. httpStatusText: string) => void): this;
  8994. addListener(event: 'did-navigate', listener: (event: Event,
  8995. url: string,
  8996. /**
  8997. * -1 for non HTTP navigations
  8998. */
  8999. httpResponseCode: number,
  9000. /**
  9001. * empty for non HTTP navigations
  9002. */
  9003. httpStatusText: string) => void): this;
  9004. removeListener(event: 'did-navigate', listener: (event: Event,
  9005. url: string,
  9006. /**
  9007. * -1 for non HTTP navigations
  9008. */
  9009. httpResponseCode: number,
  9010. /**
  9011. * empty for non HTTP navigations
  9012. */
  9013. httpStatusText: string) => void): this;
  9014. /**
  9015. * Emitted when an in-page navigation happened in any frame.
  9016. *
  9017. * When in-page navigation happens, the page URL changes but does not cause
  9018. * navigation outside of the page. Examples of this occurring are when anchor links
  9019. * are clicked or when the DOM `hashchange` event is triggered.
  9020. */
  9021. on(event: 'did-navigate-in-page', listener: (event: Event,
  9022. url: string,
  9023. isMainFrame: boolean,
  9024. frameProcessId: number,
  9025. frameRoutingId: number) => void): this;
  9026. once(event: 'did-navigate-in-page', listener: (event: Event,
  9027. url: string,
  9028. isMainFrame: boolean,
  9029. frameProcessId: number,
  9030. frameRoutingId: number) => void): this;
  9031. addListener(event: 'did-navigate-in-page', listener: (event: Event,
  9032. url: string,
  9033. isMainFrame: boolean,
  9034. frameProcessId: number,
  9035. frameRoutingId: number) => void): this;
  9036. removeListener(event: 'did-navigate-in-page', listener: (event: Event,
  9037. url: string,
  9038. isMainFrame: boolean,
  9039. frameProcessId: number,
  9040. frameRoutingId: number) => void): this;
  9041. /**
  9042. * Emitted after a server side redirect occurs during navigation. For example a
  9043. * 302 redirect.
  9044. *
  9045. * This event cannot be prevented, if you want to prevent redirects you should
  9046. * checkout out the `will-redirect` event above.
  9047. */
  9048. on(event: 'did-redirect-navigation', listener: (event: Event,
  9049. url: string,
  9050. isInPlace: boolean,
  9051. isMainFrame: boolean,
  9052. frameProcessId: number,
  9053. frameRoutingId: number) => void): this;
  9054. once(event: 'did-redirect-navigation', listener: (event: Event,
  9055. url: string,
  9056. isInPlace: boolean,
  9057. isMainFrame: boolean,
  9058. frameProcessId: number,
  9059. frameRoutingId: number) => void): this;
  9060. addListener(event: 'did-redirect-navigation', listener: (event: Event,
  9061. url: string,
  9062. isInPlace: boolean,
  9063. isMainFrame: boolean,
  9064. frameProcessId: number,
  9065. frameRoutingId: number) => void): this;
  9066. removeListener(event: 'did-redirect-navigation', listener: (event: Event,
  9067. url: string,
  9068. isInPlace: boolean,
  9069. isMainFrame: boolean,
  9070. frameProcessId: number,
  9071. frameRoutingId: number) => void): this;
  9072. /**
  9073. * Corresponds to the points in time when the spinner of the tab started spinning.
  9074. */
  9075. on(event: 'did-start-loading', listener: Function): this;
  9076. once(event: 'did-start-loading', listener: Function): this;
  9077. addListener(event: 'did-start-loading', listener: Function): this;
  9078. removeListener(event: 'did-start-loading', listener: Function): this;
  9079. /**
  9080. * Emitted when any frame (including main) starts navigating. `isInPlace` will be
  9081. * `true` for in-page navigations.
  9082. */
  9083. on(event: 'did-start-navigation', listener: (event: Event,
  9084. url: string,
  9085. isInPlace: boolean,
  9086. isMainFrame: boolean,
  9087. frameProcessId: number,
  9088. frameRoutingId: number) => void): this;
  9089. once(event: 'did-start-navigation', listener: (event: Event,
  9090. url: string,
  9091. isInPlace: boolean,
  9092. isMainFrame: boolean,
  9093. frameProcessId: number,
  9094. frameRoutingId: number) => void): this;
  9095. addListener(event: 'did-start-navigation', listener: (event: Event,
  9096. url: string,
  9097. isInPlace: boolean,
  9098. isMainFrame: boolean,
  9099. frameProcessId: number,
  9100. frameRoutingId: number) => void): this;
  9101. removeListener(event: 'did-start-navigation', listener: (event: Event,
  9102. url: string,
  9103. isInPlace: boolean,
  9104. isMainFrame: boolean,
  9105. frameProcessId: number,
  9106. frameRoutingId: number) => void): this;
  9107. /**
  9108. * Corresponds to the points in time when the spinner of the tab stopped spinning.
  9109. */
  9110. on(event: 'did-stop-loading', listener: Function): this;
  9111. once(event: 'did-stop-loading', listener: Function): this;
  9112. addListener(event: 'did-stop-loading', listener: Function): this;
  9113. removeListener(event: 'did-stop-loading', listener: Function): this;
  9114. /**
  9115. * Emitted when the document in the given frame is loaded.
  9116. */
  9117. on(event: 'dom-ready', listener: (event: Event) => void): this;
  9118. once(event: 'dom-ready', listener: (event: Event) => void): this;
  9119. addListener(event: 'dom-ready', listener: (event: Event) => void): this;
  9120. removeListener(event: 'dom-ready', listener: (event: Event) => void): this;
  9121. /**
  9122. * Emitted when the window enters a full-screen state triggered by HTML API.
  9123. */
  9124. on(event: 'enter-html-full-screen', listener: Function): this;
  9125. once(event: 'enter-html-full-screen', listener: Function): this;
  9126. addListener(event: 'enter-html-full-screen', listener: Function): this;
  9127. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  9128. /**
  9129. * Emitted when a result is available for [`webContents.findInPage`] request.
  9130. */
  9131. on(event: 'found-in-page', listener: (event: Event,
  9132. result: Result) => void): this;
  9133. once(event: 'found-in-page', listener: (event: Event,
  9134. result: Result) => void): this;
  9135. addListener(event: 'found-in-page', listener: (event: Event,
  9136. result: Result) => void): this;
  9137. removeListener(event: 'found-in-page', listener: (event: Event,
  9138. result: Result) => void): this;
  9139. /**
  9140. * Emitted when the renderer process sends an asynchronous message via
  9141. * `ipcRenderer.send()`.
  9142. */
  9143. on(event: 'ipc-message', listener: (event: Event,
  9144. channel: string,
  9145. ...args: any[]) => void): this;
  9146. once(event: 'ipc-message', listener: (event: Event,
  9147. channel: string,
  9148. ...args: any[]) => void): this;
  9149. addListener(event: 'ipc-message', listener: (event: Event,
  9150. channel: string,
  9151. ...args: any[]) => void): this;
  9152. removeListener(event: 'ipc-message', listener: (event: Event,
  9153. channel: string,
  9154. ...args: any[]) => void): this;
  9155. /**
  9156. * Emitted when the renderer process sends a synchronous message via
  9157. * `ipcRenderer.sendSync()`.
  9158. */
  9159. on(event: 'ipc-message-sync', listener: (event: Event,
  9160. channel: string,
  9161. ...args: any[]) => void): this;
  9162. once(event: 'ipc-message-sync', listener: (event: Event,
  9163. channel: string,
  9164. ...args: any[]) => void): this;
  9165. addListener(event: 'ipc-message-sync', listener: (event: Event,
  9166. channel: string,
  9167. ...args: any[]) => void): this;
  9168. removeListener(event: 'ipc-message-sync', listener: (event: Event,
  9169. channel: string,
  9170. ...args: any[]) => void): this;
  9171. /**
  9172. * Emitted when the window leaves a full-screen state triggered by HTML API.
  9173. */
  9174. on(event: 'leave-html-full-screen', listener: Function): this;
  9175. once(event: 'leave-html-full-screen', listener: Function): this;
  9176. addListener(event: 'leave-html-full-screen', listener: Function): this;
  9177. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  9178. /**
  9179. * Emitted when `webContents` wants to do basic auth.
  9180. *
  9181. The usage is the same with the `login` event of `app`.
  9182. */
  9183. on(event: 'login', listener: (event: Event,
  9184. authenticationResponseDetails: AuthenticationResponseDetails,
  9185. authInfo: AuthInfo,
  9186. callback: (username?: string, password?: string) => void) => void): this;
  9187. once(event: 'login', listener: (event: Event,
  9188. authenticationResponseDetails: AuthenticationResponseDetails,
  9189. authInfo: AuthInfo,
  9190. callback: (username?: string, password?: string) => void) => void): this;
  9191. addListener(event: 'login', listener: (event: Event,
  9192. authenticationResponseDetails: AuthenticationResponseDetails,
  9193. authInfo: AuthInfo,
  9194. callback: (username?: string, password?: string) => void) => void): this;
  9195. removeListener(event: 'login', listener: (event: Event,
  9196. authenticationResponseDetails: AuthenticationResponseDetails,
  9197. authInfo: AuthInfo,
  9198. callback: (username?: string, password?: string) => void) => void): this;
  9199. /**
  9200. * Emitted when media is paused or done playing.
  9201. */
  9202. on(event: 'media-paused', listener: Function): this;
  9203. once(event: 'media-paused', listener: Function): this;
  9204. addListener(event: 'media-paused', listener: Function): this;
  9205. removeListener(event: 'media-paused', listener: Function): this;
  9206. /**
  9207. * Emitted when media starts playing.
  9208. */
  9209. on(event: 'media-started-playing', listener: Function): this;
  9210. once(event: 'media-started-playing', listener: Function): this;
  9211. addListener(event: 'media-started-playing', listener: Function): this;
  9212. removeListener(event: 'media-started-playing', listener: Function): this;
  9213. /**
  9214. * Deprecated in favor of `webContents.setWindowOpenHandler`.
  9215. *
  9216. * Emitted when the page requests to open a new window for a `url`. It could be
  9217. * requested by `window.open` or an external link like `<a target='_blank'>`.
  9218. *
  9219. * By default a new `BrowserWindow` will be created for the `url`.
  9220. *
  9221. * Calling `event.preventDefault()` will prevent Electron from automatically
  9222. * creating a new `BrowserWindow`. If you call `event.preventDefault()` and
  9223. * manually create a new `BrowserWindow` then you must set `event.newGuest` to
  9224. * reference the new `BrowserWindow` instance, failing to do so may result in
  9225. * unexpected behavior. For example:
  9226. *
  9227. * @deprecated
  9228. */
  9229. on(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9230. url: string,
  9231. frameName: string,
  9232. /**
  9233. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9234. * `save-to-disk` and `other`.
  9235. */
  9236. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9237. /**
  9238. * The options which will be used for creating the new `BrowserWindow`.
  9239. */
  9240. options: BrowserWindowConstructorOptions,
  9241. /**
  9242. * The non-standard features (features not handled by Chromium or Electron) given
  9243. * to `window.open()`.
  9244. */
  9245. additionalFeatures: string[],
  9246. /**
  9247. * The referrer that will be passed to the new window. May or may not result in the
  9248. * `Referer` header being sent, depending on the referrer policy.
  9249. */
  9250. referrer: Referrer,
  9251. /**
  9252. * The post data that will be sent to the new window, along with the appropriate
  9253. * headers that will be set. If no post data is to be sent, the value will be
  9254. * `null`. Only defined when the window is being created by a form that set
  9255. * `target=_blank`.
  9256. */
  9257. postBody: PostBody) => void): this;
  9258. once(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9259. url: string,
  9260. frameName: string,
  9261. /**
  9262. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9263. * `save-to-disk` and `other`.
  9264. */
  9265. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9266. /**
  9267. * The options which will be used for creating the new `BrowserWindow`.
  9268. */
  9269. options: BrowserWindowConstructorOptions,
  9270. /**
  9271. * The non-standard features (features not handled by Chromium or Electron) given
  9272. * to `window.open()`.
  9273. */
  9274. additionalFeatures: string[],
  9275. /**
  9276. * The referrer that will be passed to the new window. May or may not result in the
  9277. * `Referer` header being sent, depending on the referrer policy.
  9278. */
  9279. referrer: Referrer,
  9280. /**
  9281. * The post data that will be sent to the new window, along with the appropriate
  9282. * headers that will be set. If no post data is to be sent, the value will be
  9283. * `null`. Only defined when the window is being created by a form that set
  9284. * `target=_blank`.
  9285. */
  9286. postBody: PostBody) => void): this;
  9287. addListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9288. url: string,
  9289. frameName: string,
  9290. /**
  9291. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9292. * `save-to-disk` and `other`.
  9293. */
  9294. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9295. /**
  9296. * The options which will be used for creating the new `BrowserWindow`.
  9297. */
  9298. options: BrowserWindowConstructorOptions,
  9299. /**
  9300. * The non-standard features (features not handled by Chromium or Electron) given
  9301. * to `window.open()`.
  9302. */
  9303. additionalFeatures: string[],
  9304. /**
  9305. * The referrer that will be passed to the new window. May or may not result in the
  9306. * `Referer` header being sent, depending on the referrer policy.
  9307. */
  9308. referrer: Referrer,
  9309. /**
  9310. * The post data that will be sent to the new window, along with the appropriate
  9311. * headers that will be set. If no post data is to be sent, the value will be
  9312. * `null`. Only defined when the window is being created by a form that set
  9313. * `target=_blank`.
  9314. */
  9315. postBody: PostBody) => void): this;
  9316. removeListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  9317. url: string,
  9318. frameName: string,
  9319. /**
  9320. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  9321. * `save-to-disk` and `other`.
  9322. */
  9323. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  9324. /**
  9325. * The options which will be used for creating the new `BrowserWindow`.
  9326. */
  9327. options: BrowserWindowConstructorOptions,
  9328. /**
  9329. * The non-standard features (features not handled by Chromium or Electron) given
  9330. * to `window.open()`.
  9331. */
  9332. additionalFeatures: string[],
  9333. /**
  9334. * The referrer that will be passed to the new window. May or may not result in the
  9335. * `Referer` header being sent, depending on the referrer policy.
  9336. */
  9337. referrer: Referrer,
  9338. /**
  9339. * The post data that will be sent to the new window, along with the appropriate
  9340. * headers that will be set. If no post data is to be sent, the value will be
  9341. * `null`. Only defined when the window is being created by a form that set
  9342. * `target=_blank`.
  9343. */
  9344. postBody: PostBody) => void): this;
  9345. /**
  9346. * Emitted when page receives favicon urls.
  9347. */
  9348. on(event: 'page-favicon-updated', listener: (event: Event,
  9349. /**
  9350. * Array of URLs.
  9351. */
  9352. favicons: string[]) => void): this;
  9353. once(event: 'page-favicon-updated', listener: (event: Event,
  9354. /**
  9355. * Array of URLs.
  9356. */
  9357. favicons: string[]) => void): this;
  9358. addListener(event: 'page-favicon-updated', listener: (event: Event,
  9359. /**
  9360. * Array of URLs.
  9361. */
  9362. favicons: string[]) => void): this;
  9363. removeListener(event: 'page-favicon-updated', listener: (event: Event,
  9364. /**
  9365. * Array of URLs.
  9366. */
  9367. favicons: string[]) => void): this;
  9368. /**
  9369. * Fired when page title is set during navigation. `explicitSet` is false when
  9370. * title is synthesized from file url.
  9371. */
  9372. on(event: 'page-title-updated', listener: (event: Event,
  9373. title: string,
  9374. explicitSet: boolean) => void): this;
  9375. once(event: 'page-title-updated', listener: (event: Event,
  9376. title: string,
  9377. explicitSet: boolean) => void): this;
  9378. addListener(event: 'page-title-updated', listener: (event: Event,
  9379. title: string,
  9380. explicitSet: boolean) => void): this;
  9381. removeListener(event: 'page-title-updated', listener: (event: Event,
  9382. title: string,
  9383. explicitSet: boolean) => void): this;
  9384. /**
  9385. * Emitted when a new frame is generated. Only the dirty area is passed in the
  9386. * buffer.
  9387. */
  9388. on(event: 'paint', listener: (event: Event,
  9389. dirtyRect: Rectangle,
  9390. /**
  9391. * The image data of the whole frame.
  9392. */
  9393. image: NativeImage) => void): this;
  9394. once(event: 'paint', listener: (event: Event,
  9395. dirtyRect: Rectangle,
  9396. /**
  9397. * The image data of the whole frame.
  9398. */
  9399. image: NativeImage) => void): this;
  9400. addListener(event: 'paint', listener: (event: Event,
  9401. dirtyRect: Rectangle,
  9402. /**
  9403. * The image data of the whole frame.
  9404. */
  9405. image: NativeImage) => void): this;
  9406. removeListener(event: 'paint', listener: (event: Event,
  9407. dirtyRect: Rectangle,
  9408. /**
  9409. * The image data of the whole frame.
  9410. */
  9411. image: NativeImage) => void): this;
  9412. /**
  9413. * Emitted when a plugin process has crashed.
  9414. */
  9415. on(event: 'plugin-crashed', listener: (event: Event,
  9416. name: string,
  9417. version: string) => void): this;
  9418. once(event: 'plugin-crashed', listener: (event: Event,
  9419. name: string,
  9420. version: string) => void): this;
  9421. addListener(event: 'plugin-crashed', listener: (event: Event,
  9422. name: string,
  9423. version: string) => void): this;
  9424. removeListener(event: 'plugin-crashed', listener: (event: Event,
  9425. name: string,
  9426. version: string) => void): this;
  9427. /**
  9428. * Emitted when the `WebContents` preferred size has changed.
  9429. *
  9430. * This event will only be emitted when `enablePreferredSizeMode` is set to `true`
  9431. * in `webPreferences`.
  9432. */
  9433. on(event: 'preferred-size-changed', listener: (event: Event,
  9434. /**
  9435. * The minimum size needed to contain the layout of the document—without requiring
  9436. * scrolling.
  9437. */
  9438. preferredSize: Size) => void): this;
  9439. once(event: 'preferred-size-changed', listener: (event: Event,
  9440. /**
  9441. * The minimum size needed to contain the layout of the document—without requiring
  9442. * scrolling.
  9443. */
  9444. preferredSize: Size) => void): this;
  9445. addListener(event: 'preferred-size-changed', listener: (event: Event,
  9446. /**
  9447. * The minimum size needed to contain the layout of the document—without requiring
  9448. * scrolling.
  9449. */
  9450. preferredSize: Size) => void): this;
  9451. removeListener(event: 'preferred-size-changed', listener: (event: Event,
  9452. /**
  9453. * The minimum size needed to contain the layout of the document—without requiring
  9454. * scrolling.
  9455. */
  9456. preferredSize: Size) => void): this;
  9457. /**
  9458. * Emitted when the preload script `preloadPath` throws an unhandled exception
  9459. * `error`.
  9460. */
  9461. on(event: 'preload-error', listener: (event: Event,
  9462. preloadPath: string,
  9463. error: Error) => void): this;
  9464. once(event: 'preload-error', listener: (event: Event,
  9465. preloadPath: string,
  9466. error: Error) => void): this;
  9467. addListener(event: 'preload-error', listener: (event: Event,
  9468. preloadPath: string,
  9469. error: Error) => void): this;
  9470. removeListener(event: 'preload-error', listener: (event: Event,
  9471. preloadPath: string,
  9472. error: Error) => void): this;
  9473. /**
  9474. * Emitted when `remote.getBuiltin()` is called in the renderer process. Calling
  9475. * `event.preventDefault()` will prevent the module from being returned. Custom
  9476. * value can be returned by setting `event.returnValue`.
  9477. *
  9478. * @deprecated
  9479. */
  9480. on(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9481. moduleName: string) => void): this;
  9482. once(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9483. moduleName: string) => void): this;
  9484. addListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9485. moduleName: string) => void): this;
  9486. removeListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9487. moduleName: string) => void): this;
  9488. /**
  9489. * Emitted when `remote.getCurrentWebContents()` is called in the renderer process.
  9490. * Calling `event.preventDefault()` will prevent the object from being returned.
  9491. * Custom value can be returned by setting `event.returnValue`.
  9492. *
  9493. * @deprecated
  9494. */
  9495. on(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9496. once(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9497. addListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9498. removeListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9499. /**
  9500. * Emitted when `remote.getCurrentWindow()` is called in the renderer process.
  9501. * Calling `event.preventDefault()` will prevent the object from being returned.
  9502. * Custom value can be returned by setting `event.returnValue`.
  9503. *
  9504. * @deprecated
  9505. */
  9506. on(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9507. once(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9508. addListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9509. removeListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9510. /**
  9511. * Emitted when `remote.getGlobal()` is called in the renderer process. Calling
  9512. * `event.preventDefault()` will prevent the global from being returned. Custom
  9513. * value can be returned by setting `event.returnValue`.
  9514. *
  9515. * @deprecated
  9516. */
  9517. on(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9518. globalName: string) => void): this;
  9519. once(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9520. globalName: string) => void): this;
  9521. addListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9522. globalName: string) => void): this;
  9523. removeListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9524. globalName: string) => void): this;
  9525. /**
  9526. * Emitted when `remote.require()` is called in the renderer process. Calling
  9527. * `event.preventDefault()` will prevent the module from being returned. Custom
  9528. * value can be returned by setting `event.returnValue`.
  9529. *
  9530. * @deprecated
  9531. */
  9532. on(event: 'remote-require', listener: (event: IpcMainEvent,
  9533. moduleName: string) => void): this;
  9534. once(event: 'remote-require', listener: (event: IpcMainEvent,
  9535. moduleName: string) => void): this;
  9536. addListener(event: 'remote-require', listener: (event: IpcMainEvent,
  9537. moduleName: string) => void): this;
  9538. removeListener(event: 'remote-require', listener: (event: IpcMainEvent,
  9539. moduleName: string) => void): this;
  9540. /**
  9541. * Emitted when the renderer process unexpectedly disappears. This is normally
  9542. * because it was crashed or killed.
  9543. */
  9544. on(event: 'render-process-gone', listener: (event: Event,
  9545. details: RenderProcessGoneDetails) => void): this;
  9546. once(event: 'render-process-gone', listener: (event: Event,
  9547. details: RenderProcessGoneDetails) => void): this;
  9548. addListener(event: 'render-process-gone', listener: (event: Event,
  9549. details: RenderProcessGoneDetails) => void): this;
  9550. removeListener(event: 'render-process-gone', listener: (event: Event,
  9551. details: RenderProcessGoneDetails) => void): this;
  9552. /**
  9553. * Emitted when the unresponsive web page becomes responsive again.
  9554. */
  9555. on(event: 'responsive', listener: Function): this;
  9556. once(event: 'responsive', listener: Function): this;
  9557. addListener(event: 'responsive', listener: Function): this;
  9558. removeListener(event: 'responsive', listener: Function): this;
  9559. /**
  9560. * Emitted when bluetooth device needs to be selected on call to
  9561. * `navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
  9562. * `webBluetooth` should be enabled. If `event.preventDefault` is not called, first
  9563. * available device will be selected. `callback` should be called with `deviceId`
  9564. * to be selected, passing empty string to `callback` will cancel the request.
  9565. */
  9566. on(event: 'select-bluetooth-device', listener: (event: Event,
  9567. devices: BluetoothDevice[],
  9568. callback: (deviceId: string) => void) => void): this;
  9569. once(event: 'select-bluetooth-device', listener: (event: Event,
  9570. devices: BluetoothDevice[],
  9571. callback: (deviceId: string) => void) => void): this;
  9572. addListener(event: 'select-bluetooth-device', listener: (event: Event,
  9573. devices: BluetoothDevice[],
  9574. callback: (deviceId: string) => void) => void): this;
  9575. removeListener(event: 'select-bluetooth-device', listener: (event: Event,
  9576. devices: BluetoothDevice[],
  9577. callback: (deviceId: string) => void) => void): this;
  9578. /**
  9579. * Emitted when a client certificate is requested.
  9580. *
  9581. The usage is the same with the `select-client-certificate` event of `app`.
  9582. */
  9583. on(event: 'select-client-certificate', listener: (event: Event,
  9584. url: string,
  9585. certificateList: Certificate[],
  9586. callback: (certificate: Certificate) => void) => void): this;
  9587. once(event: 'select-client-certificate', listener: (event: Event,
  9588. url: string,
  9589. certificateList: Certificate[],
  9590. callback: (certificate: Certificate) => void) => void): this;
  9591. addListener(event: 'select-client-certificate', listener: (event: Event,
  9592. url: string,
  9593. certificateList: Certificate[],
  9594. callback: (certificate: Certificate) => void) => void): this;
  9595. removeListener(event: 'select-client-certificate', listener: (event: Event,
  9596. url: string,
  9597. certificateList: Certificate[],
  9598. callback: (certificate: Certificate) => void) => void): this;
  9599. /**
  9600. * Emitted when the web page becomes unresponsive.
  9601. */
  9602. on(event: 'unresponsive', listener: Function): this;
  9603. once(event: 'unresponsive', listener: Function): this;
  9604. addListener(event: 'unresponsive', listener: Function): this;
  9605. removeListener(event: 'unresponsive', listener: Function): this;
  9606. /**
  9607. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  9608. */
  9609. on(event: 'update-target-url', listener: (event: Event,
  9610. url: string) => void): this;
  9611. once(event: 'update-target-url', listener: (event: Event,
  9612. url: string) => void): this;
  9613. addListener(event: 'update-target-url', listener: (event: Event,
  9614. url: string) => void): this;
  9615. removeListener(event: 'update-target-url', listener: (event: Event,
  9616. url: string) => void): this;
  9617. /**
  9618. * Emitted when a `<webview>`'s web contents is being attached to this web
  9619. * contents. Calling `event.preventDefault()` will destroy the guest page.
  9620. *
  9621. * This event can be used to configure `webPreferences` for the `webContents` of a
  9622. * `<webview>` before it's loaded, and provides the ability to set settings that
  9623. * can't be set via `<webview>` attributes.
  9624. *
  9625. * **Note:** The specified `preload` script option will appear as `preloadURL` (not
  9626. * `preload`) in the `webPreferences` object emitted with this event.
  9627. */
  9628. on(event: 'will-attach-webview', listener: (event: Event,
  9629. /**
  9630. * The web preferences that will be used by the guest page. This object can be
  9631. * modified to adjust the preferences for the guest page.
  9632. */
  9633. webPreferences: WebPreferences,
  9634. /**
  9635. * The other `<webview>` parameters such as the `src` URL. This object can be
  9636. * modified to adjust the parameters of the guest page.
  9637. */
  9638. params: Record<string, string>) => void): this;
  9639. once(event: 'will-attach-webview', listener: (event: Event,
  9640. /**
  9641. * The web preferences that will be used by the guest page. This object can be
  9642. * modified to adjust the preferences for the guest page.
  9643. */
  9644. webPreferences: WebPreferences,
  9645. /**
  9646. * The other `<webview>` parameters such as the `src` URL. This object can be
  9647. * modified to adjust the parameters of the guest page.
  9648. */
  9649. params: Record<string, string>) => void): this;
  9650. addListener(event: 'will-attach-webview', listener: (event: Event,
  9651. /**
  9652. * The web preferences that will be used by the guest page. This object can be
  9653. * modified to adjust the preferences for the guest page.
  9654. */
  9655. webPreferences: WebPreferences,
  9656. /**
  9657. * The other `<webview>` parameters such as the `src` URL. This object can be
  9658. * modified to adjust the parameters of the guest page.
  9659. */
  9660. params: Record<string, string>) => void): this;
  9661. removeListener(event: 'will-attach-webview', listener: (event: Event,
  9662. /**
  9663. * The web preferences that will be used by the guest page. This object can be
  9664. * modified to adjust the preferences for the guest page.
  9665. */
  9666. webPreferences: WebPreferences,
  9667. /**
  9668. * The other `<webview>` parameters such as the `src` URL. This object can be
  9669. * modified to adjust the parameters of the guest page.
  9670. */
  9671. params: Record<string, string>) => void): this;
  9672. /**
  9673. * Emitted when a user or the page wants to start navigation. It can happen when
  9674. * the `window.location` object is changed or a user clicks a link in the page.
  9675. *
  9676. * This event will not emit when the navigation is started programmatically with
  9677. * APIs like `webContents.loadURL` and `webContents.back`.
  9678. *
  9679. * It is also not emitted for in-page navigations, such as clicking anchor links or
  9680. * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
  9681. * purpose.
  9682. Calling `event.preventDefault()` will prevent the navigation.
  9683. */
  9684. on(event: 'will-navigate', listener: (event: Event,
  9685. url: string) => void): this;
  9686. once(event: 'will-navigate', listener: (event: Event,
  9687. url: string) => void): this;
  9688. addListener(event: 'will-navigate', listener: (event: Event,
  9689. url: string) => void): this;
  9690. removeListener(event: 'will-navigate', listener: (event: Event,
  9691. url: string) => void): this;
  9692. /**
  9693. * Emitted when a `beforeunload` event handler is attempting to cancel a page
  9694. * unload.
  9695. *
  9696. * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
  9697. * and allow the page to be unloaded.
  9698. */
  9699. on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9700. once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9701. addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9702. removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9703. /**
  9704. * Emitted as a server side redirect occurs during navigation. For example a 302
  9705. * redirect.
  9706. *
  9707. * This event will be emitted after `did-start-navigation` and always before the
  9708. * `did-redirect-navigation` event for the same navigation.
  9709. *
  9710. * Calling `event.preventDefault()` will prevent the navigation (not just the
  9711. * redirect).
  9712. */
  9713. on(event: 'will-redirect', listener: (event: Event,
  9714. url: string,
  9715. isInPlace: boolean,
  9716. isMainFrame: boolean,
  9717. frameProcessId: number,
  9718. frameRoutingId: number) => void): this;
  9719. once(event: 'will-redirect', listener: (event: Event,
  9720. url: string,
  9721. isInPlace: boolean,
  9722. isMainFrame: boolean,
  9723. frameProcessId: number,
  9724. frameRoutingId: number) => void): this;
  9725. addListener(event: 'will-redirect', listener: (event: Event,
  9726. url: string,
  9727. isInPlace: boolean,
  9728. isMainFrame: boolean,
  9729. frameProcessId: number,
  9730. frameRoutingId: number) => void): this;
  9731. removeListener(event: 'will-redirect', listener: (event: Event,
  9732. url: string,
  9733. isInPlace: boolean,
  9734. isMainFrame: boolean,
  9735. frameProcessId: number,
  9736. frameRoutingId: number) => void): this;
  9737. /**
  9738. * Emitted when the user is requesting to change the zoom level using the mouse
  9739. * wheel.
  9740. */
  9741. on(event: 'zoom-changed', listener: (event: Event,
  9742. /**
  9743. * Can be `in` or `out`.
  9744. */
  9745. zoomDirection: ('in' | 'out')) => void): this;
  9746. once(event: 'zoom-changed', listener: (event: Event,
  9747. /**
  9748. * Can be `in` or `out`.
  9749. */
  9750. zoomDirection: ('in' | 'out')) => void): this;
  9751. addListener(event: 'zoom-changed', listener: (event: Event,
  9752. /**
  9753. * Can be `in` or `out`.
  9754. */
  9755. zoomDirection: ('in' | 'out')) => void): this;
  9756. removeListener(event: 'zoom-changed', listener: (event: Event,
  9757. /**
  9758. * Can be `in` or `out`.
  9759. */
  9760. zoomDirection: ('in' | 'out')) => void): this;
  9761. /**
  9762. * Adds the specified path to DevTools workspace. Must be used after DevTools
  9763. * creation:
  9764. */
  9765. addWorkSpace(path: string): void;
  9766. /**
  9767. * Begin subscribing for presentation events and captured frames, the `callback`
  9768. * will be called with `callback(image, dirtyRect)` when there is a presentation
  9769. * event.
  9770. *
  9771. * The `image` is an instance of NativeImage that stores the captured frame.
  9772. *
  9773. * The `dirtyRect` is an object with `x, y, width, height` properties that
  9774. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  9775. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  9776. */
  9777. beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  9778. /**
  9779. * Begin subscribing for presentation events and captured frames, the `callback`
  9780. * will be called with `callback(image, dirtyRect)` when there is a presentation
  9781. * event.
  9782. *
  9783. * The `image` is an instance of NativeImage that stores the captured frame.
  9784. *
  9785. * The `dirtyRect` is an object with `x, y, width, height` properties that
  9786. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  9787. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  9788. */
  9789. beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  9790. /**
  9791. * Whether the browser can go back to previous web page.
  9792. */
  9793. canGoBack(): boolean;
  9794. /**
  9795. * Whether the browser can go forward to next web page.
  9796. */
  9797. canGoForward(): boolean;
  9798. /**
  9799. * Whether the web page can go to `offset`.
  9800. */
  9801. canGoToOffset(offset: number): boolean;
  9802. /**
  9803. * Resolves with a NativeImage
  9804. *
  9805. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  9806. * whole visible page.
  9807. */
  9808. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  9809. /**
  9810. * Clears the navigation history.
  9811. */
  9812. clearHistory(): void;
  9813. /**
  9814. * Closes the devtools.
  9815. */
  9816. closeDevTools(): void;
  9817. /**
  9818. * Executes the editing command `copy` in web page.
  9819. */
  9820. copy(): void;
  9821. /**
  9822. * Copy the image at the given position to the clipboard.
  9823. */
  9824. copyImageAt(x: number, y: number): void;
  9825. /**
  9826. * Executes the editing command `cut` in web page.
  9827. */
  9828. cut(): void;
  9829. /**
  9830. * Decrease the capturer count by one. The page will be set to hidden or occluded
  9831. * state when its browser window is hidden or occluded and the capturer count
  9832. * reaches zero. If you want to decrease the hidden capturer count instead you
  9833. * should set `stayHidden` to true.
  9834. */
  9835. decrementCapturerCount(stayHidden?: boolean, stayAwake?: boolean): void;
  9836. /**
  9837. * Executes the editing command `delete` in web page.
  9838. */
  9839. delete(): void;
  9840. /**
  9841. * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
  9842. */
  9843. disableDeviceEmulation(): void;
  9844. /**
  9845. * Initiates a download of the resource at `url` without navigating. The
  9846. * `will-download` event of `session` will be triggered.
  9847. */
  9848. downloadURL(url: string): void;
  9849. /**
  9850. * Enable device emulation with the given parameters.
  9851. */
  9852. enableDeviceEmulation(parameters: Parameters): void;
  9853. /**
  9854. * End subscribing for frame presentation events.
  9855. */
  9856. endFrameSubscription(): void;
  9857. /**
  9858. * A promise that resolves with the result of the executed code or is rejected if
  9859. * the result of the code is a rejected promise.
  9860. *
  9861. * Evaluates `code` in page.
  9862. *
  9863. * In the browser window some HTML APIs like `requestFullScreen` can only be
  9864. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  9865. * this limitation.
  9866. Code execution will be suspended until web page stop loading.
  9867. */
  9868. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  9869. /**
  9870. * A promise that resolves with the result of the executed code or is rejected if
  9871. * the result of the code is a rejected promise.
  9872. *
  9873. Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  9874. */
  9875. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
  9876. /**
  9877. * The request id used for the request.
  9878. *
  9879. * Starts a request to find all matches for the `text` in the web page. The result
  9880. * of the request can be obtained by subscribing to `found-in-page` event.
  9881. */
  9882. findInPage(text: string, options?: FindInPageOptions): number;
  9883. /**
  9884. * Focuses the web page.
  9885. */
  9886. focus(): void;
  9887. /**
  9888. * Forcefully terminates the renderer process that is currently hosting this
  9889. * `webContents`. This will cause the `render-process-gone` event to be emitted
  9890. * with the `reason=killed || reason=crashed`. Please note that some webContents
  9891. * share renderer processes and therefore calling this method may also crash the
  9892. * host process for other webContents as well.
  9893. *
  9894. * Calling `reload()` immediately after calling this method will force the reload
  9895. * to occur in a new process. This should be used when this process is unstable or
  9896. * unusable, for instance in order to recover from the `unresponsive` event.
  9897. */
  9898. forcefullyCrashRenderer(): void;
  9899. /**
  9900. * Information about all Shared Workers.
  9901. */
  9902. getAllSharedWorkers(): SharedWorkerInfo[];
  9903. /**
  9904. * whether or not this WebContents will throttle animations and timers when the
  9905. * page becomes backgrounded. This also affects the Page Visibility API.
  9906. */
  9907. getBackgroundThrottling(): boolean;
  9908. /**
  9909. * If *offscreen rendering* is enabled returns the current frame rate.
  9910. */
  9911. getFrameRate(): number;
  9912. /**
  9913. * The operating system `pid` of the associated renderer process.
  9914. */
  9915. getOSProcessId(): number;
  9916. /**
  9917. * Get the system printer list.
  9918. */
  9919. getPrinters(): PrinterInfo[];
  9920. /**
  9921. * The Chromium internal `pid` of the associated renderer. Can be compared to the
  9922. * `frameProcessId` passed by frame specific navigation events (e.g.
  9923. * `did-frame-navigate`)
  9924. */
  9925. getProcessId(): number;
  9926. /**
  9927. * The title of the current web page.
  9928. */
  9929. getTitle(): string;
  9930. /**
  9931. * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
  9932. * `remote`, `webview` or `offscreen`.
  9933. */
  9934. getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
  9935. /**
  9936. * The URL of the current web page.
  9937. */
  9938. getURL(): string;
  9939. /**
  9940. * The user agent for this web page.
  9941. */
  9942. getUserAgent(): string;
  9943. /**
  9944. * Returns the WebRTC IP Handling Policy.
  9945. */
  9946. getWebRTCIPHandlingPolicy(): string;
  9947. /**
  9948. * the current zoom factor.
  9949. */
  9950. getZoomFactor(): number;
  9951. /**
  9952. * the current zoom level.
  9953. */
  9954. getZoomLevel(): number;
  9955. /**
  9956. * Makes the browser go back a web page.
  9957. */
  9958. goBack(): void;
  9959. /**
  9960. * Makes the browser go forward a web page.
  9961. */
  9962. goForward(): void;
  9963. /**
  9964. * Navigates browser to the specified absolute web page index.
  9965. */
  9966. goToIndex(index: number): void;
  9967. /**
  9968. * Navigates to the specified offset from the "current entry".
  9969. */
  9970. goToOffset(offset: number): void;
  9971. /**
  9972. * Increase the capturer count by one. The page is considered visible when its
  9973. * browser window is hidden and the capturer count is non-zero. If you would like
  9974. * the page to stay hidden, you should ensure that `stayHidden` is set to true.
  9975. *
  9976. This also affects the Page Visibility API.
  9977. */
  9978. incrementCapturerCount(size?: Size, stayHidden?: boolean, stayAwake?: boolean): void;
  9979. /**
  9980. * A promise that resolves with a key for the inserted CSS that can later be used
  9981. * to remove the CSS via `contents.removeInsertedCSS(key)`.
  9982. *
  9983. * Injects CSS into the current web page and returns a unique key for the inserted
  9984. * stylesheet.
  9985. */
  9986. insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
  9987. /**
  9988. * Inserts `text` to the focused element.
  9989. */
  9990. insertText(text: string): Promise<void>;
  9991. /**
  9992. * Starts inspecting element at position (`x`, `y`).
  9993. */
  9994. inspectElement(x: number, y: number): void;
  9995. /**
  9996. * Opens the developer tools for the service worker context.
  9997. */
  9998. inspectServiceWorker(): void;
  9999. /**
  10000. * Opens the developer tools for the shared worker context.
  10001. */
  10002. inspectSharedWorker(): void;
  10003. /**
  10004. * Inspects the shared worker based on its ID.
  10005. */
  10006. inspectSharedWorkerById(workerId: string): void;
  10007. /**
  10008. * Schedules a full repaint of the window this web contents is in.
  10009. *
  10010. * If *offscreen rendering* is enabled invalidates the frame and generates a new
  10011. * one through the `'paint'` event.
  10012. */
  10013. invalidate(): void;
  10014. /**
  10015. * Whether this page has been muted.
  10016. */
  10017. isAudioMuted(): boolean;
  10018. /**
  10019. * Whether this page is being captured. It returns true when the capturer count is
  10020. * large then 0.
  10021. */
  10022. isBeingCaptured(): boolean;
  10023. /**
  10024. * Whether the renderer process has crashed.
  10025. */
  10026. isCrashed(): boolean;
  10027. /**
  10028. * Whether audio is currently playing.
  10029. */
  10030. isCurrentlyAudible(): boolean;
  10031. /**
  10032. * Whether the web page is destroyed.
  10033. */
  10034. isDestroyed(): boolean;
  10035. /**
  10036. * Whether the devtools view is focused .
  10037. */
  10038. isDevToolsFocused(): boolean;
  10039. /**
  10040. * Whether the devtools is opened.
  10041. */
  10042. isDevToolsOpened(): boolean;
  10043. /**
  10044. * Whether the web page is focused.
  10045. */
  10046. isFocused(): boolean;
  10047. /**
  10048. * Whether web page is still loading resources.
  10049. */
  10050. isLoading(): boolean;
  10051. /**
  10052. * Whether the main frame (and not just iframes or frames within it) is still
  10053. * loading.
  10054. */
  10055. isLoadingMainFrame(): boolean;
  10056. /**
  10057. * Indicates whether *offscreen rendering* is enabled.
  10058. */
  10059. isOffscreen(): boolean;
  10060. /**
  10061. * If *offscreen rendering* is enabled returns whether it is currently painting.
  10062. */
  10063. isPainting(): boolean;
  10064. /**
  10065. * Whether the web page is waiting for a first-response from the main resource of
  10066. * the page.
  10067. */
  10068. isWaitingForResponse(): boolean;
  10069. /**
  10070. * the promise will resolve when the page has finished loading (see
  10071. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  10072. *
  10073. * Loads the given file in the window, `filePath` should be a path to an HTML file
  10074. * relative to the root of your application. For instance an app structure like
  10075. * this:
  10076. Would require code like this
  10077. */
  10078. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  10079. /**
  10080. * the promise will resolve when the page has finished loading (see
  10081. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  10082. * A noop rejection handler is already attached, which avoids unhandled rejection
  10083. * errors.
  10084. *
  10085. * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
  10086. * the `http://` or `file://`. If the load should bypass http cache then use the
  10087. * `pragma` header to achieve it.
  10088. */
  10089. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  10090. /**
  10091. * Opens the devtools.
  10092. *
  10093. * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
  10094. * explicitly passing an empty `mode` can force using last used dock state.
  10095. */
  10096. openDevTools(options?: OpenDevToolsOptions): void;
  10097. /**
  10098. * Executes the editing command `paste` in web page.
  10099. */
  10100. paste(): void;
  10101. /**
  10102. * Executes the editing command `pasteAndMatchStyle` in web page.
  10103. */
  10104. pasteAndMatchStyle(): void;
  10105. /**
  10106. * Send a message to the renderer process, optionally transferring ownership of
  10107. * zero or more [`MessagePortMain`][] objects.
  10108. *
  10109. * The transferred `MessagePortMain` objects will be available in the renderer
  10110. * process by accessing the `ports` property of the emitted event. When they arrive
  10111. * in the renderer, they will be native DOM `MessagePort` objects.
  10112. For example:
  10113. */
  10114. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  10115. /**
  10116. * When a custom `pageSize` is passed, Chromium attempts to validate platform
  10117. * specific minimum values for `width_microns` and `height_microns`. Width and
  10118. * height must both be minimum 353 microns but may be higher on some operating
  10119. * systems.
  10120. *
  10121. * Prints window's web page. When `silent` is set to `true`, Electron will pick the
  10122. * system's default printer if `deviceName` is empty and the default settings for
  10123. * printing.
  10124. *
  10125. * Use `page-break-before: always;` CSS style to force to print to a new page.
  10126. *
  10127. Example usage:
  10128. */
  10129. print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
  10130. /**
  10131. * Resolves with the generated PDF data.
  10132. *
  10133. * Prints window's web page as PDF with Chromium's preview printing custom
  10134. * settings.
  10135. *
  10136. * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
  10137. *
  10138. * By default, an empty `options` will be regarded as:
  10139. *
  10140. * Use `page-break-before: always;` CSS style to force to print to a new page.
  10141. *
  10142. An example of `webContents.printToPDF`:
  10143. */
  10144. printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
  10145. /**
  10146. * Executes the editing command `redo` in web page.
  10147. */
  10148. redo(): void;
  10149. /**
  10150. * Reloads the current web page.
  10151. */
  10152. reload(): void;
  10153. /**
  10154. * Reloads current page and ignores cache.
  10155. */
  10156. reloadIgnoringCache(): void;
  10157. /**
  10158. * Resolves if the removal was successful.
  10159. *
  10160. * Removes the inserted CSS from the current web page. The stylesheet is identified
  10161. * by its key, which is returned from `contents.insertCSS(css)`.
  10162. */
  10163. removeInsertedCSS(key: string): Promise<void>;
  10164. /**
  10165. * Removes the specified path from DevTools workspace.
  10166. */
  10167. removeWorkSpace(path: string): void;
  10168. /**
  10169. * Executes the editing command `replace` in web page.
  10170. */
  10171. replace(text: string): void;
  10172. /**
  10173. * Executes the editing command `replaceMisspelling` in web page.
  10174. */
  10175. replaceMisspelling(text: string): void;
  10176. /**
  10177. * resolves if the page is saved.
  10178. */
  10179. savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
  10180. /**
  10181. * Executes the editing command `selectAll` in web page.
  10182. */
  10183. selectAll(): void;
  10184. /**
  10185. * Send an asynchronous message to the renderer process via `channel`, along with
  10186. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  10187. * just like `postMessage`, so prototype chains will not be included. Sending
  10188. * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
  10189. *
  10190. * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
  10191. * Electron objects will throw an exception.
  10192. *
  10193. * The renderer process can handle the message by listening to `channel` with the
  10194. * `ipcRenderer` module.
  10195. *
  10196. An example of sending messages from the main process to the renderer process:
  10197. */
  10198. send(channel: string, ...args: any[]): void;
  10199. /**
  10200. * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
  10201. * contents needs to be focused for `sendInputEvent()` to work.
  10202. */
  10203. sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
  10204. /**
  10205. * Send an asynchronous message to a specific frame in a renderer process via
  10206. * `channel`, along with arguments. Arguments will be serialized with the
  10207. * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
  10208. * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
  10209. * will throw an exception.
  10210. *
  10211. * > **NOTE:** Sending non-standard JavaScript types such as DOM objects or special
  10212. * Electron objects will throw an exception.
  10213. *
  10214. * The renderer process can handle the message by listening to `channel` with the
  10215. * `ipcRenderer` module.
  10216. *
  10217. * If you want to get the `frameId` of a given renderer context you should use the
  10218. * `webFrame.routingId` value. E.g.
  10219. *
  10220. You can also read `frameId` from all incoming IPC messages in the main process.
  10221. */
  10222. sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
  10223. /**
  10224. * Mute the audio on the current web page.
  10225. */
  10226. setAudioMuted(muted: boolean): void;
  10227. /**
  10228. * Controls whether or not this WebContents will throttle animations and timers
  10229. * when the page becomes backgrounded. This also affects the Page Visibility API.
  10230. */
  10231. setBackgroundThrottling(allowed: boolean): void;
  10232. /**
  10233. * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
  10234. *
  10235. * The `devToolsWebContents` must not have done any navigation, and it should not
  10236. * be used for other purposes after the call.
  10237. *
  10238. * By default Electron manages the devtools by creating an internal `WebContents`
  10239. * with native view, which developers have very limited control of. With the
  10240. * `setDevToolsWebContents` method, developers can use any `WebContents` to show
  10241. * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
  10242. * tag.
  10243. *
  10244. * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
  10245. * caller's responsibility to destroy `devToolsWebContents`.
  10246. *
  10247. * An example of showing devtools in a `<webview>` tag:
  10248. *
  10249. An example of showing devtools in a `BrowserWindow`:
  10250. */
  10251. setDevToolsWebContents(devToolsWebContents: WebContents): void;
  10252. /**
  10253. * If *offscreen rendering* is enabled sets the frame rate to the specified number.
  10254. * Only values between 1 and 240 are accepted.
  10255. */
  10256. setFrameRate(fps: number): void;
  10257. /**
  10258. * Ignore application menu shortcuts while this web contents is focused.
  10259. */
  10260. setIgnoreMenuShortcuts(ignore: boolean): void;
  10261. /**
  10262. * Overrides the user agent for this web page.
  10263. */
  10264. setUserAgent(userAgent: string): void;
  10265. /**
  10266. * Sets the maximum and minimum pinch-to-zoom level.
  10267. *
  10268. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  10269. * call:
  10270. */
  10271. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  10272. /**
  10273. * Setting the WebRTC IP handling policy allows you to control which IPs are
  10274. * exposed via WebRTC. See BrowserLeaks for more details.
  10275. */
  10276. setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
  10277. /**
  10278. * Called before creating a window when `window.open()` is called from the
  10279. * renderer. See `window.open()` for more details and how to use this in
  10280. * conjunction with `did-create-window`.
  10281. */
  10282. setWindowOpenHandler(handler: (details: HandlerDetails) => ({action: 'deny'}) | ({action: 'allow', overrideBrowserWindowOptions?: BrowserWindowConstructorOptions})): void;
  10283. /**
  10284. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  10285. * divided by 100, so 300% = 3.0.
  10286. The factor must be greater than 0.0.
  10287. */
  10288. setZoomFactor(factor: number): void;
  10289. /**
  10290. * Changes the zoom level to the specified level. The original size is 0 and each
  10291. * increment above or below represents zooming 20% larger or smaller to default
  10292. * limits of 300% and 50% of original size, respectively. The formula for this is
  10293. * `scale := 1.2 ^ level`.
  10294. *
  10295. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  10296. * the zoom level for a specific domain propagates across all instances of windows
  10297. * with the same domain. Differentiating the window URLs will make zoom work
  10298. * per-window.
  10299. */
  10300. setZoomLevel(level: number): void;
  10301. /**
  10302. * Shows pop-up dictionary that searches the selected word on the page.
  10303. *
  10304. * @platform darwin
  10305. */
  10306. showDefinitionForSelection(): void;
  10307. /**
  10308. * Sets the `item` as dragging item for current drag-drop operation, `file` is the
  10309. * absolute path of the file to be dragged, and `icon` is the image showing under
  10310. * the cursor when dragging.
  10311. */
  10312. startDrag(item: Item): void;
  10313. /**
  10314. * If *offscreen rendering* is enabled and not painting, start painting.
  10315. */
  10316. startPainting(): void;
  10317. /**
  10318. * Stops any pending navigation.
  10319. */
  10320. stop(): void;
  10321. /**
  10322. * Stops any `findInPage` request for the `webContents` with the provided `action`.
  10323. */
  10324. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  10325. /**
  10326. * If *offscreen rendering* is enabled and painting, stop painting.
  10327. */
  10328. stopPainting(): void;
  10329. /**
  10330. * Indicates whether the snapshot has been created successfully.
  10331. *
  10332. Takes a V8 heap snapshot and saves it to `filePath`.
  10333. */
  10334. takeHeapSnapshot(filePath: string): Promise<void>;
  10335. /**
  10336. * Toggles the developer tools.
  10337. */
  10338. toggleDevTools(): void;
  10339. /**
  10340. * Executes the editing command `undo` in web page.
  10341. */
  10342. undo(): void;
  10343. /**
  10344. * Executes the editing command `unselect` in web page.
  10345. */
  10346. unselect(): void;
  10347. audioMuted: boolean;
  10348. backgroundThrottling: boolean;
  10349. readonly debugger: Debugger;
  10350. readonly devToolsWebContents: (WebContents) | (null);
  10351. frameRate: number;
  10352. readonly hostWebContents: WebContents;
  10353. readonly id: number;
  10354. readonly mainFrame: WebFrameMain;
  10355. readonly session: Session;
  10356. userAgent: string;
  10357. zoomFactor: number;
  10358. zoomLevel: number;
  10359. }
  10360. interface WebFrame extends NodeJS.EventEmitter {
  10361. // Docs: https://electronjs.org/docs/api/web-frame
  10362. /**
  10363. * Attempts to free memory that is no longer being used (like images from a
  10364. * previous navigation).
  10365. *
  10366. * Note that blindly calling this method probably makes Electron slower since it
  10367. * will have to refill these emptied caches, you should only call it if an event in
  10368. * your app has occurred that makes you think your page is actually using less
  10369. * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
  10370. * and intend to stay there).
  10371. */
  10372. clearCache(): void;
  10373. /**
  10374. * A promise that resolves with the result of the executed code or is rejected if
  10375. * execution throws or results in a rejected promise.
  10376. *
  10377. * Evaluates `code` in page.
  10378. *
  10379. * In the browser window some HTML APIs like `requestFullScreen` can only be
  10380. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  10381. * this limitation.
  10382. */
  10383. executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  10384. /**
  10385. * A promise that resolves with the result of the executed code or is rejected if
  10386. * execution could not start.
  10387. *
  10388. * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  10389. *
  10390. * Note that when the execution of script fails, the returned promise will not
  10391. * reject and the `result` would be `undefined`. This is because Chromium does not
  10392. * dispatch errors of isolated worlds to foreign worlds.
  10393. */
  10394. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  10395. /**
  10396. * A child of `webFrame` with the supplied `name`, `null` would be returned if
  10397. * there's no such frame or if the frame is not in the current renderer process.
  10398. */
  10399. findFrameByName(name: string): WebFrame;
  10400. /**
  10401. * that has the supplied `routingId`, `null` if not found.
  10402. */
  10403. findFrameByRoutingId(routingId: number): WebFrame;
  10404. /**
  10405. * The frame element in `webFrame's` document selected by `selector`, `null` would
  10406. * be returned if `selector` does not select a frame or if the frame is not in the
  10407. * current renderer process.
  10408. */
  10409. getFrameForSelector(selector: string): WebFrame;
  10410. /**
  10411. * * `images` MemoryUsageDetails
  10412. * * `scripts` MemoryUsageDetails
  10413. * * `cssStyleSheets` MemoryUsageDetails
  10414. * * `xslStyleSheets` MemoryUsageDetails
  10415. * * `fonts` MemoryUsageDetails
  10416. * * `other` MemoryUsageDetails
  10417. *
  10418. * Returns an object describing usage information of Blink's internal memory
  10419. * caches.
  10420. This will generate:
  10421. */
  10422. getResourceUsage(): ResourceUsage;
  10423. /**
  10424. * A list of suggested words for a given word. If the word is spelled correctly,
  10425. * the result will be empty.
  10426. */
  10427. getWordSuggestions(word: string): string[];
  10428. /**
  10429. * The current zoom factor.
  10430. */
  10431. getZoomFactor(): number;
  10432. /**
  10433. * The current zoom level.
  10434. */
  10435. getZoomLevel(): number;
  10436. /**
  10437. * A key for the inserted CSS that can later be used to remove the CSS via
  10438. * `webFrame.removeInsertedCSS(key)`.
  10439. *
  10440. * Injects CSS into the current web page and returns a unique key for the inserted
  10441. * stylesheet.
  10442. */
  10443. insertCSS(css: string): string;
  10444. /**
  10445. * Inserts `text` to the focused element.
  10446. */
  10447. insertText(text: string): void;
  10448. /**
  10449. * True if the word is misspelled according to the built in spellchecker, false
  10450. * otherwise. If no dictionary is loaded, always return false.
  10451. */
  10452. isWordMisspelled(word: string): boolean;
  10453. /**
  10454. * Removes the inserted CSS from the current web page. The stylesheet is identified
  10455. * by its key, which is returned from `webFrame.insertCSS(css)`.
  10456. */
  10457. removeInsertedCSS(key: string): void;
  10458. /**
  10459. * Set the security origin, content security policy and name of the isolated world.
  10460. * Note: If the `csp` is specified, then the `securityOrigin` also has to be
  10461. * specified.
  10462. */
  10463. setIsolatedWorldInfo(worldId: number, info: Info): void;
  10464. /**
  10465. * Sets a provider for spell checking in input fields and text areas.
  10466. *
  10467. * If you want to use this method you must disable the builtin spellchecker when
  10468. * you construct the window.
  10469. *
  10470. * The `provider` must be an object that has a `spellCheck` method that accepts an
  10471. * array of individual words for spellchecking. The `spellCheck` function runs
  10472. * asynchronously and calls the `callback` function with an array of misspelt words
  10473. * when complete.
  10474. An example of using node-spellchecker as provider:
  10475. */
  10476. setSpellCheckProvider(language: string, provider: Provider): void;
  10477. /**
  10478. * Sets the maximum and minimum pinch-to-zoom level.
  10479. *
  10480. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  10481. * call:
  10482. *
  10483. * > **NOTE**: Visual zoom only applies to pinch-to-zoom behavior. Cmd+/-/0 zoom
  10484. * shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem
  10485. * roles in the application Menu. To disable shortcuts, manually define the Menu
  10486. * and omit zoom roles from the definition.
  10487. */
  10488. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
  10489. /**
  10490. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  10491. * divided by 100, so 300% = 3.0.
  10492. The factor must be greater than 0.0.
  10493. */
  10494. setZoomFactor(factor: number): void;
  10495. /**
  10496. * Changes the zoom level to the specified level. The original size is 0 and each
  10497. * increment above or below represents zooming 20% larger or smaller to default
  10498. * limits of 300% and 50% of original size, respectively.
  10499. *
  10500. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  10501. * the zoom level for a specific domain propagates across all instances of windows
  10502. * with the same domain. Differentiating the window URLs will make zoom work
  10503. * per-window.
  10504. */
  10505. setZoomLevel(level: number): void;
  10506. /**
  10507. * A `WebFrame | null` representing the first child frame of `webFrame`, the
  10508. * property would be `null` if `webFrame` has no children or if first child is not
  10509. * in the current renderer process.
  10510. *
  10511. */
  10512. readonly firstChild: (WebFrame) | (null);
  10513. /**
  10514. * A `WebFrame | null` representing next sibling frame, the property would be
  10515. * `null` if `webFrame` is the last frame in its parent or if the next sibling is
  10516. * not in the current renderer process.
  10517. *
  10518. */
  10519. readonly nextSibling: (WebFrame) | (null);
  10520. /**
  10521. * A `WebFrame | null` representing the frame which opened `webFrame`, the property
  10522. * would be `null` if there's no opener or opener is not in the current renderer
  10523. * process.
  10524. *
  10525. */
  10526. readonly opener: (WebFrame) | (null);
  10527. /**
  10528. * A `WebFrame | null` representing parent frame of `webFrame`, the property would
  10529. * be `null` if `webFrame` is top or parent is not in the current renderer process.
  10530. *
  10531. */
  10532. readonly parent: (WebFrame) | (null);
  10533. /**
  10534. * An `Integer` representing the unique frame id in the current renderer process.
  10535. * Distinct WebFrame instances that refer to the same underlying frame will have
  10536. * the same `routingId`.
  10537. *
  10538. */
  10539. readonly routingId: number;
  10540. /**
  10541. * A `WebFrame | null` representing top frame in frame hierarchy to which
  10542. * `webFrame` belongs, the property would be `null` if top frame is not in the
  10543. * current renderer process.
  10544. *
  10545. */
  10546. readonly top: (WebFrame) | (null);
  10547. }
  10548. class WebFrameMain extends NodeEventEmitter {
  10549. // Docs: https://electronjs.org/docs/api/web-frame-main
  10550. /**
  10551. * A frame with the given process and routing IDs, or `undefined` if there is no
  10552. * WebFrameMain associated with the given IDs.
  10553. */
  10554. static fromId(processId: number, routingId: number): (WebFrameMain) | (undefined);
  10555. /**
  10556. * A promise that resolves with the result of the executed code or is rejected if
  10557. * execution throws or results in a rejected promise.
  10558. *
  10559. * Evaluates `code` in page.
  10560. *
  10561. * In the browser window some HTML APIs like `requestFullScreen` can only be
  10562. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  10563. * this limitation.
  10564. */
  10565. executeJavaScript(code: string, userGesture?: boolean): Promise<unknown>;
  10566. /**
  10567. * Send a message to the renderer process, optionally transferring ownership of
  10568. * zero or more [`MessagePortMain`][] objects.
  10569. *
  10570. * The transferred `MessagePortMain` objects will be available in the renderer
  10571. * process by accessing the `ports` property of the emitted event. When they arrive
  10572. * in the renderer, they will be native DOM `MessagePort` objects.
  10573. For example:
  10574. */
  10575. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  10576. /**
  10577. * Whether the reload was initiated successfully. Only results in `false` when the
  10578. * frame has no history.
  10579. */
  10580. reload(): boolean;
  10581. /**
  10582. * Send an asynchronous message to the renderer process via `channel`, along with
  10583. * arguments. Arguments will be serialized with the [Structured Clone
  10584. * Algorithm][SCA], just like [`postMessage`][], so prototype chains will not be
  10585. * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
  10586. * an exception.
  10587. *
  10588. * The renderer process can handle the message by listening to `channel` with the
  10589. * `ipcRenderer` module.
  10590. */
  10591. send(channel: string, ...args: any[]): void;
  10592. readonly frames: WebFrameMain[];
  10593. readonly framesInSubtree: WebFrameMain[];
  10594. readonly frameTreeNodeId: number;
  10595. readonly name: string;
  10596. readonly osProcessId: number;
  10597. readonly parent: (WebFrameMain) | (null);
  10598. readonly processId: number;
  10599. readonly routingId: number;
  10600. readonly top: (WebFrameMain) | (null);
  10601. readonly url: string;
  10602. }
  10603. class WebRequest {
  10604. // Docs: https://electronjs.org/docs/api/web-request
  10605. /**
  10606. * The `listener` will be called with `listener(details)` when a server initiated
  10607. * redirect is about to occur.
  10608. */
  10609. onBeforeRedirect(filter: Filter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  10610. /**
  10611. * The `listener` will be called with `listener(details)` when a server initiated
  10612. * redirect is about to occur.
  10613. */
  10614. onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  10615. /**
  10616. * The `listener` will be called with `listener(details, callback)` when a request
  10617. * is about to occur.
  10618. *
  10619. * The `uploadData` is an array of `UploadData` objects.
  10620. *
  10621. * The `callback` has to be called with an `response` object.
  10622. *
  10623. Some examples of valid `urls`:
  10624. */
  10625. onBeforeRequest(filter: Filter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
  10626. /**
  10627. * The `listener` will be called with `listener(details, callback)` when a request
  10628. * is about to occur.
  10629. *
  10630. * The `uploadData` is an array of `UploadData` objects.
  10631. *
  10632. * The `callback` has to be called with an `response` object.
  10633. *
  10634. Some examples of valid `urls`:
  10635. */
  10636. onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
  10637. /**
  10638. * The `listener` will be called with `listener(details, callback)` before sending
  10639. * an HTTP request, once the request headers are available. This may occur after a
  10640. * TCP connection is made to the server, but before any http data is sent.
  10641. *
  10642. The `callback` has to be called with a `response` object.
  10643. */
  10644. onBeforeSendHeaders(filter: Filter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  10645. /**
  10646. * The `listener` will be called with `listener(details, callback)` before sending
  10647. * an HTTP request, once the request headers are available. This may occur after a
  10648. * TCP connection is made to the server, but before any http data is sent.
  10649. *
  10650. The `callback` has to be called with a `response` object.
  10651. */
  10652. onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  10653. /**
  10654. * The `listener` will be called with `listener(details)` when a request is
  10655. * completed.
  10656. */
  10657. onCompleted(filter: Filter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  10658. /**
  10659. * The `listener` will be called with `listener(details)` when a request is
  10660. * completed.
  10661. */
  10662. onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  10663. /**
  10664. * The `listener` will be called with `listener(details)` when an error occurs.
  10665. */
  10666. onErrorOccurred(filter: Filter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  10667. /**
  10668. * The `listener` will be called with `listener(details)` when an error occurs.
  10669. */
  10670. onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  10671. /**
  10672. * The `listener` will be called with `listener(details, callback)` when HTTP
  10673. * response headers of a request have been received.
  10674. *
  10675. The `callback` has to be called with a `response` object.
  10676. */
  10677. onHeadersReceived(filter: Filter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  10678. /**
  10679. * The `listener` will be called with `listener(details, callback)` when HTTP
  10680. * response headers of a request have been received.
  10681. *
  10682. The `callback` has to be called with a `response` object.
  10683. */
  10684. onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  10685. /**
  10686. * The `listener` will be called with `listener(details)` when first byte of the
  10687. * response body is received. For HTTP requests, this means that the status line
  10688. * and response headers are available.
  10689. */
  10690. onResponseStarted(filter: Filter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  10691. /**
  10692. * The `listener` will be called with `listener(details)` when first byte of the
  10693. * response body is received. For HTTP requests, this means that the status line
  10694. * and response headers are available.
  10695. */
  10696. onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  10697. /**
  10698. * The `listener` will be called with `listener(details)` just before a request is
  10699. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  10700. * response are visible by the time this listener is fired.
  10701. */
  10702. onSendHeaders(filter: Filter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  10703. /**
  10704. * The `listener` will be called with `listener(details)` just before a request is
  10705. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  10706. * response are visible by the time this listener is fired.
  10707. */
  10708. onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  10709. }
  10710. interface WebSource {
  10711. // Docs: https://electronjs.org/docs/api/structures/web-source
  10712. code: string;
  10713. /**
  10714. * Default is 1.
  10715. */
  10716. startLine?: number;
  10717. url?: string;
  10718. }
  10719. interface WebviewTag extends HTMLElement {
  10720. // Docs: https://electronjs.org/docs/api/webview-tag
  10721. /**
  10722. * Fired when a load has committed. This includes navigation within the current
  10723. * document as well as subframe document-level loads, but does not include
  10724. * asynchronous resource loads.
  10725. */
  10726. addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
  10727. removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
  10728. /**
  10729. * Fired when the navigation is done, i.e. the spinner of the tab will stop
  10730. * spinning, and the `onload` event is dispatched.
  10731. */
  10732. addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this;
  10733. removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this;
  10734. /**
  10735. * This event is like `did-finish-load`, but fired when the load failed or was
  10736. * cancelled, e.g. `window.stop()` is invoked.
  10737. */
  10738. addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
  10739. removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
  10740. /**
  10741. * Fired when a frame has done navigation.
  10742. */
  10743. addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
  10744. removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
  10745. /**
  10746. * Corresponds to the points in time when the spinner of the tab starts spinning.
  10747. */
  10748. addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this;
  10749. removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this;
  10750. /**
  10751. * Corresponds to the points in time when the spinner of the tab stops spinning.
  10752. */
  10753. addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this;
  10754. removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this;
  10755. /**
  10756. * Fired when document in the given frame is loaded.
  10757. */
  10758. addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this;
  10759. removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this;
  10760. /**
  10761. * Fired when page title is set during navigation. `explicitSet` is false when
  10762. * title is synthesized from file url.
  10763. */
  10764. addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
  10765. removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
  10766. /**
  10767. * Fired when page receives favicon urls.
  10768. */
  10769. addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
  10770. removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
  10771. /**
  10772. * Fired when page enters fullscreen triggered by HTML API.
  10773. */
  10774. addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
  10775. removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this;
  10776. /**
  10777. * Fired when page leaves fullscreen triggered by HTML API.
  10778. */
  10779. addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
  10780. removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this;
  10781. /**
  10782. * Fired when the guest window logs a console message.
  10783. *
  10784. * The following example code forwards all log messages to the embedder's console
  10785. * without regard for log level or other properties.
  10786. */
  10787. addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
  10788. removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
  10789. /**
  10790. * Fired when a result is available for `webview.findInPage` request.
  10791. */
  10792. addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
  10793. removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
  10794. /**
  10795. * Fired when the guest page attempts to open a new browser window.
  10796. *
  10797. The following example code opens the new url in system's default browser.
  10798. */
  10799. addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this;
  10800. removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this;
  10801. /**
  10802. * Emitted when a user or the page wants to start navigation. It can happen when
  10803. * the `window.location` object is changed or a user clicks a link in the page.
  10804. *
  10805. * This event will not emit when the navigation is started programmatically with
  10806. * APIs like `<webview>.loadURL` and `<webview>.back`.
  10807. *
  10808. * It is also not emitted during in-page navigation, such as clicking anchor links
  10809. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  10810. * this purpose.
  10811. Calling `event.preventDefault()` does __NOT__ have any effect.
  10812. */
  10813. addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
  10814. removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
  10815. /**
  10816. * Emitted when a navigation is done.
  10817. *
  10818. * This event is not emitted for in-page navigations, such as clicking anchor links
  10819. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  10820. * this purpose.
  10821. */
  10822. addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
  10823. removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
  10824. /**
  10825. * Emitted when an in-page navigation happened.
  10826. *
  10827. * When in-page navigation happens, the page URL changes but does not cause
  10828. * navigation outside of the page. Examples of this occurring are when anchor links
  10829. * are clicked or when the DOM `hashchange` event is triggered.
  10830. */
  10831. addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
  10832. removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
  10833. /**
  10834. * Fired when the guest page attempts to close itself.
  10835. *
  10836. * The following example code navigates the `webview` to `about:blank` when the
  10837. * guest attempts to close itself.
  10838. */
  10839. addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this;
  10840. removeEventListener(event: 'close', listener: (event: Event) => void): this;
  10841. /**
  10842. * Fired when the guest page has sent an asynchronous message to embedder page.
  10843. *
  10844. * With `sendToHost` method and `ipc-message` event you can communicate between
  10845. * guest page and embedder page:
  10846. */
  10847. addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
  10848. removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
  10849. /**
  10850. * Fired when the renderer process is crashed.
  10851. */
  10852. addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this;
  10853. removeEventListener(event: 'crashed', listener: (event: Event) => void): this;
  10854. /**
  10855. * Fired when a plugin process is crashed.
  10856. */
  10857. addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
  10858. removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
  10859. /**
  10860. * Fired when the WebContents is destroyed.
  10861. */
  10862. addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this;
  10863. removeEventListener(event: 'destroyed', listener: (event: Event) => void): this;
  10864. /**
  10865. * Emitted when media starts playing.
  10866. */
  10867. addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this;
  10868. removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this;
  10869. /**
  10870. * Emitted when media is paused or done playing.
  10871. */
  10872. addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this;
  10873. removeEventListener(event: 'media-paused', listener: (event: Event) => void): this;
  10874. /**
  10875. * Emitted when a page's theme color changes. This is usually due to encountering a
  10876. * meta tag:
  10877. */
  10878. addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
  10879. removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
  10880. /**
  10881. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  10882. */
  10883. addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
  10884. removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
  10885. /**
  10886. * Emitted when DevTools is opened.
  10887. */
  10888. addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this;
  10889. removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this;
  10890. /**
  10891. * Emitted when DevTools is closed.
  10892. */
  10893. addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this;
  10894. removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this;
  10895. /**
  10896. * Emitted when DevTools is focused / opened.
  10897. */
  10898. addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this;
  10899. removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this;
  10900. addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  10901. addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  10902. removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  10903. removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  10904. /**
  10905. * Whether the guest page can go back.
  10906. */
  10907. canGoBack(): boolean;
  10908. /**
  10909. * Whether the guest page can go forward.
  10910. */
  10911. canGoForward(): boolean;
  10912. /**
  10913. * Whether the guest page can go to `offset`.
  10914. */
  10915. canGoToOffset(offset: number): boolean;
  10916. /**
  10917. * Resolves with a NativeImage
  10918. *
  10919. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  10920. * whole visible page.
  10921. */
  10922. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  10923. /**
  10924. * Clears the navigation history.
  10925. */
  10926. clearHistory(): void;
  10927. /**
  10928. * Closes the DevTools window of guest page.
  10929. */
  10930. closeDevTools(): void;
  10931. /**
  10932. * Executes editing command `copy` in page.
  10933. */
  10934. copy(): void;
  10935. /**
  10936. * Executes editing command `cut` in page.
  10937. */
  10938. cut(): void;
  10939. /**
  10940. * Executes editing command `delete` in page.
  10941. */
  10942. delete(): void;
  10943. /**
  10944. * Initiates a download of the resource at `url` without navigating.
  10945. */
  10946. downloadURL(url: string): void;
  10947. /**
  10948. * A promise that resolves with the result of the executed code or is rejected if
  10949. * the result of the code is a rejected promise.
  10950. *
  10951. * Evaluates `code` in page. If `userGesture` is set, it will create the user
  10952. * gesture context in the page. HTML APIs like `requestFullScreen`, which require
  10953. * user action, can take advantage of this option for automation.
  10954. */
  10955. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  10956. /**
  10957. * The request id used for the request.
  10958. *
  10959. * Starts a request to find all matches for the `text` in the web page. The result
  10960. * of the request can be obtained by subscribing to `found-in-page` event.
  10961. */
  10962. findInPage(text: string, options?: FindInPageOptions): number;
  10963. /**
  10964. * The title of guest page.
  10965. */
  10966. getTitle(): string;
  10967. /**
  10968. * The URL of guest page.
  10969. */
  10970. getURL(): string;
  10971. /**
  10972. * The user agent for guest page.
  10973. */
  10974. getUserAgent(): string;
  10975. /**
  10976. * The WebContents ID of this `webview`.
  10977. */
  10978. getWebContentsId(): number;
  10979. /**
  10980. * the current zoom factor.
  10981. */
  10982. getZoomFactor(): number;
  10983. /**
  10984. * the current zoom level.
  10985. */
  10986. getZoomLevel(): number;
  10987. /**
  10988. * Makes the guest page go back.
  10989. */
  10990. goBack(): void;
  10991. /**
  10992. * Makes the guest page go forward.
  10993. */
  10994. goForward(): void;
  10995. /**
  10996. * Navigates to the specified absolute index.
  10997. */
  10998. goToIndex(index: number): void;
  10999. /**
  11000. * Navigates to the specified offset from the "current entry".
  11001. */
  11002. goToOffset(offset: number): void;
  11003. /**
  11004. * A promise that resolves with a key for the inserted CSS that can later be used
  11005. * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
  11006. *
  11007. * Injects CSS into the current web page and returns a unique key for the inserted
  11008. * stylesheet.
  11009. */
  11010. insertCSS(css: string): Promise<string>;
  11011. /**
  11012. * Inserts `text` to the focused element.
  11013. */
  11014. insertText(text: string): Promise<void>;
  11015. /**
  11016. * Starts inspecting element at position (`x`, `y`) of guest page.
  11017. */
  11018. inspectElement(x: number, y: number): void;
  11019. /**
  11020. * Opens the DevTools for the service worker context present in the guest page.
  11021. */
  11022. inspectServiceWorker(): void;
  11023. /**
  11024. * Opens the DevTools for the shared worker context present in the guest page.
  11025. */
  11026. inspectSharedWorker(): void;
  11027. /**
  11028. * Whether guest page has been muted.
  11029. */
  11030. isAudioMuted(): boolean;
  11031. /**
  11032. * Whether the renderer process has crashed.
  11033. */
  11034. isCrashed(): boolean;
  11035. /**
  11036. * Whether audio is currently playing.
  11037. */
  11038. isCurrentlyAudible(): boolean;
  11039. /**
  11040. * Whether DevTools window of guest page is focused.
  11041. */
  11042. isDevToolsFocused(): boolean;
  11043. /**
  11044. * Whether guest page has a DevTools window attached.
  11045. */
  11046. isDevToolsOpened(): boolean;
  11047. /**
  11048. * Whether guest page is still loading resources.
  11049. */
  11050. isLoading(): boolean;
  11051. /**
  11052. * Whether the main frame (and not just iframes or frames within it) is still
  11053. * loading.
  11054. */
  11055. isLoadingMainFrame(): boolean;
  11056. /**
  11057. * Whether the guest page is waiting for a first-response for the main resource of
  11058. * the page.
  11059. */
  11060. isWaitingForResponse(): boolean;
  11061. /**
  11062. * The promise will resolve when the page has finished loading (see
  11063. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  11064. *
  11065. * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
  11066. * the `http://` or `file://`.
  11067. */
  11068. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  11069. /**
  11070. * Opens a DevTools window for guest page.
  11071. */
  11072. openDevTools(): void;
  11073. /**
  11074. * Executes editing command `paste` in page.
  11075. */
  11076. paste(): void;
  11077. /**
  11078. * Executes editing command `pasteAndMatchStyle` in page.
  11079. */
  11080. pasteAndMatchStyle(): void;
  11081. /**
  11082. * Prints `webview`'s web page. Same as `webContents.print([options])`.
  11083. */
  11084. print(options?: WebviewTagPrintOptions): Promise<void>;
  11085. /**
  11086. * Resolves with the generated PDF data.
  11087. *
  11088. Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
  11089. */
  11090. printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
  11091. /**
  11092. * Executes editing command `redo` in page.
  11093. */
  11094. redo(): void;
  11095. /**
  11096. * Reloads the guest page.
  11097. */
  11098. reload(): void;
  11099. /**
  11100. * Reloads the guest page and ignores cache.
  11101. */
  11102. reloadIgnoringCache(): void;
  11103. /**
  11104. * Resolves if the removal was successful.
  11105. *
  11106. * Removes the inserted CSS from the current web page. The stylesheet is identified
  11107. * by its key, which is returned from `<webview>.insertCSS(css)`.
  11108. */
  11109. removeInsertedCSS(key: string): Promise<void>;
  11110. /**
  11111. * Executes editing command `replace` in page.
  11112. */
  11113. replace(text: string): void;
  11114. /**
  11115. * Executes editing command `replaceMisspelling` in page.
  11116. */
  11117. replaceMisspelling(text: string): void;
  11118. /**
  11119. * Executes editing command `selectAll` in page.
  11120. */
  11121. selectAll(): void;
  11122. /**
  11123. * Send an asynchronous message to renderer process via `channel`, you can also
  11124. * send arbitrary arguments. The renderer process can handle the message by
  11125. * listening to the `channel` event with the `ipcRenderer` module.
  11126. *
  11127. See webContents.send for examples.
  11128. */
  11129. send(channel: string, ...args: any[]): Promise<void>;
  11130. /**
  11131. * Sends an input `event` to the page.
  11132. *
  11133. See webContents.sendInputEvent for detailed description of `event` object.
  11134. */
  11135. sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
  11136. /**
  11137. * Set guest page muted.
  11138. */
  11139. setAudioMuted(muted: boolean): void;
  11140. /**
  11141. * Overrides the user agent for the guest page.
  11142. */
  11143. setUserAgent(userAgent: string): void;
  11144. /**
  11145. * Sets the maximum and minimum pinch-to-zoom level.
  11146. */
  11147. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  11148. /**
  11149. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  11150. * divided by 100, so 300% = 3.0.
  11151. */
  11152. setZoomFactor(factor: number): void;
  11153. /**
  11154. * Changes the zoom level to the specified level. The original size is 0 and each
  11155. * increment above or below represents zooming 20% larger or smaller to default
  11156. * limits of 300% and 50% of original size, respectively. The formula for this is
  11157. * `scale := 1.2 ^ level`.
  11158. *
  11159. * > **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that
  11160. * the zoom level for a specific domain propagates across all instances of windows
  11161. * with the same domain. Differentiating the window URLs will make zoom work
  11162. * per-window.
  11163. */
  11164. setZoomLevel(level: number): void;
  11165. /**
  11166. * Shows pop-up dictionary that searches the selected word on the page.
  11167. *
  11168. * @platform darwin
  11169. */
  11170. showDefinitionForSelection(): void;
  11171. /**
  11172. * Stops any pending navigation.
  11173. */
  11174. stop(): void;
  11175. /**
  11176. * Stops any `findInPage` request for the `webview` with the provided `action`.
  11177. */
  11178. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  11179. /**
  11180. * Executes editing command `undo` in page.
  11181. */
  11182. undo(): void;
  11183. /**
  11184. * Executes editing command `unselect` in page.
  11185. */
  11186. unselect(): void;
  11187. /**
  11188. * A `Boolean`. When this attribute is present the guest page will be allowed to
  11189. * open new windows. Popups are disabled by default.
  11190. */
  11191. allowpopups: boolean;
  11192. /**
  11193. * A `String` which is a list of strings which specifies the blink features to be
  11194. * disabled separated by `,`. The full list of supported feature strings can be
  11195. * found in the RuntimeEnabledFeatures.json5 file.
  11196. */
  11197. disableblinkfeatures: string;
  11198. /**
  11199. * A `Boolean`. When this attribute is present the guest page will have web
  11200. * security disabled. Web security is enabled by default.
  11201. */
  11202. disablewebsecurity: boolean;
  11203. /**
  11204. * A `String` which is a list of strings which specifies the blink features to be
  11205. * enabled separated by `,`. The full list of supported feature strings can be
  11206. * found in the RuntimeEnabledFeatures.json5 file.
  11207. */
  11208. enableblinkfeatures: string;
  11209. /**
  11210. * A `Boolean`. When this attribute is `false` the guest page in `webview` will not
  11211. * have access to the `remote` module. The remote module is unavailable by default.
  11212. */
  11213. enableremotemodule: boolean;
  11214. /**
  11215. * A `String` that sets the referrer URL for the guest page.
  11216. */
  11217. httpreferrer: string;
  11218. /**
  11219. * A `Boolean`. When this attribute is present the guest page in `webview` will
  11220. * have node integration and can use node APIs like `require` and `process` to
  11221. * access low level system resources. Node integration is disabled by default in
  11222. * the guest page.
  11223. */
  11224. nodeintegration: boolean;
  11225. /**
  11226. * A `Boolean` for the experimental option for enabling NodeJS support in
  11227. * sub-frames such as iframes inside the `webview`. All your preloads will load for
  11228. * every iframe, you can use `process.isMainFrame` to determine if you are in the
  11229. * main frame or not. This option is disabled by default in the guest page.
  11230. */
  11231. nodeintegrationinsubframes: boolean;
  11232. /**
  11233. * A `String` that sets the session used by the page. If `partition` starts with
  11234. * `persist:`, the page will use a persistent session available to all pages in the
  11235. * app with the same `partition`. if there is no `persist:` prefix, the page will
  11236. * use an in-memory session. By assigning the same `partition`, multiple pages can
  11237. * share the same session. If the `partition` is unset then default session of the
  11238. * app will be used.
  11239. *
  11240. * This value can only be modified before the first navigation, since the session
  11241. * of an active renderer process cannot change. Subsequent attempts to modify the
  11242. * value will fail with a DOM exception.
  11243. */
  11244. partition: string;
  11245. /**
  11246. * A `Boolean`. When this attribute is present the guest page in `webview` will be
  11247. * able to use browser plugins. Plugins are disabled by default.
  11248. */
  11249. plugins: boolean;
  11250. /**
  11251. * A `String` that specifies a script that will be loaded before other scripts run
  11252. * in the guest page. The protocol of script's URL must be either `file:` or
  11253. * `asar:`, because it will be loaded by `require` in guest page under the hood.
  11254. *
  11255. * When the guest page doesn't have node integration this script will still have
  11256. * access to all Node APIs, but global objects injected by Node will be deleted
  11257. * after this script has finished executing.
  11258. *
  11259. * **Note:** This option will appear as `preloadURL` (not `preload`) in the
  11260. * `webPreferences` specified to the `will-attach-webview` event.
  11261. */
  11262. preload: string;
  11263. /**
  11264. * A `String` representing the visible URL. Writing to this attribute initiates
  11265. * top-level navigation.
  11266. *
  11267. * Assigning `src` its own value will reload the current page.
  11268. *
  11269. * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
  11270. * world!`.
  11271. */
  11272. src: string;
  11273. /**
  11274. * A `String` that sets the user agent for the guest page before the page is
  11275. * navigated to. Once the page is loaded, use the `setUserAgent` method to change
  11276. * the user agent.
  11277. */
  11278. useragent: string;
  11279. /**
  11280. * A `String` which is a comma separated list of strings which specifies the web
  11281. * preferences to be set on the webview. The full list of supported preference
  11282. * strings can be found in BrowserWindow.
  11283. *
  11284. * The string follows the same format as the features string in `window.open`. A
  11285. * name by itself is given a `true` boolean value. A preference can be set to
  11286. * another value by including an `=`, followed by the value. Special values `yes`
  11287. * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
  11288. * `false`.
  11289. */
  11290. webpreferences: string;
  11291. }
  11292. interface AboutPanelOptionsOptions {
  11293. /**
  11294. * The app's name.
  11295. */
  11296. applicationName?: string;
  11297. /**
  11298. * The app's version.
  11299. */
  11300. applicationVersion?: string;
  11301. /**
  11302. * Copyright information.
  11303. */
  11304. copyright?: string;
  11305. /**
  11306. * The app's build version number.
  11307. *
  11308. * @platform darwin
  11309. */
  11310. version?: string;
  11311. /**
  11312. * Credit information.
  11313. *
  11314. * @platform darwin,win32
  11315. */
  11316. credits?: string;
  11317. /**
  11318. * List of app authors.
  11319. *
  11320. * @platform linux
  11321. */
  11322. authors?: string[];
  11323. /**
  11324. * The app's website.
  11325. *
  11326. * @platform linux
  11327. */
  11328. website?: string;
  11329. /**
  11330. * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
  11331. * 64x64 pixels while retaining aspect ratio.
  11332. *
  11333. * @platform linux,win32
  11334. */
  11335. iconPath?: string;
  11336. }
  11337. interface AddRepresentationOptions {
  11338. /**
  11339. * The scale factor to add the image representation for.
  11340. */
  11341. scaleFactor: number;
  11342. /**
  11343. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  11344. */
  11345. width?: number;
  11346. /**
  11347. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  11348. */
  11349. height?: number;
  11350. /**
  11351. * The buffer containing the raw image data.
  11352. */
  11353. buffer?: Buffer;
  11354. /**
  11355. * The data URL containing either a base 64 encoded PNG or JPEG image.
  11356. */
  11357. dataURL?: string;
  11358. }
  11359. interface AnimationSettings {
  11360. /**
  11361. * Returns true if rich animations should be rendered. Looks at session type (e.g.
  11362. * remote desktop) and accessibility settings to give guidance for heavy
  11363. * animations.
  11364. */
  11365. shouldRenderRichAnimation: boolean;
  11366. /**
  11367. * Determines on a per-platform basis whether scroll animations (e.g. produced by
  11368. * home/end key) should be enabled.
  11369. */
  11370. scrollAnimationsEnabledBySystem: boolean;
  11371. /**
  11372. * Determines whether the user desires reduced motion based on platform APIs.
  11373. */
  11374. prefersReducedMotion: boolean;
  11375. }
  11376. interface AppDetailsOptions {
  11377. /**
  11378. * Window's App User Model ID. It has to be set, otherwise the other options will
  11379. * have no effect.
  11380. */
  11381. appId?: string;
  11382. /**
  11383. * Window's Relaunch Icon.
  11384. */
  11385. appIconPath?: string;
  11386. /**
  11387. * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
  11388. * Default is `0`.
  11389. */
  11390. appIconIndex?: number;
  11391. /**
  11392. * Window's Relaunch Command.
  11393. */
  11394. relaunchCommand?: string;
  11395. /**
  11396. * Window's Relaunch Display Name.
  11397. */
  11398. relaunchDisplayName?: string;
  11399. }
  11400. interface ApplicationInfoForProtocolReturnValue {
  11401. /**
  11402. * the display icon of the app handling the protocol.
  11403. */
  11404. icon: NativeImage;
  11405. /**
  11406. * installation path of the app handling the protocol.
  11407. */
  11408. path: string;
  11409. /**
  11410. * display name of the app handling the protocol.
  11411. */
  11412. name: string;
  11413. }
  11414. interface AuthenticationResponseDetails {
  11415. url: string;
  11416. }
  11417. interface AuthInfo {
  11418. isProxy: boolean;
  11419. scheme: string;
  11420. host: string;
  11421. port: number;
  11422. realm: string;
  11423. }
  11424. interface AutoResizeOptions {
  11425. /**
  11426. * If `true`, the view's width will grow and shrink together with the window.
  11427. * `false` by default.
  11428. */
  11429. width?: boolean;
  11430. /**
  11431. * If `true`, the view's height will grow and shrink together with the window.
  11432. * `false` by default.
  11433. */
  11434. height?: boolean;
  11435. /**
  11436. * If `true`, the view's x position and width will grow and shrink proportionally
  11437. * with the window. `false` by default.
  11438. */
  11439. horizontal?: boolean;
  11440. /**
  11441. * If `true`, the view's y position and height will grow and shrink proportionally
  11442. * with the window. `false` by default.
  11443. */
  11444. vertical?: boolean;
  11445. }
  11446. interface BeforeSendResponse {
  11447. cancel?: boolean;
  11448. /**
  11449. * When provided, request will be made with these headers.
  11450. */
  11451. requestHeaders?: Record<string, (string) | (string[])>;
  11452. }
  11453. interface BitmapOptions {
  11454. /**
  11455. * Defaults to 1.0.
  11456. */
  11457. scaleFactor?: number;
  11458. }
  11459. interface BlinkMemoryInfo {
  11460. /**
  11461. * Size of all allocated objects in Kilobytes.
  11462. */
  11463. allocated: number;
  11464. /**
  11465. * Size of all marked objects in Kilobytes.
  11466. */
  11467. marked: number;
  11468. /**
  11469. * Total allocated space in Kilobytes.
  11470. */
  11471. total: number;
  11472. }
  11473. interface BrowserViewConstructorOptions {
  11474. /**
  11475. * See BrowserWindow.
  11476. */
  11477. webPreferences?: WebPreferences;
  11478. }
  11479. interface BrowserWindowConstructorOptions {
  11480. /**
  11481. * Window's width in pixels. Default is `800`.
  11482. */
  11483. width?: number;
  11484. /**
  11485. * Window's height in pixels. Default is `600`.
  11486. */
  11487. height?: number;
  11488. /**
  11489. * (**required** if y is used) Window's left offset from screen. Default is to
  11490. * center the window.
  11491. */
  11492. x?: number;
  11493. /**
  11494. * (**required** if x is used) Window's top offset from screen. Default is to
  11495. * center the window.
  11496. */
  11497. y?: number;
  11498. /**
  11499. * The `width` and `height` would be used as web page's size, which means the
  11500. * actual window's size will include window frame's size and be slightly larger.
  11501. * Default is `false`.
  11502. */
  11503. useContentSize?: boolean;
  11504. /**
  11505. * Show window in the center of the screen.
  11506. */
  11507. center?: boolean;
  11508. /**
  11509. * Window's minimum width. Default is `0`.
  11510. */
  11511. minWidth?: number;
  11512. /**
  11513. * Window's minimum height. Default is `0`.
  11514. */
  11515. minHeight?: number;
  11516. /**
  11517. * Window's maximum width. Default is no limit.
  11518. */
  11519. maxWidth?: number;
  11520. /**
  11521. * Window's maximum height. Default is no limit.
  11522. */
  11523. maxHeight?: number;
  11524. /**
  11525. * Whether window is resizable. Default is `true`.
  11526. */
  11527. resizable?: boolean;
  11528. /**
  11529. * Whether window is movable. This is not implemented on Linux. Default is `true`.
  11530. */
  11531. movable?: boolean;
  11532. /**
  11533. * Whether window is minimizable. This is not implemented on Linux. Default is
  11534. * `true`.
  11535. */
  11536. minimizable?: boolean;
  11537. /**
  11538. * Whether window is maximizable. This is not implemented on Linux. Default is
  11539. * `true`.
  11540. */
  11541. maximizable?: boolean;
  11542. /**
  11543. * Whether window is closable. This is not implemented on Linux. Default is `true`.
  11544. */
  11545. closable?: boolean;
  11546. /**
  11547. * Whether the window can be focused. Default is `true`. On Windows setting
  11548. * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
  11549. * `focusable: false` makes the window stop interacting with wm, so the window will
  11550. * always stay on top in all workspaces.
  11551. */
  11552. focusable?: boolean;
  11553. /**
  11554. * Whether the window should always stay on top of other windows. Default is
  11555. * `false`.
  11556. */
  11557. alwaysOnTop?: boolean;
  11558. /**
  11559. * Whether the window should show in fullscreen. When explicitly set to `false` the
  11560. * fullscreen button will be hidden or disabled on macOS. Default is `false`.
  11561. */
  11562. fullscreen?: boolean;
  11563. /**
  11564. * Whether the window can be put into fullscreen mode. On macOS, also whether the
  11565. * maximize/zoom button should toggle full screen mode or maximize window. Default
  11566. * is `true`.
  11567. */
  11568. fullscreenable?: boolean;
  11569. /**
  11570. * Use pre-Lion fullscreen on macOS. Default is `false`.
  11571. */
  11572. simpleFullscreen?: boolean;
  11573. /**
  11574. * Whether to show the window in taskbar. Default is `false`.
  11575. */
  11576. skipTaskbar?: boolean;
  11577. /**
  11578. * Whether the window is in kiosk mode. Default is `false`.
  11579. */
  11580. kiosk?: boolean;
  11581. /**
  11582. * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
  11583. * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
  11584. */
  11585. title?: string;
  11586. /**
  11587. * The window icon. On Windows it is recommended to use `ICO` icons to get best
  11588. * visual effects, you can also leave it undefined so the executable's icon will be
  11589. * used.
  11590. */
  11591. icon?: (NativeImage) | (string);
  11592. /**
  11593. * Whether window should be shown when created. Default is `true`.
  11594. */
  11595. show?: boolean;
  11596. /**
  11597. * Whether the renderer should be active when `show` is `false` and it has just
  11598. * been created. In order for `document.visibilityState` to work correctly on
  11599. * first load with `show: false` you should set this to `false`. Setting this to
  11600. * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
  11601. */
  11602. paintWhenInitiallyHidden?: boolean;
  11603. /**
  11604. * Specify `false` to create a Frameless Window. Default is `true`.
  11605. */
  11606. frame?: boolean;
  11607. /**
  11608. * Specify parent window. Default is `null`.
  11609. */
  11610. parent?: BrowserWindow;
  11611. /**
  11612. * Whether this is a modal window. This only works when the window is a child
  11613. * window. Default is `false`.
  11614. */
  11615. modal?: boolean;
  11616. /**
  11617. * Whether the web view accepts a single mouse-down event that simultaneously
  11618. * activates the window. Default is `false`.
  11619. */
  11620. acceptFirstMouse?: boolean;
  11621. /**
  11622. * Whether to hide cursor when typing. Default is `false`.
  11623. */
  11624. disableAutoHideCursor?: boolean;
  11625. /**
  11626. * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
  11627. */
  11628. autoHideMenuBar?: boolean;
  11629. /**
  11630. * Enable the window to be resized larger than screen. Only relevant for macOS, as
  11631. * other OSes allow larger-than-screen windows by default. Default is `false`.
  11632. */
  11633. enableLargerThanScreen?: boolean;
  11634. /**
  11635. * Window's background color as a hexadecimal value, like `#66CD00` or `#FFF` or
  11636. * `#80FFFFFF` (alpha in #AARRGGBB format is supported if `transparent` is set to
  11637. * `true`). Default is `#FFF` (white).
  11638. */
  11639. backgroundColor?: string;
  11640. /**
  11641. * Whether window should have a shadow. Default is `true`.
  11642. */
  11643. hasShadow?: boolean;
  11644. /**
  11645. * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
  11646. * (fully opaque). This is only implemented on Windows and macOS.
  11647. */
  11648. opacity?: number;
  11649. /**
  11650. * Forces using dark theme for the window, only works on some GTK+3 desktop
  11651. * environments. Default is `false`.
  11652. */
  11653. darkTheme?: boolean;
  11654. /**
  11655. * Makes the window transparent. Default is `false`. On Windows, does not work
  11656. * unless the window is frameless.
  11657. */
  11658. transparent?: boolean;
  11659. /**
  11660. * The type of window, default is normal window. See more about this below.
  11661. */
  11662. type?: string;
  11663. /**
  11664. * Specify how the material appearance should reflect window activity state on
  11665. * macOS. Must be used with the `vibrancy` property. Possible values are:
  11666. */
  11667. visualEffectState?: ('followWindow' | 'active' | 'inactive');
  11668. /**
  11669. * The style of window title bar. Default is `default`. Possible values are:
  11670. */
  11671. titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
  11672. /**
  11673. * Set a custom position for the traffic light buttons in frameless windows.
  11674. */
  11675. trafficLightPosition?: Point;
  11676. /**
  11677. * Whether frameless window should have rounded corners on macOS. Default is
  11678. * `true`.
  11679. */
  11680. roundedCorners?: boolean;
  11681. /**
  11682. * Shows the title in the title bar in full screen mode on macOS for `hiddenInset`
  11683. * titleBarStyle. Default is `false`.
  11684. *
  11685. * @deprecated
  11686. */
  11687. fullscreenWindowTitle?: boolean;
  11688. /**
  11689. * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
  11690. * window frame. Setting it to `false` will remove window shadow and window
  11691. * animations. Default is `true`.
  11692. */
  11693. thickFrame?: boolean;
  11694. /**
  11695. * Add a type of vibrancy effect to the window, only on macOS. Can be
  11696. * `appearance-based`, `light`, `dark`, `titlebar`, `selection`, `menu`, `popover`,
  11697. * `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`,
  11698. * `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please
  11699. * note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
  11700. * are deprecated and have been removed in macOS Catalina (10.15).
  11701. */
  11702. 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');
  11703. /**
  11704. * Controls the behavior on macOS when option-clicking the green stoplight button
  11705. * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
  11706. * will grow to the preferred width of the web page when zoomed, `false` will cause
  11707. * it to zoom to the width of the screen. This will also affect the behavior when
  11708. * calling `maximize()` directly. Default is `false`.
  11709. */
  11710. zoomToPageWidth?: boolean;
  11711. /**
  11712. * Tab group name, allows opening the window as a native tab on macOS 10.12+.
  11713. * Windows with the same tabbing identifier will be grouped together. This also
  11714. * adds a native new tab button to your window's tab bar and allows your `app` and
  11715. * window to receive the `new-window-for-tab` event.
  11716. */
  11717. tabbingIdentifier?: string;
  11718. /**
  11719. * Settings of web page's features.
  11720. */
  11721. webPreferences?: WebPreferences;
  11722. }
  11723. interface CertificateTrustDialogOptions {
  11724. /**
  11725. * The certificate to trust/import.
  11726. */
  11727. certificate: Certificate;
  11728. /**
  11729. * The message to display to the user.
  11730. */
  11731. message: string;
  11732. }
  11733. interface ClearStorageDataOptions {
  11734. /**
  11735. * Should follow `window.location.origin`’s representation `scheme://host:port`.
  11736. */
  11737. origin?: string;
  11738. /**
  11739. * The types of storages to clear, can contain: `appcache`, `cookies`,
  11740. * `filesystem`, `indexdb`, `localstorage`, `shadercache`, `websql`,
  11741. * `serviceworkers`, `cachestorage`. If not specified, clear all storage types.
  11742. */
  11743. storages?: string[];
  11744. /**
  11745. * The types of quotas to clear, can contain: `temporary`, `persistent`,
  11746. * `syncable`. If not specified, clear all quotas.
  11747. */
  11748. quotas?: string[];
  11749. }
  11750. interface ClientRequestConstructorOptions {
  11751. /**
  11752. * The HTTP request method. Defaults to the GET method.
  11753. */
  11754. method?: string;
  11755. /**
  11756. * The request URL. Must be provided in the absolute form with the protocol scheme
  11757. * specified as http or https.
  11758. */
  11759. url?: string;
  11760. /**
  11761. * The `Session` instance with which the request is associated.
  11762. */
  11763. session?: Session;
  11764. /**
  11765. * The name of the `partition` with which the request is associated. Defaults to
  11766. * the empty string. The `session` option supersedes `partition`. Thus if a
  11767. * `session` is explicitly specified, `partition` is ignored.
  11768. */
  11769. partition?: string;
  11770. /**
  11771. * Can be `include` or `omit`. Whether to send credentials with this request. If
  11772. * set to `include`, credentials from the session associated with the request will
  11773. * be used. If set to `omit`, credentials will not be sent with the request (and
  11774. * the `'login'` event will not be triggered in the event of a 401). This matches
  11775. * the behavior of the fetch option of the same name. If this option is not
  11776. * specified, authentication data from the session will be sent, and cookies will
  11777. * not be sent (unless `useSessionCookies` is set).
  11778. */
  11779. credentials?: ('include' | 'omit');
  11780. /**
  11781. * Whether to send cookies with this request from the provided session. If
  11782. * `credentials` is specified, this option has no effect. Default is `false`.
  11783. */
  11784. useSessionCookies?: boolean;
  11785. /**
  11786. * Can be `http:` or `https:`. The protocol scheme in the form 'scheme:'. Defaults
  11787. * to 'http:'.
  11788. */
  11789. protocol?: string;
  11790. /**
  11791. * The server host provided as a concatenation of the hostname and the port number
  11792. * 'hostname:port'.
  11793. */
  11794. host?: string;
  11795. /**
  11796. * The server host name.
  11797. */
  11798. hostname?: string;
  11799. /**
  11800. * The server's listening port number.
  11801. */
  11802. port?: number;
  11803. /**
  11804. * The path part of the request URL.
  11805. */
  11806. path?: string;
  11807. /**
  11808. * Can be `follow`, `error` or `manual`. The redirect mode for this request. When
  11809. * mode is `error`, any redirection will be aborted. When mode is `manual` the
  11810. * redirection will be cancelled unless `request.followRedirect` is invoked
  11811. * synchronously during the `redirect` event. Defaults to `follow`.
  11812. */
  11813. redirect?: ('follow' | 'error' | 'manual');
  11814. /**
  11815. * The origin URL of the request.
  11816. */
  11817. origin?: string;
  11818. }
  11819. interface Config {
  11820. /**
  11821. * The proxy mode. Should be one of `direct`, `auto_detect`, `pac_script`,
  11822. * `fixed_servers` or `system`. If it's unspecified, it will be automatically
  11823. * determined based on other specified options.
  11824. */
  11825. mode?: ('direct' | 'auto_detect' | 'pac_script' | 'fixed_servers' | 'system');
  11826. /**
  11827. * The URL associated with the PAC file.
  11828. */
  11829. pacScript?: string;
  11830. /**
  11831. * Rules indicating which proxies to use.
  11832. */
  11833. proxyRules?: string;
  11834. /**
  11835. * Rules indicating which URLs should bypass the proxy settings.
  11836. */
  11837. proxyBypassRules?: string;
  11838. }
  11839. interface ConsoleMessageEvent extends Event {
  11840. /**
  11841. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  11842. * `error`.
  11843. */
  11844. level: number;
  11845. /**
  11846. * The actual console message
  11847. */
  11848. message: string;
  11849. /**
  11850. * The line number of the source that triggered this console message
  11851. */
  11852. line: number;
  11853. sourceId: string;
  11854. }
  11855. interface ContextMenuParams {
  11856. /**
  11857. * x coordinate.
  11858. */
  11859. x: number;
  11860. /**
  11861. * y coordinate.
  11862. */
  11863. y: number;
  11864. /**
  11865. * URL of the link that encloses the node the context menu was invoked on.
  11866. */
  11867. linkURL: string;
  11868. /**
  11869. * Text associated with the link. May be an empty string if the contents of the
  11870. * link are an image.
  11871. */
  11872. linkText: string;
  11873. /**
  11874. * URL of the top level page that the context menu was invoked on.
  11875. */
  11876. pageURL: string;
  11877. /**
  11878. * URL of the subframe that the context menu was invoked on.
  11879. */
  11880. frameURL: string;
  11881. /**
  11882. * Source URL for the element that the context menu was invoked on. Elements with
  11883. * source URLs are images, audio and video.
  11884. */
  11885. srcURL: string;
  11886. /**
  11887. * Type of the node the context menu was invoked on. Can be `none`, `image`,
  11888. * `audio`, `video`, `canvas`, `file` or `plugin`.
  11889. */
  11890. mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
  11891. /**
  11892. * Whether the context menu was invoked on an image which has non-empty contents.
  11893. */
  11894. hasImageContents: boolean;
  11895. /**
  11896. * Whether the context is editable.
  11897. */
  11898. isEditable: boolean;
  11899. /**
  11900. * Text of the selection that the context menu was invoked on.
  11901. */
  11902. selectionText: string;
  11903. /**
  11904. * Title text of the selection that the context menu was invoked on.
  11905. */
  11906. titleText: string;
  11907. /**
  11908. * Alt text of the selection that the context menu was invoked on.
  11909. */
  11910. altText: string;
  11911. /**
  11912. * Suggested filename to be used when saving file through 'Save Link As' option of
  11913. * context menu.
  11914. */
  11915. suggestedFilename: string;
  11916. /**
  11917. * Rect representing the coordinates in the document space of the selection.
  11918. */
  11919. selectionRect: Rectangle;
  11920. /**
  11921. * Start position of the selection text.
  11922. */
  11923. selectionStartOffset: number;
  11924. /**
  11925. * The referrer policy of the frame on which the menu is invoked.
  11926. */
  11927. referrerPolicy: Referrer;
  11928. /**
  11929. * The misspelled word under the cursor, if any.
  11930. */
  11931. misspelledWord: string;
  11932. /**
  11933. * An array of suggested words to show the user to replace the `misspelledWord`.
  11934. * Only available if there is a misspelled word and spellchecker is enabled.
  11935. */
  11936. dictionarySuggestions: string[];
  11937. /**
  11938. * The character encoding of the frame on which the menu was invoked.
  11939. */
  11940. frameCharset: string;
  11941. /**
  11942. * If the context menu was invoked on an input field, the type of that field.
  11943. * Possible values are `none`, `plainText`, `password`, `other`.
  11944. */
  11945. inputFieldType: string;
  11946. /**
  11947. * If the context is editable, whether or not spellchecking is enabled.
  11948. */
  11949. spellcheckEnabled: boolean;
  11950. /**
  11951. * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
  11952. * `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`,
  11953. * `adjustSelection`, or `adjustSelectionReset`.
  11954. */
  11955. menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset');
  11956. /**
  11957. * The flags for the media element the context menu was invoked on.
  11958. */
  11959. mediaFlags: MediaFlags;
  11960. /**
  11961. * These flags indicate whether the renderer believes it is able to perform the
  11962. * corresponding action.
  11963. */
  11964. editFlags: EditFlags;
  11965. }
  11966. interface CookiesGetFilter {
  11967. /**
  11968. * Retrieves cookies which are associated with `url`. Empty implies retrieving
  11969. * cookies of all URLs.
  11970. */
  11971. url?: string;
  11972. /**
  11973. * Filters cookies by name.
  11974. */
  11975. name?: string;
  11976. /**
  11977. * Retrieves cookies whose domains match or are subdomains of `domains`.
  11978. */
  11979. domain?: string;
  11980. /**
  11981. * Retrieves cookies whose path matches `path`.
  11982. */
  11983. path?: string;
  11984. /**
  11985. * Filters cookies by their Secure property.
  11986. */
  11987. secure?: boolean;
  11988. /**
  11989. * Filters out session or persistent cookies.
  11990. */
  11991. session?: boolean;
  11992. }
  11993. interface CookiesSetDetails {
  11994. /**
  11995. * The URL to associate the cookie with. The promise will be rejected if the URL is
  11996. * invalid.
  11997. */
  11998. url: string;
  11999. /**
  12000. * The name of the cookie. Empty by default if omitted.
  12001. */
  12002. name?: string;
  12003. /**
  12004. * The value of the cookie. Empty by default if omitted.
  12005. */
  12006. value?: string;
  12007. /**
  12008. * The domain of the cookie; this will be normalized with a preceding dot so that
  12009. * it's also valid for subdomains. Empty by default if omitted.
  12010. */
  12011. domain?: string;
  12012. /**
  12013. * The path of the cookie. Empty by default if omitted.
  12014. */
  12015. path?: string;
  12016. /**
  12017. * Whether the cookie should be marked as Secure. Defaults to false.
  12018. */
  12019. secure?: boolean;
  12020. /**
  12021. * Whether the cookie should be marked as HTTP only. Defaults to false.
  12022. */
  12023. httpOnly?: boolean;
  12024. /**
  12025. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  12026. * If omitted then the cookie becomes a session cookie and will not be retained
  12027. * between sessions.
  12028. */
  12029. expirationDate?: number;
  12030. /**
  12031. * The Same Site policy to apply to this cookie. Can be `unspecified`,
  12032. * `no_restriction`, `lax` or `strict`. Default is `no_restriction`.
  12033. */
  12034. sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  12035. }
  12036. interface CrashReporterStartOptions {
  12037. /**
  12038. * URL that crash reports will be sent to as POST. Required unless `uploadToServer`
  12039. * is `false`.
  12040. */
  12041. submitURL?: string;
  12042. /**
  12043. * Defaults to `app.name`.
  12044. */
  12045. productName?: string;
  12046. /**
  12047. * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
  12048. *
  12049. * @deprecated
  12050. */
  12051. companyName?: string;
  12052. /**
  12053. * Whether crash reports should be sent to the server. If false, crash reports will
  12054. * be collected and stored in the crashes directory, but not uploaded. Default is
  12055. * `true`.
  12056. */
  12057. uploadToServer?: boolean;
  12058. /**
  12059. * If true, crashes generated in the main process will not be forwarded to the
  12060. * system crash handler. Default is `false`.
  12061. */
  12062. ignoreSystemCrashHandler?: boolean;
  12063. /**
  12064. * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
  12065. *
  12066. * @platform darwin,win32
  12067. */
  12068. rateLimit?: boolean;
  12069. /**
  12070. * If true, crash reports will be compressed and uploaded with `Content-Encoding:
  12071. * gzip`. Default is `true`.
  12072. */
  12073. compress?: boolean;
  12074. /**
  12075. * Extra string key/value annotations that will be sent along with crash reports
  12076. * that are generated in the main process. Only string values are supported.
  12077. * Crashes generated in child processes will not contain these extra parameters to
  12078. * crash reports generated from child processes, call `addExtraParameter` from the
  12079. * child process.
  12080. */
  12081. extra?: Record<string, string>;
  12082. /**
  12083. * Extra string key/value annotations that will be sent along with any crash
  12084. * reports generated in any process. These annotations cannot be changed once the
  12085. * crash reporter has been started. If a key is present in both the global extra
  12086. * parameters and the process-specific extra parameters, then the global one will
  12087. * take precedence. By default, `productName` and the app version are included, as
  12088. * well as the Electron version.
  12089. */
  12090. globalExtra?: Record<string, string>;
  12091. }
  12092. interface CreateFromBitmapOptions {
  12093. width: number;
  12094. height: number;
  12095. /**
  12096. * Defaults to 1.0.
  12097. */
  12098. scaleFactor?: number;
  12099. }
  12100. interface CreateFromBufferOptions {
  12101. /**
  12102. * Required for bitmap buffers.
  12103. */
  12104. width?: number;
  12105. /**
  12106. * Required for bitmap buffers.
  12107. */
  12108. height?: number;
  12109. /**
  12110. * Defaults to 1.0.
  12111. */
  12112. scaleFactor?: number;
  12113. }
  12114. interface CreateInterruptedDownloadOptions {
  12115. /**
  12116. * Absolute path of the download.
  12117. */
  12118. path: string;
  12119. /**
  12120. * Complete URL chain for the download.
  12121. */
  12122. urlChain: string[];
  12123. mimeType?: string;
  12124. /**
  12125. * Start range for the download.
  12126. */
  12127. offset: number;
  12128. /**
  12129. * Total length of the download.
  12130. */
  12131. length: number;
  12132. /**
  12133. * Last-Modified header value.
  12134. */
  12135. lastModified?: string;
  12136. /**
  12137. * ETag header value.
  12138. */
  12139. eTag?: string;
  12140. /**
  12141. * Time when download was started in number of seconds since UNIX epoch.
  12142. */
  12143. startTime?: number;
  12144. }
  12145. interface Data {
  12146. text?: string;
  12147. html?: string;
  12148. image?: NativeImage;
  12149. rtf?: string;
  12150. /**
  12151. * The title of the URL at `text`.
  12152. */
  12153. bookmark?: string;
  12154. }
  12155. interface Details {
  12156. /**
  12157. * Process type. One of the following values:
  12158. */
  12159. type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  12160. /**
  12161. * The reason the child process is gone. Possible values:
  12162. */
  12163. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  12164. /**
  12165. * The exit code for the process (e.g. status from waitpid if on posix, from
  12166. * GetExitCodeProcess on Windows).
  12167. */
  12168. exitCode: number;
  12169. /**
  12170. * The non-localized name of the process.
  12171. */
  12172. serviceName?: string;
  12173. /**
  12174. * The name of the process. Examples for utility: `Audio Service`, `Content
  12175. * Decryption Module Service`, `Network Service`, `Video Capture`, etc.
  12176. */
  12177. name?: string;
  12178. }
  12179. interface DidChangeThemeColorEvent extends Event {
  12180. themeColor: string;
  12181. }
  12182. interface DidCreateWindowDetails {
  12183. /**
  12184. * URL for the created window.
  12185. */
  12186. url: string;
  12187. /**
  12188. * Name given to the created window in the `window.open()` call.
  12189. */
  12190. frameName: string;
  12191. /**
  12192. * The options used to create the BrowserWindow. They are merged in increasing
  12193. * precedence: options inherited from the parent, parsed options from the
  12194. * `features` string from `window.open()`, and options given by
  12195. * `webContents.setWindowOpenHandler`. Unrecognized options are not filtered out.
  12196. */
  12197. options: BrowserWindowConstructorOptions;
  12198. /**
  12199. * The non-standard features (features not handled Chromium or Electron)
  12200. * _Deprecated_
  12201. */
  12202. additionalFeatures: string[];
  12203. /**
  12204. * The referrer that will be passed to the new window. May or may not result in the
  12205. * `Referer` header being sent, depending on the referrer policy.
  12206. */
  12207. referrer: Referrer;
  12208. /**
  12209. * The post data that will be sent to the new window, along with the appropriate
  12210. * headers that will be set. If no post data is to be sent, the value will be
  12211. * `null`. Only defined when the window is being created by a form that set
  12212. * `target=_blank`.
  12213. */
  12214. postBody?: PostBody;
  12215. /**
  12216. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  12217. * `save-to-disk` and `other`.
  12218. */
  12219. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  12220. }
  12221. interface DidFailLoadEvent extends Event {
  12222. errorCode: number;
  12223. errorDescription: string;
  12224. validatedURL: string;
  12225. isMainFrame: boolean;
  12226. }
  12227. interface DidFrameFinishLoadEvent extends Event {
  12228. isMainFrame: boolean;
  12229. }
  12230. interface DidNavigateEvent extends Event {
  12231. url: string;
  12232. }
  12233. interface DidNavigateInPageEvent extends Event {
  12234. isMainFrame: boolean;
  12235. url: string;
  12236. }
  12237. interface DisplayBalloonOptions {
  12238. /**
  12239. * Icon to use when `iconType` is `custom`.
  12240. */
  12241. icon?: (NativeImage) | (string);
  12242. /**
  12243. * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
  12244. */
  12245. iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
  12246. title: string;
  12247. content: string;
  12248. /**
  12249. * The large version of the icon should be used. Default is `true`. Maps to
  12250. * `NIIF_LARGE_ICON`.
  12251. */
  12252. largeIcon?: boolean;
  12253. /**
  12254. * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
  12255. */
  12256. noSound?: boolean;
  12257. /**
  12258. * Do not display the balloon notification if the current user is in "quiet time".
  12259. * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
  12260. */
  12261. respectQuietTime?: boolean;
  12262. }
  12263. interface EnableNetworkEmulationOptions {
  12264. /**
  12265. * Whether to emulate network outage. Defaults to false.
  12266. */
  12267. offline?: boolean;
  12268. /**
  12269. * RTT in ms. Defaults to 0 which will disable latency throttling.
  12270. */
  12271. latency?: number;
  12272. /**
  12273. * Download rate in Bps. Defaults to 0 which will disable download throttling.
  12274. */
  12275. downloadThroughput?: number;
  12276. /**
  12277. * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
  12278. */
  12279. uploadThroughput?: number;
  12280. }
  12281. interface FeedURLOptions {
  12282. url: string;
  12283. /**
  12284. * HTTP request headers.
  12285. *
  12286. * @platform darwin
  12287. */
  12288. headers?: Record<string, string>;
  12289. /**
  12290. * Can be `json` or `default`, see the Squirrel.Mac README for more information.
  12291. *
  12292. * @platform darwin
  12293. */
  12294. serverType?: ('json' | 'default');
  12295. }
  12296. interface FileIconOptions {
  12297. size: ('small' | 'normal' | 'large');
  12298. }
  12299. interface Filter {
  12300. /**
  12301. * Array of URL patterns that will be used to filter out the requests that do not
  12302. * match the URL patterns.
  12303. */
  12304. urls: string[];
  12305. }
  12306. interface FindInPageOptions {
  12307. /**
  12308. * Whether to search forward or backward, defaults to `true`.
  12309. */
  12310. forward?: boolean;
  12311. /**
  12312. * Whether to begin a new text finding session with this request. Should be `true`
  12313. * for initial requests, and `false` for follow-up requests. Defaults to `false`.
  12314. */
  12315. findNext?: boolean;
  12316. /**
  12317. * Whether search should be case-sensitive, defaults to `false`.
  12318. */
  12319. matchCase?: boolean;
  12320. }
  12321. interface FocusOptions {
  12322. /**
  12323. * Make the receiver the active app even if another app is currently active.
  12324. *
  12325. * @platform darwin
  12326. */
  12327. steal: boolean;
  12328. }
  12329. interface FoundInPageEvent extends Event {
  12330. result: FoundInPageResult;
  12331. }
  12332. interface FromPartitionOptions {
  12333. /**
  12334. * Whether to enable cache.
  12335. */
  12336. cache: boolean;
  12337. }
  12338. interface HandlerDetails {
  12339. /**
  12340. * The _resolved_ version of the URL passed to `window.open()`. e.g. opening a
  12341. * window with `window.open('foo')` will yield something like
  12342. * `https://the-origin/the/current/path/foo`.
  12343. */
  12344. url: string;
  12345. /**
  12346. * Name of the window provided in `window.open()`
  12347. */
  12348. frameName: string;
  12349. /**
  12350. * Comma separated list of window features provided to `window.open()`.
  12351. */
  12352. features: string;
  12353. /**
  12354. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  12355. * `save-to-disk` or `other`.
  12356. */
  12357. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  12358. /**
  12359. * The referrer that will be passed to the new window. May or may not result in the
  12360. * `Referer` header being sent, depending on the referrer policy.
  12361. */
  12362. referrer: Referrer;
  12363. /**
  12364. * The post data that will be sent to the new window, along with the appropriate
  12365. * headers that will be set. If no post data is to be sent, the value will be
  12366. * `null`. Only defined when the window is being created by a form that set
  12367. * `target=_blank`.
  12368. */
  12369. postBody?: PostBody;
  12370. }
  12371. interface HeadersReceivedResponse {
  12372. cancel?: boolean;
  12373. /**
  12374. * When provided, the server is assumed to have responded with these headers.
  12375. */
  12376. responseHeaders?: Record<string, (string) | (string[])>;
  12377. /**
  12378. * Should be provided when overriding `responseHeaders` to change header status
  12379. * otherwise original response header's status will be used.
  12380. */
  12381. statusLine?: string;
  12382. }
  12383. interface HeapStatistics {
  12384. totalHeapSize: number;
  12385. totalHeapSizeExecutable: number;
  12386. totalPhysicalSize: number;
  12387. totalAvailableSize: number;
  12388. usedHeapSize: number;
  12389. heapSizeLimit: number;
  12390. mallocedMemory: number;
  12391. peakMallocedMemory: number;
  12392. doesZapGarbage: boolean;
  12393. }
  12394. interface IgnoreMouseEventsOptions {
  12395. /**
  12396. * If true, forwards mouse move messages to Chromium, enabling mouse related events
  12397. * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
  12398. * forwarding is always disabled regardless of this value.
  12399. *
  12400. * @platform darwin,win32
  12401. */
  12402. forward?: boolean;
  12403. }
  12404. interface ImportCertificateOptions {
  12405. /**
  12406. * Path for the pkcs12 file.
  12407. */
  12408. certificate: string;
  12409. /**
  12410. * Passphrase for the certificate.
  12411. */
  12412. password: string;
  12413. }
  12414. interface Info {
  12415. /**
  12416. * Security origin for the isolated world.
  12417. */
  12418. securityOrigin?: string;
  12419. /**
  12420. * Content Security Policy for the isolated world.
  12421. */
  12422. csp?: string;
  12423. /**
  12424. * Name for isolated world. Useful in devtools.
  12425. */
  12426. name?: string;
  12427. }
  12428. interface Input {
  12429. /**
  12430. * Either `keyUp` or `keyDown`.
  12431. */
  12432. type: string;
  12433. /**
  12434. * Equivalent to KeyboardEvent.key.
  12435. */
  12436. key: string;
  12437. /**
  12438. * Equivalent to KeyboardEvent.code.
  12439. */
  12440. code: string;
  12441. /**
  12442. * Equivalent to KeyboardEvent.repeat.
  12443. */
  12444. isAutoRepeat: boolean;
  12445. /**
  12446. * Equivalent to KeyboardEvent.isComposing.
  12447. */
  12448. isComposing: boolean;
  12449. /**
  12450. * Equivalent to KeyboardEvent.shiftKey.
  12451. */
  12452. shift: boolean;
  12453. /**
  12454. * Equivalent to KeyboardEvent.controlKey.
  12455. */
  12456. control: boolean;
  12457. /**
  12458. * Equivalent to KeyboardEvent.altKey.
  12459. */
  12460. alt: boolean;
  12461. /**
  12462. * Equivalent to KeyboardEvent.metaKey.
  12463. */
  12464. meta: boolean;
  12465. }
  12466. interface InsertCSSOptions {
  12467. /**
  12468. * Can be either 'user' or 'author'; Specifying 'user' enables you to prevent
  12469. * websites from overriding the CSS you insert. Default is 'author'.
  12470. */
  12471. cssOrigin?: string;
  12472. }
  12473. interface IpcMessageEvent extends Event {
  12474. channel: string;
  12475. args: any[];
  12476. }
  12477. interface Item {
  12478. /**
  12479. * The path(s) to the file(s) being dragged.
  12480. */
  12481. file: (string[]) | (string);
  12482. /**
  12483. * The image must be non-empty on macOS.
  12484. */
  12485. icon: (NativeImage) | (string);
  12486. }
  12487. interface JumpListSettings {
  12488. /**
  12489. * The minimum number of items that will be shown in the Jump List (for a more
  12490. * detailed description of this value see the MSDN docs).
  12491. */
  12492. minItems: number;
  12493. /**
  12494. * Array of `JumpListItem` objects that correspond to items that the user has
  12495. * explicitly removed from custom categories in the Jump List. These items must not
  12496. * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
  12497. * Windows will not display any custom category that contains any of the removed
  12498. * items.
  12499. */
  12500. removedItems: JumpListItem[];
  12501. }
  12502. interface LoadCommitEvent extends Event {
  12503. url: string;
  12504. isMainFrame: boolean;
  12505. }
  12506. interface LoadExtensionOptions {
  12507. /**
  12508. * Whether to allow the extension to read local files over `file://` protocol and
  12509. * inject content scripts into `file://` pages. This is required e.g. for loading
  12510. * devtools extensions on `file://` URLs. Defaults to false.
  12511. */
  12512. allowFileAccess: boolean;
  12513. }
  12514. interface LoadFileOptions {
  12515. /**
  12516. * Passed to `url.format()`.
  12517. */
  12518. query?: Record<string, string>;
  12519. /**
  12520. * Passed to `url.format()`.
  12521. */
  12522. search?: string;
  12523. /**
  12524. * Passed to `url.format()`.
  12525. */
  12526. hash?: string;
  12527. }
  12528. interface LoadURLOptions {
  12529. /**
  12530. * An HTTP Referrer url.
  12531. */
  12532. httpReferrer?: (string) | (Referrer);
  12533. /**
  12534. * A user agent originating the request.
  12535. */
  12536. userAgent?: string;
  12537. /**
  12538. * Extra headers separated by "\n"
  12539. */
  12540. extraHeaders?: string;
  12541. postData?: Array<(UploadRawData) | (UploadFile)>;
  12542. /**
  12543. * Base url (with trailing path separator) for files to be loaded by the data url.
  12544. * This is needed only if the specified `url` is a data url and needs to load other
  12545. * files.
  12546. */
  12547. baseURLForDataURL?: string;
  12548. }
  12549. interface LoginItemSettings {
  12550. /**
  12551. * `true` if the app is set to open at login.
  12552. */
  12553. openAtLogin: boolean;
  12554. /**
  12555. * `true` if the app is set to open as hidden at login. This setting is not
  12556. * available on MAS builds.
  12557. *
  12558. * @platform darwin
  12559. */
  12560. openAsHidden: boolean;
  12561. /**
  12562. * `true` if the app was opened at login automatically. This setting is not
  12563. * available on MAS builds.
  12564. *
  12565. * @platform darwin
  12566. */
  12567. wasOpenedAtLogin: boolean;
  12568. /**
  12569. * `true` if the app was opened as a hidden login item. This indicates that the app
  12570. * should not open any windows at startup. This setting is not available on MAS
  12571. * builds.
  12572. *
  12573. * @platform darwin
  12574. */
  12575. wasOpenedAsHidden: boolean;
  12576. /**
  12577. * `true` if the app was opened as a login item that should restore the state from
  12578. * the previous session. This indicates that the app should restore the windows
  12579. * that were open the last time the app was closed. This setting is not available
  12580. * on MAS builds.
  12581. *
  12582. * @platform darwin
  12583. */
  12584. restoreState: boolean;
  12585. /**
  12586. * `true` if app is set to open at login and its run key is not deactivated. This
  12587. * differs from `openAtLogin` as it ignores the `args` option, this property will
  12588. * be true if the given executable would be launched at login with **any**
  12589. * arguments.
  12590. *
  12591. * @platform win32
  12592. */
  12593. executableWillLaunchAtLogin: boolean;
  12594. launchItems: LaunchItems[];
  12595. }
  12596. interface LoginItemSettingsOptions {
  12597. /**
  12598. * The executable path to compare against. Defaults to `process.execPath`.
  12599. *
  12600. * @platform win32
  12601. */
  12602. path?: string;
  12603. /**
  12604. * The command-line arguments to compare against. Defaults to an empty array.
  12605. *
  12606. * @platform win32
  12607. */
  12608. args?: string[];
  12609. }
  12610. interface MenuItemConstructorOptions {
  12611. /**
  12612. * Will be called with `click(menuItem, browserWindow, event)` when the menu item
  12613. * is clicked.
  12614. */
  12615. click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
  12616. /**
  12617. * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
  12618. * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
  12619. * `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`,
  12620. * `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
  12621. * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
  12622. * `shareMenu`, `recentDocuments`, `toggleTabBar`, `selectNextTab`,
  12623. * `selectPreviousTab`, `mergeAllWindows`, `clearRecentDocuments`,
  12624. * `moveTabToNewWindow` or `windowMenu` - Define the action of the menu item, when
  12625. * specified the `click` property will be ignored. See roles.
  12626. */
  12627. role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'shareMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
  12628. /**
  12629. * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
  12630. */
  12631. type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  12632. label?: string;
  12633. sublabel?: string;
  12634. /**
  12635. * Hover text for this menu item.
  12636. *
  12637. * @platform darwin
  12638. */
  12639. toolTip?: string;
  12640. accelerator?: Accelerator;
  12641. icon?: (NativeImage) | (string);
  12642. /**
  12643. * If false, the menu item will be greyed out and unclickable.
  12644. */
  12645. enabled?: boolean;
  12646. /**
  12647. * default is `true`, and when `false` will prevent the accelerator from triggering
  12648. * the item if the item is not visible`.
  12649. *
  12650. * @platform darwin
  12651. */
  12652. acceleratorWorksWhenHidden?: boolean;
  12653. /**
  12654. * If false, the menu item will be entirely hidden.
  12655. */
  12656. visible?: boolean;
  12657. /**
  12658. * Should only be specified for `checkbox` or `radio` type menu items.
  12659. */
  12660. checked?: boolean;
  12661. /**
  12662. * If false, the accelerator won't be registered with the system, but it will still
  12663. * be displayed. Defaults to true.
  12664. *
  12665. * @platform linux,win32
  12666. */
  12667. registerAccelerator?: boolean;
  12668. /**
  12669. * The item to share when the `role` is `shareMenu`.
  12670. *
  12671. * @platform darwin
  12672. */
  12673. sharingItem?: SharingItem;
  12674. /**
  12675. * Should be specified for `submenu` type menu items. If `submenu` is specified,
  12676. * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
  12677. * be automatically converted to one using `Menu.buildFromTemplate`.
  12678. */
  12679. submenu?: (MenuItemConstructorOptions[]) | (Menu);
  12680. /**
  12681. * Unique within a single menu. If defined then it can be used as a reference to
  12682. * this item by the position attribute.
  12683. */
  12684. id?: string;
  12685. /**
  12686. * Inserts this item before the item with the specified label. If the referenced
  12687. * item doesn't exist the item will be inserted at the end of the menu. Also
  12688. * implies that the menu item in question should be placed in the same “group” as
  12689. * the item.
  12690. */
  12691. before?: string[];
  12692. /**
  12693. * Inserts this item after the item with the specified label. If the referenced
  12694. * item doesn't exist the item will be inserted at the end of the menu.
  12695. */
  12696. after?: string[];
  12697. /**
  12698. * Provides a means for a single context menu to declare the placement of their
  12699. * containing group before the containing group of the item with the specified
  12700. * label.
  12701. */
  12702. beforeGroupContaining?: string[];
  12703. /**
  12704. * Provides a means for a single context menu to declare the placement of their
  12705. * containing group after the containing group of the item with the specified
  12706. * label.
  12707. */
  12708. afterGroupContaining?: string[];
  12709. }
  12710. interface MessageBoxOptions {
  12711. /**
  12712. * Content of the message box.
  12713. */
  12714. message: string;
  12715. /**
  12716. * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
  12717. * `"question"` displays the same icon as `"info"`, unless you set an icon using
  12718. * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
  12719. * warning icon.
  12720. */
  12721. type?: string;
  12722. /**
  12723. * Array of texts for buttons. On Windows, an empty array will result in one button
  12724. * labeled "OK".
  12725. */
  12726. buttons?: string[];
  12727. /**
  12728. * Index of the button in the buttons array which will be selected by default when
  12729. * the message box opens.
  12730. */
  12731. defaultId?: number;
  12732. /**
  12733. * Title of the message box, some platforms will not show it.
  12734. */
  12735. title?: string;
  12736. /**
  12737. * Extra information of the message.
  12738. */
  12739. detail?: string;
  12740. /**
  12741. * If provided, the message box will include a checkbox with the given label.
  12742. */
  12743. checkboxLabel?: string;
  12744. /**
  12745. * Initial checked state of the checkbox. `false` by default.
  12746. */
  12747. checkboxChecked?: boolean;
  12748. icon?: NativeImage;
  12749. /**
  12750. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  12751. * default this is assigned to the first button with "cancel" or "no" as the label.
  12752. * If no such labeled buttons exist and this option is not set, `0` will be used as
  12753. * the return value.
  12754. */
  12755. cancelId?: number;
  12756. /**
  12757. * On Windows Electron will try to figure out which one of the `buttons` are common
  12758. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  12759. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  12760. * you don't like this behavior, you can set `noLink` to `true`.
  12761. */
  12762. noLink?: boolean;
  12763. /**
  12764. * Normalize the keyboard access keys across platforms. Default is `false`.
  12765. * Enabling this assumes `&` is used in the button labels for the placement of the
  12766. * keyboard shortcut access key and labels will be converted so they work correctly
  12767. * on each platform, `&` characters are removed on macOS, converted to `_` on
  12768. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  12769. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  12770. * via `Alt-W` on Windows and Linux.
  12771. */
  12772. normalizeAccessKeys?: boolean;
  12773. }
  12774. interface MessageBoxReturnValue {
  12775. /**
  12776. * The index of the clicked button.
  12777. */
  12778. response: number;
  12779. /**
  12780. * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
  12781. */
  12782. checkboxChecked: boolean;
  12783. }
  12784. interface MessageBoxSyncOptions {
  12785. /**
  12786. * Content of the message box.
  12787. */
  12788. message: string;
  12789. /**
  12790. * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
  12791. * `"question"` displays the same icon as `"info"`, unless you set an icon using
  12792. * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
  12793. * warning icon.
  12794. */
  12795. type?: string;
  12796. /**
  12797. * Array of texts for buttons. On Windows, an empty array will result in one button
  12798. * labeled "OK".
  12799. */
  12800. buttons?: string[];
  12801. /**
  12802. * Index of the button in the buttons array which will be selected by default when
  12803. * the message box opens.
  12804. */
  12805. defaultId?: number;
  12806. /**
  12807. * Title of the message box, some platforms will not show it.
  12808. */
  12809. title?: string;
  12810. /**
  12811. * Extra information of the message.
  12812. */
  12813. detail?: string;
  12814. /**
  12815. * If provided, the message box will include a checkbox with the given label.
  12816. */
  12817. checkboxLabel?: string;
  12818. /**
  12819. * Initial checked state of the checkbox. `false` by default.
  12820. */
  12821. checkboxChecked?: boolean;
  12822. icon?: (NativeImage) | (string);
  12823. /**
  12824. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  12825. * default this is assigned to the first button with "cancel" or "no" as the label.
  12826. * If no such labeled buttons exist and this option is not set, `0` will be used as
  12827. * the return value.
  12828. */
  12829. cancelId?: number;
  12830. /**
  12831. * On Windows Electron will try to figure out which one of the `buttons` are common
  12832. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  12833. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  12834. * you don't like this behavior, you can set `noLink` to `true`.
  12835. */
  12836. noLink?: boolean;
  12837. /**
  12838. * Normalize the keyboard access keys across platforms. Default is `false`.
  12839. * Enabling this assumes `&` is used in the button labels for the placement of the
  12840. * keyboard shortcut access key and labels will be converted so they work correctly
  12841. * on each platform, `&` characters are removed on macOS, converted to `_` on
  12842. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  12843. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  12844. * via `Alt-W` on Windows and Linux.
  12845. */
  12846. normalizeAccessKeys?: boolean;
  12847. }
  12848. interface MessageDetails {
  12849. /**
  12850. * The actual console message
  12851. */
  12852. message: string;
  12853. /**
  12854. * The version ID of the service worker that sent the log message
  12855. */
  12856. versionId: number;
  12857. /**
  12858. * The type of source for this message. Can be `javascript`, `xml`, `network`,
  12859. * `console-api`, `storage`, `app-cache`, `rendering`, `security`, `deprecation`,
  12860. * `worker`, `violation`, `intervention`, `recommendation` or `other`.
  12861. */
  12862. source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'app-cache' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
  12863. /**
  12864. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  12865. * `error`.
  12866. */
  12867. level: number;
  12868. /**
  12869. * The URL the message came from
  12870. */
  12871. sourceUrl: string;
  12872. /**
  12873. * The line number of the source that triggered this console message
  12874. */
  12875. lineNumber: number;
  12876. }
  12877. interface MessageEvent {
  12878. data: any;
  12879. ports: MessagePortMain[];
  12880. }
  12881. interface MoveToApplicationsFolderOptions {
  12882. /**
  12883. * A handler for potential conflict in move failure.
  12884. */
  12885. conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
  12886. }
  12887. interface NewWindowEvent extends Event {
  12888. url: string;
  12889. frameName: string;
  12890. /**
  12891. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  12892. * `save-to-disk` and `other`.
  12893. */
  12894. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  12895. /**
  12896. * The options which should be used for creating the new `BrowserWindow`.
  12897. */
  12898. options: BrowserWindowConstructorOptions;
  12899. }
  12900. interface NotificationConstructorOptions {
  12901. /**
  12902. * A title for the notification, which will be shown at the top of the notification
  12903. * window when it is shown.
  12904. */
  12905. title?: string;
  12906. /**
  12907. * A subtitle for the notification, which will be displayed below the title.
  12908. *
  12909. * @platform darwin
  12910. */
  12911. subtitle?: string;
  12912. /**
  12913. * The body text of the notification, which will be displayed below the title or
  12914. * subtitle.
  12915. */
  12916. body?: string;
  12917. /**
  12918. * Whether or not to emit an OS notification noise when showing the notification.
  12919. */
  12920. silent?: boolean;
  12921. /**
  12922. * An icon to use in the notification.
  12923. */
  12924. icon?: (string) | (NativeImage);
  12925. /**
  12926. * Whether or not to add an inline reply option to the notification.
  12927. *
  12928. * @platform darwin
  12929. */
  12930. hasReply?: boolean;
  12931. /**
  12932. * The timeout duration of the notification. Can be 'default' or 'never'.
  12933. *
  12934. * @platform linux,win32
  12935. */
  12936. timeoutType?: ('default' | 'never');
  12937. /**
  12938. * The placeholder to write in the inline reply input field.
  12939. *
  12940. * @platform darwin
  12941. */
  12942. replyPlaceholder?: string;
  12943. /**
  12944. * The name of the sound file to play when the notification is shown.
  12945. *
  12946. * @platform darwin
  12947. */
  12948. sound?: string;
  12949. /**
  12950. * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
  12951. *
  12952. * @platform linux
  12953. */
  12954. urgency?: ('normal' | 'critical' | 'low');
  12955. /**
  12956. * Actions to add to the notification. Please read the available actions and
  12957. * limitations in the `NotificationAction` documentation.
  12958. *
  12959. * @platform darwin
  12960. */
  12961. actions?: NotificationAction[];
  12962. /**
  12963. * A custom title for the close button of an alert. An empty string will cause the
  12964. * default localized text to be used.
  12965. *
  12966. * @platform darwin
  12967. */
  12968. closeButtonText?: string;
  12969. /**
  12970. * A custom description of the Notification on Windows superseding all properties
  12971. * above. Provides full customization of design and behavior of the notification.
  12972. *
  12973. * @platform win32
  12974. */
  12975. toastXml?: string;
  12976. }
  12977. interface OnBeforeRedirectListenerDetails {
  12978. id: number;
  12979. url: string;
  12980. method: string;
  12981. webContentsId?: number;
  12982. webContents?: WebContents;
  12983. frame?: WebFrameMain;
  12984. resourceType: string;
  12985. referrer: string;
  12986. timestamp: number;
  12987. redirectURL: string;
  12988. statusCode: number;
  12989. statusLine: string;
  12990. /**
  12991. * The server IP address that the request was actually sent to.
  12992. */
  12993. ip?: string;
  12994. fromCache: boolean;
  12995. responseHeaders?: Record<string, string[]>;
  12996. }
  12997. interface OnBeforeRequestListenerDetails {
  12998. id: number;
  12999. url: string;
  13000. method: string;
  13001. webContentsId?: number;
  13002. webContents?: WebContents;
  13003. frame?: WebFrameMain;
  13004. resourceType: string;
  13005. referrer: string;
  13006. timestamp: number;
  13007. uploadData: UploadData[];
  13008. }
  13009. interface OnBeforeSendHeadersListenerDetails {
  13010. id: number;
  13011. url: string;
  13012. method: string;
  13013. webContentsId?: number;
  13014. webContents?: WebContents;
  13015. frame?: WebFrameMain;
  13016. resourceType: string;
  13017. referrer: string;
  13018. timestamp: number;
  13019. requestHeaders: Record<string, string>;
  13020. }
  13021. interface OnCompletedListenerDetails {
  13022. id: number;
  13023. url: string;
  13024. method: string;
  13025. webContentsId?: number;
  13026. webContents?: WebContents;
  13027. frame?: WebFrameMain;
  13028. resourceType: string;
  13029. referrer: string;
  13030. timestamp: number;
  13031. responseHeaders?: Record<string, string[]>;
  13032. fromCache: boolean;
  13033. statusCode: number;
  13034. statusLine: string;
  13035. error: string;
  13036. }
  13037. interface OnErrorOccurredListenerDetails {
  13038. id: number;
  13039. url: string;
  13040. method: string;
  13041. webContentsId?: number;
  13042. webContents?: WebContents;
  13043. frame?: WebFrameMain;
  13044. resourceType: string;
  13045. referrer: string;
  13046. timestamp: number;
  13047. fromCache: boolean;
  13048. /**
  13049. * The error description.
  13050. */
  13051. error: string;
  13052. }
  13053. interface OnHeadersReceivedListenerDetails {
  13054. id: number;
  13055. url: string;
  13056. method: string;
  13057. webContentsId?: number;
  13058. webContents?: WebContents;
  13059. frame?: WebFrameMain;
  13060. resourceType: string;
  13061. referrer: string;
  13062. timestamp: number;
  13063. statusLine: string;
  13064. statusCode: number;
  13065. requestHeaders: Record<string, string>;
  13066. responseHeaders?: Record<string, string[]>;
  13067. }
  13068. interface OnResponseStartedListenerDetails {
  13069. id: number;
  13070. url: string;
  13071. method: string;
  13072. webContentsId?: number;
  13073. webContents?: WebContents;
  13074. frame?: WebFrameMain;
  13075. resourceType: string;
  13076. referrer: string;
  13077. timestamp: number;
  13078. responseHeaders?: Record<string, string[]>;
  13079. /**
  13080. * Indicates whether the response was fetched from disk cache.
  13081. */
  13082. fromCache: boolean;
  13083. statusCode: number;
  13084. statusLine: string;
  13085. }
  13086. interface OnSendHeadersListenerDetails {
  13087. id: number;
  13088. url: string;
  13089. method: string;
  13090. webContentsId?: number;
  13091. webContents?: WebContents;
  13092. frame?: WebFrameMain;
  13093. resourceType: string;
  13094. referrer: string;
  13095. timestamp: number;
  13096. requestHeaders: Record<string, string>;
  13097. }
  13098. interface OpenDevToolsOptions {
  13099. /**
  13100. * Opens the devtools with specified dock state, can be `right`, `bottom`,
  13101. * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
  13102. * possible to dock back. In `detach` mode it's not.
  13103. */
  13104. mode: ('right' | 'bottom' | 'undocked' | 'detach');
  13105. /**
  13106. * Whether to bring the opened devtools window to the foreground. The default is
  13107. * `true`.
  13108. */
  13109. activate?: boolean;
  13110. }
  13111. interface OpenDialogOptions {
  13112. title?: string;
  13113. defaultPath?: string;
  13114. /**
  13115. * Custom label for the confirmation button, when left empty the default label will
  13116. * be used.
  13117. */
  13118. buttonLabel?: string;
  13119. filters?: FileFilter[];
  13120. /**
  13121. * Contains which features the dialog should use. The following values are
  13122. * supported:
  13123. */
  13124. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  13125. /**
  13126. * Message to display above input boxes.
  13127. *
  13128. * @platform darwin
  13129. */
  13130. message?: string;
  13131. /**
  13132. * Create security scoped bookmarks when packaged for the Mac App Store.
  13133. *
  13134. * @platform darwin,mas
  13135. */
  13136. securityScopedBookmarks?: boolean;
  13137. }
  13138. interface OpenDialogReturnValue {
  13139. /**
  13140. * whether or not the dialog was canceled.
  13141. */
  13142. canceled: boolean;
  13143. /**
  13144. * An array of file paths chosen by the user. If the dialog is cancelled this will
  13145. * be an empty array.
  13146. */
  13147. filePaths: string[];
  13148. /**
  13149. * An array matching the `filePaths` array of base64 encoded strings which contains
  13150. * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
  13151. * this to be populated. (For return values, see table here.)
  13152. *
  13153. * @platform darwin,mas
  13154. */
  13155. bookmarks?: string[];
  13156. }
  13157. interface OpenDialogSyncOptions {
  13158. title?: string;
  13159. defaultPath?: string;
  13160. /**
  13161. * Custom label for the confirmation button, when left empty the default label will
  13162. * be used.
  13163. */
  13164. buttonLabel?: string;
  13165. filters?: FileFilter[];
  13166. /**
  13167. * Contains which features the dialog should use. The following values are
  13168. * supported:
  13169. */
  13170. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  13171. /**
  13172. * Message to display above input boxes.
  13173. *
  13174. * @platform darwin
  13175. */
  13176. message?: string;
  13177. /**
  13178. * Create security scoped bookmarks when packaged for the Mac App Store.
  13179. *
  13180. * @platform darwin,mas
  13181. */
  13182. securityScopedBookmarks?: boolean;
  13183. }
  13184. interface OpenExternalOptions {
  13185. /**
  13186. * `true` to bring the opened application to the foreground. The default is `true`.
  13187. *
  13188. * @platform darwin
  13189. */
  13190. activate?: boolean;
  13191. /**
  13192. * The working directory.
  13193. *
  13194. * @platform win32
  13195. */
  13196. workingDirectory?: string;
  13197. }
  13198. interface Options {
  13199. }
  13200. interface PageFaviconUpdatedEvent extends Event {
  13201. /**
  13202. * Array of URLs.
  13203. */
  13204. favicons: string[];
  13205. }
  13206. interface PageTitleUpdatedEvent extends Event {
  13207. title: string;
  13208. explicitSet: boolean;
  13209. }
  13210. interface Parameters {
  13211. /**
  13212. * Specify the screen type to emulate (default: `desktop`):
  13213. */
  13214. screenPosition: ('desktop' | 'mobile');
  13215. /**
  13216. * Set the emulated screen size (screenPosition == mobile).
  13217. */
  13218. screenSize: Size;
  13219. /**
  13220. * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
  13221. * 0 }`).
  13222. */
  13223. viewPosition: Point;
  13224. /**
  13225. * Set the device scale factor (if zero defaults to original device scale factor)
  13226. * (default: `0`).
  13227. */
  13228. deviceScaleFactor: number;
  13229. /**
  13230. * Set the emulated view size (empty means no override)
  13231. */
  13232. viewSize: Size;
  13233. /**
  13234. * Scale of emulated view inside available space (not in fit to view mode)
  13235. * (default: `1`).
  13236. */
  13237. scale: number;
  13238. }
  13239. interface Payment {
  13240. /**
  13241. * The identifier of the purchased product.
  13242. */
  13243. productIdentifier: string;
  13244. /**
  13245. * The quantity purchased.
  13246. */
  13247. quantity: number;
  13248. }
  13249. interface PermissionCheckHandlerHandlerDetails {
  13250. /**
  13251. * The origin of the frame embedding the frame that made the permission check.
  13252. * Only set for cross-origin sub frames making permission checks.
  13253. */
  13254. embeddingOrigin?: string;
  13255. /**
  13256. * The security origin of the `media` check.
  13257. */
  13258. securityOrigin?: string;
  13259. /**
  13260. * The type of media access being requested, can be `video`, `audio` or `unknown`
  13261. */
  13262. mediaType?: ('video' | 'audio' | 'unknown');
  13263. /**
  13264. * The last URL the requesting frame loaded. This is not provided for cross-origin
  13265. * sub frames making permission checks.
  13266. */
  13267. requestingUrl?: string;
  13268. /**
  13269. * Whether the frame making the request is the main frame
  13270. */
  13271. isMainFrame: boolean;
  13272. }
  13273. interface PermissionRequestHandlerHandlerDetails {
  13274. /**
  13275. * The url of the `openExternal` request.
  13276. */
  13277. externalURL?: string;
  13278. /**
  13279. * The types of media access being requested, elements can be `video` or `audio`
  13280. */
  13281. mediaTypes?: Array<'video' | 'audio'>;
  13282. /**
  13283. * The last URL the requesting frame loaded
  13284. */
  13285. requestingUrl: string;
  13286. /**
  13287. * Whether the frame making the request is the main frame
  13288. */
  13289. isMainFrame: boolean;
  13290. }
  13291. interface PluginCrashedEvent extends Event {
  13292. name: string;
  13293. version: string;
  13294. }
  13295. interface PopupOptions {
  13296. /**
  13297. * Default is the focused window.
  13298. */
  13299. window?: BrowserWindow;
  13300. /**
  13301. * Default is the current mouse cursor position. Must be declared if `y` is
  13302. * declared.
  13303. */
  13304. x?: number;
  13305. /**
  13306. * Default is the current mouse cursor position. Must be declared if `x` is
  13307. * declared.
  13308. */
  13309. y?: number;
  13310. /**
  13311. * The index of the menu item to be positioned under the mouse cursor at the
  13312. * specified coordinates. Default is -1.
  13313. *
  13314. * @platform darwin
  13315. */
  13316. positioningItem?: number;
  13317. /**
  13318. * Called when menu is closed.
  13319. */
  13320. callback?: () => void;
  13321. }
  13322. interface PreconnectOptions {
  13323. /**
  13324. * URL for preconnect. Only the origin is relevant for opening the socket.
  13325. */
  13326. url: string;
  13327. /**
  13328. * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
  13329. */
  13330. numSockets?: number;
  13331. }
  13332. interface PrintToPDFOptions {
  13333. /**
  13334. * the header and footer for the PDF.
  13335. */
  13336. headerFooter?: Record<string, string>;
  13337. /**
  13338. * `true` for landscape, `false` for portrait.
  13339. */
  13340. landscape?: boolean;
  13341. /**
  13342. * Specifies the type of margins to use. Uses 0 for default margin, 1 for no
  13343. * margin, and 2 for minimum margin. and `width` in microns.
  13344. */
  13345. marginsType?: number;
  13346. /**
  13347. * The scale factor of the web page. Can range from 0 to 100.
  13348. */
  13349. scaleFactor?: number;
  13350. /**
  13351. * The page range to print. On macOS, only the first range is honored.
  13352. */
  13353. pageRanges?: Record<string, number>;
  13354. /**
  13355. * Specify page size of the generated PDF. Can be `A3`, `A4`, `A5`, `Legal`,
  13356. * `Letter`, `Tabloid` or an Object containing `height`
  13357. */
  13358. pageSize?: (string) | (Size);
  13359. /**
  13360. * Whether to print CSS backgrounds.
  13361. */
  13362. printBackground?: boolean;
  13363. /**
  13364. * Whether to print selection only.
  13365. */
  13366. printSelectionOnly?: boolean;
  13367. }
  13368. interface Privileges {
  13369. /**
  13370. * Default false.
  13371. */
  13372. standard?: boolean;
  13373. /**
  13374. * Default false.
  13375. */
  13376. secure?: boolean;
  13377. /**
  13378. * Default false.
  13379. */
  13380. bypassCSP?: boolean;
  13381. /**
  13382. * Default false.
  13383. */
  13384. allowServiceWorkers?: boolean;
  13385. /**
  13386. * Default false.
  13387. */
  13388. supportFetchAPI?: boolean;
  13389. /**
  13390. * Default false.
  13391. */
  13392. corsEnabled?: boolean;
  13393. /**
  13394. * Default false.
  13395. */
  13396. stream?: boolean;
  13397. }
  13398. interface ProgressBarOptions {
  13399. /**
  13400. * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
  13401. * `paused`.
  13402. *
  13403. * @platform win32
  13404. */
  13405. mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
  13406. }
  13407. interface Provider {
  13408. spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
  13409. }
  13410. interface ReadBookmark {
  13411. title: string;
  13412. url: string;
  13413. }
  13414. interface RegistrationCompletedDetails {
  13415. /**
  13416. * The base URL that a service worker is registered for
  13417. */
  13418. scope: string;
  13419. }
  13420. interface RelaunchOptions {
  13421. args?: string[];
  13422. execPath?: string;
  13423. }
  13424. interface RenderProcessGoneDetails {
  13425. /**
  13426. * The reason the render process is gone. Possible values:
  13427. */
  13428. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  13429. /**
  13430. * The exit code of the process, unless `reason` is `launch-failed`, in which case
  13431. * `exitCode` will be a platform-specific launch failure error code.
  13432. */
  13433. exitCode: number;
  13434. }
  13435. interface Request {
  13436. hostname: string;
  13437. certificate: Certificate;
  13438. validatedCertificate: Certificate;
  13439. /**
  13440. * Verification result from chromium.
  13441. */
  13442. verificationResult: string;
  13443. /**
  13444. * Error code.
  13445. */
  13446. errorCode: number;
  13447. }
  13448. interface ResizeOptions {
  13449. /**
  13450. * Defaults to the image's width.
  13451. */
  13452. width?: number;
  13453. /**
  13454. * Defaults to the image's height.
  13455. */
  13456. height?: number;
  13457. /**
  13458. * The desired quality of the resize image. Possible values are `good`, `better`,
  13459. * or `best`. The default is `best`. These values express a desired quality/speed
  13460. * tradeoff. They are translated into an algorithm-specific method that depends on
  13461. * the capabilities (CPU, GPU) of the underlying platform. It is possible for all
  13462. * three methods to be mapped to the same algorithm on a given platform.
  13463. */
  13464. quality?: string;
  13465. }
  13466. interface ResourceUsage {
  13467. images: MemoryUsageDetails;
  13468. scripts: MemoryUsageDetails;
  13469. cssStyleSheets: MemoryUsageDetails;
  13470. xslStyleSheets: MemoryUsageDetails;
  13471. fonts: MemoryUsageDetails;
  13472. other: MemoryUsageDetails;
  13473. }
  13474. interface Response {
  13475. cancel?: boolean;
  13476. /**
  13477. * The original request is prevented from being sent or completed and is instead
  13478. * redirected to the given URL.
  13479. */
  13480. redirectURL?: string;
  13481. }
  13482. interface Result {
  13483. requestId: number;
  13484. /**
  13485. * Position of the active match.
  13486. */
  13487. activeMatchOrdinal: number;
  13488. /**
  13489. * Number of Matches.
  13490. */
  13491. matches: number;
  13492. /**
  13493. * Coordinates of first match region.
  13494. */
  13495. selectionArea: Rectangle;
  13496. finalUpdate: boolean;
  13497. }
  13498. interface SaveDialogOptions {
  13499. /**
  13500. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  13501. */
  13502. title?: string;
  13503. /**
  13504. * Absolute directory path, absolute file path, or file name to use by default.
  13505. */
  13506. defaultPath?: string;
  13507. /**
  13508. * Custom label for the confirmation button, when left empty the default label will
  13509. * be used.
  13510. */
  13511. buttonLabel?: string;
  13512. filters?: FileFilter[];
  13513. /**
  13514. * Message to display above text fields.
  13515. *
  13516. * @platform darwin
  13517. */
  13518. message?: string;
  13519. /**
  13520. * Custom label for the text displayed in front of the filename text field.
  13521. *
  13522. * @platform darwin
  13523. */
  13524. nameFieldLabel?: string;
  13525. /**
  13526. * Show the tags input box, defaults to `true`.
  13527. *
  13528. * @platform darwin
  13529. */
  13530. showsTagField?: boolean;
  13531. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  13532. /**
  13533. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  13534. * option is enabled and the file doesn't already exist a blank file will be
  13535. * created at the chosen path.
  13536. *
  13537. * @platform darwin,mas
  13538. */
  13539. securityScopedBookmarks?: boolean;
  13540. }
  13541. interface SaveDialogReturnValue {
  13542. /**
  13543. * whether or not the dialog was canceled.
  13544. */
  13545. canceled: boolean;
  13546. /**
  13547. * If the dialog is canceled, this will be `undefined`.
  13548. */
  13549. filePath?: string;
  13550. /**
  13551. * Base64 encoded string which contains the security scoped bookmark data for the
  13552. * saved file. `securityScopedBookmarks` must be enabled for this to be present.
  13553. * (For return values, see table here.)
  13554. *
  13555. * @platform darwin,mas
  13556. */
  13557. bookmark?: string;
  13558. }
  13559. interface SaveDialogSyncOptions {
  13560. /**
  13561. * The dialog title. Cannot be displayed on some _Linux_ desktop environments.
  13562. */
  13563. title?: string;
  13564. /**
  13565. * Absolute directory path, absolute file path, or file name to use by default.
  13566. */
  13567. defaultPath?: string;
  13568. /**
  13569. * Custom label for the confirmation button, when left empty the default label will
  13570. * be used.
  13571. */
  13572. buttonLabel?: string;
  13573. filters?: FileFilter[];
  13574. /**
  13575. * Message to display above text fields.
  13576. *
  13577. * @platform darwin
  13578. */
  13579. message?: string;
  13580. /**
  13581. * Custom label for the text displayed in front of the filename text field.
  13582. *
  13583. * @platform darwin
  13584. */
  13585. nameFieldLabel?: string;
  13586. /**
  13587. * Show the tags input box, defaults to `true`.
  13588. *
  13589. * @platform darwin
  13590. */
  13591. showsTagField?: boolean;
  13592. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  13593. /**
  13594. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  13595. * option is enabled and the file doesn't already exist a blank file will be
  13596. * created at the chosen path.
  13597. *
  13598. * @platform darwin,mas
  13599. */
  13600. securityScopedBookmarks?: boolean;
  13601. }
  13602. interface Settings {
  13603. /**
  13604. * `true` to open the app at login, `false` to remove the app as a login item.
  13605. * Defaults to `false`.
  13606. */
  13607. openAtLogin?: boolean;
  13608. /**
  13609. * `true` to open the app as hidden. Defaults to `false`. The user can edit this
  13610. * setting from the System Preferences so
  13611. * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
  13612. * opened to know the current value. This setting is not available on MAS builds.
  13613. *
  13614. * @platform darwin
  13615. */
  13616. openAsHidden?: boolean;
  13617. /**
  13618. * The executable to launch at login. Defaults to `process.execPath`.
  13619. *
  13620. * @platform win32
  13621. */
  13622. path?: string;
  13623. /**
  13624. * The command-line arguments to pass to the executable. Defaults to an empty
  13625. * array. Take care to wrap paths in quotes.
  13626. *
  13627. * @platform win32
  13628. */
  13629. args?: string[];
  13630. /**
  13631. * `true` will change the startup approved registry key and `enable / disable` the
  13632. * App in Task Manager and Windows Settings. Defaults to `true`.
  13633. *
  13634. * @platform win32
  13635. */
  13636. enabled?: boolean;
  13637. /**
  13638. * value name to write into registry. Defaults to the app's AppUserModelId(). Set
  13639. * the app's login item settings.
  13640. *
  13641. * @platform win32
  13642. */
  13643. name?: string;
  13644. }
  13645. interface SourcesOptions {
  13646. /**
  13647. * An array of Strings that lists the types of desktop sources to be captured,
  13648. * available types are `screen` and `window`.
  13649. */
  13650. types: string[];
  13651. /**
  13652. * The size that the media source thumbnail should be scaled to. Default is `150` x
  13653. * `150`. Set width or height to 0 when you do not need the thumbnails. This will
  13654. * save the processing time required for capturing the content of each window and
  13655. * screen.
  13656. */
  13657. thumbnailSize?: Size;
  13658. /**
  13659. * Set to true to enable fetching window icons. The default value is false. When
  13660. * false the appIcon property of the sources return null. Same if a source has the
  13661. * type screen.
  13662. */
  13663. fetchWindowIcons?: boolean;
  13664. }
  13665. interface SSLConfigConfig {
  13666. /**
  13667. * Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`. The minimum SSL version to allow
  13668. * when connecting to remote servers. Defaults to `tls1`.
  13669. */
  13670. minVersion?: string;
  13671. /**
  13672. * Can be `tls1.2` or `tls1.3`. The maximum SSL version to allow when connecting to
  13673. * remote servers. Defaults to `tls1.3`.
  13674. */
  13675. maxVersion?: string;
  13676. /**
  13677. * List of cipher suites which should be explicitly prevented from being used in
  13678. * addition to those disabled by the net built-in policy. Supported literal forms:
  13679. * 0xAABB, where AA is `cipher_suite[0]` and BB is `cipher_suite[1]`, as defined in
  13680. * RFC 2246, Section 7.4.1.2. Unrecognized but parsable cipher suites in this form
  13681. * will not return an error. Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify
  13682. * 0x0004, while to disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. Note
  13683. * that TLSv1.3 ciphers cannot be disabled using this mechanism.
  13684. */
  13685. disabledCipherSuites?: number[];
  13686. }
  13687. interface StartLoggingOptions {
  13688. /**
  13689. * What kinds of data should be captured. By default, only metadata about requests
  13690. * will be captured. Setting this to `includeSensitive` will include cookies and
  13691. * authentication data. Setting it to `everything` will include all bytes
  13692. * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
  13693. */
  13694. captureMode?: ('default' | 'includeSensitive' | 'everything');
  13695. /**
  13696. * When the log grows beyond this size, logging will automatically stop. Defaults
  13697. * to unlimited.
  13698. */
  13699. maxFileSize?: number;
  13700. }
  13701. interface SystemMemoryInfo {
  13702. /**
  13703. * The total amount of physical memory in Kilobytes available to the system.
  13704. */
  13705. total: number;
  13706. /**
  13707. * The total amount of memory not being used by applications or disk cache.
  13708. */
  13709. free: number;
  13710. /**
  13711. * The total amount of swap memory in Kilobytes available to the system.
  13712. *
  13713. * @platform win32,linux
  13714. */
  13715. swapTotal: number;
  13716. /**
  13717. * The free amount of swap memory in Kilobytes available to the system.
  13718. *
  13719. * @platform win32,linux
  13720. */
  13721. swapFree: number;
  13722. }
  13723. interface TitleOptions {
  13724. /**
  13725. * The font family variant to display, can be `monospaced` or `monospacedDigit`.
  13726. * `monospaced` is available in macOS 10.15+ and `monospacedDigit` is available in
  13727. * macOS 10.11+. When left blank, the title uses the default system font.
  13728. */
  13729. fontType?: ('monospaced' | 'monospacedDigit');
  13730. }
  13731. interface ToBitmapOptions {
  13732. /**
  13733. * Defaults to 1.0.
  13734. */
  13735. scaleFactor?: number;
  13736. }
  13737. interface ToDataURLOptions {
  13738. /**
  13739. * Defaults to 1.0.
  13740. */
  13741. scaleFactor?: number;
  13742. }
  13743. interface ToPNGOptions {
  13744. /**
  13745. * Defaults to 1.0.
  13746. */
  13747. scaleFactor?: number;
  13748. }
  13749. interface TouchBarButtonConstructorOptions {
  13750. /**
  13751. * Button text.
  13752. */
  13753. label?: string;
  13754. /**
  13755. * A short description of the button for use by screenreaders like VoiceOver.
  13756. */
  13757. accessibilityLabel?: string;
  13758. /**
  13759. * Button background color in hex format, i.e `#ABCDEF`.
  13760. */
  13761. backgroundColor?: string;
  13762. /**
  13763. * Button icon.
  13764. */
  13765. icon?: (NativeImage) | (string);
  13766. /**
  13767. * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
  13768. */
  13769. iconPosition?: ('left' | 'right' | 'overlay');
  13770. /**
  13771. * Function to call when the button is clicked.
  13772. */
  13773. click?: () => void;
  13774. /**
  13775. * Whether the button is in an enabled state. Default is `true`.
  13776. */
  13777. enabled?: boolean;
  13778. }
  13779. interface TouchBarColorPickerConstructorOptions {
  13780. /**
  13781. * Array of hex color strings to appear as possible colors to select.
  13782. */
  13783. availableColors?: string[];
  13784. /**
  13785. * The selected hex color in the picker, i.e `#ABCDEF`.
  13786. */
  13787. selectedColor?: string;
  13788. /**
  13789. * Function to call when a color is selected.
  13790. */
  13791. change?: (color: string) => void;
  13792. }
  13793. interface TouchBarConstructorOptions {
  13794. items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
  13795. escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
  13796. }
  13797. interface TouchBarGroupConstructorOptions {
  13798. /**
  13799. * Items to display as a group.
  13800. */
  13801. items: TouchBar;
  13802. }
  13803. interface TouchBarLabelConstructorOptions {
  13804. /**
  13805. * Text to display.
  13806. */
  13807. label?: string;
  13808. /**
  13809. * A short description of the button for use by screenreaders like VoiceOver.
  13810. */
  13811. accessibilityLabel?: string;
  13812. /**
  13813. * Hex color of text, i.e `#ABCDEF`.
  13814. */
  13815. textColor?: string;
  13816. }
  13817. interface TouchBarPopoverConstructorOptions {
  13818. /**
  13819. * Popover button text.
  13820. */
  13821. label?: string;
  13822. /**
  13823. * Popover button icon.
  13824. */
  13825. icon?: NativeImage;
  13826. /**
  13827. * Items to display in the popover.
  13828. */
  13829. items: TouchBar;
  13830. /**
  13831. * `true` to display a close button on the left of the popover, `false` to not show
  13832. * it. Default is `true`.
  13833. */
  13834. showCloseButton?: boolean;
  13835. }
  13836. interface TouchBarScrubberConstructorOptions {
  13837. /**
  13838. * An array of items to place in this scrubber.
  13839. */
  13840. items: ScrubberItem[];
  13841. /**
  13842. * Called when the user taps an item that was not the last tapped item.
  13843. */
  13844. select?: (selectedIndex: number) => void;
  13845. /**
  13846. * Called when the user taps any item.
  13847. */
  13848. highlight?: (highlightedIndex: number) => void;
  13849. /**
  13850. * Selected item style. Can be `background`, `outline` or `none`. Defaults to
  13851. * `none`.
  13852. */
  13853. selectedStyle?: ('background' | 'outline' | 'none');
  13854. /**
  13855. * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
  13856. * to `none`.
  13857. */
  13858. overlayStyle?: ('background' | 'outline' | 'none');
  13859. /**
  13860. * Defaults to `false`.
  13861. */
  13862. showArrowButtons?: boolean;
  13863. /**
  13864. * Can be `fixed` or `free`. The default is `free`.
  13865. */
  13866. mode?: ('fixed' | 'free');
  13867. /**
  13868. * Defaults to `true`.
  13869. */
  13870. continuous?: boolean;
  13871. }
  13872. interface TouchBarSegmentedControlConstructorOptions {
  13873. /**
  13874. * Style of the segments:
  13875. */
  13876. segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
  13877. /**
  13878. * The selection mode of the control:
  13879. */
  13880. mode?: ('single' | 'multiple' | 'buttons');
  13881. /**
  13882. * An array of segments to place in this control.
  13883. */
  13884. segments: SegmentedControlSegment[];
  13885. /**
  13886. * The index of the currently selected segment, will update automatically with user
  13887. * interaction. When the mode is `multiple` it will be the last selected item.
  13888. */
  13889. selectedIndex?: number;
  13890. /**
  13891. * Called when the user selects a new segment.
  13892. */
  13893. change?: (selectedIndex: number, isSelected: boolean) => void;
  13894. }
  13895. interface TouchBarSliderConstructorOptions {
  13896. /**
  13897. * Label text.
  13898. */
  13899. label?: string;
  13900. /**
  13901. * Selected value.
  13902. */
  13903. value?: number;
  13904. /**
  13905. * Minimum value.
  13906. */
  13907. minValue?: number;
  13908. /**
  13909. * Maximum value.
  13910. */
  13911. maxValue?: number;
  13912. /**
  13913. * Function to call when the slider is changed.
  13914. */
  13915. change?: (newValue: number) => void;
  13916. }
  13917. interface TouchBarSpacerConstructorOptions {
  13918. /**
  13919. * Size of spacer, possible values are:
  13920. */
  13921. size?: ('small' | 'large' | 'flexible');
  13922. }
  13923. interface TraceBufferUsageReturnValue {
  13924. value: number;
  13925. percentage: number;
  13926. }
  13927. interface UpdateTargetUrlEvent extends Event {
  13928. url: string;
  13929. }
  13930. interface UploadProgress {
  13931. /**
  13932. * Whether the request is currently active. If this is false no other properties
  13933. * will be set
  13934. */
  13935. active: boolean;
  13936. /**
  13937. * Whether the upload has started. If this is false both `current` and `total` will
  13938. * be set to 0.
  13939. */
  13940. started: boolean;
  13941. /**
  13942. * The number of bytes that have been uploaded so far
  13943. */
  13944. current: number;
  13945. /**
  13946. * The number of bytes that will be uploaded this request
  13947. */
  13948. total: number;
  13949. }
  13950. interface VisibleOnAllWorkspacesOptions {
  13951. /**
  13952. * Sets whether the window should be visible above fullscreen windows.
  13953. *
  13954. * @platform darwin
  13955. */
  13956. visibleOnFullScreen?: boolean;
  13957. /**
  13958. * Calling setVisibleOnAllWorkspaces will by default transform the process type
  13959. * between UIElementApplication and ForegroundApplication to ensure the correct
  13960. * behavior. However, this will hide the window and dock for a short time every
  13961. * time it is called. If your window is already of type UIElementApplication, you
  13962. * can bypass this transformation by passing true to skipTransformProcessType.
  13963. *
  13964. * @platform darwin
  13965. */
  13966. skipTransformProcessType?: boolean;
  13967. }
  13968. interface WebContentsPrintOptions {
  13969. /**
  13970. * Don't ask user for print settings. Default is `false`.
  13971. */
  13972. silent?: boolean;
  13973. /**
  13974. * Prints the background color and image of the web page. Default is `false`.
  13975. */
  13976. printBackground?: boolean;
  13977. /**
  13978. * Set the printer device name to use. Must be the system-defined name and not the
  13979. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  13980. */
  13981. deviceName?: string;
  13982. /**
  13983. * Set whether the printed web page will be in color or grayscale. Default is
  13984. * `true`.
  13985. */
  13986. color?: boolean;
  13987. margins?: Margins;
  13988. /**
  13989. * Whether the web page should be printed in landscape mode. Default is `false`.
  13990. */
  13991. landscape?: boolean;
  13992. /**
  13993. * The scale factor of the web page.
  13994. */
  13995. scaleFactor?: number;
  13996. /**
  13997. * The number of pages to print per page sheet.
  13998. */
  13999. pagesPerSheet?: number;
  14000. /**
  14001. * Whether the web page should be collated.
  14002. */
  14003. collate?: boolean;
  14004. /**
  14005. * The number of copies of the web page to print.
  14006. */
  14007. copies?: number;
  14008. /**
  14009. * The page range to print. On macOS, only one range is honored.
  14010. */
  14011. pageRanges?: PageRanges[];
  14012. /**
  14013. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  14014. * `longEdge`.
  14015. */
  14016. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  14017. dpi?: Record<string, number>;
  14018. /**
  14019. * String to be printed as page header.
  14020. */
  14021. header?: string;
  14022. /**
  14023. * String to be printed as page footer.
  14024. */
  14025. footer?: string;
  14026. /**
  14027. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  14028. * `Letter`, `Tabloid` or an Object containing `height`.
  14029. */
  14030. pageSize?: (string) | (Size);
  14031. }
  14032. interface WebviewTagPrintOptions {
  14033. /**
  14034. * Don't ask user for print settings. Default is `false`.
  14035. */
  14036. silent?: boolean;
  14037. /**
  14038. * Prints the background color and image of the web page. Default is `false`.
  14039. */
  14040. printBackground?: boolean;
  14041. /**
  14042. * Set the printer device name to use. Must be the system-defined name and not the
  14043. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  14044. */
  14045. deviceName?: string;
  14046. /**
  14047. * Set whether the printed web page will be in color or grayscale. Default is
  14048. * `true`.
  14049. */
  14050. color?: boolean;
  14051. margins?: Margins;
  14052. /**
  14053. * Whether the web page should be printed in landscape mode. Default is `false`.
  14054. */
  14055. landscape?: boolean;
  14056. /**
  14057. * The scale factor of the web page.
  14058. */
  14059. scaleFactor?: number;
  14060. /**
  14061. * The number of pages to print per page sheet.
  14062. */
  14063. pagesPerSheet?: number;
  14064. /**
  14065. * Whether the web page should be collated.
  14066. */
  14067. collate?: boolean;
  14068. /**
  14069. * The number of copies of the web page to print.
  14070. */
  14071. copies?: number;
  14072. /**
  14073. * The page range to print.
  14074. */
  14075. pageRanges?: PageRanges[];
  14076. /**
  14077. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  14078. * `longEdge`.
  14079. */
  14080. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  14081. dpi?: Record<string, number>;
  14082. /**
  14083. * String to be printed as page header.
  14084. */
  14085. header?: string;
  14086. /**
  14087. * String to be printed as page footer.
  14088. */
  14089. footer?: string;
  14090. /**
  14091. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  14092. * `Letter`, `Tabloid` or an Object containing `height`.
  14093. */
  14094. pageSize?: (string) | (Size);
  14095. }
  14096. interface WillNavigateEvent extends Event {
  14097. url: string;
  14098. }
  14099. interface EditFlags {
  14100. /**
  14101. * Whether the renderer believes it can undo.
  14102. */
  14103. canUndo: boolean;
  14104. /**
  14105. * Whether the renderer believes it can redo.
  14106. */
  14107. canRedo: boolean;
  14108. /**
  14109. * Whether the renderer believes it can cut.
  14110. */
  14111. canCut: boolean;
  14112. /**
  14113. * Whether the renderer believes it can copy.
  14114. */
  14115. canCopy: boolean;
  14116. /**
  14117. * Whether the renderer believes it can paste.
  14118. */
  14119. canPaste: boolean;
  14120. /**
  14121. * Whether the renderer believes it can delete.
  14122. */
  14123. canDelete: boolean;
  14124. /**
  14125. * Whether the renderer believes it can select all.
  14126. */
  14127. canSelectAll: boolean;
  14128. /**
  14129. * Whether the renderer believes it can edit text richly.
  14130. */
  14131. canEditRichly: boolean;
  14132. }
  14133. interface FoundInPageResult {
  14134. requestId: number;
  14135. /**
  14136. * Position of the active match.
  14137. */
  14138. activeMatchOrdinal: number;
  14139. /**
  14140. * Number of Matches.
  14141. */
  14142. matches: number;
  14143. /**
  14144. * Coordinates of first match region.
  14145. */
  14146. selectionArea: Rectangle;
  14147. finalUpdate: boolean;
  14148. }
  14149. interface LaunchItems {
  14150. /**
  14151. * name value of a registry entry.
  14152. *
  14153. * @platform win32
  14154. */
  14155. name: string;
  14156. /**
  14157. * The executable to an app that corresponds to a registry entry.
  14158. *
  14159. * @platform win32
  14160. */
  14161. path: string;
  14162. /**
  14163. * the command-line arguments to pass to the executable.
  14164. *
  14165. * @platform win32
  14166. */
  14167. args: string[];
  14168. /**
  14169. * one of `user` or `machine`. Indicates whether the registry entry is under
  14170. * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  14171. *
  14172. * @platform win32
  14173. */
  14174. scope: string;
  14175. /**
  14176. * `true` if the app registry key is startup approved and therefore shows as
  14177. * `enabled` in Task Manager and Windows settings.
  14178. *
  14179. * @platform win32
  14180. */
  14181. enabled: boolean;
  14182. }
  14183. interface Margins {
  14184. /**
  14185. * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
  14186. * you will also need to specify `top`, `bottom`, `left`, and `right`.
  14187. */
  14188. marginType?: ('default' | 'none' | 'printableArea' | 'custom');
  14189. /**
  14190. * The top margin of the printed web page, in pixels.
  14191. */
  14192. top?: number;
  14193. /**
  14194. * The bottom margin of the printed web page, in pixels.
  14195. */
  14196. bottom?: number;
  14197. /**
  14198. * The left margin of the printed web page, in pixels.
  14199. */
  14200. left?: number;
  14201. /**
  14202. * The right margin of the printed web page, in pixels.
  14203. */
  14204. right?: number;
  14205. }
  14206. interface MediaFlags {
  14207. /**
  14208. * Whether the media element has crashed.
  14209. */
  14210. inError: boolean;
  14211. /**
  14212. * Whether the media element is paused.
  14213. */
  14214. isPaused: boolean;
  14215. /**
  14216. * Whether the media element is muted.
  14217. */
  14218. isMuted: boolean;
  14219. /**
  14220. * Whether the media element has audio.
  14221. */
  14222. hasAudio: boolean;
  14223. /**
  14224. * Whether the media element is looping.
  14225. */
  14226. isLooping: boolean;
  14227. /**
  14228. * Whether the media element's controls are visible.
  14229. */
  14230. isControlsVisible: boolean;
  14231. /**
  14232. * Whether the media element's controls are toggleable.
  14233. */
  14234. canToggleControls: boolean;
  14235. /**
  14236. * Whether the media element can be printed.
  14237. */
  14238. canPrint: boolean;
  14239. /**
  14240. * Whether or not the media element can be downloaded.
  14241. */
  14242. canSave: boolean;
  14243. /**
  14244. * Whether the media element can show picture-in-picture.
  14245. */
  14246. canShowPictureInPicture: boolean;
  14247. /**
  14248. * Whether the media element is currently showing picture-in-picture.
  14249. */
  14250. isShowingPictureInPicture: boolean;
  14251. /**
  14252. * Whether the media element can be rotated.
  14253. */
  14254. canRotate: boolean;
  14255. /**
  14256. * Whether the media element can be looped.
  14257. */
  14258. canLoop: boolean;
  14259. }
  14260. interface PageRanges {
  14261. /**
  14262. * Index of the first page to print (0-based).
  14263. */
  14264. from: number;
  14265. /**
  14266. * Index of the last page to print (inclusive) (0-based).
  14267. */
  14268. to: number;
  14269. }
  14270. interface WebPreferences {
  14271. /**
  14272. * Whether to enable DevTools. If it is set to `false`, can not use
  14273. * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
  14274. */
  14275. devTools?: boolean;
  14276. /**
  14277. * Whether node integration is enabled. Default is `false`.
  14278. */
  14279. nodeIntegration?: boolean;
  14280. /**
  14281. * Whether node integration is enabled in web workers. Default is `false`. More
  14282. * about this can be found in Multithreading.
  14283. */
  14284. nodeIntegrationInWorker?: boolean;
  14285. /**
  14286. * Experimental option for enabling Node.js support in sub-frames such as iframes
  14287. * and child windows. All your preloads will load for every iframe, you can use
  14288. * `process.isMainFrame` to determine if you are in the main frame or not.
  14289. */
  14290. nodeIntegrationInSubFrames?: boolean;
  14291. /**
  14292. * Specifies a script that will be loaded before other scripts run in the page.
  14293. * This script will always have access to node APIs no matter whether node
  14294. * integration is turned on or off. The value should be the absolute file path to
  14295. * the script. When node integration is turned off, the preload script can
  14296. * reintroduce Node global symbols back to the global scope. See example here.
  14297. */
  14298. preload?: string;
  14299. /**
  14300. * If set, this will sandbox the renderer associated with the window, making it
  14301. * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
  14302. * This is not the same as the `nodeIntegration` option and the APIs available to
  14303. * the preload script are more limited. Read more about the option here.
  14304. */
  14305. sandbox?: boolean;
  14306. /**
  14307. * Whether to enable the `remote` module. Default is `false`.
  14308. */
  14309. enableRemoteModule?: boolean;
  14310. /**
  14311. * Sets the session used by the page. Instead of passing the Session object
  14312. * directly, you can also choose to use the `partition` option instead, which
  14313. * accepts a partition string. When both `session` and `partition` are provided,
  14314. * `session` will be preferred. Default is the default session.
  14315. */
  14316. session?: Session;
  14317. /**
  14318. * Sets the session used by the page according to the session's partition string.
  14319. * If `partition` starts with `persist:`, the page will use a persistent session
  14320. * available to all pages in the app with the same `partition`. If there is no
  14321. * `persist:` prefix, the page will use an in-memory session. By assigning the same
  14322. * `partition`, multiple pages can share the same session. Default is the default
  14323. * session.
  14324. */
  14325. partition?: string;
  14326. /**
  14327. * When specified, web pages with the same `affinity` will run in the same renderer
  14328. * process. Note that due to reusing the renderer process, certain `webPreferences`
  14329. * options will also be shared between the web pages even when you specified
  14330. * different values for them, including but not limited to `preload`, `sandbox` and
  14331. * `nodeIntegration`. So it is suggested to use exact same `webPreferences` for web
  14332. * pages with the same `affinity`. _Deprecated_
  14333. */
  14334. affinity?: string;
  14335. /**
  14336. * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
  14337. */
  14338. zoomFactor?: number;
  14339. /**
  14340. * Enables JavaScript support. Default is `true`.
  14341. */
  14342. javascript?: boolean;
  14343. /**
  14344. * When `false`, it will disable the same-origin policy (usually using testing
  14345. * websites by people), and set `allowRunningInsecureContent` to `true` if this
  14346. * options has not been set by user. Default is `true`.
  14347. */
  14348. webSecurity?: boolean;
  14349. /**
  14350. * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
  14351. * `false`.
  14352. */
  14353. allowRunningInsecureContent?: boolean;
  14354. /**
  14355. * Enables image support. Default is `true`.
  14356. */
  14357. images?: boolean;
  14358. /**
  14359. * Make TextArea elements resizable. Default is `true`.
  14360. */
  14361. textAreasAreResizable?: boolean;
  14362. /**
  14363. * Enables WebGL support. Default is `true`.
  14364. */
  14365. webgl?: boolean;
  14366. /**
  14367. * Whether plugins should be enabled. Default is `false`.
  14368. */
  14369. plugins?: boolean;
  14370. /**
  14371. * Enables Chromium's experimental features. Default is `false`.
  14372. */
  14373. experimentalFeatures?: boolean;
  14374. /**
  14375. * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
  14376. */
  14377. scrollBounce?: boolean;
  14378. /**
  14379. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  14380. * to enable. The full list of supported feature strings can be found in the
  14381. * RuntimeEnabledFeatures.json5 file.
  14382. */
  14383. enableBlinkFeatures?: string;
  14384. /**
  14385. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  14386. * to disable. The full list of supported feature strings can be found in the
  14387. * RuntimeEnabledFeatures.json5 file.
  14388. */
  14389. disableBlinkFeatures?: string;
  14390. /**
  14391. * Sets the default font for the font-family.
  14392. */
  14393. defaultFontFamily?: DefaultFontFamily;
  14394. /**
  14395. * Defaults to `16`.
  14396. */
  14397. defaultFontSize?: number;
  14398. /**
  14399. * Defaults to `13`.
  14400. */
  14401. defaultMonospaceFontSize?: number;
  14402. /**
  14403. * Defaults to `0`.
  14404. */
  14405. minimumFontSize?: number;
  14406. /**
  14407. * Defaults to `ISO-8859-1`.
  14408. */
  14409. defaultEncoding?: string;
  14410. /**
  14411. * Whether to throttle animations and timers when the page becomes background. This
  14412. * also affects the Page Visibility API. Defaults to `true`.
  14413. */
  14414. backgroundThrottling?: boolean;
  14415. /**
  14416. * Whether to enable offscreen rendering for the browser window. Defaults to
  14417. * `false`. See the offscreen rendering tutorial for more details.
  14418. */
  14419. offscreen?: boolean;
  14420. /**
  14421. * Whether to run Electron APIs and the specified `preload` script in a separate
  14422. * JavaScript context. Defaults to `true`. The context that the `preload` script
  14423. * runs in will only have access to its own dedicated `document` and `window`
  14424. * globals, as well as its own set of JavaScript builtins (`Array`, `Object`,
  14425. * `JSON`, etc.), which are all invisible to the loaded content. The Electron API
  14426. * will only be available in the `preload` script and not the loaded page. This
  14427. * option should be used when loading potentially untrusted remote content to
  14428. * ensure the loaded content cannot tamper with the `preload` script and any
  14429. * Electron APIs being used. This option uses the same technique used by Chrome
  14430. * Content Scripts. You can access this context in the dev tools by selecting the
  14431. * 'Electron Isolated Context' entry in the combo box at the top of the Console
  14432. * tab.
  14433. */
  14434. contextIsolation?: boolean;
  14435. /**
  14436. * If true, values returned from `webFrame.executeJavaScript` will be sanitized to
  14437. * ensure JS values can't unsafely cross between worlds when using
  14438. * `contextIsolation`. Defaults to `true`. _Deprecated_
  14439. */
  14440. worldSafeExecuteJavaScript?: boolean;
  14441. /**
  14442. * Whether to use native `window.open()`. Defaults to `false`. Child windows will
  14443. * always have node integration disabled unless `nodeIntegrationInSubFrames` is
  14444. * true. **Note:** This option is currently experimental.
  14445. */
  14446. nativeWindowOpen?: boolean;
  14447. /**
  14448. * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
  14449. * `preload` script configured for the `<webview>` will have node integration
  14450. * enabled when it is executed so you should ensure remote/untrusted content is not
  14451. * able to create a `<webview>` tag with a possibly malicious `preload` script. You
  14452. * can use the `will-attach-webview` event on webContents to strip away the
  14453. * `preload` script and to validate or alter the `<webview>`'s initial settings.
  14454. */
  14455. webviewTag?: boolean;
  14456. /**
  14457. * A list of strings that will be appended to `process.argv` in the renderer
  14458. * process of this app. Useful for passing small bits of data down to renderer
  14459. * process preload scripts.
  14460. */
  14461. additionalArguments?: string[];
  14462. /**
  14463. * Whether to enable browser style consecutive dialog protection. Default is
  14464. * `false`.
  14465. */
  14466. safeDialogs?: boolean;
  14467. /**
  14468. * The message to display when consecutive dialog protection is triggered. If not
  14469. * defined the default message would be used, note that currently the default
  14470. * message is in English and not localized.
  14471. */
  14472. safeDialogsMessage?: string;
  14473. /**
  14474. * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
  14475. * `false`.
  14476. */
  14477. disableDialogs?: boolean;
  14478. /**
  14479. * Whether dragging and dropping a file or link onto the page causes a navigation.
  14480. * Default is `false`.
  14481. */
  14482. navigateOnDragDrop?: boolean;
  14483. /**
  14484. * Autoplay policy to apply to content in the window, can be
  14485. * `no-user-gesture-required`, `user-gesture-required`,
  14486. * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
  14487. */
  14488. autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
  14489. /**
  14490. * Whether to prevent the window from resizing when entering HTML Fullscreen.
  14491. * Default is `false`.
  14492. */
  14493. disableHtmlFullscreenWindowResize?: boolean;
  14494. /**
  14495. * An alternative title string provided only to accessibility tools such as screen
  14496. * readers. This string is not directly visible to users.
  14497. */
  14498. accessibleTitle?: string;
  14499. /**
  14500. * Whether to enable the builtin spellchecker. Default is `true`.
  14501. */
  14502. spellcheck?: boolean;
  14503. /**
  14504. * Whether to enable the WebSQL api. Default is `true`.
  14505. */
  14506. enableWebSQL?: boolean;
  14507. /**
  14508. * Enforces the v8 code caching policy used by blink. Accepted values are
  14509. */
  14510. v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
  14511. /**
  14512. * Whether to enable preferred size mode. The preferred size is the minimum size
  14513. * needed to contain the layout of the document—without requiring scrolling.
  14514. * Enabling this will cause the `preferred-size-changed` event to be emitted on the
  14515. * `WebContents` when the preferred size changes. Default is `false`.
  14516. */
  14517. enablePreferredSizeMode?: boolean;
  14518. }
  14519. interface DefaultFontFamily {
  14520. /**
  14521. * Defaults to `Times New Roman`.
  14522. */
  14523. standard?: string;
  14524. /**
  14525. * Defaults to `Times New Roman`.
  14526. */
  14527. serif?: string;
  14528. /**
  14529. * Defaults to `Arial`.
  14530. */
  14531. sansSerif?: string;
  14532. /**
  14533. * Defaults to `Courier New`.
  14534. */
  14535. monospace?: string;
  14536. /**
  14537. * Defaults to `Script`.
  14538. */
  14539. cursive?: string;
  14540. /**
  14541. * Defaults to `Impact`.
  14542. */
  14543. fantasy?: string;
  14544. }
  14545. interface RemoteMainInterface {
  14546. app: App;
  14547. autoUpdater: AutoUpdater;
  14548. BrowserView: typeof BrowserView;
  14549. BrowserWindow: typeof BrowserWindow;
  14550. ClientRequest: typeof ClientRequest;
  14551. clipboard: Clipboard;
  14552. CommandLine: typeof CommandLine;
  14553. contentTracing: ContentTracing;
  14554. Cookies: typeof Cookies;
  14555. crashReporter: CrashReporter;
  14556. Debugger: typeof Debugger;
  14557. desktopCapturer: DesktopCapturer;
  14558. dialog: Dialog;
  14559. Dock: typeof Dock;
  14560. DownloadItem: typeof DownloadItem;
  14561. globalShortcut: GlobalShortcut;
  14562. inAppPurchase: InAppPurchase;
  14563. IncomingMessage: typeof IncomingMessage;
  14564. ipcMain: IpcMain;
  14565. Menu: typeof Menu;
  14566. MenuItem: typeof MenuItem;
  14567. MessageChannelMain: typeof MessageChannelMain;
  14568. MessagePortMain: typeof MessagePortMain;
  14569. nativeImage: typeof NativeImage;
  14570. nativeTheme: NativeTheme;
  14571. net: Net;
  14572. netLog: NetLog;
  14573. Notification: typeof Notification;
  14574. powerMonitor: PowerMonitor;
  14575. powerSaveBlocker: PowerSaveBlocker;
  14576. protocol: Protocol;
  14577. screen: Screen;
  14578. ServiceWorkers: typeof ServiceWorkers;
  14579. session: typeof Session;
  14580. ShareMenu: typeof ShareMenu;
  14581. shell: Shell;
  14582. systemPreferences: SystemPreferences;
  14583. TouchBar: typeof TouchBar;
  14584. TouchBarButton: typeof TouchBarButton;
  14585. TouchBarColorPicker: typeof TouchBarColorPicker;
  14586. TouchBarGroup: typeof TouchBarGroup;
  14587. TouchBarLabel: typeof TouchBarLabel;
  14588. TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
  14589. TouchBarPopover: typeof TouchBarPopover;
  14590. TouchBarScrubber: typeof TouchBarScrubber;
  14591. TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
  14592. TouchBarSlider: typeof TouchBarSlider;
  14593. TouchBarSpacer: typeof TouchBarSpacer;
  14594. Tray: typeof Tray;
  14595. webContents: typeof WebContents;
  14596. webFrameMain: typeof WebFrameMain;
  14597. WebRequest: typeof WebRequest;
  14598. }
  14599. namespace Common {
  14600. const clipboard: Clipboard;
  14601. const crashReporter: CrashReporter;
  14602. const desktopCapturer: DesktopCapturer;
  14603. class NativeImage extends Electron.NativeImage {}
  14604. type nativeImage = NativeImage;
  14605. const nativeImage: typeof NativeImage;
  14606. const shell: Shell;
  14607. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  14608. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  14609. type AnimationSettings = Electron.AnimationSettings;
  14610. type AppDetailsOptions = Electron.AppDetailsOptions;
  14611. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  14612. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  14613. type AuthInfo = Electron.AuthInfo;
  14614. type AutoResizeOptions = Electron.AutoResizeOptions;
  14615. type BeforeSendResponse = Electron.BeforeSendResponse;
  14616. type BitmapOptions = Electron.BitmapOptions;
  14617. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  14618. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  14619. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  14620. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  14621. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  14622. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  14623. type Config = Electron.Config;
  14624. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  14625. type ContextMenuParams = Electron.ContextMenuParams;
  14626. type CookiesGetFilter = Electron.CookiesGetFilter;
  14627. type CookiesSetDetails = Electron.CookiesSetDetails;
  14628. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  14629. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  14630. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  14631. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  14632. type Data = Electron.Data;
  14633. type Details = Electron.Details;
  14634. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  14635. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  14636. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  14637. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  14638. type DidNavigateEvent = Electron.DidNavigateEvent;
  14639. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  14640. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  14641. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  14642. type FeedURLOptions = Electron.FeedURLOptions;
  14643. type FileIconOptions = Electron.FileIconOptions;
  14644. type Filter = Electron.Filter;
  14645. type FindInPageOptions = Electron.FindInPageOptions;
  14646. type FocusOptions = Electron.FocusOptions;
  14647. type FoundInPageEvent = Electron.FoundInPageEvent;
  14648. type FromPartitionOptions = Electron.FromPartitionOptions;
  14649. type HandlerDetails = Electron.HandlerDetails;
  14650. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  14651. type HeapStatistics = Electron.HeapStatistics;
  14652. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  14653. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  14654. type Info = Electron.Info;
  14655. type Input = Electron.Input;
  14656. type InsertCSSOptions = Electron.InsertCSSOptions;
  14657. type IpcMessageEvent = Electron.IpcMessageEvent;
  14658. type Item = Electron.Item;
  14659. type JumpListSettings = Electron.JumpListSettings;
  14660. type LoadCommitEvent = Electron.LoadCommitEvent;
  14661. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  14662. type LoadFileOptions = Electron.LoadFileOptions;
  14663. type LoadURLOptions = Electron.LoadURLOptions;
  14664. type LoginItemSettings = Electron.LoginItemSettings;
  14665. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  14666. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  14667. type MessageBoxOptions = Electron.MessageBoxOptions;
  14668. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  14669. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  14670. type MessageDetails = Electron.MessageDetails;
  14671. type MessageEvent = Electron.MessageEvent;
  14672. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  14673. type NewWindowEvent = Electron.NewWindowEvent;
  14674. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  14675. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  14676. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  14677. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  14678. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  14679. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  14680. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  14681. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  14682. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  14683. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  14684. type OpenDialogOptions = Electron.OpenDialogOptions;
  14685. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  14686. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  14687. type OpenExternalOptions = Electron.OpenExternalOptions;
  14688. type Options = Electron.Options;
  14689. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  14690. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  14691. type Parameters = Electron.Parameters;
  14692. type Payment = Electron.Payment;
  14693. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  14694. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  14695. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  14696. type PopupOptions = Electron.PopupOptions;
  14697. type PreconnectOptions = Electron.PreconnectOptions;
  14698. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  14699. type Privileges = Electron.Privileges;
  14700. type ProgressBarOptions = Electron.ProgressBarOptions;
  14701. type Provider = Electron.Provider;
  14702. type ReadBookmark = Electron.ReadBookmark;
  14703. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  14704. type RelaunchOptions = Electron.RelaunchOptions;
  14705. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  14706. type Request = Electron.Request;
  14707. type ResizeOptions = Electron.ResizeOptions;
  14708. type ResourceUsage = Electron.ResourceUsage;
  14709. type Response = Electron.Response;
  14710. type Result = Electron.Result;
  14711. type SaveDialogOptions = Electron.SaveDialogOptions;
  14712. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  14713. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  14714. type Settings = Electron.Settings;
  14715. type SourcesOptions = Electron.SourcesOptions;
  14716. type SSLConfigConfig = Electron.SSLConfigConfig;
  14717. type StartLoggingOptions = Electron.StartLoggingOptions;
  14718. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  14719. type TitleOptions = Electron.TitleOptions;
  14720. type ToBitmapOptions = Electron.ToBitmapOptions;
  14721. type ToDataURLOptions = Electron.ToDataURLOptions;
  14722. type ToPNGOptions = Electron.ToPNGOptions;
  14723. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  14724. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  14725. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  14726. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  14727. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  14728. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  14729. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  14730. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  14731. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  14732. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  14733. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  14734. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  14735. type UploadProgress = Electron.UploadProgress;
  14736. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  14737. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  14738. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  14739. type WillNavigateEvent = Electron.WillNavigateEvent;
  14740. type EditFlags = Electron.EditFlags;
  14741. type FoundInPageResult = Electron.FoundInPageResult;
  14742. type LaunchItems = Electron.LaunchItems;
  14743. type Margins = Electron.Margins;
  14744. type MediaFlags = Electron.MediaFlags;
  14745. type PageRanges = Electron.PageRanges;
  14746. type WebPreferences = Electron.WebPreferences;
  14747. type DefaultFontFamily = Electron.DefaultFontFamily;
  14748. type BluetoothDevice = Electron.BluetoothDevice;
  14749. type Certificate = Electron.Certificate;
  14750. type CertificatePrincipal = Electron.CertificatePrincipal;
  14751. type Cookie = Electron.Cookie;
  14752. type CPUUsage = Electron.CPUUsage;
  14753. type CrashReport = Electron.CrashReport;
  14754. type CustomScheme = Electron.CustomScheme;
  14755. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  14756. type Display = Electron.Display;
  14757. type Event = Electron.Event;
  14758. type Extension = Electron.Extension;
  14759. type ExtensionInfo = Electron.ExtensionInfo;
  14760. type FileFilter = Electron.FileFilter;
  14761. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  14762. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  14763. type InputEvent = Electron.InputEvent;
  14764. type IOCounters = Electron.IOCounters;
  14765. type IpcMainEvent = Electron.IpcMainEvent;
  14766. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  14767. type IpcRendererEvent = Electron.IpcRendererEvent;
  14768. type JumpListCategory = Electron.JumpListCategory;
  14769. type JumpListItem = Electron.JumpListItem;
  14770. type KeyboardEvent = Electron.KeyboardEvent;
  14771. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  14772. type MemoryInfo = Electron.MemoryInfo;
  14773. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  14774. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  14775. type MouseInputEvent = Electron.MouseInputEvent;
  14776. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  14777. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  14778. type NotificationAction = Electron.NotificationAction;
  14779. type NotificationResponse = Electron.NotificationResponse;
  14780. type Point = Electron.Point;
  14781. type PostBody = Electron.PostBody;
  14782. type PrinterInfo = Electron.PrinterInfo;
  14783. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  14784. type ProcessMetric = Electron.ProcessMetric;
  14785. type Product = Electron.Product;
  14786. type ProtocolRequest = Electron.ProtocolRequest;
  14787. type ProtocolResponse = Electron.ProtocolResponse;
  14788. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  14789. type Rectangle = Electron.Rectangle;
  14790. type Referrer = Electron.Referrer;
  14791. type ScrubberItem = Electron.ScrubberItem;
  14792. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  14793. type SerialPort = Electron.SerialPort;
  14794. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  14795. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  14796. type SharingItem = Electron.SharingItem;
  14797. type ShortcutDetails = Electron.ShortcutDetails;
  14798. type Size = Electron.Size;
  14799. type Task = Electron.Task;
  14800. type ThumbarButton = Electron.ThumbarButton;
  14801. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  14802. type TraceConfig = Electron.TraceConfig;
  14803. type Transaction = Electron.Transaction;
  14804. type UploadData = Electron.UploadData;
  14805. type UploadFile = Electron.UploadFile;
  14806. type UploadRawData = Electron.UploadRawData;
  14807. type WebSource = Electron.WebSource;
  14808. }
  14809. namespace Main {
  14810. const app: App;
  14811. const autoUpdater: AutoUpdater;
  14812. class BrowserView extends Electron.BrowserView {}
  14813. class BrowserWindow extends Electron.BrowserWindow {}
  14814. class ClientRequest extends Electron.ClientRequest {}
  14815. class CommandLine extends Electron.CommandLine {}
  14816. const contentTracing: ContentTracing;
  14817. class Cookies extends Electron.Cookies {}
  14818. class Debugger extends Electron.Debugger {}
  14819. const dialog: Dialog;
  14820. class Dock extends Electron.Dock {}
  14821. class DownloadItem extends Electron.DownloadItem {}
  14822. const globalShortcut: GlobalShortcut;
  14823. const inAppPurchase: InAppPurchase;
  14824. class IncomingMessage extends Electron.IncomingMessage {}
  14825. const ipcMain: IpcMain;
  14826. class Menu extends Electron.Menu {}
  14827. class MenuItem extends Electron.MenuItem {}
  14828. class MessageChannelMain extends Electron.MessageChannelMain {}
  14829. class MessagePortMain extends Electron.MessagePortMain {}
  14830. const nativeTheme: NativeTheme;
  14831. const net: Net;
  14832. const netLog: NetLog;
  14833. class Notification extends Electron.Notification {}
  14834. const powerMonitor: PowerMonitor;
  14835. const powerSaveBlocker: PowerSaveBlocker;
  14836. const protocol: Protocol;
  14837. const screen: Screen;
  14838. class ServiceWorkers extends Electron.ServiceWorkers {}
  14839. class Session extends Electron.Session {}
  14840. type session = Session;
  14841. const session: typeof Session;
  14842. class ShareMenu extends Electron.ShareMenu {}
  14843. const systemPreferences: SystemPreferences;
  14844. class TouchBar extends Electron.TouchBar {}
  14845. class TouchBarButton extends Electron.TouchBarButton {}
  14846. class TouchBarColorPicker extends Electron.TouchBarColorPicker {}
  14847. class TouchBarGroup extends Electron.TouchBarGroup {}
  14848. class TouchBarLabel extends Electron.TouchBarLabel {}
  14849. class TouchBarOtherItemsProxy extends Electron.TouchBarOtherItemsProxy {}
  14850. class TouchBarPopover extends Electron.TouchBarPopover {}
  14851. class TouchBarScrubber extends Electron.TouchBarScrubber {}
  14852. class TouchBarSegmentedControl extends Electron.TouchBarSegmentedControl {}
  14853. class TouchBarSlider extends Electron.TouchBarSlider {}
  14854. class TouchBarSpacer extends Electron.TouchBarSpacer {}
  14855. class Tray extends Electron.Tray {}
  14856. class WebContents extends Electron.WebContents {}
  14857. type webContents = WebContents;
  14858. const webContents: typeof WebContents;
  14859. class WebFrameMain extends Electron.WebFrameMain {}
  14860. type webFrameMain = WebFrameMain;
  14861. const webFrameMain: typeof WebFrameMain;
  14862. class WebRequest extends Electron.WebRequest {}
  14863. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  14864. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  14865. type AnimationSettings = Electron.AnimationSettings;
  14866. type AppDetailsOptions = Electron.AppDetailsOptions;
  14867. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  14868. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  14869. type AuthInfo = Electron.AuthInfo;
  14870. type AutoResizeOptions = Electron.AutoResizeOptions;
  14871. type BeforeSendResponse = Electron.BeforeSendResponse;
  14872. type BitmapOptions = Electron.BitmapOptions;
  14873. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  14874. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  14875. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  14876. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  14877. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  14878. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  14879. type Config = Electron.Config;
  14880. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  14881. type ContextMenuParams = Electron.ContextMenuParams;
  14882. type CookiesGetFilter = Electron.CookiesGetFilter;
  14883. type CookiesSetDetails = Electron.CookiesSetDetails;
  14884. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  14885. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  14886. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  14887. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  14888. type Data = Electron.Data;
  14889. type Details = Electron.Details;
  14890. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  14891. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  14892. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  14893. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  14894. type DidNavigateEvent = Electron.DidNavigateEvent;
  14895. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  14896. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  14897. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  14898. type FeedURLOptions = Electron.FeedURLOptions;
  14899. type FileIconOptions = Electron.FileIconOptions;
  14900. type Filter = Electron.Filter;
  14901. type FindInPageOptions = Electron.FindInPageOptions;
  14902. type FocusOptions = Electron.FocusOptions;
  14903. type FoundInPageEvent = Electron.FoundInPageEvent;
  14904. type FromPartitionOptions = Electron.FromPartitionOptions;
  14905. type HandlerDetails = Electron.HandlerDetails;
  14906. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  14907. type HeapStatistics = Electron.HeapStatistics;
  14908. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  14909. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  14910. type Info = Electron.Info;
  14911. type Input = Electron.Input;
  14912. type InsertCSSOptions = Electron.InsertCSSOptions;
  14913. type IpcMessageEvent = Electron.IpcMessageEvent;
  14914. type Item = Electron.Item;
  14915. type JumpListSettings = Electron.JumpListSettings;
  14916. type LoadCommitEvent = Electron.LoadCommitEvent;
  14917. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  14918. type LoadFileOptions = Electron.LoadFileOptions;
  14919. type LoadURLOptions = Electron.LoadURLOptions;
  14920. type LoginItemSettings = Electron.LoginItemSettings;
  14921. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  14922. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  14923. type MessageBoxOptions = Electron.MessageBoxOptions;
  14924. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  14925. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  14926. type MessageDetails = Electron.MessageDetails;
  14927. type MessageEvent = Electron.MessageEvent;
  14928. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  14929. type NewWindowEvent = Electron.NewWindowEvent;
  14930. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  14931. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  14932. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  14933. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  14934. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  14935. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  14936. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  14937. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  14938. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  14939. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  14940. type OpenDialogOptions = Electron.OpenDialogOptions;
  14941. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  14942. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  14943. type OpenExternalOptions = Electron.OpenExternalOptions;
  14944. type Options = Electron.Options;
  14945. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  14946. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  14947. type Parameters = Electron.Parameters;
  14948. type Payment = Electron.Payment;
  14949. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  14950. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  14951. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  14952. type PopupOptions = Electron.PopupOptions;
  14953. type PreconnectOptions = Electron.PreconnectOptions;
  14954. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  14955. type Privileges = Electron.Privileges;
  14956. type ProgressBarOptions = Electron.ProgressBarOptions;
  14957. type Provider = Electron.Provider;
  14958. type ReadBookmark = Electron.ReadBookmark;
  14959. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  14960. type RelaunchOptions = Electron.RelaunchOptions;
  14961. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  14962. type Request = Electron.Request;
  14963. type ResizeOptions = Electron.ResizeOptions;
  14964. type ResourceUsage = Electron.ResourceUsage;
  14965. type Response = Electron.Response;
  14966. type Result = Electron.Result;
  14967. type SaveDialogOptions = Electron.SaveDialogOptions;
  14968. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  14969. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  14970. type Settings = Electron.Settings;
  14971. type SourcesOptions = Electron.SourcesOptions;
  14972. type SSLConfigConfig = Electron.SSLConfigConfig;
  14973. type StartLoggingOptions = Electron.StartLoggingOptions;
  14974. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  14975. type TitleOptions = Electron.TitleOptions;
  14976. type ToBitmapOptions = Electron.ToBitmapOptions;
  14977. type ToDataURLOptions = Electron.ToDataURLOptions;
  14978. type ToPNGOptions = Electron.ToPNGOptions;
  14979. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  14980. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  14981. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  14982. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  14983. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  14984. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  14985. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  14986. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  14987. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  14988. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  14989. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  14990. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  14991. type UploadProgress = Electron.UploadProgress;
  14992. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  14993. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  14994. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  14995. type WillNavigateEvent = Electron.WillNavigateEvent;
  14996. type EditFlags = Electron.EditFlags;
  14997. type FoundInPageResult = Electron.FoundInPageResult;
  14998. type LaunchItems = Electron.LaunchItems;
  14999. type Margins = Electron.Margins;
  15000. type MediaFlags = Electron.MediaFlags;
  15001. type PageRanges = Electron.PageRanges;
  15002. type WebPreferences = Electron.WebPreferences;
  15003. type DefaultFontFamily = Electron.DefaultFontFamily;
  15004. type BluetoothDevice = Electron.BluetoothDevice;
  15005. type Certificate = Electron.Certificate;
  15006. type CertificatePrincipal = Electron.CertificatePrincipal;
  15007. type Cookie = Electron.Cookie;
  15008. type CPUUsage = Electron.CPUUsage;
  15009. type CrashReport = Electron.CrashReport;
  15010. type CustomScheme = Electron.CustomScheme;
  15011. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  15012. type Display = Electron.Display;
  15013. type Event = Electron.Event;
  15014. type Extension = Electron.Extension;
  15015. type ExtensionInfo = Electron.ExtensionInfo;
  15016. type FileFilter = Electron.FileFilter;
  15017. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  15018. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  15019. type InputEvent = Electron.InputEvent;
  15020. type IOCounters = Electron.IOCounters;
  15021. type IpcMainEvent = Electron.IpcMainEvent;
  15022. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  15023. type IpcRendererEvent = Electron.IpcRendererEvent;
  15024. type JumpListCategory = Electron.JumpListCategory;
  15025. type JumpListItem = Electron.JumpListItem;
  15026. type KeyboardEvent = Electron.KeyboardEvent;
  15027. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  15028. type MemoryInfo = Electron.MemoryInfo;
  15029. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  15030. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  15031. type MouseInputEvent = Electron.MouseInputEvent;
  15032. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  15033. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  15034. type NotificationAction = Electron.NotificationAction;
  15035. type NotificationResponse = Electron.NotificationResponse;
  15036. type Point = Electron.Point;
  15037. type PostBody = Electron.PostBody;
  15038. type PrinterInfo = Electron.PrinterInfo;
  15039. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  15040. type ProcessMetric = Electron.ProcessMetric;
  15041. type Product = Electron.Product;
  15042. type ProtocolRequest = Electron.ProtocolRequest;
  15043. type ProtocolResponse = Electron.ProtocolResponse;
  15044. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  15045. type Rectangle = Electron.Rectangle;
  15046. type Referrer = Electron.Referrer;
  15047. type ScrubberItem = Electron.ScrubberItem;
  15048. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  15049. type SerialPort = Electron.SerialPort;
  15050. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  15051. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  15052. type SharingItem = Electron.SharingItem;
  15053. type ShortcutDetails = Electron.ShortcutDetails;
  15054. type Size = Electron.Size;
  15055. type Task = Electron.Task;
  15056. type ThumbarButton = Electron.ThumbarButton;
  15057. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  15058. type TraceConfig = Electron.TraceConfig;
  15059. type Transaction = Electron.Transaction;
  15060. type UploadData = Electron.UploadData;
  15061. type UploadFile = Electron.UploadFile;
  15062. type UploadRawData = Electron.UploadRawData;
  15063. type WebSource = Electron.WebSource;
  15064. }
  15065. namespace Renderer {
  15066. class BrowserWindowProxy extends Electron.BrowserWindowProxy {}
  15067. const contextBridge: ContextBridge;
  15068. const ipcRenderer: IpcRenderer;
  15069. const remote: Remote;
  15070. const webFrame: WebFrame;
  15071. const webviewTag: WebviewTag;
  15072. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  15073. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  15074. type AnimationSettings = Electron.AnimationSettings;
  15075. type AppDetailsOptions = Electron.AppDetailsOptions;
  15076. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  15077. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  15078. type AuthInfo = Electron.AuthInfo;
  15079. type AutoResizeOptions = Electron.AutoResizeOptions;
  15080. type BeforeSendResponse = Electron.BeforeSendResponse;
  15081. type BitmapOptions = Electron.BitmapOptions;
  15082. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  15083. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  15084. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  15085. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  15086. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  15087. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  15088. type Config = Electron.Config;
  15089. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  15090. type ContextMenuParams = Electron.ContextMenuParams;
  15091. type CookiesGetFilter = Electron.CookiesGetFilter;
  15092. type CookiesSetDetails = Electron.CookiesSetDetails;
  15093. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  15094. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  15095. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  15096. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  15097. type Data = Electron.Data;
  15098. type Details = Electron.Details;
  15099. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  15100. type DidCreateWindowDetails = Electron.DidCreateWindowDetails;
  15101. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  15102. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  15103. type DidNavigateEvent = Electron.DidNavigateEvent;
  15104. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  15105. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  15106. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  15107. type FeedURLOptions = Electron.FeedURLOptions;
  15108. type FileIconOptions = Electron.FileIconOptions;
  15109. type Filter = Electron.Filter;
  15110. type FindInPageOptions = Electron.FindInPageOptions;
  15111. type FocusOptions = Electron.FocusOptions;
  15112. type FoundInPageEvent = Electron.FoundInPageEvent;
  15113. type FromPartitionOptions = Electron.FromPartitionOptions;
  15114. type HandlerDetails = Electron.HandlerDetails;
  15115. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  15116. type HeapStatistics = Electron.HeapStatistics;
  15117. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  15118. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  15119. type Info = Electron.Info;
  15120. type Input = Electron.Input;
  15121. type InsertCSSOptions = Electron.InsertCSSOptions;
  15122. type IpcMessageEvent = Electron.IpcMessageEvent;
  15123. type Item = Electron.Item;
  15124. type JumpListSettings = Electron.JumpListSettings;
  15125. type LoadCommitEvent = Electron.LoadCommitEvent;
  15126. type LoadExtensionOptions = Electron.LoadExtensionOptions;
  15127. type LoadFileOptions = Electron.LoadFileOptions;
  15128. type LoadURLOptions = Electron.LoadURLOptions;
  15129. type LoginItemSettings = Electron.LoginItemSettings;
  15130. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  15131. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  15132. type MessageBoxOptions = Electron.MessageBoxOptions;
  15133. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  15134. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  15135. type MessageDetails = Electron.MessageDetails;
  15136. type MessageEvent = Electron.MessageEvent;
  15137. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  15138. type NewWindowEvent = Electron.NewWindowEvent;
  15139. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  15140. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  15141. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  15142. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  15143. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  15144. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  15145. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  15146. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  15147. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  15148. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  15149. type OpenDialogOptions = Electron.OpenDialogOptions;
  15150. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  15151. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  15152. type OpenExternalOptions = Electron.OpenExternalOptions;
  15153. type Options = Electron.Options;
  15154. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  15155. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  15156. type Parameters = Electron.Parameters;
  15157. type Payment = Electron.Payment;
  15158. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  15159. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  15160. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  15161. type PopupOptions = Electron.PopupOptions;
  15162. type PreconnectOptions = Electron.PreconnectOptions;
  15163. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  15164. type Privileges = Electron.Privileges;
  15165. type ProgressBarOptions = Electron.ProgressBarOptions;
  15166. type Provider = Electron.Provider;
  15167. type ReadBookmark = Electron.ReadBookmark;
  15168. type RegistrationCompletedDetails = Electron.RegistrationCompletedDetails;
  15169. type RelaunchOptions = Electron.RelaunchOptions;
  15170. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  15171. type Request = Electron.Request;
  15172. type ResizeOptions = Electron.ResizeOptions;
  15173. type ResourceUsage = Electron.ResourceUsage;
  15174. type Response = Electron.Response;
  15175. type Result = Electron.Result;
  15176. type SaveDialogOptions = Electron.SaveDialogOptions;
  15177. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  15178. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  15179. type Settings = Electron.Settings;
  15180. type SourcesOptions = Electron.SourcesOptions;
  15181. type SSLConfigConfig = Electron.SSLConfigConfig;
  15182. type StartLoggingOptions = Electron.StartLoggingOptions;
  15183. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  15184. type TitleOptions = Electron.TitleOptions;
  15185. type ToBitmapOptions = Electron.ToBitmapOptions;
  15186. type ToDataURLOptions = Electron.ToDataURLOptions;
  15187. type ToPNGOptions = Electron.ToPNGOptions;
  15188. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  15189. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  15190. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  15191. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  15192. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  15193. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  15194. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  15195. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  15196. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  15197. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  15198. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  15199. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  15200. type UploadProgress = Electron.UploadProgress;
  15201. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  15202. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  15203. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  15204. type WillNavigateEvent = Electron.WillNavigateEvent;
  15205. type EditFlags = Electron.EditFlags;
  15206. type FoundInPageResult = Electron.FoundInPageResult;
  15207. type LaunchItems = Electron.LaunchItems;
  15208. type Margins = Electron.Margins;
  15209. type MediaFlags = Electron.MediaFlags;
  15210. type PageRanges = Electron.PageRanges;
  15211. type WebPreferences = Electron.WebPreferences;
  15212. type DefaultFontFamily = Electron.DefaultFontFamily;
  15213. type BluetoothDevice = Electron.BluetoothDevice;
  15214. type Certificate = Electron.Certificate;
  15215. type CertificatePrincipal = Electron.CertificatePrincipal;
  15216. type Cookie = Electron.Cookie;
  15217. type CPUUsage = Electron.CPUUsage;
  15218. type CrashReport = Electron.CrashReport;
  15219. type CustomScheme = Electron.CustomScheme;
  15220. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  15221. type Display = Electron.Display;
  15222. type Event = Electron.Event;
  15223. type Extension = Electron.Extension;
  15224. type ExtensionInfo = Electron.ExtensionInfo;
  15225. type FileFilter = Electron.FileFilter;
  15226. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  15227. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  15228. type InputEvent = Electron.InputEvent;
  15229. type IOCounters = Electron.IOCounters;
  15230. type IpcMainEvent = Electron.IpcMainEvent;
  15231. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  15232. type IpcRendererEvent = Electron.IpcRendererEvent;
  15233. type JumpListCategory = Electron.JumpListCategory;
  15234. type JumpListItem = Electron.JumpListItem;
  15235. type KeyboardEvent = Electron.KeyboardEvent;
  15236. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  15237. type MemoryInfo = Electron.MemoryInfo;
  15238. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  15239. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  15240. type MouseInputEvent = Electron.MouseInputEvent;
  15241. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  15242. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  15243. type NotificationAction = Electron.NotificationAction;
  15244. type NotificationResponse = Electron.NotificationResponse;
  15245. type Point = Electron.Point;
  15246. type PostBody = Electron.PostBody;
  15247. type PrinterInfo = Electron.PrinterInfo;
  15248. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  15249. type ProcessMetric = Electron.ProcessMetric;
  15250. type Product = Electron.Product;
  15251. type ProtocolRequest = Electron.ProtocolRequest;
  15252. type ProtocolResponse = Electron.ProtocolResponse;
  15253. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  15254. type Rectangle = Electron.Rectangle;
  15255. type Referrer = Electron.Referrer;
  15256. type ScrubberItem = Electron.ScrubberItem;
  15257. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  15258. type SerialPort = Electron.SerialPort;
  15259. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  15260. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  15261. type SharingItem = Electron.SharingItem;
  15262. type ShortcutDetails = Electron.ShortcutDetails;
  15263. type Size = Electron.Size;
  15264. type Task = Electron.Task;
  15265. type ThumbarButton = Electron.ThumbarButton;
  15266. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  15267. type TraceConfig = Electron.TraceConfig;
  15268. type Transaction = Electron.Transaction;
  15269. type UploadData = Electron.UploadData;
  15270. type UploadFile = Electron.UploadFile;
  15271. type UploadRawData = Electron.UploadRawData;
  15272. type WebSource = Electron.WebSource;
  15273. }
  15274. const app: App;
  15275. const autoUpdater: AutoUpdater;
  15276. const clipboard: Clipboard;
  15277. const contentTracing: ContentTracing;
  15278. const contextBridge: ContextBridge;
  15279. const crashReporter: CrashReporter;
  15280. const desktopCapturer: DesktopCapturer;
  15281. const dialog: Dialog;
  15282. const globalShortcut: GlobalShortcut;
  15283. const inAppPurchase: InAppPurchase;
  15284. const ipcMain: IpcMain;
  15285. const ipcRenderer: IpcRenderer;
  15286. type nativeImage = NativeImage;
  15287. const nativeImage: typeof NativeImage;
  15288. const nativeTheme: NativeTheme;
  15289. const net: Net;
  15290. const netLog: NetLog;
  15291. const powerMonitor: PowerMonitor;
  15292. const powerSaveBlocker: PowerSaveBlocker;
  15293. const protocol: Protocol;
  15294. const remote: Remote;
  15295. const screen: Screen;
  15296. type session = Session;
  15297. const session: typeof Session;
  15298. const shell: Shell;
  15299. const systemPreferences: SystemPreferences;
  15300. type webContents = WebContents;
  15301. const webContents: typeof WebContents;
  15302. const webFrame: WebFrame;
  15303. type webFrameMain = WebFrameMain;
  15304. const webFrameMain: typeof WebFrameMain;
  15305. const webviewTag: WebviewTag;
  15306. }
  15307. declare module 'electron' {
  15308. export = Electron;
  15309. }
  15310. declare module 'electron/main' {
  15311. export = Electron.Main
  15312. }
  15313. declare module 'electron/common' {
  15314. export = Electron.Common
  15315. }
  15316. declare module 'electron/renderer' {
  15317. export = Electron.Renderer
  15318. }
  15319. interface NodeRequireFunction {
  15320. (moduleName: 'electron'): typeof Electron;
  15321. (moduleName: 'electron/main'): typeof Electron.Main;
  15322. (moduleName: 'electron/common'): typeof Electron.Common;
  15323. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  15324. }
  15325. interface NodeRequire {
  15326. (moduleName: 'electron'): typeof Electron;
  15327. (moduleName: 'electron/main'): typeof Electron.Main;
  15328. (moduleName: 'electron/common'): typeof Electron.Common;
  15329. (moduleName: 'electron/renderer'): typeof Electron.Renderer;
  15330. }
  15331. interface File {
  15332. /**
  15333. * The real path to the file on the users filesystem
  15334. */
  15335. path: string;
  15336. }
  15337. declare module 'original-fs' {
  15338. import * as fs from 'fs';
  15339. export = fs;
  15340. }
  15341. interface Document {
  15342. createElement(tagName: 'webview'): Electron.WebviewTag;
  15343. }
  15344. declare namespace NodeJS {
  15345. interface Process extends NodeJS.EventEmitter {
  15346. // Docs: https://electronjs.org/docs/api/process
  15347. /**
  15348. * Emitted when Electron has loaded its internal initialization script and is
  15349. * beginning to load the web page or the main script.
  15350. */
  15351. on(event: 'loaded', listener: Function): this;
  15352. once(event: 'loaded', listener: Function): this;
  15353. addListener(event: 'loaded', listener: Function): this;
  15354. removeListener(event: 'loaded', listener: Function): this;
  15355. /**
  15356. * Causes the main thread of the current process crash.
  15357. */
  15358. crash(): void;
  15359. /**
  15360. * * `allocated` Integer - Size of all allocated objects in Kilobytes.
  15361. * * `marked` Integer - Size of all marked objects in Kilobytes.
  15362. * * `total` Integer - Total allocated space in Kilobytes.
  15363. *
  15364. * Returns an object with Blink memory information. It can be useful for debugging
  15365. * rendering / DOM related memory issues. Note that all values are reported in
  15366. * Kilobytes.
  15367. */
  15368. getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
  15369. getCPUUsage(): Electron.CPUUsage;
  15370. /**
  15371. * The number of milliseconds since epoch, or `null` if the information is
  15372. * unavailable
  15373. *
  15374. * Indicates the creation time of the application. The time is represented as
  15375. * number of milliseconds since epoch. It returns null if it is unable to get the
  15376. * process creation time.
  15377. */
  15378. getCreationTime(): (number) | (null);
  15379. /**
  15380. * * `totalHeapSize` Integer
  15381. * * `totalHeapSizeExecutable` Integer
  15382. * * `totalPhysicalSize` Integer
  15383. * * `totalAvailableSize` Integer
  15384. * * `usedHeapSize` Integer
  15385. * * `heapSizeLimit` Integer
  15386. * * `mallocedMemory` Integer
  15387. * * `peakMallocedMemory` Integer
  15388. * * `doesZapGarbage` Boolean
  15389. *
  15390. * Returns an object with V8 heap statistics. Note that all statistics are reported
  15391. * in Kilobytes.
  15392. */
  15393. getHeapStatistics(): Electron.HeapStatistics;
  15394. getIOCounters(): Electron.IOCounters;
  15395. /**
  15396. * Resolves with a ProcessMemoryInfo
  15397. *
  15398. * Returns an object giving memory usage statistics about the current process. Note
  15399. * that all statistics are reported in Kilobytes. This api should be called after
  15400. * app ready.
  15401. *
  15402. * Chromium does not provide `residentSet` value for macOS. This is because macOS
  15403. * performs in-memory compression of pages that haven't been recently used. As a
  15404. * result the resident set size value is not what one would expect. `private`
  15405. * memory is more representative of the actual pre-compression memory usage of the
  15406. * process on macOS.
  15407. */
  15408. getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
  15409. /**
  15410. * * `total` Integer - The total amount of physical memory in Kilobytes available
  15411. * to the system.
  15412. * * `free` Integer - The total amount of memory not being used by applications or
  15413. * disk cache.
  15414. * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
  15415. * Kilobytes available to the system.
  15416. * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
  15417. * Kilobytes available to the system.
  15418. *
  15419. * Returns an object giving memory usage statistics about the entire system. Note
  15420. * that all statistics are reported in Kilobytes.
  15421. */
  15422. getSystemMemoryInfo(): Electron.SystemMemoryInfo;
  15423. /**
  15424. * The version of the host operating system.
  15425. *
  15426. * Example:
  15427. *
  15428. * **Note:** It returns the actual operating system version instead of kernel
  15429. * version on macOS unlike `os.release()`.
  15430. */
  15431. getSystemVersion(): string;
  15432. /**
  15433. * Causes the main thread of the current process hang.
  15434. */
  15435. hang(): void;
  15436. /**
  15437. * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
  15438. * whichever is lower for the current process.
  15439. *
  15440. * @platform darwin,linux
  15441. */
  15442. setFdLimit(maxDescriptors: number): void;
  15443. /**
  15444. * Indicates whether the snapshot has been created successfully.
  15445. *
  15446. Takes a V8 heap snapshot and saves it to `filePath`.
  15447. */
  15448. takeHeapSnapshot(filePath: string): boolean;
  15449. /**
  15450. * A `String` representing Chrome's version string.
  15451. *
  15452. */
  15453. readonly chrome: string;
  15454. /**
  15455. * A `String` (optional) representing a globally unique ID of the current
  15456. * JavaScript context. Each frame has its own JavaScript context. When
  15457. * contextIsolation is enabled, the isolated world also has a separate JavaScript
  15458. * context. This property is only available in the renderer process.
  15459. *
  15460. */
  15461. readonly contextId?: string;
  15462. /**
  15463. * A `Boolean` that indicates whether the current renderer context has
  15464. * `contextIsolation` enabled. It is `undefined` in the main process.
  15465. *
  15466. */
  15467. readonly contextIsolated: boolean;
  15468. /**
  15469. * A `Boolean`. When app is started by being passed as parameter to the default
  15470. * app, this property is `true` in the main process, otherwise it is `undefined`.
  15471. *
  15472. */
  15473. readonly defaultApp: boolean;
  15474. /**
  15475. * A `String` representing Electron's version string.
  15476. *
  15477. */
  15478. readonly electron: string;
  15479. /**
  15480. * A `Boolean`, `true` when the current renderer context is the "main" renderer
  15481. * frame. If you want the ID of the current frame you should use
  15482. * `webFrame.routingId`.
  15483. *
  15484. */
  15485. readonly isMainFrame: boolean;
  15486. /**
  15487. * A `Boolean`. For Mac App Store build, this property is `true`, for other builds
  15488. * it is `undefined`.
  15489. *
  15490. */
  15491. readonly mas: boolean;
  15492. /**
  15493. * A `Boolean` that controls ASAR support inside your application. Setting this to
  15494. * `true` will disable the support for `asar` archives in Node's built-in modules.
  15495. */
  15496. noAsar: boolean;
  15497. /**
  15498. * A `Boolean` that controls whether or not deprecation warnings are printed to
  15499. * `stderr`. Setting this to `true` will silence deprecation warnings. This
  15500. * property is used instead of the `--no-deprecation` command line flag.
  15501. */
  15502. noDeprecation: boolean;
  15503. /**
  15504. * A `String` representing the path to the resources directory.
  15505. *
  15506. */
  15507. readonly resourcesPath: string;
  15508. /**
  15509. * A `Boolean`. When the renderer process is sandboxed, this property is `true`,
  15510. * otherwise it is `undefined`.
  15511. *
  15512. */
  15513. readonly sandboxed: boolean;
  15514. /**
  15515. * A `Boolean` that controls whether or not deprecation warnings will be thrown as
  15516. * exceptions. Setting this to `true` will throw errors for deprecations. This
  15517. * property is used instead of the `--throw-deprecation` command line flag.
  15518. */
  15519. throwDeprecation: boolean;
  15520. /**
  15521. * A `Boolean` that controls whether or not deprecations printed to `stderr`
  15522. * include their stack trace. Setting this to `true` will print stack traces for
  15523. * deprecations. This property is instead of the `--trace-deprecation` command line
  15524. * flag.
  15525. */
  15526. traceDeprecation: boolean;
  15527. /**
  15528. * A `Boolean` that controls whether or not process warnings printed to `stderr`
  15529. * include their stack trace. Setting this to `true` will print stack traces for
  15530. * process warnings (including deprecations). This property is instead of the
  15531. * `--trace-warnings` command line flag.
  15532. */
  15533. traceProcessWarnings: boolean;
  15534. /**
  15535. * A `String` representing the current process's type, can be:
  15536. *
  15537. * * `browser` - The main process
  15538. * * `renderer` - A renderer process
  15539. * `worker` - In a web worker
  15540. *
  15541. */
  15542. readonly type: ('browser' | 'renderer' | 'worker');
  15543. /**
  15544. * A `Boolean`. If the app is running as a Windows Store app (appx), this property
  15545. * is `true`, for otherwise it is `undefined`.
  15546. *
  15547. */
  15548. readonly windowsStore: boolean;
  15549. }
  15550. interface ProcessVersions {
  15551. readonly electron: string;
  15552. readonly chrome: string;
  15553. }
  15554. }